From 4aadaa779b48f35838cccd4e25107b2338f05547 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Mon, 28 Sep 2020 10:53:09 +0200 Subject: [PATCH 01/10] fix(codebuild): `encryptionKey` cannot be disabled (#10474) Because of a limitation of the CodeBuild Service API and its CloudFormation implementation, it is not possible to disable the encryption key used to encrypt uploaded artifacts after having deployed a Project once that uses a key (the update back to "no key" is ignored). Work around this by explicitly always selecting the default `alias/aws/s3` key. This is the same one CodeBuild would have used if no key was given, except it doesn't suffer from the "property cannot be made empty" problem. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/aws-codebuild/lib/project.ts | 4 +++- ...earning-container-build-image.expected.json | 3 ++- .../test/integ.caching.expected.json | 3 ++- .../test/integ.defaults.lit.expected.json | 5 +++-- .../test/integ.docker-asset.lit.expected.json | 3 ++- .../integ.docker-registry.lit.expected.json | 5 +++-- .../test/integ.ecr.lit.expected.json | 3 ++- .../test/integ.github.expected.json | 3 ++- .../test/integ.project-bucket.expected.json | 3 ++- ...g.project-buildspec-artifacts.expected.json | 14 ++++++++------ ....project-file-system-location.expected.json | 1 + ...t-secondary-sources-artifacts.expected.json | 1 + .../test/integ.project-vpc.expected.json | 1 + .../aws-codebuild/test/test.codebuild.ts | 18 ++++++++++++++++++ ...build-multiple-inputs-outputs.expected.json | 5 +++-- .../integ.pipeline-ecs-deploy.expected.json | 5 +++-- .../integ.project-events.expected.json | 3 ++- .../codebuild/integ.start-build.expected.json | 5 +++-- 18 files changed, 61 insertions(+), 24 deletions(-) diff --git a/packages/@aws-cdk/aws-codebuild/lib/project.ts b/packages/@aws-cdk/aws-codebuild/lib/project.ts index 4c1ec9ca6b752..abf61ea06be86 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/project.ts +++ b/packages/@aws-cdk/aws-codebuild/lib/project.ts @@ -753,7 +753,9 @@ export class Project extends ProjectBase { environment: this.renderEnvironment(props.environment, environmentVariables), fileSystemLocations: Lazy.anyValue({ produce: () => this.renderFileSystemLocations() }), // lazy, because we have a setter for it in setEncryptionKey - encryptionKey: Lazy.stringValue({ produce: () => this._encryptionKey && this._encryptionKey.keyArn }), + // The 'alias/aws/s3' default is necessary because leaving the `encryptionKey` field + // empty will not remove existing encryptionKeys during an update (ref. t/D17810523) + encryptionKey: Lazy.stringValue({ produce: () => this._encryptionKey ? this._encryptionKey.keyArn : 'alias/aws/s3' }), badgeEnabled: props.badge, cache: cache._toCloudFormation(), name: this.physicalName, diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.expected.json index 2c91da398b0a7..6eb429e6cb569 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.expected.json @@ -208,7 +208,8 @@ "Source": { "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"ls\"\n ]\n }\n }\n}", "Type": "NO_SOURCE" - } + }, + "EncryptionKey": "alias/aws/s3" } } }, diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.caching.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.caching.expected.json index 738924ce04b93..79f9c50c2e5a7 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.caching.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.caching.expected.json @@ -165,7 +165,8 @@ ] }, "Type": "S3" - } + }, + "EncryptionKey": "alias/aws/s3" } } } diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.expected.json index aae808b132920..c7162f3219c85 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.expected.json @@ -144,8 +144,9 @@ "Source": { "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"echo \\\"Hello, CodeBuild!\\\"\"\n ]\n }\n }\n}", "Type": "NO_SOURCE" - } + }, + "EncryptionKey": "alias/aws/s3" } } } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.expected.json index 561aeb8f22f9a..64ff7f68d7f8c 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.expected.json @@ -163,7 +163,8 @@ "Source": { "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"ls\"\n ]\n }\n }\n}", "Type": "NO_SOURCE" - } + }, + "EncryptionKey": "alias/aws/s3" } } } diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.expected.json index efaee26898636..ca3d5bfef0619 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.expected.json @@ -154,8 +154,9 @@ "Source": { "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"ls\"\n ]\n }\n }\n}", "Type": "NO_SOURCE" - } + }, + "EncryptionKey": "alias/aws/s3" } } } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.expected.json index c92a8b6c2deba..12ca8fff1853b 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.expected.json @@ -184,7 +184,8 @@ "Source": { "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"ls\"\n ]\n }\n }\n}", "Type": "NO_SOURCE" - } + }, + "EncryptionKey": "alias/aws/s3" } } } diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.github.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.github.expected.json index 017456796ac69..222a29feeeb8a 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.github.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.github.expected.json @@ -112,7 +112,8 @@ "Location": "https://github.com/aws/aws-cdk.git", "ReportBuildStatus": false, "Type": "GITHUB" - } + }, + "EncryptionKey": "alias/aws/s3" } } } diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.expected.json index 3c3262ad23747..0ba33dae84b91 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.expected.json @@ -156,7 +156,8 @@ ] }, "Type": "S3" - } + }, + "EncryptionKey": "alias/aws/s3" } } } diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.expected.json index fff6b92d11f44..13ff8f1e054c0 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.expected.json @@ -1,9 +1,9 @@ { "Resources": { "MyBucketF68F3FF0": { - "DeletionPolicy": "Delete", + "Type": "AWS::S3::Bucket", "UpdateReplacePolicy": "Delete", - "Type": "AWS::S3::Bucket" + "DeletionPolicy": "Delete" }, "MyProjectRole9BBE5233": { "Type": "AWS::IAM::Role", @@ -133,7 +133,9 @@ "Properties": { "Artifacts": { "ArtifactIdentifier": "AddArtifact1", - "Location": { "Ref": "MyBucketF68F3FF0" }, + "Location": { + "Ref": "MyBucketF68F3FF0" + }, "NamespaceType": "NONE", "OverrideArtifactName": true, "Packaging": "ZIP", @@ -155,9 +157,9 @@ "Source": { "BuildSpec": "{\n \"version\": \"0.2\"\n}", "Type": "NO_SOURCE" - } + }, + "EncryptionKey": "alias/aws/s3" } } } -} - +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.expected.json index c23bcab0e013a..ef679f0b9fb7a 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.expected.json @@ -371,6 +371,7 @@ "BuildSpec": "{\n \"version\": \"0.2\"\n}", "Type": "NO_SOURCE" }, + "EncryptionKey": "alias/aws/s3", "FileSystemLocations": [ { "Identifier": "myidentifier", diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.expected.json index 26a3636bfc5b3..f7261ca4b21ae 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.expected.json @@ -180,6 +180,7 @@ "BuildSpec": "{\n \"version\": \"0.2\"\n}", "Type": "NO_SOURCE" }, + "EncryptionKey": "alias/aws/s3", "SecondaryArtifacts": [ { "ArtifactIdentifier": "AddArtifact1", diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.expected.json index 2e46025573d0b..6d3eb3091b7ed 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.expected.json @@ -371,6 +371,7 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"echo \\\"Nothing to do!\\\"\"\n ]\n }\n }\n}", "Type": "NO_SOURCE" }, + "EncryptionKey": "alias/aws/s3", "VpcConfig": { "SecurityGroupIds": [ { diff --git a/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts b/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts index 8a5a9decfc1e2..558dd072c7f3f 100644 --- a/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts +++ b/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts @@ -153,6 +153,7 @@ export = { 'Image': 'aws/codebuild/standard:1.0', 'ComputeType': 'BUILD_GENERAL1_SMALL', }, + 'EncryptionKey': 'alias/aws/s3', }, }, }, @@ -331,6 +332,7 @@ export = { 'GitCloneDepth': 2, 'Type': 'CODECOMMIT', }, + 'EncryptionKey': 'alias/aws/s3', }, }, }, @@ -532,6 +534,7 @@ export = { }, 'Type': 'S3', }, + 'EncryptionKey': 'alias/aws/s3', }, }, }, @@ -800,6 +803,21 @@ export = { test.done(); }, + 'no KMS Key defaults to default S3 managed key'(test: Test) { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + new codebuild.PipelineProject(stack, 'MyProject'); + + // THEN + expect(stack).to(haveResourceLike('AWS::CodeBuild::Project', { + EncryptionKey: 'alias/aws/s3', + })); + + test.done(); + }, + 'with a KMS Key adds decrypt permissions to the CodeBuild Role'(test: Test) { const stack = new cdk.Stack(); diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.expected.json index 0b47b23b12a50..d2d59b1fe8884 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.expected.json @@ -614,8 +614,9 @@ }, "Source": { "Type": "CODEPIPELINE" - } + }, + "EncryptionKey": "alias/aws/s3" } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.expected.json index 34a425b48a1a6..5570acefe6336 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.expected.json @@ -540,7 +540,8 @@ "Source": { "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"pre_build\": {\n \"commands\": \"$(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)\"\n },\n \"build\": {\n \"commands\": \"docker build -t $REPOSITORY_URI:latest .\"\n },\n \"post_build\": {\n \"commands\": [\n \"docker push $REPOSITORY_URI:latest\",\n \"printf '[{ \\\"name\\\": \\\"Container\\\", \\\"imageUri\\\": \\\"%s\\\" }]' $REPOSITORY_URI:latest > imagedefinitions.json\"\n ]\n }\n },\n \"artifacts\": {\n \"files\": \"imagedefinitions.json\"\n }\n}", "Type": "CODEPIPELINE" - } + }, + "EncryptionKey": "alias/aws/s3" } }, "MyPipelineRoleC0D47CA4": { @@ -1041,4 +1042,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.expected.json b/packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.expected.json index 178bba14bbc1c..ed269b2e7b524 100644 --- a/packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.expected.json +++ b/packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.expected.json @@ -226,7 +226,8 @@ ] }, "Type": "CODECOMMIT" - } + }, + "EncryptionKey": "alias/aws/s3" } }, "MyProjectStateChange2DAB75B7": { diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.expected.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.expected.json index a3a245b0ddfd8..360eadea837cb 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.expected.json +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.expected.json @@ -152,7 +152,8 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"echo \\\"Hello, CodeBuild!\\\"\"\n ]\n }\n }\n}", "Type": "NO_SOURCE" }, - "Name": "MyTestProject" + "Name": "MyTestProject", + "EncryptionKey": "alias/aws/s3" } }, "StateMachineRoleB840431D": { @@ -258,4 +259,4 @@ } } } -} \ No newline at end of file +} From 350105a7f27b6f7fafb5e5dd7f6b3a81a1f5baae Mon Sep 17 00:00:00 2001 From: Nick Lynch Date: Mon, 28 Sep 2020 11:20:41 +0100 Subject: [PATCH 02/10] fix(secretsmanager): cannot import secrets if ARN is a token (#10568) The feature to support importing secrets by name (#10309) failed to handle scenarios where the secret ARN is a token, due to parsing the ARN to retrieve the secret name. fixes #10520 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../@aws-cdk/aws-secretsmanager/lib/secret.ts | 9 +++++-- .../aws-secretsmanager/test/test.secret.ts | 24 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/packages/@aws-cdk/aws-secretsmanager/lib/secret.ts b/packages/@aws-cdk/aws-secretsmanager/lib/secret.ts index c4539cca154ea..1e6bf8d2441a5 100644 --- a/packages/@aws-cdk/aws-secretsmanager/lib/secret.ts +++ b/packages/@aws-cdk/aws-secretsmanager/lib/secret.ts @@ -1,6 +1,6 @@ import * as iam from '@aws-cdk/aws-iam'; import * as kms from '@aws-cdk/aws-kms'; -import { Construct, IConstruct, IResource, RemovalPolicy, Resource, SecretValue, Stack } from '@aws-cdk/core'; +import { Construct, IConstruct, IResource, RemovalPolicy, Resource, SecretValue, Stack, Token } from '@aws-cdk/core'; import { ResourcePolicy } from './policy'; import { RotationSchedule, RotationScheduleOptions } from './rotation-schedule'; import * as secretsmanager from './secretsmanager.generated'; @@ -596,8 +596,13 @@ export interface SecretStringGenerator { /** Parses the secret name from the ARN. */ function parseSecretName(construct: IConstruct, secretArn: string) { - const resourceName = Stack.of(construct).parseArn(secretArn).resourceName; + const resourceName = Stack.of(construct).parseArn(secretArn, ':').resourceName; if (resourceName) { + // Can't operate on the token to remove the SecretsManager suffix, so just return the full secret name + if (Token.isUnresolved(resourceName)) { + return resourceName; + } + // Secret resource names are in the format `${secretName}-${SecretsManager suffix}` const secretNameFromArn = resourceName.substr(0, resourceName.lastIndexOf('-')); if (secretNameFromArn) { return secretNameFromArn; } diff --git a/packages/@aws-cdk/aws-secretsmanager/test/test.secret.ts b/packages/@aws-cdk/aws-secretsmanager/test/test.secret.ts index 1b7c1e3063ed9..523ce501b9126 100644 --- a/packages/@aws-cdk/aws-secretsmanager/test/test.secret.ts +++ b/packages/@aws-cdk/aws-secretsmanager/test/test.secret.ts @@ -482,6 +482,30 @@ export = { test.done(); }, + 'import by secretArn supports tokens for ARNs'(test: Test) { + // GIVEN + const app = new cdk.App(); + const stackA = new cdk.Stack(app, 'StackA'); + const stackB = new cdk.Stack(app, 'StackB'); + const secretA = new secretsmanager.Secret(stackA, 'SecretA'); + + // WHEN + const secretB = secretsmanager.Secret.fromSecretArn(stackB, 'SecretB', secretA.secretArn); + new cdk.CfnOutput(stackB, 'secretBSecretName', { value: secretB.secretName }); + + // THEN + test.equals(secretB.secretArn, secretA.secretArn); + expect(stackB).toMatch({ + Outputs: { + secretBSecretName: { + Value: { 'Fn::Select': [6, { 'Fn::Split': [':', { 'Fn::ImportValue': 'StackA:ExportsOutputRefSecretA188F281703FC8A52' }] }] }, + }, + }, + }); + + test.done(); + }, + 'import by attributes'(test: Test) { // GIVEN const stack = new cdk.Stack(); From 97bfd10fef4c23404ec3f5c6a6ca68604fc78aa8 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Mon, 28 Sep 2020 16:01:59 +0200 Subject: [PATCH 03/10] fix(pipelines): stack tags (#10533) Apply stack tags to the stacks deployed using CDK Pipelines. Taking this opportunity to make tags easier to work with -- move them from metadata into cloud artifact properties. Fixes #9260. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../lib/cloud-assembly/artifact-schema.ts | 7 + .../lib/cloud-assembly/metadata-schema.ts | 8 ++ .../cloud-assembly-schema/lib/manifest.ts | 87 +++++++++--- .../schema/cloud-assembly.schema.json | 7 + .../schema/cloud-assembly.version.json | 2 +- .../core/lib/stack-synthesizers/_shared.ts | 6 +- packages/@aws-cdk/core/lib/tag-manager.ts | 18 ++- packages/@aws-cdk/core/test/test.stack.ts | 20 ++- .../lib/artifacts/cloudformation-artifact.ts | 23 ++- .../cx-api/test/stack-artifact.test.ts | 132 ++++++++++++++++++ packages/@aws-cdk/cx-api/test/util.ts | 23 +++ .../lib/actions/deploy-cdk-stack-action.ts | 46 +++++- .../@aws-cdk/pipelines/test/pipeline.test.ts | 40 +++++- packages/aws-cdk/lib/cdk-toolkit.ts | 17 +-- 14 files changed, 390 insertions(+), 46 deletions(-) create mode 100644 packages/@aws-cdk/cx-api/test/stack-artifact.test.ts create mode 100644 packages/@aws-cdk/cx-api/test/util.ts diff --git a/packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/artifact-schema.ts b/packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/artifact-schema.ts index 6a43b187475f5..cea67ab76263d 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/artifact-schema.ts +++ b/packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/artifact-schema.ts @@ -15,6 +15,13 @@ export interface AwsCloudFormationStackProperties { */ 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 diff --git a/packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/metadata-schema.ts b/packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/metadata-schema.ts index 54cabf83554fc..5e9e4e1517145 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/metadata-schema.ts +++ b/packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/metadata-schema.ts @@ -54,11 +54,19 @@ export interface FileAssetMetadataEntry extends BaseAssetMetadataEntry { 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 } diff --git a/packages/@aws-cdk/cloud-assembly-schema/lib/manifest.ts b/packages/@aws-cdk/cloud-assembly-schema/lib/manifest.ts index 4c7c5229f0fc0..1e3ea7afa62e7 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/lib/manifest.ts +++ b/packages/@aws-cdk/cloud-assembly-schema/lib/manifest.ts @@ -32,7 +32,7 @@ export class Manifest { * @param filePath - output file path. */ public static saveAssemblyManifest(manifest: assembly.AssemblyManifest, filePath: string) { - Manifest.saveManifest(manifest, filePath, ASSEMBLY_SCHEMA); + Manifest.saveManifest(manifest, filePath, ASSEMBLY_SCHEMA, Manifest.patchStackTagsOnWrite); } /** @@ -41,7 +41,7 @@ export class Manifest { * @param filePath - path to the manifest file. */ public static loadAssemblyManifest(filePath: string): assembly.AssemblyManifest { - return Manifest.loadManifest(filePath, ASSEMBLY_SCHEMA, obj => Manifest.patchStackTags(obj)); + return Manifest.loadManifest(filePath, ASSEMBLY_SCHEMA, Manifest.patchStackTagsOnRead); } /** @@ -51,7 +51,7 @@ export class Manifest { * @param filePath - output file path. */ public static saveAssetManifest(manifest: assets.AssetManifest, filePath: string) { - Manifest.saveManifest(manifest, filePath, ASSETS_SCHEMA); + Manifest.saveManifest(manifest, filePath, ASSETS_SCHEMA, Manifest.patchStackTagsOnRead); } /** @@ -118,9 +118,12 @@ export class Manifest { } - private static saveManifest(manifest: any, filePath: string, schema: jsonschema.Schema) { - const withVersion = { ...manifest, version: Manifest.version() }; + 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)); } @@ -148,23 +151,69 @@ export class Manifest { * 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 patchStackTags(manifest: assembly.AssemblyManifest) { - for (const artifact of Object.values(manifest.artifacts || [])) { - if (artifact.type === assembly.ArtifactType.AWS_CLOUDFORMATION_STACK) { - for (const metadataEntries of Object.values(artifact.metadata || [])) { - for (const metadataEntry of metadataEntries) { - if (metadataEntry.type === assembly.ArtifactMetadataEntryType.STACK_TAGS && metadataEntry.data) { - const metadataAny = metadataEntry as any; - metadataAny.data = metadataAny.data.map((t: any) => ({ key: t.Key, value: t.Value })); - } - } - } - } - } + 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, + )); + } - return manifest; + /** + * 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; +} \ No newline at end of file diff --git a/packages/@aws-cdk/cloud-assembly-schema/schema/cloud-assembly.schema.json b/packages/@aws-cdk/cloud-assembly-schema/schema/cloud-assembly.schema.json index 8c3e58485b12b..a154b78a0b508 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/schema/cloud-assembly.schema.json +++ b/packages/@aws-cdk/cloud-assembly-schema/schema/cloud-assembly.schema.json @@ -275,6 +275,13 @@ "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" diff --git a/packages/@aws-cdk/cloud-assembly-schema/schema/cloud-assembly.version.json b/packages/@aws-cdk/cloud-assembly-schema/schema/cloud-assembly.version.json index 78d33700c0698..42cb403235c06 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/schema/cloud-assembly.version.json +++ b/packages/@aws-cdk/cloud-assembly-schema/schema/cloud-assembly.version.json @@ -1 +1 @@ -{"version":"5.0.0"} +{"version":"6.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/_shared.ts b/packages/@aws-cdk/core/lib/stack-synthesizers/_shared.ts index 5a57c423779df..233490968b31d 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/_shared.ts +++ b/packages/@aws-cdk/core/lib/stack-synthesizers/_shared.ts @@ -21,7 +21,6 @@ export function addStackArtifactToAssembly( // nested stack tags are applied at the AWS::CloudFormation::Stack resource // level and are not needed in the cloud assembly. - // TODO: move these to the cloud assembly artifact properties instead of metadata if (stack.tags.hasTags()) { stack.node.addMetadata(cxschema.ArtifactMetadataEntryType.STACK_TAGS, stack.tags.renderTags()); } @@ -46,6 +45,7 @@ export function addStackArtifactToAssembly( const properties: cxschema.AwsCloudFormationStackProperties = { templateFile: stack.templateFile, terminationProtection: stack.terminationProtection, + tags: nonEmptyDict(stack.tags.tagValues()), ...stackProps, ...stackNameProperty, }; @@ -116,4 +116,8 @@ export function assertBound(x: A | undefined): asserts x is NonNullable { if (x === null && x === undefined) { throw new Error('You must call bindStack() first'); } +} + +function nonEmptyDict(xs: Record) { + return Object.keys(xs).length > 0 ? xs : undefined; } \ No newline at end of file diff --git a/packages/@aws-cdk/core/lib/tag-manager.ts b/packages/@aws-cdk/core/lib/tag-manager.ts index b1db219ef4440..2189af4bc4929 100644 --- a/packages/@aws-cdk/core/lib/tag-manager.ts +++ b/packages/@aws-cdk/core/lib/tag-manager.ts @@ -279,8 +279,18 @@ export class TagManager { * Renders tags into the proper format based on TagType */ public renderTags(): any { - const sortedTags = Array.from(this.tags.values()).sort((a, b) => a.key.localeCompare(b.key)); - return this.tagFormatter.formatTags(sortedTags); + return this.tagFormatter.formatTags(this.sortedTags); + } + + /** + * Render the tags in a readable format + */ + public tagValues(): Record { + const ret: Record = {}; + for (const tag of this.sortedTags) { + ret[tag.key] = tag.value; + } + return ret; } /** @@ -315,4 +325,8 @@ export class TagManager { } } } + + private get sortedTags() { + return Array.from(this.tags.values()).sort((a, b) => a.key.localeCompare(b.key)); + } } diff --git a/packages/@aws-cdk/core/test/test.stack.ts b/packages/@aws-cdk/core/test/test.stack.ts index a27a992b5fdfd..49a7ac671b0ad 100644 --- a/packages/@aws-cdk/core/test/test.stack.ts +++ b/packages/@aws-cdk/core/test/test.stack.ts @@ -897,7 +897,7 @@ export = { test.done(); }, - 'stack tags are reflected in the stack cloud assembly artifact'(test: Test) { + 'stack tags are reflected in the stack cloud assembly artifact metadata'(test: Test) { // GIVEN const app = new App({ stackTraces: false }); const stack1 = new Stack(app, 'stack1'); @@ -920,6 +920,24 @@ export = { test.done(); }, + 'stack tags are reflected in the stack artifact properties'(test: Test) { + // GIVEN + const app = new App({ stackTraces: false }); + const stack1 = new Stack(app, 'stack1'); + const stack2 = new Stack(stack1, 'stack2'); + + // WHEN + Tags.of(app).add('foo', 'bar'); + + // THEN + const asm = app.synth(); + const expected = { foo: 'bar' }; + + test.deepEqual(asm.getStackArtifact(stack1.artifactId).tags, expected); + test.deepEqual(asm.getStackArtifact(stack2.artifactId).tags, expected); + test.done(); + }, + 'Termination Protection is reflected in Cloud Assembly artifact'(test: Test) { // if the root is an app, invoke "synth" to avoid double synthesis const app = new App(); diff --git a/packages/@aws-cdk/cx-api/lib/artifacts/cloudformation-artifact.ts b/packages/@aws-cdk/cx-api/lib/artifacts/cloudformation-artifact.ts index 167d589753b63..807e58f1a411c 100644 --- a/packages/@aws-cdk/cx-api/lib/artifacts/cloudformation-artifact.ts +++ b/packages/@aws-cdk/cx-api/lib/artifacts/cloudformation-artifact.ts @@ -26,6 +26,11 @@ export class CloudFormationStackArtifact extends CloudArtifact { */ 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. */ @@ -96,7 +101,11 @@ export class CloudFormationStackArtifact extends CloudArtifact { } this.environment = EnvironmentUtils.parse(artifact.environment); this.templateFile = properties.templateFile; - this.parameters = properties.parameters || { }; + 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.cloudFormationExecutionRoleArn = properties.cloudFormationExecutionRoleArn; this.stackTemplateAssetObjectUrl = properties.stackTemplateAssetObjectUrl; @@ -130,4 +139,14 @@ export class CloudFormationStackArtifact extends CloudArtifact { } 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; + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/cx-api/test/stack-artifact.test.ts b/packages/@aws-cdk/cx-api/test/stack-artifact.test.ts new file mode 100644 index 0000000000000..1f4591f00177a --- /dev/null +++ b/packages/@aws-cdk/cx-api/test/stack-artifact.test.ts @@ -0,0 +1,132 @@ +import * as fs from 'fs'; +import * as path from 'path'; +import * as cxschema from '@aws-cdk/cloud-assembly-schema'; +import * as cxapi from '../lib'; +import { rimraf } from './util'; + +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' }); +}); diff --git a/packages/@aws-cdk/cx-api/test/util.ts b/packages/@aws-cdk/cx-api/test/util.ts new file mode 100644 index 0000000000000..58cee8acf89c7 --- /dev/null +++ b/packages/@aws-cdk/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) { + // We will survive ENOENT + if (e.code !== 'ENOENT') { throw e; } + } +} diff --git a/packages/@aws-cdk/pipelines/lib/actions/deploy-cdk-stack-action.ts b/packages/@aws-cdk/pipelines/lib/actions/deploy-cdk-stack-action.ts index 902409c43a331..ee3038ad4372c 100644 --- a/packages/@aws-cdk/pipelines/lib/actions/deploy-cdk-stack-action.ts +++ b/packages/@aws-cdk/pipelines/lib/actions/deploy-cdk-stack-action.ts @@ -1,3 +1,4 @@ +import * as fs from 'fs'; import * as path from 'path'; import * as cfn from '@aws-cdk/aws-cloudformation'; import * as codepipeline from '@aws-cdk/aws-codepipeline'; @@ -112,6 +113,13 @@ export interface DeployCdkStackActionProps extends DeployCdkStackActionOptions { * @default - No dependencies */ readonly dependencyStackArtifactIds?: string[]; + + /** + * Template configuration path relative to the input artifact + * + * @default - No template configuration + */ + readonly templateConfigurationPath?: string; } /** @@ -156,12 +164,25 @@ export class DeployCdkStackAction implements codepipeline.IAction { // It should be easier to get this, but for now it is what it is. const appAsmRoot = assemblyBuilderOf(appOf(scope)).outdir; const fullTemplatePath = path.join(artifact.assembly.directory, artifact.templateFile); - const templatePath = path.relative(appAsmRoot, fullTemplatePath); + + let fullConfigPath; + if (Object.keys(artifact.tags).length > 0) { + fullConfigPath = `${fullTemplatePath}.config.json`; + + // 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(fullConfigPath, { + Tags: artifact.tags, + }); + } return new DeployCdkStackAction({ actionRole, cloudFormationExecutionRole, - templatePath, + templatePath: path.relative(appAsmRoot, fullTemplatePath), + templateConfigurationPath: fullConfigPath ? path.relative(appAsmRoot, fullConfigPath) : undefined, region, stackArtifactId: artifact.id, dependencyStackArtifactIds: artifact.dependencies.filter(isStackArtifact).map(s => s.id), @@ -223,6 +244,7 @@ export class DeployCdkStackAction implements codepipeline.IAction { deploymentRole: props.cloudFormationExecutionRole, region: props.region, capabilities: [cfn.CloudFormationCapabilities.NAMED_IAM, cfn.CloudFormationCapabilities.AUTO_EXPAND], + templateConfiguration: props.templateConfigurationPath ? props.cloudAssemblyInput.atPath(props.templateConfigurationPath) : undefined, }); this.executeChangeSetAction = new cpactions.CloudFormationExecuteChangeSetAction({ actionName: `${baseActionName}.Deploy`, @@ -331,3 +353,23 @@ function isStackArtifact(a: cxapi.CloudArtifact): a is cxapi.CloudFormationStack // return a instanceof cxapi.CloudFormationStackArtifact; return a.constructor.name === 'CloudFormationStackArtifact'; } + +/** + * Template configuration in a CodePipeline + * + * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/continuous-delivery-codepipeline-cfn-artifacts.html#w2ab1c13c17c15 + */ +interface TemplateConfiguration { + readonly Parameters?: Record; + readonly Tags?: Record; + readonly StackPolicy?: { + readonly Statements: Array>; + }; +} + +/** + * Write template configuration to the given file + */ +function writeTemplateConfiguration(filename: string, config: TemplateConfiguration) { + fs.writeFileSync(filename, JSON.stringify(config, undefined, 2), { encoding: 'utf-8' }); +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/pipeline.test.ts b/packages/@aws-cdk/pipelines/test/pipeline.test.ts index 7d4455959a8eb..f47149e5f8395 100644 --- a/packages/@aws-cdk/pipelines/test/pipeline.test.ts +++ b/packages/@aws-cdk/pipelines/test/pipeline.test.ts @@ -1,8 +1,10 @@ -import { anything, arrayWith, deepObjectLike, encodedJson, objectLike, stringLike } from '@aws-cdk/assert'; +import * as fs from 'fs'; +import * as path from 'path'; +import { anything, arrayWith, Capture, deepObjectLike, encodedJson, objectLike, stringLike } from '@aws-cdk/assert'; import '@aws-cdk/assert/jest'; import * as cp from '@aws-cdk/aws-codepipeline'; import * as cpa from '@aws-cdk/aws-codepipeline-actions'; -import { Construct, Stack, Stage, StageProps, SecretValue } from '@aws-cdk/core'; +import { Construct, Stack, Stage, StageProps, SecretValue, Tags } from '@aws-cdk/core'; import * as cdkp from '../lib'; import { BucketStack, PIPELINE_ENV, stackTemplate, TestApp, TestGitHubNpmPipeline } from './testutil'; @@ -404,6 +406,40 @@ test('add another action to an existing stage', () => { }); }); +test('tags get reflected in pipeline', () => { + // WHEN + const stage = new OneStackApp(app, 'App'); + Tags.of(stage).add('CostCenter', 'F00B4R'); + pipeline.addApplicationStage(stage); + + // THEN + const templateConfig = Capture.aString(); + expect(pipelineStack).toHaveResourceLike('AWS::CodePipeline::Pipeline', { + Stages: arrayWith({ + Name: 'App', + Actions: arrayWith( + objectLike({ + Name: 'Stack.Prepare', + InputArtifacts: [objectLike({})], + Configuration: objectLike({ + StackName: 'App-Stack', + TemplateConfiguration: templateConfig.capture(stringLike('*::assembly-App/*.template.*json')), + }), + }), + ), + }), + }); + + const [, relConfigFile] = templateConfig.capturedValue.split('::'); + const absConfigFile = path.join(app.outdir, relConfigFile); + const configFile = JSON.parse(fs.readFileSync(absConfigFile, { encoding: 'utf-8' })); + expect(configFile).toEqual(expect.objectContaining({ + Tags: { + CostCenter: 'F00B4R', + }, + })); +}); + class OneStackApp extends Stage { constructor(scope: Construct, id: string, props?: StageProps) { super(scope, id, props); diff --git a/packages/aws-cdk/lib/cdk-toolkit.ts b/packages/aws-cdk/lib/cdk-toolkit.ts index 62cd54f1d2068..c0ae230879a80 100644 --- a/packages/aws-cdk/lib/cdk-toolkit.ts +++ b/packages/aws-cdk/lib/cdk-toolkit.ts @@ -1,6 +1,5 @@ import * as path from 'path'; import { format } from 'util'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as cxapi from '@aws-cdk/cx-api'; import * as colors from 'colors/safe'; import * as fs from 'fs-extra'; @@ -626,21 +625,7 @@ export interface DestroyOptions { * @returns an array with the tags available in the stack metadata. */ function tagsForStack(stack: cxapi.CloudFormationStackArtifact): Tag[] { - const tagLists = stack.findMetadataByType(cxschema.ArtifactMetadataEntryType.STACK_TAGS).map( - // the tags in the cloud assembly are stored differently - // unfortunately. - x => toCloudFormationTags(x.data as cxschema.Tag[])); - return Array.prototype.concat([], ...tagLists); -} - -/** - * Transform tags as they are retrieved from the cloud assembly, - * to the way that CloudFormation expects them. (Different casing). - */ -function toCloudFormationTags(tags: cxschema.Tag[]): Tag[] { - return tags.map(t => { - return { Key: t.key, Value: t.value }; - }); + return Object.entries(stack.tags).map(([Key, Value]) => ({ Key, Value })); } export interface Tag { From d3df6c74f2566ec0862ed0cd93a6f15b645154e3 Mon Sep 17 00:00:00 2001 From: Romain Marcadier Date: Mon, 28 Sep 2020 16:29:06 +0200 Subject: [PATCH 04/10] chore: set up "Framework :: AWS CDK" PyPI classifiers (#10571) Configure the `jsii` targets for Python so that the `Framework :: AWS CDK` and `Framework :: AWS CDK :: 1` trove classifiers are present on the package metadata, for easier discovery in PyPI. See: https://pypi.org/search/?q=&o=&c=Framework+%3A%3A+AWS+CDK Fixes aws/cdk-ops#393 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/alexa-ask/package.json | 6 +++++- packages/@aws-cdk/app-delivery/package.json | 6 +++++- packages/@aws-cdk/assets/package.json | 6 +++++- packages/@aws-cdk/aws-accessanalyzer/package.json | 6 +++++- packages/@aws-cdk/aws-acmpca/package.json | 6 +++++- packages/@aws-cdk/aws-amazonmq/package.json | 6 +++++- packages/@aws-cdk/aws-amplify/package.json | 6 +++++- packages/@aws-cdk/aws-apigateway/package.json | 6 +++++- packages/@aws-cdk/aws-apigatewayv2/package.json | 6 +++++- packages/@aws-cdk/aws-appconfig/package.json | 6 +++++- packages/@aws-cdk/aws-applicationautoscaling/package.json | 6 +++++- packages/@aws-cdk/aws-applicationinsights/package.json | 6 +++++- packages/@aws-cdk/aws-appmesh/package.json | 6 +++++- packages/@aws-cdk/aws-appstream/package.json | 6 +++++- packages/@aws-cdk/aws-appsync/package.json | 6 +++++- packages/@aws-cdk/aws-athena/package.json | 6 +++++- packages/@aws-cdk/aws-autoscaling-common/package.json | 6 +++++- packages/@aws-cdk/aws-autoscaling-hooktargets/package.json | 6 +++++- packages/@aws-cdk/aws-autoscaling/package.json | 6 +++++- packages/@aws-cdk/aws-autoscalingplans/package.json | 6 +++++- packages/@aws-cdk/aws-backup/package.json | 6 +++++- packages/@aws-cdk/aws-batch/package.json | 6 +++++- packages/@aws-cdk/aws-budgets/package.json | 6 +++++- packages/@aws-cdk/aws-cassandra/package.json | 6 +++++- packages/@aws-cdk/aws-ce/package.json | 6 +++++- packages/@aws-cdk/aws-certificatemanager/package.json | 6 +++++- packages/@aws-cdk/aws-chatbot/package.json | 6 +++++- packages/@aws-cdk/aws-cloud9/package.json | 6 +++++- packages/@aws-cdk/aws-cloudformation/package.json | 6 +++++- packages/@aws-cdk/aws-cloudfront-origins/package.json | 6 +++++- packages/@aws-cdk/aws-cloudfront/package.json | 6 +++++- packages/@aws-cdk/aws-cloudtrail/package.json | 6 +++++- packages/@aws-cdk/aws-cloudwatch-actions/package.json | 6 +++++- packages/@aws-cdk/aws-cloudwatch/package.json | 6 +++++- packages/@aws-cdk/aws-codebuild/package.json | 6 +++++- packages/@aws-cdk/aws-codecommit/package.json | 6 +++++- packages/@aws-cdk/aws-codedeploy/package.json | 6 +++++- packages/@aws-cdk/aws-codeguruprofiler/package.json | 6 +++++- packages/@aws-cdk/aws-codegurureviewer/package.json | 6 +++++- packages/@aws-cdk/aws-codepipeline-actions/package.json | 6 +++++- packages/@aws-cdk/aws-codepipeline/package.json | 6 +++++- packages/@aws-cdk/aws-codestar/package.json | 6 +++++- packages/@aws-cdk/aws-codestarconnections/package.json | 6 +++++- packages/@aws-cdk/aws-codestarnotifications/package.json | 6 +++++- packages/@aws-cdk/aws-cognito/package.json | 6 +++++- packages/@aws-cdk/aws-config/package.json | 6 +++++- packages/@aws-cdk/aws-datapipeline/package.json | 6 +++++- packages/@aws-cdk/aws-dax/package.json | 6 +++++- packages/@aws-cdk/aws-detective/package.json | 6 +++++- packages/@aws-cdk/aws-directoryservice/package.json | 6 +++++- packages/@aws-cdk/aws-dlm/package.json | 6 +++++- packages/@aws-cdk/aws-dms/package.json | 6 +++++- packages/@aws-cdk/aws-docdb/package.json | 6 +++++- packages/@aws-cdk/aws-dynamodb-global/package.json | 6 +++++- packages/@aws-cdk/aws-dynamodb/package.json | 6 +++++- packages/@aws-cdk/aws-ec2/package.json | 6 +++++- packages/@aws-cdk/aws-ecr-assets/package.json | 6 +++++- packages/@aws-cdk/aws-ecr/package.json | 6 +++++- packages/@aws-cdk/aws-ecs-patterns/package.json | 6 +++++- packages/@aws-cdk/aws-ecs/package.json | 6 +++++- packages/@aws-cdk/aws-efs/package.json | 6 +++++- packages/@aws-cdk/aws-eks-legacy/package.json | 6 +++++- packages/@aws-cdk/aws-eks/package.json | 6 +++++- packages/@aws-cdk/aws-elasticache/package.json | 6 +++++- packages/@aws-cdk/aws-elasticbeanstalk/package.json | 6 +++++- packages/@aws-cdk/aws-elasticloadbalancing/package.json | 6 +++++- .../aws-elasticloadbalancingv2-actions/package.json | 6 +++++- .../aws-elasticloadbalancingv2-targets/package.json | 6 +++++- packages/@aws-cdk/aws-elasticloadbalancingv2/package.json | 6 +++++- packages/@aws-cdk/aws-elasticsearch/package.json | 6 +++++- packages/@aws-cdk/aws-emr/package.json | 6 +++++- packages/@aws-cdk/aws-events-targets/package.json | 6 +++++- packages/@aws-cdk/aws-events/package.json | 6 +++++- packages/@aws-cdk/aws-eventschemas/package.json | 6 +++++- packages/@aws-cdk/aws-fms/package.json | 6 +++++- packages/@aws-cdk/aws-fsx/package.json | 6 +++++- packages/@aws-cdk/aws-gamelift/package.json | 6 +++++- packages/@aws-cdk/aws-globalaccelerator/package.json | 6 +++++- packages/@aws-cdk/aws-glue/package.json | 6 +++++- packages/@aws-cdk/aws-greengrass/package.json | 6 +++++- packages/@aws-cdk/aws-guardduty/package.json | 6 +++++- packages/@aws-cdk/aws-iam/package.json | 6 +++++- packages/@aws-cdk/aws-imagebuilder/package.json | 6 +++++- packages/@aws-cdk/aws-inspector/package.json | 6 +++++- packages/@aws-cdk/aws-iot/package.json | 6 +++++- packages/@aws-cdk/aws-iot1click/package.json | 6 +++++- packages/@aws-cdk/aws-iotanalytics/package.json | 6 +++++- packages/@aws-cdk/aws-iotevents/package.json | 6 +++++- packages/@aws-cdk/aws-iotthingsgraph/package.json | 6 +++++- packages/@aws-cdk/aws-kendra/package.json | 6 +++++- packages/@aws-cdk/aws-kinesis/package.json | 6 +++++- packages/@aws-cdk/aws-kinesisanalytics/package.json | 6 +++++- packages/@aws-cdk/aws-kinesisfirehose/package.json | 6 +++++- packages/@aws-cdk/aws-kms/package.json | 6 +++++- packages/@aws-cdk/aws-lakeformation/package.json | 6 +++++- packages/@aws-cdk/aws-lambda-destinations/package.json | 6 +++++- packages/@aws-cdk/aws-lambda-event-sources/package.json | 6 +++++- packages/@aws-cdk/aws-lambda-nodejs/package.json | 6 +++++- packages/@aws-cdk/aws-lambda-python/package.json | 6 +++++- packages/@aws-cdk/aws-lambda/package.json | 6 +++++- packages/@aws-cdk/aws-logs-destinations/package.json | 6 +++++- packages/@aws-cdk/aws-logs/package.json | 6 +++++- packages/@aws-cdk/aws-macie/package.json | 6 +++++- packages/@aws-cdk/aws-managedblockchain/package.json | 6 +++++- packages/@aws-cdk/aws-mediaconvert/package.json | 6 +++++- packages/@aws-cdk/aws-medialive/package.json | 6 +++++- packages/@aws-cdk/aws-mediastore/package.json | 6 +++++- packages/@aws-cdk/aws-msk/package.json | 6 +++++- packages/@aws-cdk/aws-neptune/package.json | 6 +++++- packages/@aws-cdk/aws-networkmanager/package.json | 6 +++++- packages/@aws-cdk/aws-opsworks/package.json | 6 +++++- packages/@aws-cdk/aws-opsworkscm/package.json | 6 +++++- packages/@aws-cdk/aws-pinpoint/package.json | 6 +++++- packages/@aws-cdk/aws-pinpointemail/package.json | 6 +++++- packages/@aws-cdk/aws-qldb/package.json | 6 +++++- packages/@aws-cdk/aws-ram/package.json | 6 +++++- packages/@aws-cdk/aws-rds/package.json | 6 +++++- packages/@aws-cdk/aws-redshift/package.json | 6 +++++- packages/@aws-cdk/aws-resourcegroups/package.json | 6 +++++- packages/@aws-cdk/aws-robomaker/package.json | 6 +++++- packages/@aws-cdk/aws-route53-patterns/package.json | 6 +++++- packages/@aws-cdk/aws-route53-targets/package.json | 6 +++++- packages/@aws-cdk/aws-route53/package.json | 6 +++++- packages/@aws-cdk/aws-route53resolver/package.json | 6 +++++- packages/@aws-cdk/aws-s3-assets/package.json | 6 +++++- packages/@aws-cdk/aws-s3-deployment/package.json | 6 +++++- packages/@aws-cdk/aws-s3-notifications/package.json | 6 +++++- packages/@aws-cdk/aws-s3/package.json | 6 +++++- packages/@aws-cdk/aws-sagemaker/package.json | 6 +++++- packages/@aws-cdk/aws-sam/package.json | 6 +++++- packages/@aws-cdk/aws-sdb/package.json | 6 +++++- packages/@aws-cdk/aws-secretsmanager/package.json | 6 +++++- packages/@aws-cdk/aws-securityhub/package.json | 6 +++++- packages/@aws-cdk/aws-servicecatalog/package.json | 6 +++++- packages/@aws-cdk/aws-servicediscovery/package.json | 6 +++++- packages/@aws-cdk/aws-ses-actions/package.json | 6 +++++- packages/@aws-cdk/aws-ses/package.json | 6 +++++- packages/@aws-cdk/aws-sns-subscriptions/package.json | 6 +++++- packages/@aws-cdk/aws-sns/package.json | 6 +++++- packages/@aws-cdk/aws-sqs/package.json | 6 +++++- packages/@aws-cdk/aws-ssm/package.json | 6 +++++- packages/@aws-cdk/aws-sso/package.json | 6 +++++- packages/@aws-cdk/aws-stepfunctions-tasks/package.json | 6 +++++- packages/@aws-cdk/aws-stepfunctions/package.json | 6 +++++- packages/@aws-cdk/aws-synthetics/package.json | 6 +++++- packages/@aws-cdk/aws-transfer/package.json | 6 +++++- packages/@aws-cdk/aws-waf/package.json | 6 +++++- packages/@aws-cdk/aws-wafregional/package.json | 6 +++++- packages/@aws-cdk/aws-wafv2/package.json | 6 +++++- packages/@aws-cdk/aws-workspaces/package.json | 6 +++++- packages/@aws-cdk/cdk-assets-schema/package.json | 6 +++++- .../cfnspec/build-tools/create-missing-libraries.ts | 4 ++++ packages/@aws-cdk/cloud-assembly-schema/package.json | 6 +++++- packages/@aws-cdk/cloudformation-include/package.json | 6 +++++- packages/@aws-cdk/core/package.json | 6 +++++- packages/@aws-cdk/custom-resources/package.json | 6 +++++- packages/@aws-cdk/cx-api/package.json | 6 +++++- packages/@aws-cdk/example-construct-library/package.json | 6 +++++- packages/@aws-cdk/pipelines/package.json | 6 +++++- packages/@aws-cdk/region-info/package.json | 6 +++++- packages/@aws-cdk/yaml-cfn/package.json | 6 +++++- tools/pkglint/lib/rules.ts | 3 +++ 162 files changed, 807 insertions(+), 160 deletions(-) diff --git a/packages/@aws-cdk/alexa-ask/package.json b/packages/@aws-cdk/alexa-ask/package.json index 825196baf23c2..94f22c5a50b59 100644 --- a/packages/@aws-cdk/alexa-ask/package.json +++ b/packages/@aws-cdk/alexa-ask/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.alexa-ask", - "module": "aws_cdk.alexa_ask" + "module": "aws_cdk.alexa_ask", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/app-delivery/package.json b/packages/@aws-cdk/app-delivery/package.json index c85209e9eef41..1151128ca0e11 100644 --- a/packages/@aws-cdk/app-delivery/package.json +++ b/packages/@aws-cdk/app-delivery/package.json @@ -22,7 +22,11 @@ }, "python": { "distName": "aws-cdk.app-delivery", - "module": "aws_cdk.app_delivery" + "module": "aws_cdk.app_delivery", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "outdir": "dist", diff --git a/packages/@aws-cdk/assets/package.json b/packages/@aws-cdk/assets/package.json index 99f052d188ab8..1c6288a584c9f 100644 --- a/packages/@aws-cdk/assets/package.json +++ b/packages/@aws-cdk/assets/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.assets", - "module": "aws_cdk.assets" + "module": "aws_cdk.assets", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-accessanalyzer/package.json b/packages/@aws-cdk/aws-accessanalyzer/package.json index 41c87fff5bdc1..cc3e5f4abadd7 100644 --- a/packages/@aws-cdk/aws-accessanalyzer/package.json +++ b/packages/@aws-cdk/aws-accessanalyzer/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-accessanalyzer", - "module": "aws_cdk.aws_accessanalyzer" + "module": "aws_cdk.aws_accessanalyzer", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-acmpca/package.json b/packages/@aws-cdk/aws-acmpca/package.json index 1f6a8aacf5b35..4636ccbb5a254 100644 --- a/packages/@aws-cdk/aws-acmpca/package.json +++ b/packages/@aws-cdk/aws-acmpca/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-acmpca", - "module": "aws_cdk.aws_acmpca" + "module": "aws_cdk.aws_acmpca", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-amazonmq/package.json b/packages/@aws-cdk/aws-amazonmq/package.json index b215adabe636d..57b006a6d8497 100644 --- a/packages/@aws-cdk/aws-amazonmq/package.json +++ b/packages/@aws-cdk/aws-amazonmq/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-amazonmq", - "module": "aws_cdk.aws_amazonmq" + "module": "aws_cdk.aws_amazonmq", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-amplify/package.json b/packages/@aws-cdk/aws-amplify/package.json index 6f7417f3363f8..ae5c91a801159 100644 --- a/packages/@aws-cdk/aws-amplify/package.json +++ b/packages/@aws-cdk/aws-amplify/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-amplify", - "module": "aws_cdk.aws_amplify" + "module": "aws_cdk.aws_amplify", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-apigateway/package.json b/packages/@aws-cdk/aws-apigateway/package.json index 72534284e0d2f..90fbaadcf26ab 100644 --- a/packages/@aws-cdk/aws-apigateway/package.json +++ b/packages/@aws-cdk/aws-apigateway/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-apigateway", - "module": "aws_cdk.aws_apigateway" + "module": "aws_cdk.aws_apigateway", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-apigatewayv2/package.json b/packages/@aws-cdk/aws-apigatewayv2/package.json index 945cb89bb4586..5bc75ca9013d2 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/package.json +++ b/packages/@aws-cdk/aws-apigatewayv2/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-apigatewayv2", - "module": "aws_cdk.aws_apigatewayv2" + "module": "aws_cdk.aws_apigatewayv2", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-appconfig/package.json b/packages/@aws-cdk/aws-appconfig/package.json index 8eff1859225bf..882b6c95adab8 100644 --- a/packages/@aws-cdk/aws-appconfig/package.json +++ b/packages/@aws-cdk/aws-appconfig/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-appconfig", - "module": "aws_cdk.aws_appconfig" + "module": "aws_cdk.aws_appconfig", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-applicationautoscaling/package.json b/packages/@aws-cdk/aws-applicationautoscaling/package.json index e866816981b40..874fea95fa0f0 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/package.json +++ b/packages/@aws-cdk/aws-applicationautoscaling/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-applicationautoscaling", - "module": "aws_cdk.aws_applicationautoscaling" + "module": "aws_cdk.aws_applicationautoscaling", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-applicationinsights/package.json b/packages/@aws-cdk/aws-applicationinsights/package.json index a4a83155b62a9..2d01bb0af2495 100644 --- a/packages/@aws-cdk/aws-applicationinsights/package.json +++ b/packages/@aws-cdk/aws-applicationinsights/package.json @@ -24,7 +24,11 @@ }, "python": { "distName": "aws-cdk.aws-applicationinsights", - "module": "aws_cdk.aws_applicationinsights" + "module": "aws_cdk.aws_applicationinsights", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } } }, diff --git a/packages/@aws-cdk/aws-appmesh/package.json b/packages/@aws-cdk/aws-appmesh/package.json index 47b943e957a4d..106bbf45d9ee0 100644 --- a/packages/@aws-cdk/aws-appmesh/package.json +++ b/packages/@aws-cdk/aws-appmesh/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-appmesh", - "module": "aws_cdk.aws_appmesh" + "module": "aws_cdk.aws_appmesh", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-appstream/package.json b/packages/@aws-cdk/aws-appstream/package.json index fe2a533988bcb..6f8a6657e471a 100644 --- a/packages/@aws-cdk/aws-appstream/package.json +++ b/packages/@aws-cdk/aws-appstream/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-appstream", - "module": "aws_cdk.aws_appstream" + "module": "aws_cdk.aws_appstream", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-appsync/package.json b/packages/@aws-cdk/aws-appsync/package.json index 87f8c66b231e7..21930d695061e 100644 --- a/packages/@aws-cdk/aws-appsync/package.json +++ b/packages/@aws-cdk/aws-appsync/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-appsync", - "module": "aws_cdk.aws_appsync" + "module": "aws_cdk.aws_appsync", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-athena/package.json b/packages/@aws-cdk/aws-athena/package.json index 7f5a88705c65b..95e98d47c31f5 100644 --- a/packages/@aws-cdk/aws-athena/package.json +++ b/packages/@aws-cdk/aws-athena/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-athena", - "module": "aws_cdk.aws_athena" + "module": "aws_cdk.aws_athena", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-autoscaling-common/package.json b/packages/@aws-cdk/aws-autoscaling-common/package.json index 8c423257b0285..61a1295700937 100644 --- a/packages/@aws-cdk/aws-autoscaling-common/package.json +++ b/packages/@aws-cdk/aws-autoscaling-common/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-autoscaling-common", - "module": "aws_cdk.aws_autoscaling_common" + "module": "aws_cdk.aws_autoscaling_common", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/package.json b/packages/@aws-cdk/aws-autoscaling-hooktargets/package.json index a2013f4b2d29a..cac6df3c172cf 100644 --- a/packages/@aws-cdk/aws-autoscaling-hooktargets/package.json +++ b/packages/@aws-cdk/aws-autoscaling-hooktargets/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-autoscaling-hooktargets", - "module": "aws_cdk.aws_autoscaling_hooktargets" + "module": "aws_cdk.aws_autoscaling_hooktargets", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-autoscaling/package.json b/packages/@aws-cdk/aws-autoscaling/package.json index 923e6c6adec08..3d8d1e4a80993 100644 --- a/packages/@aws-cdk/aws-autoscaling/package.json +++ b/packages/@aws-cdk/aws-autoscaling/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-autoscaling", - "module": "aws_cdk.aws_autoscaling" + "module": "aws_cdk.aws_autoscaling", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-autoscalingplans/package.json b/packages/@aws-cdk/aws-autoscalingplans/package.json index ac5c4b8477e52..388a29873ef12 100644 --- a/packages/@aws-cdk/aws-autoscalingplans/package.json +++ b/packages/@aws-cdk/aws-autoscalingplans/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-autoscalingplans", - "module": "aws_cdk.aws_autoscalingplans" + "module": "aws_cdk.aws_autoscalingplans", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-backup/package.json b/packages/@aws-cdk/aws-backup/package.json index 6993e60ac380b..6622f7c75badc 100644 --- a/packages/@aws-cdk/aws-backup/package.json +++ b/packages/@aws-cdk/aws-backup/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-backup", - "module": "aws_cdk.aws_backup" + "module": "aws_cdk.aws_backup", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-batch/package.json b/packages/@aws-cdk/aws-batch/package.json index ad24cb4da40c8..699a4fcf33b58 100644 --- a/packages/@aws-cdk/aws-batch/package.json +++ b/packages/@aws-cdk/aws-batch/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-batch", - "module": "aws_cdk.aws_batch" + "module": "aws_cdk.aws_batch", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-budgets/package.json b/packages/@aws-cdk/aws-budgets/package.json index 33c5cfc91a6e7..5620f490a2d6a 100644 --- a/packages/@aws-cdk/aws-budgets/package.json +++ b/packages/@aws-cdk/aws-budgets/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-budgets", - "module": "aws_cdk.aws_budgets" + "module": "aws_cdk.aws_budgets", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-cassandra/package.json b/packages/@aws-cdk/aws-cassandra/package.json index 38acd5d388b30..165d47b79cb33 100644 --- a/packages/@aws-cdk/aws-cassandra/package.json +++ b/packages/@aws-cdk/aws-cassandra/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-cassandra", - "module": "aws_cdk.aws_cassandra" + "module": "aws_cdk.aws_cassandra", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-ce/package.json b/packages/@aws-cdk/aws-ce/package.json index 5ffd08fcc3ea9..86c100223e0f5 100644 --- a/packages/@aws-cdk/aws-ce/package.json +++ b/packages/@aws-cdk/aws-ce/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-ce", - "module": "aws_cdk.aws_ce" + "module": "aws_cdk.aws_ce", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-certificatemanager/package.json b/packages/@aws-cdk/aws-certificatemanager/package.json index 61a55b83bcfa9..9ad0d12c3d0e1 100644 --- a/packages/@aws-cdk/aws-certificatemanager/package.json +++ b/packages/@aws-cdk/aws-certificatemanager/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-certificatemanager", - "module": "aws_cdk.aws_certificatemanager" + "module": "aws_cdk.aws_certificatemanager", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-chatbot/package.json b/packages/@aws-cdk/aws-chatbot/package.json index 59ddd0cd77453..ef17794163e93 100644 --- a/packages/@aws-cdk/aws-chatbot/package.json +++ b/packages/@aws-cdk/aws-chatbot/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-chatbot", - "module": "aws_cdk.aws_chatbot" + "module": "aws_cdk.aws_chatbot", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-cloud9/package.json b/packages/@aws-cdk/aws-cloud9/package.json index 2333a332791eb..de967a9e7a38d 100644 --- a/packages/@aws-cdk/aws-cloud9/package.json +++ b/packages/@aws-cdk/aws-cloud9/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-cloud9", - "module": "aws_cdk.aws_cloud9" + "module": "aws_cdk.aws_cloud9", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-cloudformation/package.json b/packages/@aws-cdk/aws-cloudformation/package.json index 4eabd9c3a914b..d74b71bc9038d 100644 --- a/packages/@aws-cdk/aws-cloudformation/package.json +++ b/packages/@aws-cdk/aws-cloudformation/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-cloudformation", - "module": "aws_cdk.aws_cloudformation" + "module": "aws_cdk.aws_cloudformation", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-cloudfront-origins/package.json b/packages/@aws-cdk/aws-cloudfront-origins/package.json index 851ffefd9e715..70e167f8dd984 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/package.json +++ b/packages/@aws-cdk/aws-cloudfront-origins/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-cloudfront-origins", - "module": "aws_cdk.aws_cloudfront_origins" + "module": "aws_cdk.aws_cloudfront_origins", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-cloudfront/package.json b/packages/@aws-cdk/aws-cloudfront/package.json index f1853646cda47..b3b40d712560e 100644 --- a/packages/@aws-cdk/aws-cloudfront/package.json +++ b/packages/@aws-cdk/aws-cloudfront/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-cloudfront", - "module": "aws_cdk.aws_cloudfront" + "module": "aws_cdk.aws_cloudfront", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-cloudtrail/package.json b/packages/@aws-cdk/aws-cloudtrail/package.json index 773aedf8a1c9a..67c6de96f918c 100644 --- a/packages/@aws-cdk/aws-cloudtrail/package.json +++ b/packages/@aws-cdk/aws-cloudtrail/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-cloudtrail", - "module": "aws_cdk.aws_cloudtrail" + "module": "aws_cdk.aws_cloudtrail", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/package.json b/packages/@aws-cdk/aws-cloudwatch-actions/package.json index b399039dafee7..3b9d6a5034f78 100644 --- a/packages/@aws-cdk/aws-cloudwatch-actions/package.json +++ b/packages/@aws-cdk/aws-cloudwatch-actions/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-cloudwatch-actions", - "module": "aws_cdk.aws_cloudwatch_actions" + "module": "aws_cdk.aws_cloudwatch_actions", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-cloudwatch/package.json b/packages/@aws-cdk/aws-cloudwatch/package.json index ecf3d2229f8a6..10fcf3bfce240 100644 --- a/packages/@aws-cdk/aws-cloudwatch/package.json +++ b/packages/@aws-cdk/aws-cloudwatch/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-cloudwatch", - "module": "aws_cdk.aws_cloudwatch" + "module": "aws_cdk.aws_cloudwatch", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-codebuild/package.json b/packages/@aws-cdk/aws-codebuild/package.json index edb147d12b59a..fb556ae6b7190 100644 --- a/packages/@aws-cdk/aws-codebuild/package.json +++ b/packages/@aws-cdk/aws-codebuild/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-codebuild", - "module": "aws_cdk.aws_codebuild" + "module": "aws_cdk.aws_codebuild", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-codecommit/package.json b/packages/@aws-cdk/aws-codecommit/package.json index 1b83f89ecef25..ef00706f6eae0 100644 --- a/packages/@aws-cdk/aws-codecommit/package.json +++ b/packages/@aws-cdk/aws-codecommit/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-codecommit", - "module": "aws_cdk.aws_codecommit" + "module": "aws_cdk.aws_codecommit", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-codedeploy/package.json b/packages/@aws-cdk/aws-codedeploy/package.json index 9862b256c6678..136cca68a108f 100644 --- a/packages/@aws-cdk/aws-codedeploy/package.json +++ b/packages/@aws-cdk/aws-codedeploy/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-codedeploy", - "module": "aws_cdk.aws_codedeploy" + "module": "aws_cdk.aws_codedeploy", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-codeguruprofiler/package.json b/packages/@aws-cdk/aws-codeguruprofiler/package.json index 20285133f7606..b4a35197b310d 100644 --- a/packages/@aws-cdk/aws-codeguruprofiler/package.json +++ b/packages/@aws-cdk/aws-codeguruprofiler/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-codeguruprofiler", - "module": "aws_cdk.aws_codeguruprofiler" + "module": "aws_cdk.aws_codeguruprofiler", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-codegurureviewer/package.json b/packages/@aws-cdk/aws-codegurureviewer/package.json index 637e03e8f98ec..4528848bdf5e6 100644 --- a/packages/@aws-cdk/aws-codegurureviewer/package.json +++ b/packages/@aws-cdk/aws-codegurureviewer/package.json @@ -24,7 +24,11 @@ }, "python": { "distName": "aws-cdk.aws-codegurureviewer", - "module": "aws_cdk.aws_codegurureviewer" + "module": "aws_cdk.aws_codegurureviewer", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } } }, diff --git a/packages/@aws-cdk/aws-codepipeline-actions/package.json b/packages/@aws-cdk/aws-codepipeline-actions/package.json index e95142fed69b5..49c0a224fa34b 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/package.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-codepipeline-actions", - "module": "aws_cdk.aws_codepipeline_actions" + "module": "aws_cdk.aws_codepipeline_actions", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-codepipeline/package.json b/packages/@aws-cdk/aws-codepipeline/package.json index f57169ef70cf4..3ee04f96196e9 100644 --- a/packages/@aws-cdk/aws-codepipeline/package.json +++ b/packages/@aws-cdk/aws-codepipeline/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-codepipeline", - "module": "aws_cdk.aws_codepipeline" + "module": "aws_cdk.aws_codepipeline", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-codestar/package.json b/packages/@aws-cdk/aws-codestar/package.json index 1b813576d9694..65c610745c1a0 100644 --- a/packages/@aws-cdk/aws-codestar/package.json +++ b/packages/@aws-cdk/aws-codestar/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-codestar", - "module": "aws_cdk.aws_codestar" + "module": "aws_cdk.aws_codestar", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-codestarconnections/package.json b/packages/@aws-cdk/aws-codestarconnections/package.json index 979b46551f051..8605bb93ef47f 100644 --- a/packages/@aws-cdk/aws-codestarconnections/package.json +++ b/packages/@aws-cdk/aws-codestarconnections/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-codestarconnections", - "module": "aws_cdk.aws_codestarconnections" + "module": "aws_cdk.aws_codestarconnections", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-codestarnotifications/package.json b/packages/@aws-cdk/aws-codestarnotifications/package.json index 7262362dafa5a..05e6cbadabf23 100644 --- a/packages/@aws-cdk/aws-codestarnotifications/package.json +++ b/packages/@aws-cdk/aws-codestarnotifications/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-codestarnotifications", - "module": "aws_cdk.aws_codestarnotifications" + "module": "aws_cdk.aws_codestarnotifications", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-cognito/package.json b/packages/@aws-cdk/aws-cognito/package.json index 68fc9bdcf835c..4b606b05fefff 100644 --- a/packages/@aws-cdk/aws-cognito/package.json +++ b/packages/@aws-cdk/aws-cognito/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-cognito", - "module": "aws_cdk.aws_cognito" + "module": "aws_cdk.aws_cognito", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-config/package.json b/packages/@aws-cdk/aws-config/package.json index 7888a4c70479e..1904de7f4a660 100644 --- a/packages/@aws-cdk/aws-config/package.json +++ b/packages/@aws-cdk/aws-config/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-config", - "module": "aws_cdk.aws_config" + "module": "aws_cdk.aws_config", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-datapipeline/package.json b/packages/@aws-cdk/aws-datapipeline/package.json index 3c1f8105739ad..1b24802929d73 100644 --- a/packages/@aws-cdk/aws-datapipeline/package.json +++ b/packages/@aws-cdk/aws-datapipeline/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-datapipeline", - "module": "aws_cdk.aws_datapipeline" + "module": "aws_cdk.aws_datapipeline", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-dax/package.json b/packages/@aws-cdk/aws-dax/package.json index b856b24216a89..a266a83a0124f 100644 --- a/packages/@aws-cdk/aws-dax/package.json +++ b/packages/@aws-cdk/aws-dax/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-dax", - "module": "aws_cdk.aws_dax" + "module": "aws_cdk.aws_dax", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-detective/package.json b/packages/@aws-cdk/aws-detective/package.json index 6becc0bc0a150..fdbb9dc3a2362 100644 --- a/packages/@aws-cdk/aws-detective/package.json +++ b/packages/@aws-cdk/aws-detective/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-detective", - "module": "aws_cdk.aws_detective" + "module": "aws_cdk.aws_detective", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-directoryservice/package.json b/packages/@aws-cdk/aws-directoryservice/package.json index f977f48e9a0ba..348ce00c60d1f 100644 --- a/packages/@aws-cdk/aws-directoryservice/package.json +++ b/packages/@aws-cdk/aws-directoryservice/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-directoryservice", - "module": "aws_cdk.aws_directoryservice" + "module": "aws_cdk.aws_directoryservice", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-dlm/package.json b/packages/@aws-cdk/aws-dlm/package.json index 3eba4edcc1fc5..f3123d4187356 100644 --- a/packages/@aws-cdk/aws-dlm/package.json +++ b/packages/@aws-cdk/aws-dlm/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-dlm", - "module": "aws_cdk.aws_dlm" + "module": "aws_cdk.aws_dlm", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-dms/package.json b/packages/@aws-cdk/aws-dms/package.json index dcae3650803f0..61637d58edad1 100644 --- a/packages/@aws-cdk/aws-dms/package.json +++ b/packages/@aws-cdk/aws-dms/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-dms", - "module": "aws_cdk.aws_dms" + "module": "aws_cdk.aws_dms", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-docdb/package.json b/packages/@aws-cdk/aws-docdb/package.json index 2732be6d944da..0959ef2574981 100644 --- a/packages/@aws-cdk/aws-docdb/package.json +++ b/packages/@aws-cdk/aws-docdb/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-docdb", - "module": "aws_cdk.aws_docdb" + "module": "aws_cdk.aws_docdb", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-dynamodb-global/package.json b/packages/@aws-cdk/aws-dynamodb-global/package.json index 5c81160c134b0..8e371e6d99d73 100644 --- a/packages/@aws-cdk/aws-dynamodb-global/package.json +++ b/packages/@aws-cdk/aws-dynamodb-global/package.json @@ -27,7 +27,11 @@ }, "python": { "distName": "aws-cdk.aws-dynamodb-global", - "module": "aws_cdk.aws_dynamodb_global" + "module": "aws_cdk.aws_dynamodb_global", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] }, "dotnet": { "namespace": "Amazon.CDK.AWS.DynamoDB.Global", diff --git a/packages/@aws-cdk/aws-dynamodb/package.json b/packages/@aws-cdk/aws-dynamodb/package.json index d52338c60123e..402328d6cf997 100644 --- a/packages/@aws-cdk/aws-dynamodb/package.json +++ b/packages/@aws-cdk/aws-dynamodb/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-dynamodb", - "module": "aws_cdk.aws_dynamodb" + "module": "aws_cdk.aws_dynamodb", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-ec2/package.json b/packages/@aws-cdk/aws-ec2/package.json index da082c3f5571b..530fbd4a7473a 100644 --- a/packages/@aws-cdk/aws-ec2/package.json +++ b/packages/@aws-cdk/aws-ec2/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-ec2", - "module": "aws_cdk.aws_ec2" + "module": "aws_cdk.aws_ec2", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-ecr-assets/package.json b/packages/@aws-cdk/aws-ecr-assets/package.json index e72a6f77b301f..a71af02e87eaa 100644 --- a/packages/@aws-cdk/aws-ecr-assets/package.json +++ b/packages/@aws-cdk/aws-ecr-assets/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-ecr-assets", - "module": "aws_cdk.aws_ecr_assets" + "module": "aws_cdk.aws_ecr_assets", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-ecr/package.json b/packages/@aws-cdk/aws-ecr/package.json index 0521418925521..02715f1d1b27a 100644 --- a/packages/@aws-cdk/aws-ecr/package.json +++ b/packages/@aws-cdk/aws-ecr/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-ecr", - "module": "aws_cdk.aws_ecr" + "module": "aws_cdk.aws_ecr", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-ecs-patterns/package.json b/packages/@aws-cdk/aws-ecs-patterns/package.json index a6f5c320dc9aa..5717edc48d756 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/package.json +++ b/packages/@aws-cdk/aws-ecs-patterns/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-ecs-patterns", - "module": "aws_cdk.aws_ecs_patterns" + "module": "aws_cdk.aws_ecs_patterns", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-ecs/package.json b/packages/@aws-cdk/aws-ecs/package.json index 27c113cf8a54b..5052533ce989e 100644 --- a/packages/@aws-cdk/aws-ecs/package.json +++ b/packages/@aws-cdk/aws-ecs/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-ecs", - "module": "aws_cdk.aws_ecs" + "module": "aws_cdk.aws_ecs", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-efs/package.json b/packages/@aws-cdk/aws-efs/package.json index ec64229c39fc6..810316d715094 100644 --- a/packages/@aws-cdk/aws-efs/package.json +++ b/packages/@aws-cdk/aws-efs/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-efs", - "module": "aws_cdk.aws_efs" + "module": "aws_cdk.aws_efs", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-eks-legacy/package.json b/packages/@aws-cdk/aws-eks-legacy/package.json index b91810dad9758..0cbb2b783a0b4 100644 --- a/packages/@aws-cdk/aws-eks-legacy/package.json +++ b/packages/@aws-cdk/aws-eks-legacy/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-eks-legacy", - "module": "aws_cdk.aws_eks_legacy" + "module": "aws_cdk.aws_eks_legacy", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-eks/package.json b/packages/@aws-cdk/aws-eks/package.json index 8dfe97519e1d3..913aaeb024388 100644 --- a/packages/@aws-cdk/aws-eks/package.json +++ b/packages/@aws-cdk/aws-eks/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-eks", - "module": "aws_cdk.aws_eks" + "module": "aws_cdk.aws_eks", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-elasticache/package.json b/packages/@aws-cdk/aws-elasticache/package.json index 4e7bb129572bd..04e8b46390fd4 100644 --- a/packages/@aws-cdk/aws-elasticache/package.json +++ b/packages/@aws-cdk/aws-elasticache/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-elasticache", - "module": "aws_cdk.aws_elasticache" + "module": "aws_cdk.aws_elasticache", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-elasticbeanstalk/package.json b/packages/@aws-cdk/aws-elasticbeanstalk/package.json index e0ce7edaa9258..dc04dcdf44aea 100644 --- a/packages/@aws-cdk/aws-elasticbeanstalk/package.json +++ b/packages/@aws-cdk/aws-elasticbeanstalk/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-elasticbeanstalk", - "module": "aws_cdk.aws_elasticbeanstalk" + "module": "aws_cdk.aws_elasticbeanstalk", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/package.json b/packages/@aws-cdk/aws-elasticloadbalancing/package.json index bbd613800a969..7187de75b3ad0 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancing/package.json +++ b/packages/@aws-cdk/aws-elasticloadbalancing/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-elasticloadbalancing", - "module": "aws_cdk.aws_elasticloadbalancing" + "module": "aws_cdk.aws_elasticloadbalancing", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/package.json b/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/package.json index 69a2275f1c0d8..b63572c2da2d2 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/package.json +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-elasticloadbalancingv2-actions", - "module": "aws_cdk.aws_elasticloadbalancingv2_actions" + "module": "aws_cdk.aws_elasticloadbalancingv2_actions", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/package.json b/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/package.json index bff2591ecdc89..96bf7c63d209c 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/package.json +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-elasticloadbalancingv2-targets", - "module": "aws_cdk.aws_elasticloadbalancingv2_targets" + "module": "aws_cdk.aws_elasticloadbalancingv2_targets", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json b/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json index 1bf66849dfa9f..86c52cce535ca 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-elasticloadbalancingv2", - "module": "aws_cdk.aws_elasticloadbalancingv2" + "module": "aws_cdk.aws_elasticloadbalancingv2", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-elasticsearch/package.json b/packages/@aws-cdk/aws-elasticsearch/package.json index 3924a972f06b2..0597d412ed6fb 100644 --- a/packages/@aws-cdk/aws-elasticsearch/package.json +++ b/packages/@aws-cdk/aws-elasticsearch/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-elasticsearch", - "module": "aws_cdk.aws_elasticsearch" + "module": "aws_cdk.aws_elasticsearch", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-emr/package.json b/packages/@aws-cdk/aws-emr/package.json index 494fe248be53d..775ed37d98345 100644 --- a/packages/@aws-cdk/aws-emr/package.json +++ b/packages/@aws-cdk/aws-emr/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-emr", - "module": "aws_cdk.aws_emr" + "module": "aws_cdk.aws_emr", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-events-targets/package.json b/packages/@aws-cdk/aws-events-targets/package.json index 80a1d52f9240b..d38d1b60ca067 100644 --- a/packages/@aws-cdk/aws-events-targets/package.json +++ b/packages/@aws-cdk/aws-events-targets/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-events-targets", - "module": "aws_cdk.aws_events_targets" + "module": "aws_cdk.aws_events_targets", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-events/package.json b/packages/@aws-cdk/aws-events/package.json index b1505b5bc050c..49601a8a03bb2 100644 --- a/packages/@aws-cdk/aws-events/package.json +++ b/packages/@aws-cdk/aws-events/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-events", - "module": "aws_cdk.aws_events" + "module": "aws_cdk.aws_events", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-eventschemas/package.json b/packages/@aws-cdk/aws-eventschemas/package.json index c2844140889be..2f71cc896e3a4 100644 --- a/packages/@aws-cdk/aws-eventschemas/package.json +++ b/packages/@aws-cdk/aws-eventschemas/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-eventschemas", - "module": "aws_cdk.aws_eventschemas" + "module": "aws_cdk.aws_eventschemas", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-fms/package.json b/packages/@aws-cdk/aws-fms/package.json index 9dcdef1863963..f6820c068b8fd 100644 --- a/packages/@aws-cdk/aws-fms/package.json +++ b/packages/@aws-cdk/aws-fms/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-fms", - "module": "aws_cdk.aws_fms" + "module": "aws_cdk.aws_fms", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-fsx/package.json b/packages/@aws-cdk/aws-fsx/package.json index f6187a29111af..8c04546c14f52 100644 --- a/packages/@aws-cdk/aws-fsx/package.json +++ b/packages/@aws-cdk/aws-fsx/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-fsx", - "module": "aws_cdk.aws_fsx" + "module": "aws_cdk.aws_fsx", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-gamelift/package.json b/packages/@aws-cdk/aws-gamelift/package.json index 4ee1873b7aede..656f5f2979455 100644 --- a/packages/@aws-cdk/aws-gamelift/package.json +++ b/packages/@aws-cdk/aws-gamelift/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-gamelift", - "module": "aws_cdk.aws_gamelift" + "module": "aws_cdk.aws_gamelift", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-globalaccelerator/package.json b/packages/@aws-cdk/aws-globalaccelerator/package.json index c26fec36a9071..35c2fb7575466 100644 --- a/packages/@aws-cdk/aws-globalaccelerator/package.json +++ b/packages/@aws-cdk/aws-globalaccelerator/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-globalaccelerator", - "module": "aws_cdk.aws_globalaccelerator" + "module": "aws_cdk.aws_globalaccelerator", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-glue/package.json b/packages/@aws-cdk/aws-glue/package.json index ca858971dd057..0a3afa2014db5 100644 --- a/packages/@aws-cdk/aws-glue/package.json +++ b/packages/@aws-cdk/aws-glue/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-glue", - "module": "aws_cdk.aws_glue" + "module": "aws_cdk.aws_glue", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-greengrass/package.json b/packages/@aws-cdk/aws-greengrass/package.json index b599c76dbbd52..d218c06a135d2 100644 --- a/packages/@aws-cdk/aws-greengrass/package.json +++ b/packages/@aws-cdk/aws-greengrass/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-greengrass", - "module": "aws_cdk.aws_greengrass" + "module": "aws_cdk.aws_greengrass", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-guardduty/package.json b/packages/@aws-cdk/aws-guardduty/package.json index 69cbb56806f67..bb51020a6e8b1 100644 --- a/packages/@aws-cdk/aws-guardduty/package.json +++ b/packages/@aws-cdk/aws-guardduty/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-guardduty", - "module": "aws_cdk.aws_guardduty" + "module": "aws_cdk.aws_guardduty", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-iam/package.json b/packages/@aws-cdk/aws-iam/package.json index 3ff154d1e52ba..b7846eef1d72f 100644 --- a/packages/@aws-cdk/aws-iam/package.json +++ b/packages/@aws-cdk/aws-iam/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-iam", - "module": "aws_cdk.aws_iam" + "module": "aws_cdk.aws_iam", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-imagebuilder/package.json b/packages/@aws-cdk/aws-imagebuilder/package.json index bdf5876a166eb..f17015d928177 100644 --- a/packages/@aws-cdk/aws-imagebuilder/package.json +++ b/packages/@aws-cdk/aws-imagebuilder/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-imagebuilder", - "module": "aws_cdk.aws_imagebuilder" + "module": "aws_cdk.aws_imagebuilder", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-inspector/package.json b/packages/@aws-cdk/aws-inspector/package.json index 193fdd6d9e67d..2fbbedd97ff9b 100644 --- a/packages/@aws-cdk/aws-inspector/package.json +++ b/packages/@aws-cdk/aws-inspector/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-inspector", - "module": "aws_cdk.aws_inspector" + "module": "aws_cdk.aws_inspector", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-iot/package.json b/packages/@aws-cdk/aws-iot/package.json index 2db587479e5c8..6d132bd45659d 100644 --- a/packages/@aws-cdk/aws-iot/package.json +++ b/packages/@aws-cdk/aws-iot/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-iot", - "module": "aws_cdk.aws_iot" + "module": "aws_cdk.aws_iot", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-iot1click/package.json b/packages/@aws-cdk/aws-iot1click/package.json index 456e4850d38f4..852a47810aac3 100644 --- a/packages/@aws-cdk/aws-iot1click/package.json +++ b/packages/@aws-cdk/aws-iot1click/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-iot1click", - "module": "aws_cdk.aws_iot1click" + "module": "aws_cdk.aws_iot1click", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-iotanalytics/package.json b/packages/@aws-cdk/aws-iotanalytics/package.json index 07667a23b94e5..90de984540ef8 100644 --- a/packages/@aws-cdk/aws-iotanalytics/package.json +++ b/packages/@aws-cdk/aws-iotanalytics/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-iotanalytics", - "module": "aws_cdk.aws_iotanalytics" + "module": "aws_cdk.aws_iotanalytics", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-iotevents/package.json b/packages/@aws-cdk/aws-iotevents/package.json index 456ae624b19fb..804b64832bd44 100644 --- a/packages/@aws-cdk/aws-iotevents/package.json +++ b/packages/@aws-cdk/aws-iotevents/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-iotevents", - "module": "aws_cdk.aws_iotevents" + "module": "aws_cdk.aws_iotevents", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-iotthingsgraph/package.json b/packages/@aws-cdk/aws-iotthingsgraph/package.json index b54e9519b2aad..fa35752c6d52c 100644 --- a/packages/@aws-cdk/aws-iotthingsgraph/package.json +++ b/packages/@aws-cdk/aws-iotthingsgraph/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-iotthingsgraph", - "module": "aws_cdk.aws_iotthingsgraph" + "module": "aws_cdk.aws_iotthingsgraph", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-kendra/package.json b/packages/@aws-cdk/aws-kendra/package.json index 08d6d1209c917..bcc7bca3f8554 100644 --- a/packages/@aws-cdk/aws-kendra/package.json +++ b/packages/@aws-cdk/aws-kendra/package.json @@ -24,7 +24,11 @@ }, "python": { "distName": "aws-cdk.aws-kendra", - "module": "aws_cdk.aws_kendra" + "module": "aws_cdk.aws_kendra", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } } }, diff --git a/packages/@aws-cdk/aws-kinesis/package.json b/packages/@aws-cdk/aws-kinesis/package.json index 976e507c78e0e..a6cb174544b72 100644 --- a/packages/@aws-cdk/aws-kinesis/package.json +++ b/packages/@aws-cdk/aws-kinesis/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-kinesis", - "module": "aws_cdk.aws_kinesis" + "module": "aws_cdk.aws_kinesis", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-kinesisanalytics/package.json b/packages/@aws-cdk/aws-kinesisanalytics/package.json index 7b8b27681f321..5758ba9abaabd 100644 --- a/packages/@aws-cdk/aws-kinesisanalytics/package.json +++ b/packages/@aws-cdk/aws-kinesisanalytics/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-kinesisanalytics", - "module": "aws_cdk.aws_kinesisanalytics" + "module": "aws_cdk.aws_kinesisanalytics", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-kinesisfirehose/package.json b/packages/@aws-cdk/aws-kinesisfirehose/package.json index c1f716d537d38..c6e59d002e10f 100644 --- a/packages/@aws-cdk/aws-kinesisfirehose/package.json +++ b/packages/@aws-cdk/aws-kinesisfirehose/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-kinesisfirehose", - "module": "aws_cdk.aws_kinesisfirehose" + "module": "aws_cdk.aws_kinesisfirehose", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-kms/package.json b/packages/@aws-cdk/aws-kms/package.json index 31f79371871ad..79afde054eab0 100644 --- a/packages/@aws-cdk/aws-kms/package.json +++ b/packages/@aws-cdk/aws-kms/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-kms", - "module": "aws_cdk.aws_kms" + "module": "aws_cdk.aws_kms", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-lakeformation/package.json b/packages/@aws-cdk/aws-lakeformation/package.json index 632c955c75447..d1078df39b644 100644 --- a/packages/@aws-cdk/aws-lakeformation/package.json +++ b/packages/@aws-cdk/aws-lakeformation/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-lakeformation", - "module": "aws_cdk.aws_lakeformation" + "module": "aws_cdk.aws_lakeformation", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-lambda-destinations/package.json b/packages/@aws-cdk/aws-lambda-destinations/package.json index 1e6783dd4f334..a813b3723c176 100644 --- a/packages/@aws-cdk/aws-lambda-destinations/package.json +++ b/packages/@aws-cdk/aws-lambda-destinations/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-lambda-destinations", - "module": "aws_cdk.aws_lambda_destinations" + "module": "aws_cdk.aws_lambda_destinations", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-lambda-event-sources/package.json b/packages/@aws-cdk/aws-lambda-event-sources/package.json index d8459753b0292..905a3e709317b 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/package.json +++ b/packages/@aws-cdk/aws-lambda-event-sources/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-lambda-event-sources", - "module": "aws_cdk.aws_lambda_event_sources" + "module": "aws_cdk.aws_lambda_event_sources", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-lambda-nodejs/package.json b/packages/@aws-cdk/aws-lambda-nodejs/package.json index 30f04975ca65b..da8d647f1301c 100644 --- a/packages/@aws-cdk/aws-lambda-nodejs/package.json +++ b/packages/@aws-cdk/aws-lambda-nodejs/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-lambda-nodejs", - "module": "aws_cdk.aws_lambda_nodejs" + "module": "aws_cdk.aws_lambda_nodejs", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-lambda-python/package.json b/packages/@aws-cdk/aws-lambda-python/package.json index 5715093b14f88..a3398d486d7c7 100644 --- a/packages/@aws-cdk/aws-lambda-python/package.json +++ b/packages/@aws-cdk/aws-lambda-python/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-lambda-python", - "module": "aws_cdk.aws_lambda_python" + "module": "aws_cdk.aws_lambda_python", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-lambda/package.json b/packages/@aws-cdk/aws-lambda/package.json index ae6fc1bd3506a..f1394d8950f0a 100644 --- a/packages/@aws-cdk/aws-lambda/package.json +++ b/packages/@aws-cdk/aws-lambda/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-lambda", - "module": "aws_cdk.aws_lambda" + "module": "aws_cdk.aws_lambda", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-logs-destinations/package.json b/packages/@aws-cdk/aws-logs-destinations/package.json index e5c3a3ef14f78..385dab205a91d 100644 --- a/packages/@aws-cdk/aws-logs-destinations/package.json +++ b/packages/@aws-cdk/aws-logs-destinations/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-logs-destinations", - "module": "aws_cdk.aws_logs_destinations" + "module": "aws_cdk.aws_logs_destinations", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-logs/package.json b/packages/@aws-cdk/aws-logs/package.json index 91e847e740955..a4eadfdeba946 100644 --- a/packages/@aws-cdk/aws-logs/package.json +++ b/packages/@aws-cdk/aws-logs/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-logs", - "module": "aws_cdk.aws_logs" + "module": "aws_cdk.aws_logs", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-macie/package.json b/packages/@aws-cdk/aws-macie/package.json index 0aa5b62ab052e..8bb07789a9ec1 100644 --- a/packages/@aws-cdk/aws-macie/package.json +++ b/packages/@aws-cdk/aws-macie/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-macie", - "module": "aws_cdk.aws_macie" + "module": "aws_cdk.aws_macie", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-managedblockchain/package.json b/packages/@aws-cdk/aws-managedblockchain/package.json index a56aa49f8ea96..78450647f4a65 100644 --- a/packages/@aws-cdk/aws-managedblockchain/package.json +++ b/packages/@aws-cdk/aws-managedblockchain/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-managedblockchain", - "module": "aws_cdk.aws_managedblockchain" + "module": "aws_cdk.aws_managedblockchain", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-mediaconvert/package.json b/packages/@aws-cdk/aws-mediaconvert/package.json index 054459c8e8f7b..df167a7059c03 100644 --- a/packages/@aws-cdk/aws-mediaconvert/package.json +++ b/packages/@aws-cdk/aws-mediaconvert/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-mediaconvert", - "module": "aws_cdk.aws_mediaconvert" + "module": "aws_cdk.aws_mediaconvert", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-medialive/package.json b/packages/@aws-cdk/aws-medialive/package.json index 3eee0925e2b3c..523db6cdb0951 100644 --- a/packages/@aws-cdk/aws-medialive/package.json +++ b/packages/@aws-cdk/aws-medialive/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-medialive", - "module": "aws_cdk.aws_medialive" + "module": "aws_cdk.aws_medialive", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-mediastore/package.json b/packages/@aws-cdk/aws-mediastore/package.json index 16b578b0e0a52..2fae56bae9d03 100644 --- a/packages/@aws-cdk/aws-mediastore/package.json +++ b/packages/@aws-cdk/aws-mediastore/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-mediastore", - "module": "aws_cdk.aws_mediastore" + "module": "aws_cdk.aws_mediastore", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-msk/package.json b/packages/@aws-cdk/aws-msk/package.json index b424ceefb383b..6ea82b33f9988 100644 --- a/packages/@aws-cdk/aws-msk/package.json +++ b/packages/@aws-cdk/aws-msk/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-msk", - "module": "aws_cdk.aws_msk" + "module": "aws_cdk.aws_msk", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-neptune/package.json b/packages/@aws-cdk/aws-neptune/package.json index df23125bc8c40..f7293686b7aaa 100644 --- a/packages/@aws-cdk/aws-neptune/package.json +++ b/packages/@aws-cdk/aws-neptune/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-neptune", - "module": "aws_cdk.aws_neptune" + "module": "aws_cdk.aws_neptune", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-networkmanager/package.json b/packages/@aws-cdk/aws-networkmanager/package.json index 26074e1ccd28a..7112c40b8da86 100644 --- a/packages/@aws-cdk/aws-networkmanager/package.json +++ b/packages/@aws-cdk/aws-networkmanager/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-networkmanager", - "module": "aws_cdk.aws_networkmanager" + "module": "aws_cdk.aws_networkmanager", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-opsworks/package.json b/packages/@aws-cdk/aws-opsworks/package.json index fafddad6199b3..2962110e06cce 100644 --- a/packages/@aws-cdk/aws-opsworks/package.json +++ b/packages/@aws-cdk/aws-opsworks/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-opsworks", - "module": "aws_cdk.aws_opsworks" + "module": "aws_cdk.aws_opsworks", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-opsworkscm/package.json b/packages/@aws-cdk/aws-opsworkscm/package.json index 83ddae38f0d9a..8ed560f9bc326 100644 --- a/packages/@aws-cdk/aws-opsworkscm/package.json +++ b/packages/@aws-cdk/aws-opsworkscm/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-opsworkscm", - "module": "aws_cdk.aws_opsworkscm" + "module": "aws_cdk.aws_opsworkscm", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-pinpoint/package.json b/packages/@aws-cdk/aws-pinpoint/package.json index 85fceb5c5e2de..b2212b78cabf0 100644 --- a/packages/@aws-cdk/aws-pinpoint/package.json +++ b/packages/@aws-cdk/aws-pinpoint/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-pinpoint", - "module": "aws_cdk.aws_pinpoint" + "module": "aws_cdk.aws_pinpoint", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-pinpointemail/package.json b/packages/@aws-cdk/aws-pinpointemail/package.json index c46af8fa39dc6..b0f9756f2a08c 100644 --- a/packages/@aws-cdk/aws-pinpointemail/package.json +++ b/packages/@aws-cdk/aws-pinpointemail/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-pinpointemail", - "module": "aws_cdk.aws_pinpointemail" + "module": "aws_cdk.aws_pinpointemail", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-qldb/package.json b/packages/@aws-cdk/aws-qldb/package.json index 282c54c382fab..7fe121a6b482f 100644 --- a/packages/@aws-cdk/aws-qldb/package.json +++ b/packages/@aws-cdk/aws-qldb/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-qldb", - "module": "aws_cdk.aws_qldb" + "module": "aws_cdk.aws_qldb", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-ram/package.json b/packages/@aws-cdk/aws-ram/package.json index b190ff47f16f2..fc5fd391233f6 100644 --- a/packages/@aws-cdk/aws-ram/package.json +++ b/packages/@aws-cdk/aws-ram/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-ram", - "module": "aws_cdk.aws_ram" + "module": "aws_cdk.aws_ram", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-rds/package.json b/packages/@aws-cdk/aws-rds/package.json index e45b2851a108f..4abc586d5a0d4 100644 --- a/packages/@aws-cdk/aws-rds/package.json +++ b/packages/@aws-cdk/aws-rds/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-rds", - "module": "aws_cdk.aws_rds" + "module": "aws_cdk.aws_rds", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-redshift/package.json b/packages/@aws-cdk/aws-redshift/package.json index ba6f6745d40f3..77790ff7c4b93 100644 --- a/packages/@aws-cdk/aws-redshift/package.json +++ b/packages/@aws-cdk/aws-redshift/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-redshift", - "module": "aws_cdk.aws_redshift" + "module": "aws_cdk.aws_redshift", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-resourcegroups/package.json b/packages/@aws-cdk/aws-resourcegroups/package.json index 8c02fb8346b04..cde5efc080d7b 100644 --- a/packages/@aws-cdk/aws-resourcegroups/package.json +++ b/packages/@aws-cdk/aws-resourcegroups/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-resourcegroups", - "module": "aws_cdk.aws_resourcegroups" + "module": "aws_cdk.aws_resourcegroups", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-robomaker/package.json b/packages/@aws-cdk/aws-robomaker/package.json index f712920916864..49a3ec2db3b28 100644 --- a/packages/@aws-cdk/aws-robomaker/package.json +++ b/packages/@aws-cdk/aws-robomaker/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-robomaker", - "module": "aws_cdk.aws_robomaker" + "module": "aws_cdk.aws_robomaker", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-route53-patterns/package.json b/packages/@aws-cdk/aws-route53-patterns/package.json index ef708106293ec..138a02cefca6d 100644 --- a/packages/@aws-cdk/aws-route53-patterns/package.json +++ b/packages/@aws-cdk/aws-route53-patterns/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-route53-patterns", - "module": "aws_cdk.aws_route53_patterns" + "module": "aws_cdk.aws_route53_patterns", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-route53-targets/package.json b/packages/@aws-cdk/aws-route53-targets/package.json index a877af56d17b8..7393055d1895c 100644 --- a/packages/@aws-cdk/aws-route53-targets/package.json +++ b/packages/@aws-cdk/aws-route53-targets/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-route53-targets", - "module": "aws_cdk.aws_route53_targets" + "module": "aws_cdk.aws_route53_targets", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-route53/package.json b/packages/@aws-cdk/aws-route53/package.json index 1c340eb48bf5a..3ac3f2a68525c 100644 --- a/packages/@aws-cdk/aws-route53/package.json +++ b/packages/@aws-cdk/aws-route53/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-route53", - "module": "aws_cdk.aws_route53" + "module": "aws_cdk.aws_route53", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-route53resolver/package.json b/packages/@aws-cdk/aws-route53resolver/package.json index c64c14efe58a0..25016c99ea9ad 100644 --- a/packages/@aws-cdk/aws-route53resolver/package.json +++ b/packages/@aws-cdk/aws-route53resolver/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-route53resolver", - "module": "aws_cdk.aws_route53resolver" + "module": "aws_cdk.aws_route53resolver", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-s3-assets/package.json b/packages/@aws-cdk/aws-s3-assets/package.json index ee888f697ab11..0d50839a6e9e7 100644 --- a/packages/@aws-cdk/aws-s3-assets/package.json +++ b/packages/@aws-cdk/aws-s3-assets/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-s3-assets", - "module": "aws_cdk.aws_s3_assets" + "module": "aws_cdk.aws_s3_assets", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-s3-deployment/package.json b/packages/@aws-cdk/aws-s3-deployment/package.json index 90d443aa52769..4639915267e90 100644 --- a/packages/@aws-cdk/aws-s3-deployment/package.json +++ b/packages/@aws-cdk/aws-s3-deployment/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-s3-deployment", - "module": "aws_cdk.aws_s3_deployment" + "module": "aws_cdk.aws_s3_deployment", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-s3-notifications/package.json b/packages/@aws-cdk/aws-s3-notifications/package.json index d3748021e1ce9..f742665f9f944 100644 --- a/packages/@aws-cdk/aws-s3-notifications/package.json +++ b/packages/@aws-cdk/aws-s3-notifications/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-s3-notifications", - "module": "aws_cdk.aws_s3_notifications" + "module": "aws_cdk.aws_s3_notifications", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-s3/package.json b/packages/@aws-cdk/aws-s3/package.json index 83150e561020d..fec39ed3100c9 100644 --- a/packages/@aws-cdk/aws-s3/package.json +++ b/packages/@aws-cdk/aws-s3/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-s3", - "module": "aws_cdk.aws_s3" + "module": "aws_cdk.aws_s3", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-sagemaker/package.json b/packages/@aws-cdk/aws-sagemaker/package.json index 27b7b63defe7d..db851cbf96644 100644 --- a/packages/@aws-cdk/aws-sagemaker/package.json +++ b/packages/@aws-cdk/aws-sagemaker/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-sagemaker", - "module": "aws_cdk.aws_sagemaker" + "module": "aws_cdk.aws_sagemaker", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-sam/package.json b/packages/@aws-cdk/aws-sam/package.json index dcf3da7c7209b..46e05e90bb0f0 100644 --- a/packages/@aws-cdk/aws-sam/package.json +++ b/packages/@aws-cdk/aws-sam/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-sam", - "module": "aws_cdk.aws_sam" + "module": "aws_cdk.aws_sam", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-sdb/package.json b/packages/@aws-cdk/aws-sdb/package.json index 28306afab851f..6287b044f5427 100644 --- a/packages/@aws-cdk/aws-sdb/package.json +++ b/packages/@aws-cdk/aws-sdb/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-sdb", - "module": "aws_cdk.aws_sdb" + "module": "aws_cdk.aws_sdb", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-secretsmanager/package.json b/packages/@aws-cdk/aws-secretsmanager/package.json index 2cb9dd1a7c84d..5283f7cc04c5f 100644 --- a/packages/@aws-cdk/aws-secretsmanager/package.json +++ b/packages/@aws-cdk/aws-secretsmanager/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-secretsmanager", - "module": "aws_cdk.aws_secretsmanager" + "module": "aws_cdk.aws_secretsmanager", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-securityhub/package.json b/packages/@aws-cdk/aws-securityhub/package.json index 9e83d4b6b198b..2465baa3de572 100644 --- a/packages/@aws-cdk/aws-securityhub/package.json +++ b/packages/@aws-cdk/aws-securityhub/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-securityhub", - "module": "aws_cdk.aws_securityhub" + "module": "aws_cdk.aws_securityhub", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-servicecatalog/package.json b/packages/@aws-cdk/aws-servicecatalog/package.json index 4461cc42185cb..a4c3b37f8e1ec 100644 --- a/packages/@aws-cdk/aws-servicecatalog/package.json +++ b/packages/@aws-cdk/aws-servicecatalog/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-servicecatalog", - "module": "aws_cdk.aws_servicecatalog" + "module": "aws_cdk.aws_servicecatalog", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-servicediscovery/package.json b/packages/@aws-cdk/aws-servicediscovery/package.json index 15308644064a3..f90041bcfb1c7 100644 --- a/packages/@aws-cdk/aws-servicediscovery/package.json +++ b/packages/@aws-cdk/aws-servicediscovery/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-servicediscovery", - "module": "aws_cdk.aws_servicediscovery" + "module": "aws_cdk.aws_servicediscovery", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-ses-actions/package.json b/packages/@aws-cdk/aws-ses-actions/package.json index d03df20b359d7..3023c34244f5a 100644 --- a/packages/@aws-cdk/aws-ses-actions/package.json +++ b/packages/@aws-cdk/aws-ses-actions/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-ses-actions", - "module": "aws_cdk.aws_ses_actions" + "module": "aws_cdk.aws_ses_actions", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-ses/package.json b/packages/@aws-cdk/aws-ses/package.json index 366ebfe579cea..7f92bf6423a43 100644 --- a/packages/@aws-cdk/aws-ses/package.json +++ b/packages/@aws-cdk/aws-ses/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-ses", - "module": "aws_cdk.aws_ses" + "module": "aws_cdk.aws_ses", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-sns-subscriptions/package.json b/packages/@aws-cdk/aws-sns-subscriptions/package.json index 012deb7b5776e..f7568ff46e143 100644 --- a/packages/@aws-cdk/aws-sns-subscriptions/package.json +++ b/packages/@aws-cdk/aws-sns-subscriptions/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-sns-subscriptions", - "module": "aws_cdk.aws_sns_subscriptions" + "module": "aws_cdk.aws_sns_subscriptions", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-sns/package.json b/packages/@aws-cdk/aws-sns/package.json index 96bbf2ccee89f..fcf94d3403f0f 100644 --- a/packages/@aws-cdk/aws-sns/package.json +++ b/packages/@aws-cdk/aws-sns/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-sns", - "module": "aws_cdk.aws_sns" + "module": "aws_cdk.aws_sns", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "excludeTypescript": [ diff --git a/packages/@aws-cdk/aws-sqs/package.json b/packages/@aws-cdk/aws-sqs/package.json index 4dbeb49535ea4..996743744aa5f 100644 --- a/packages/@aws-cdk/aws-sqs/package.json +++ b/packages/@aws-cdk/aws-sqs/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-sqs", - "module": "aws_cdk.aws_sqs" + "module": "aws_cdk.aws_sqs", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-ssm/package.json b/packages/@aws-cdk/aws-ssm/package.json index 3220cb04f17ec..d7021983ba7b3 100644 --- a/packages/@aws-cdk/aws-ssm/package.json +++ b/packages/@aws-cdk/aws-ssm/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-ssm", - "module": "aws_cdk.aws_ssm" + "module": "aws_cdk.aws_ssm", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-sso/package.json b/packages/@aws-cdk/aws-sso/package.json index ca07479857ec2..97c4875ce58e8 100644 --- a/packages/@aws-cdk/aws-sso/package.json +++ b/packages/@aws-cdk/aws-sso/package.json @@ -24,7 +24,11 @@ }, "python": { "distName": "aws-cdk.aws-sso", - "module": "aws_cdk.aws_sso" + "module": "aws_cdk.aws_sso", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } } }, diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/package.json b/packages/@aws-cdk/aws-stepfunctions-tasks/package.json index 4cd9d02c114e4..af0ae0264a30f 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/package.json +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-stepfunctions-tasks", - "module": "aws_cdk.aws_stepfunctions_tasks" + "module": "aws_cdk.aws_stepfunctions_tasks", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-stepfunctions/package.json b/packages/@aws-cdk/aws-stepfunctions/package.json index 89254abcb7407..77d086a781c31 100644 --- a/packages/@aws-cdk/aws-stepfunctions/package.json +++ b/packages/@aws-cdk/aws-stepfunctions/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-stepfunctions", - "module": "aws_cdk.aws_stepfunctions" + "module": "aws_cdk.aws_stepfunctions", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-synthetics/package.json b/packages/@aws-cdk/aws-synthetics/package.json index 19f8f1982a627..55611139e5af8 100644 --- a/packages/@aws-cdk/aws-synthetics/package.json +++ b/packages/@aws-cdk/aws-synthetics/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-synthetics", - "module": "aws_cdk.aws_synthetics" + "module": "aws_cdk.aws_synthetics", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-transfer/package.json b/packages/@aws-cdk/aws-transfer/package.json index 037df5db1a49e..e198102ef0d05 100644 --- a/packages/@aws-cdk/aws-transfer/package.json +++ b/packages/@aws-cdk/aws-transfer/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-transfer", - "module": "aws_cdk.aws_transfer" + "module": "aws_cdk.aws_transfer", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-waf/package.json b/packages/@aws-cdk/aws-waf/package.json index 5061d49c96d24..4a6c0f4fe0e18 100644 --- a/packages/@aws-cdk/aws-waf/package.json +++ b/packages/@aws-cdk/aws-waf/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-waf", - "module": "aws_cdk.aws_waf" + "module": "aws_cdk.aws_waf", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-wafregional/package.json b/packages/@aws-cdk/aws-wafregional/package.json index a1dde0aa29202..2944c053d9d25 100644 --- a/packages/@aws-cdk/aws-wafregional/package.json +++ b/packages/@aws-cdk/aws-wafregional/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-wafregional", - "module": "aws_cdk.aws_wafregional" + "module": "aws_cdk.aws_wafregional", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-wafv2/package.json b/packages/@aws-cdk/aws-wafv2/package.json index 1e4f6a918de64..6b4ffcf5a6f07 100644 --- a/packages/@aws-cdk/aws-wafv2/package.json +++ b/packages/@aws-cdk/aws-wafv2/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-wafv2", - "module": "aws_cdk.aws_wafv2" + "module": "aws_cdk.aws_wafv2", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/aws-workspaces/package.json b/packages/@aws-cdk/aws-workspaces/package.json index 72b2e25e19ce3..13ce6feb407ae 100644 --- a/packages/@aws-cdk/aws-workspaces/package.json +++ b/packages/@aws-cdk/aws-workspaces/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.aws-workspaces", - "module": "aws_cdk.aws_workspaces" + "module": "aws_cdk.aws_workspaces", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/cdk-assets-schema/package.json b/packages/@aws-cdk/cdk-assets-schema/package.json index 94f2091e69426..a2f6e7a88f7e8 100644 --- a/packages/@aws-cdk/cdk-assets-schema/package.json +++ b/packages/@aws-cdk/cdk-assets-schema/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.cdk-assets-schema", - "module": "aws_cdk.cdk_assets_schema" + "module": "aws_cdk.cdk_assets_schema", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/cfnspec/build-tools/create-missing-libraries.ts b/packages/@aws-cdk/cfnspec/build-tools/create-missing-libraries.ts index a4fe90f098011..ab0cd06c44861 100644 --- a/packages/@aws-cdk/cfnspec/build-tools/create-missing-libraries.ts +++ b/packages/@aws-cdk/cfnspec/build-tools/create-missing-libraries.ts @@ -124,6 +124,10 @@ async function main() { }, }, python: { + classifiers: [ + 'Framework :: AWS CDK', + 'Framework :: AWS CDK :: 1', + ], distName: pythonDistName, module: pythonModuleName, }, diff --git a/packages/@aws-cdk/cloud-assembly-schema/package.json b/packages/@aws-cdk/cloud-assembly-schema/package.json index 41be3a4faa4fa..330990684ae18 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/package.json +++ b/packages/@aws-cdk/cloud-assembly-schema/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.cloud-assembly-schema", - "module": "aws_cdk.cloud_assembly_schema" + "module": "aws_cdk.cloud_assembly_schema", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/cloudformation-include/package.json b/packages/@aws-cdk/cloudformation-include/package.json index 6aaf21ef1ff8d..ee082f18e4322 100644 --- a/packages/@aws-cdk/cloudformation-include/package.json +++ b/packages/@aws-cdk/cloudformation-include/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.cloudformation-include", - "module": "aws_cdk.cloudformation_include" + "module": "aws_cdk.cloudformation_include", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/core/package.json b/packages/@aws-cdk/core/package.json index ac384aac42fb1..ebf59da5cb25f 100644 --- a/packages/@aws-cdk/core/package.json +++ b/packages/@aws-cdk/core/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.core", - "module": "aws_cdk.core" + "module": "aws_cdk.core", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/custom-resources/package.json b/packages/@aws-cdk/custom-resources/package.json index 98b961ab86b95..2f370ac8a5968 100644 --- a/packages/@aws-cdk/custom-resources/package.json +++ b/packages/@aws-cdk/custom-resources/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.custom-resources", - "module": "aws_cdk.custom_resources" + "module": "aws_cdk.custom_resources", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/cx-api/package.json b/packages/@aws-cdk/cx-api/package.json index ed513afa55cd6..4f4bc15e84a3a 100644 --- a/packages/@aws-cdk/cx-api/package.json +++ b/packages/@aws-cdk/cx-api/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.cx-api", - "module": "aws_cdk.cx_api" + "module": "aws_cdk.cx_api", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/example-construct-library/package.json b/packages/@aws-cdk/example-construct-library/package.json index 4768ce70bb5c9..1fcfaf962ed3c 100644 --- a/packages/@aws-cdk/example-construct-library/package.json +++ b/packages/@aws-cdk/example-construct-library/package.json @@ -24,7 +24,11 @@ }, "python": { "distName": "aws-cdk.example-construct-library", - "module": "aws_cdk.example_construct_library" + "module": "aws_cdk.example_construct_library", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/pipelines/package.json b/packages/@aws-cdk/pipelines/package.json index 86301e67b0a0b..1b965874cec02 100644 --- a/packages/@aws-cdk/pipelines/package.json +++ b/packages/@aws-cdk/pipelines/package.json @@ -105,7 +105,11 @@ }, "python": { "distName": "aws-cdk.pipelines", - "module": "aws_cdk.pipelines" + "module": "aws_cdk.pipelines", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/region-info/package.json b/packages/@aws-cdk/region-info/package.json index a4f2f01f227de..5ea296f02297d 100644 --- a/packages/@aws-cdk/region-info/package.json +++ b/packages/@aws-cdk/region-info/package.json @@ -23,7 +23,11 @@ }, "python": { "distName": "aws-cdk.region-info", - "module": "aws_cdk.region_info" + "module": "aws_cdk.region_info", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/packages/@aws-cdk/yaml-cfn/package.json b/packages/@aws-cdk/yaml-cfn/package.json index 86fbed1f10197..ac58c869160ba 100644 --- a/packages/@aws-cdk/yaml-cfn/package.json +++ b/packages/@aws-cdk/yaml-cfn/package.json @@ -42,7 +42,11 @@ }, "python": { "distName": "aws-cdk.yaml-cfn", - "module": "aws_cdk.yaml_cfn" + "module": "aws_cdk.yaml_cfn", + "classifiers": [ + "Framework :: AWS CDK", + "Framework :: AWS CDK :: 1" + ] } }, "projectReferences": true diff --git a/tools/pkglint/lib/rules.ts b/tools/pkglint/lib/rules.ts index ca50e7c03a8de..77fce1a03d423 100644 --- a/tools/pkglint/lib/rules.ts +++ b/tools/pkglint/lib/rules.ts @@ -525,8 +525,11 @@ export class JSIIPythonTarget extends ValidationRule { const moduleName = cdkModuleName(pkg.json.name); + // See: https://github.com/aws/jsii/blob/master/docs/configuration.md#configuring-python + expectJSON(this.name, pkg, 'jsii.targets.python.distName', moduleName.python.distName); expectJSON(this.name, pkg, 'jsii.targets.python.module', moduleName.python.module); + expectJSON(this.name, pkg, 'jsii.targets.python.classifiers', ['Framework :: AWS CDK', 'Framework :: AWS CDK :: 1']); } } From fb39803b62bbd0ff62bf421464559c759ef0a923 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Mon, 28 Sep 2020 18:33:51 +0200 Subject: [PATCH 05/10] fix(core): write Metadata resource in core framework (#10306) The Metadata resource used to be added by the CLI, which led to a bug. The better, less error-prone way to do it is to have the framework add the metadata resource to the stack template upon synthesis. The resources need to be added just-in-time (before synthesis), because if we do it in the constructor `node.setContext()` will stop working (for the `Stack` already having children). We only add the Metadata resource if we're running via the CLI. If we did not do this, all unit tests everywhere that use `toMatchTemplate()`/`toExactlyMatchTemplate()`/`toMatch()` will break. There are hundreds alone in our codebase, nevermind however many other ones are out there. The consequences of this are that we [still] will not record users who are doing in-memory synthesis. The CLI only does the work when the `runtimeInfo` field of the assembly is filled, which we just never do anymore. However, the code cannot be removed from the CLI because old versions of the framework might still set that field and expect the resource to be added to the template. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../schema/cloud-assembly.version.json | 2 +- packages/@aws-cdk/core/lib/app.ts | 19 ++- packages/@aws-cdk/core/lib/cfn-fn.ts | 28 ++++- .../core/lib/private/metadata-resource.ts | 92 +++++++++++++++ .../@aws-cdk/core/lib/private/synthesis.ts | 37 +++++- packages/@aws-cdk/core/lib/stack.ts | 26 ++++- packages/@aws-cdk/core/lib/stage.ts | 3 - packages/@aws-cdk/core/package.json | 4 +- packages/@aws-cdk/core/test/test.app.ts | 108 ++++++++++++++---- packages/@aws-cdk/core/test/test.rule.ts | 2 +- .../@aws-cdk/core/test/test.runtime-info.ts | 19 +-- packages/@aws-cdk/core/test/test.stack.ts | 18 +++ packages/@aws-cdk/core/test/test.stage.ts | 2 +- packages/@aws-cdk/core/test/test.synthesis.ts | 7 +- packages/@aws-cdk/cx-api/lib/app.ts | 4 +- .../@aws-cdk/cx-api/lib/cloud-assembly.ts | 2 + packages/@aws-cdk/pipelines/test/testutil.ts | 1 - packages/aws-cdk/lib/api/cxapp/exec.ts | 10 +- packages/aws-cdk/lib/settings.ts | 4 +- 19 files changed, 309 insertions(+), 79 deletions(-) create mode 100644 packages/@aws-cdk/core/lib/private/metadata-resource.ts diff --git a/packages/@aws-cdk/cloud-assembly-schema/schema/cloud-assembly.version.json b/packages/@aws-cdk/cloud-assembly-schema/schema/cloud-assembly.version.json index 42cb403235c06..2211f30276a5e 100644 --- a/packages/@aws-cdk/cloud-assembly-schema/schema/cloud-assembly.version.json +++ b/packages/@aws-cdk/cloud-assembly-schema/schema/cloud-assembly.version.json @@ -1 +1 @@ -{"version":"6.0.0"} \ No newline at end of file +{"version":"6.0.0"} diff --git a/packages/@aws-cdk/core/lib/app.ts b/packages/@aws-cdk/core/lib/app.ts index cff51ff197ec6..eb095f801ee4f 100644 --- a/packages/@aws-cdk/core/lib/app.ts +++ b/packages/@aws-cdk/core/lib/app.ts @@ -35,11 +35,20 @@ export interface AppProps { readonly stackTraces?: boolean; /** - * Include runtime versioning information in cloud assembly manifest - * @default true runtime info is included unless `aws:cdk:disable-runtime-info` is set in the context. + * 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. * @@ -101,8 +110,10 @@ export class App extends Stage { this.node.setContext(cxapi.DISABLE_METADATA_STACK_TRACE, true); } - if (props.runtimeInfo === false) { - this.node.setContext(cxapi.DISABLE_VERSION_REPORTING, true); + const analyticsReporting = props.analyticsReporting ?? props.runtimeInfo; + + if (analyticsReporting !== undefined) { + this.node.setContext(cxapi.ANALYTICS_REPORTING_ENABLED_CONTEXT, analyticsReporting); } const autoSynth = props.autoSynth !== undefined ? props.autoSynth : cxapi.OUTDIR_ENV in process.env; diff --git a/packages/@aws-cdk/core/lib/cfn-fn.ts b/packages/@aws-cdk/core/lib/cfn-fn.ts index b05d41968a909..8add880b01674 100644 --- a/packages/@aws-cdk/core/lib/cfn-fn.ts +++ b/packages/@aws-cdk/core/lib/cfn-fn.ts @@ -196,12 +196,18 @@ export class Fn { * Returns true if all the specified conditions evaluate to true, or returns * false if any one of the conditions evaluates to false. ``Fn::And`` acts as * an AND operator. The minimum number of conditions that you can include is - * 2, and the maximum is 10. + * 1. * @param conditions conditions to AND * @returns an FnCondition token */ public static conditionAnd(...conditions: ICfnConditionExpression[]): ICfnConditionExpression { - return new FnAnd(...conditions); + if (conditions.length === 0) { + throw new Error('Fn.conditionAnd() needs at least one argument'); + } + if (conditions.length === 1) { + return conditions[0]; + } + return Fn.conditionAnd(..._inGroupsOf(conditions, 10).map(group => new FnAnd(...group))); } /** @@ -249,12 +255,18 @@ export class Fn { * Returns true if any one of the specified conditions evaluate to true, or * returns false if all of the conditions evaluates to false. ``Fn::Or`` acts * as an OR operator. The minimum number of conditions that you can include is - * 2, and the maximum is 10. + * 1. * @param conditions conditions that evaluates to true or false. * @returns an FnCondition token */ public static conditionOr(...conditions: ICfnConditionExpression[]): ICfnConditionExpression { - return new FnOr(...conditions); + if (conditions.length === 0) { + throw new Error('Fn.conditionOr() needs at least one argument'); + } + if (conditions.length === 1) { + return conditions[0]; + } + return Fn.conditionOr(..._inGroupsOf(conditions, 10).map(group => new FnOr(...group))); } /** @@ -748,3 +760,11 @@ class FnJoin implements IResolvable { return minimalCloudFormationJoin(this.delimiter, resolvedValues); } } + +function _inGroupsOf(array: T[], maxGroup: number): T[][] { + const result = new Array(); + for (let i = 0; i < array.length; i += maxGroup) { + result.push(array.slice(i, i + maxGroup)); + } + return result; +} diff --git a/packages/@aws-cdk/core/lib/private/metadata-resource.ts b/packages/@aws-cdk/core/lib/private/metadata-resource.ts new file mode 100644 index 0000000000000..09813ccb87faa --- /dev/null +++ b/packages/@aws-cdk/core/lib/private/metadata-resource.ts @@ -0,0 +1,92 @@ +import * as cxapi from '@aws-cdk/cx-api'; +import { RegionInfo } from '@aws-cdk/region-info'; +import { CfnCondition } from '../cfn-condition'; +import { Fn } from '../cfn-fn'; +import { Aws } from '../cfn-pseudo'; +import { CfnResource } from '../cfn-resource'; +import { Construct } from '../construct-compat'; +import { Lazy } from '../lazy'; +import { Stack } from '../stack'; +import { Token } from '../token'; +import { collectRuntimeInformation } from './runtime-info'; + +/** + * Construct that will render the metadata resource + */ +export class MetadataResource extends Construct { + /** + * Clear the modules cache + * + * The next time the MetadataResource is rendered, it will do a lookup of the + * modules from the NodeJS module cache again. + * + * Used only for unit tests. + */ + public static clearModulesCache() { + this._modulesPropertyCache = undefined; + } + + /** + * Cached version of the _modulesProperty() accessor + * + * No point in calculating this fairly expensive list more than once. + */ + private static _modulesPropertyCache?: string; + + /** + * Calculate the modules property + */ + private static modulesProperty(): string { + if (this._modulesPropertyCache === undefined) { + this._modulesPropertyCache = formatModules(collectRuntimeInformation()); + } + return this._modulesPropertyCache; + } + + constructor(scope: Stack, id: string) { + super(scope, id); + + const metadataServiceExists = Token.isUnresolved(scope.region) || RegionInfo.get(scope.region).cdkMetadataResourceAvailable; + if (metadataServiceExists) { + const resource = new CfnResource(this, 'Default', { + type: 'AWS::CDK::Metadata', + properties: { + Modules: Lazy.stringValue({ produce: () => MetadataResource.modulesProperty() }), + }, + }); + + // In case we don't actually know the region, add a condition to determine it at deploy time + if (Token.isUnresolved(scope.region)) { + const condition = new CfnCondition(this, 'Condition', { + expression: makeCdkMetadataAvailableCondition(), + }); + + // To not cause undue template changes + condition.overrideLogicalId('CDKMetadataAvailable'); + + resource.cfnOptions.condition = condition; + } + } + } +} + +function makeCdkMetadataAvailableCondition() { + return Fn.conditionOr(...RegionInfo.regions + .filter(ri => ri.cdkMetadataResourceAvailable) + .map(ri => Fn.conditionEquals(Aws.REGION, ri.name))); +} + +function formatModules(runtime: cxapi.RuntimeInfo): string { + const modules = new Array(); + + // inject toolkit version to list of modules + const cliVersion = process.env[cxapi.CLI_VERSION_ENV]; + if (cliVersion) { + modules.push(`aws-cdk=${cliVersion}`); + } + + for (const key of Object.keys(runtime.libraries).sort()) { + modules.push(`${key}=${runtime.libraries[key]}`); + } + return modules.join(','); +} \ No newline at end of file diff --git a/packages/@aws-cdk/core/lib/private/synthesis.ts b/packages/@aws-cdk/core/lib/private/synthesis.ts index c67fa14d5b75e..c8243ec03c763 100644 --- a/packages/@aws-cdk/core/lib/private/synthesis.ts +++ b/packages/@aws-cdk/core/lib/private/synthesis.ts @@ -5,6 +5,7 @@ import { Aspects, IAspect } from '../aspect'; import { Construct, IConstruct, SynthesisOptions, ValidationError } from '../construct-compat'; import { Stack } from '../stack'; import { Stage, StageSynthesisOptions } from '../stage'; +import { MetadataResource } from './metadata-resource'; import { prepareApp } from './prepare-app'; import { TreeMetadata } from './tree-metadata'; @@ -14,6 +15,8 @@ export function synthesize(root: IConstruct, options: SynthesisOptions = { }): c invokeAspects(root); + injectMetadataResources(root); + // This is mostly here for legacy purposes as the framework itself does not use prepare anymore. prepareTree(root); @@ -35,9 +38,7 @@ export function synthesize(root: IConstruct, options: SynthesisOptions = { }): c // stacks to add themselves to the synthesized cloud assembly. synthesizeTree(root, builder); - return builder.buildAssembly({ - runtimeInfo: options.runtimeInfo, - }); + return builder.buildAssembly(); } /** @@ -110,6 +111,36 @@ function prepareTree(root: IConstruct) { visit(root, 'post', construct => construct.onPrepare()); } +/** + * Find all stacks and add Metadata Resources to all of them + * + * There is no good generic place to do this. Can't do it in the constructor + * (because adding a child construct makes it impossible to set context on the + * node), and the generic prepare phase is deprecated. + * + * Only do this on [parent] stacks (not nested stacks), don't do this when + * disabled by the user. + * + * Also, only when running via the CLI. If we do it unconditionally, + * all unit tests everywhere are going to break massively. I've spent a day + * fixing our own, but downstream users would be affected just as badly. + * + * Stop at Assembly boundaries. + */ +function injectMetadataResources(root: IConstruct) { + visit(root, 'post', construct => { + if (!Stack.isStack(construct) || !construct._versionReportingEnabled) { return; } + + // Because of https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/assert/lib/synth-utils.ts#L74 + // synthesize() may be called more than once on a stack in unit tests, and the below would break + // if we execute it a second time. Guard against the constructs already existing. + const CDKMetadata = 'CDKMetadata'; + if (construct.node.tryFindChild(CDKMetadata)) { return; } + + new MetadataResource(construct, CDKMetadata); + }); +} + /** * Synthesize children in post-order into the given builder * diff --git a/packages/@aws-cdk/core/lib/stack.ts b/packages/@aws-cdk/core/lib/stack.ts index 68b82dadfbb7d..8d9c57fe91942 100644 --- a/packages/@aws-cdk/core/lib/stack.ts +++ b/packages/@aws-cdk/core/lib/stack.ts @@ -127,6 +127,14 @@ export interface StackProps { * @default false */ readonly terminationProtection?: boolean; + + /** + * Include runtime versioning information in this Stack + * + * @default `analyticsReporting` setting of containing `App`, or value of + * 'aws:cdk:version-reporting' context key + */ + readonly analyticsReporting?: boolean; } /** @@ -281,6 +289,15 @@ export class Stack extends Construct implements ITaggable { */ public readonly synthesizer: IStackSynthesizer; + /** + * Whether version reporting is enabled for this stack + * + * Controls whether the CDK Metadata resource is injected + * + * @internal + */ + public readonly _versionReportingEnabled: boolean; + /** * Logical ID generation strategy */ @@ -370,6 +387,10 @@ export class Stack extends Construct implements ITaggable { this.templateFile = `${this.artifactId}.template.json`; + // Not for nested stacks + this._versionReportingEnabled = (props.analyticsReporting ?? this.node.tryGetContext(cxapi.ANALYTICS_REPORTING_ENABLED_CONTEXT)) + && !this.nestedStackParent; + this.synthesizer = props.synthesizer ?? (newStyleSynthesisContext ? new DefaultStackSynthesizer() : new LegacyStackSynthesizer()); @@ -722,10 +743,11 @@ export class Stack extends Construct implements ITaggable { // this right now, so some parts still happen here. const builder = session.assembly; + const template = this._toCloudFormation(); + // write the CloudFormation template as a JSON file const outPath = path.join(builder.outdir, this.templateFile); - const text = JSON.stringify(this._toCloudFormation(), undefined, 2); - fs.writeFileSync(outPath, text); + fs.writeFileSync(outPath, JSON.stringify(template, undefined, 2)); for (const ctx of this._missingContext) { builder.addMissing(ctx); diff --git a/packages/@aws-cdk/core/lib/stage.ts b/packages/@aws-cdk/core/lib/stage.ts index 94296a6d167ee..bf18e89d89313 100644 --- a/packages/@aws-cdk/core/lib/stage.ts +++ b/packages/@aws-cdk/core/lib/stage.ts @@ -2,7 +2,6 @@ import * as cxapi from '@aws-cdk/cx-api'; import { IConstruct, Node } from 'constructs'; import { Construct } from './construct-compat'; import { Environment } from './environment'; -import { collectRuntimeInformation } from './private/runtime-info'; import { synthesize } from './private/synthesis'; /** @@ -172,10 +171,8 @@ export class Stage extends Construct { */ public synth(options: StageSynthesisOptions = { }): cxapi.CloudAssembly { if (!this.assembly || options.force) { - const runtimeInfo = this.node.tryGetContext(cxapi.DISABLE_VERSION_REPORTING) ? undefined : collectRuntimeInformation(); this.assembly = synthesize(this, { skipValidation: options.skipValidation, - runtimeInfo, }); } diff --git a/packages/@aws-cdk/core/package.json b/packages/@aws-cdk/core/package.json index ebf59da5cb25f..d3cf4a0a1c656 100644 --- a/packages/@aws-cdk/core/package.json +++ b/packages/@aws-cdk/core/package.json @@ -178,6 +178,7 @@ "dependencies": { "@aws-cdk/cloud-assembly-schema": "0.0.0", "@aws-cdk/cx-api": "0.0.0", + "@aws-cdk/region-info": "0.0.0", "constructs": "^3.0.4", "fs-extra": "^9.0.1", "minimatch": "^3.0.4" @@ -190,7 +191,8 @@ "peerDependencies": { "@aws-cdk/cloud-assembly-schema": "0.0.0", "@aws-cdk/cx-api": "0.0.0", - "constructs": "^3.0.4" + "constructs": "^3.0.4", + "@aws-cdk/region-info": "0.0.0" }, "engines": { "node": ">= 10.13.0 <13 || >=13.7.0" diff --git a/packages/@aws-cdk/core/test/test.app.ts b/packages/@aws-cdk/core/test/test.app.ts index 3feeae07829a6..ac14bcff7e620 100644 --- a/packages/@aws-cdk/core/test/test.app.ts +++ b/packages/@aws-cdk/core/test/test.app.ts @@ -4,10 +4,10 @@ import { Test } from 'nodeunit'; import { CfnResource, Construct, Stack, StackProps } from '../lib'; import { Annotations } from '../lib/annotations'; import { App, AppProps } from '../lib/app'; +import { MetadataResource } from '../lib/private/metadata-resource'; function withApp(props: AppProps, block: (app: App) => void): cxapi.CloudAssembly { const app = new App({ - runtimeInfo: false, stackTraces: false, ...props, }); @@ -245,11 +245,13 @@ export = { test.done(); }, - 'runtime library versions disabled'(test: Test) { - const context: any = {}; - context[cxapi.DISABLE_VERSION_REPORTING] = true; - - const assembly = withApp(context, app => { + /** + * Runtime library versions are now synthesized into the Stack templates directly + * + * The are not emitted into Cloud Assembly metadata anymore + */ + 'runtime library versions are not emitted in asm anymore'(test: Test) { + const assembly = withApp({ analyticsReporting: true }, app => { const stack = new Stack(app, 'stack1'); new CfnResource(stack, 'MyResource', { type: 'Resource::Type' }); }); @@ -259,52 +261,83 @@ export = { }, 'runtime library versions'(test: Test) { - const response = withApp({ runtimeInfo: true }, app => { + MetadataResource.clearModulesCache(); + + const response = withApp({ analyticsReporting: true }, app => { const stack = new Stack(app, 'stack1'); new CfnResource(stack, 'MyResource', { type: 'Resource::Type' }); }); - const libs = (response.runtime && response.runtime.libraries) || {}; + const stackTemplate = response.getStackByName('stack1').template; + const libs = parseModules(stackTemplate.Resources?.CDKMetadata?.Properties?.Modules); // eslint-disable-next-line @typescript-eslint/no-require-imports const version = require('../package.json').version; test.deepEqual(libs['@aws-cdk/core'], version); test.deepEqual(libs['@aws-cdk/cx-api'], version); test.deepEqual(libs['jsii-runtime'], `node.js/${process.version}`); + + test.done(); + }, + + 'CDK version'(test: Test) { + MetadataResource.clearModulesCache(); + + withCliVersion(() => { + const response = withApp({ analyticsReporting: true }, app => { + const stack = new Stack(app, 'stack1'); + new CfnResource(stack, 'MyResource', { type: 'Resource::Type' }); + }); + + const stackTemplate = response.getStackByName('stack1').template; + const libs = parseModules(stackTemplate.Resources?.CDKMetadata?.Properties?.Modules); + + // eslint-disable-next-line @typescript-eslint/no-require-imports + test.deepEqual(libs['aws-cdk'], '1.2.3'); + }); + test.done(); }, 'jsii-runtime version loaded from JSII_AGENT'(test: Test) { process.env.JSII_AGENT = 'Java/1.2.3.4'; + MetadataResource.clearModulesCache(); - const response = withApp({ runtimeInfo: true }, app => { - const stack = new Stack(app, 'stack1'); - new CfnResource(stack, 'MyResource', { type: 'Resource::Type' }); - }); + withCliVersion(() => { + const response = withApp({ analyticsReporting: true }, app => { + const stack = new Stack(app, 'stack1'); + new CfnResource(stack, 'MyResource', { type: 'Resource::Type' }); + }); - const libs = (response.runtime && response.runtime.libraries) || {}; - test.deepEqual(libs['jsii-runtime'], 'Java/1.2.3.4'); + const stackTemplate = response.getStackByName('stack1').template; + const libs = parseModules(stackTemplate.Resources?.CDKMetadata?.Properties?.Modules); + + test.deepEqual(libs['jsii-runtime'], 'Java/1.2.3.4'); + }); delete process.env.JSII_AGENT; test.done(); }, 'version reporting includes only @aws-cdk, aws-cdk and jsii libraries'(test: Test) { - const response = withApp({ runtimeInfo: true }, app => { + MetadataResource.clearModulesCache(); + + const response = withApp({ analyticsReporting: true }, app => { const stack = new Stack(app, 'stack1'); new CfnResource(stack, 'MyResource', { type: 'Resource::Type' }); }); - const libs = (response.runtime && response.runtime.libraries) || {}; + const stackTemplate = response.getStackByName('stack1').template; + const libs = parseModules(stackTemplate.Resources?.CDKMetadata?.Properties?.Modules); + const libNames = Object.keys(libs).sort(); - // eslint-disable-next-line @typescript-eslint/no-require-imports - const version = require('../package.json').version; - test.deepEqual(libs, { - '@aws-cdk/core': version, - '@aws-cdk/cx-api': version, - '@aws-cdk/cloud-assembly-schema': version, - 'jsii-runtime': `node.js/${process.version}`, - }); + test.deepEqual(libNames, [ + '@aws-cdk/cloud-assembly-schema', + '@aws-cdk/core', + '@aws-cdk/cx-api', + '@aws-cdk/region-info', + 'jsii-runtime', + ]); test.done(); }, @@ -385,3 +418,30 @@ class MyConstruct extends Construct { new CfnResource(this, 'r2', { type: 'ResourceType2', properties: { FromContext: this.node.tryGetContext('ctx1') } }); } } + +function parseModules(x?: string): Record { + if (x === undefined) { return {}; } + + const ret: Record = {}; + for (const clause of x.split(',')) { + const [key, value] = clause.split('='); + if (key !== undefined && value !== undefined) { + ret[key] = value; + } + } + return ret; +} + +/** + * Set the CLI_VERSION_ENV environment variable + * + * This is necessary to get the Stack to emit the metadata resource + */ +function withCliVersion(block: () => A): A { + process.env[cxapi.CLI_VERSION_ENV] = '1.2.3'; + try { + return block(); + } finally { + delete process.env[cxapi.CLI_VERSION_ENV]; + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/core/test/test.rule.ts b/packages/@aws-cdk/core/test/test.rule.ts index 62ef0611c9a38..8385183333855 100644 --- a/packages/@aws-cdk/core/test/test.rule.ts +++ b/packages/@aws-cdk/core/test/test.rule.ts @@ -19,7 +19,7 @@ export = { AssertDescription: 'lhs equals rhs', }, { - Assert: { 'Fn::Not': [{ 'Fn::And': [{ 'Fn::Contains': [['hello', 'world'], 'world'] }] }] }, + Assert: { 'Fn::Not': [{ 'Fn::Contains': [['hello', 'world'], 'world'] }] }, AssertDescription: 'some assertion', }, ], diff --git a/packages/@aws-cdk/core/test/test.runtime-info.ts b/packages/@aws-cdk/core/test/test.runtime-info.ts index 762348378d5ab..46d8e42f85048 100644 --- a/packages/@aws-cdk/core/test/test.runtime-info.ts +++ b/packages/@aws-cdk/core/test/test.runtime-info.ts @@ -21,14 +21,7 @@ export = { const runtimeInfo = collectRuntimeInformation(); // eslint-disable-next-line @typescript-eslint/no-require-imports - const version = require('../package.json').version; - test.deepEqual(runtimeInfo.libraries, { - '@aws-cdk/core': version, - '@aws-cdk/cx-api': version, - '@aws-cdk/cloud-assembly-schema': version, - '@aws-solutions-konstruk/foo': mockVersion, - 'jsii-runtime': `node.js/${process.version}`, - }); + test.deepEqual(runtimeInfo.libraries['@aws-solutions-konstruk/foo'], mockVersion); test.done(); }, @@ -48,15 +41,7 @@ export = { const runtimeInfo = collectRuntimeInformation(); // eslint-disable-next-line @typescript-eslint/no-require-imports - const version = require('../package.json').version; - test.deepEqual(runtimeInfo.libraries, { - '@aws-cdk/core': version, - '@aws-cdk/cx-api': version, - '@aws-cdk/cloud-assembly-schema': version, - '@aws-solutions-konstruk/foo': mockVersion, // picks up the module from the other test. - 'aws-rfdk': mockVersion, - 'jsii-runtime': `node.js/${process.version}`, - }); + test.deepEqual(runtimeInfo.libraries['aws-rfdk'], mockVersion); test.done(); }, diff --git a/packages/@aws-cdk/core/test/test.stack.ts b/packages/@aws-cdk/core/test/test.stack.ts index 49a7ac671b0ad..409c096da3610 100644 --- a/packages/@aws-cdk/core/test/test.stack.ts +++ b/packages/@aws-cdk/core/test/test.stack.ts @@ -993,6 +993,24 @@ export = { test.done(); }, + + 'version reporting can be configured on the app'(test: Test) { + const app = new App({ analyticsReporting: true }); + test.ok(new Stack(app, 'Stack')._versionReportingEnabled); + test.done(); + }, + + 'version reporting can be configured with context'(test: Test) { + const app = new App({ context: { 'aws:cdk:version-reporting': true } }); + test.ok(new Stack(app, 'Stack')._versionReportingEnabled); + test.done(); + }, + + 'version reporting can be configured on the stack'(test: Test) { + const app = new App(); + test.ok(new Stack(app, 'Stack', { analyticsReporting: true })._versionReportingEnabled); + test.done(); + }, }; class StackWithPostProcessor extends Stack { diff --git a/packages/@aws-cdk/core/test/test.stage.ts b/packages/@aws-cdk/core/test/test.stage.ts index f816458c6199e..52fe1c14c4d21 100644 --- a/packages/@aws-cdk/core/test/test.stage.ts +++ b/packages/@aws-cdk/core/test/test.stage.ts @@ -209,7 +209,7 @@ export = { 'Assemblies can be deeply nested'(test: Test) { // GIVEN - const app = new App({ runtimeInfo: false, treeMetadata: false }); + const app = new App({ treeMetadata: false }); const level1 = new Stage(app, 'StageLevel1'); const level2 = new Stage(level1, 'StageLevel2'); diff --git a/packages/@aws-cdk/core/test/test.synthesis.ts b/packages/@aws-cdk/core/test/test.synthesis.ts index 02b96b733d3c1..3d8c0fad35cf1 100644 --- a/packages/@aws-cdk/core/test/test.synthesis.ts +++ b/packages/@aws-cdk/core/test/test.synthesis.ts @@ -2,16 +2,11 @@ import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; import { Test } from 'nodeunit'; import * as cdk from '../lib'; function createModernApp() { - return new cdk.App({ - context: { - [cxapi.DISABLE_VERSION_REPORTING]: 'true', // for test reproducibility - }, - }); + return new cdk.App(); } export = { diff --git a/packages/@aws-cdk/cx-api/lib/app.ts b/packages/@aws-cdk/cx-api/lib/app.ts index 41283679f0db2..24be06efc6797 100644 --- a/packages/@aws-cdk/cx-api/lib/app.ts +++ b/packages/@aws-cdk/cx-api/lib/app.ts @@ -11,9 +11,9 @@ export const PATH_METADATA_ENABLE_CONTEXT = 'aws:cdk:enable-path-metadata'; /** - * Disable the collection and reporting of version information. + * Enable the collection and reporting of version information. */ -export const DISABLE_VERSION_REPORTING = 'aws:cdk:disable-version-reporting'; +export const ANALYTICS_REPORTING_ENABLED_CONTEXT = 'aws:cdk:version-reporting'; /** * If this is set, asset staging is disabled. This means that assets will not be copied to diff --git a/packages/@aws-cdk/cx-api/lib/cloud-assembly.ts b/packages/@aws-cdk/cx-api/lib/cloud-assembly.ts index 8155d8a2c33ca..05210ed891eed 100644 --- a/packages/@aws-cdk/cx-api/lib/cloud-assembly.ts +++ b/packages/@aws-cdk/cx-api/lib/cloud-assembly.ts @@ -369,6 +369,8 @@ 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; } diff --git a/packages/@aws-cdk/pipelines/test/testutil.ts b/packages/@aws-cdk/pipelines/test/testutil.ts index 821b795105365..d0573130e3ede 100644 --- a/packages/@aws-cdk/pipelines/test/testutil.ts +++ b/packages/@aws-cdk/pipelines/test/testutil.ts @@ -21,7 +21,6 @@ export class TestApp extends App { }, stackTraces: false, autoSynth: false, - runtimeInfo: false, treeMetadata: false, ...props, }); diff --git a/packages/aws-cdk/lib/api/cxapp/exec.ts b/packages/aws-cdk/lib/api/cxapp/exec.ts index 735e9a7622e19..dc74967e948a3 100644 --- a/packages/aws-cdk/lib/api/cxapp/exec.ts +++ b/packages/aws-cdk/lib/api/cxapp/exec.ts @@ -16,25 +16,21 @@ export async function execProgram(aws: SdkProvider, config: Configuration): Prom await populateDefaultEnvironmentIfNeeded(aws, env); const pathMetadata: boolean = config.settings.get(['pathMetadata']) ?? true; - if (pathMetadata) { context[cxapi.PATH_METADATA_ENABLE_CONTEXT] = true; } const assetMetadata: boolean = config.settings.get(['assetMetadata']) ?? true; - if (assetMetadata) { context[cxapi.ASSET_RESOURCE_METADATA_ENABLED_CONTEXT] = true; } const versionReporting: boolean = config.settings.get(['versionReporting']) ?? true; - - if (!versionReporting) { - context[cxapi.DISABLE_VERSION_REPORTING] = true; - } + if (versionReporting) { context[cxapi.ANALYTICS_REPORTING_ENABLED_CONTEXT] = true; } + // We need to keep on doing this for framework version from before this flag was deprecated. + if (!versionReporting) { context['aws:cdk:disable-version-reporting'] = true; } const stagingEnabled = config.settings.get(['staging']) ?? true; - if (!stagingEnabled) { context[cxapi.DISABLE_ASSET_STAGING_CONTEXT] = true; } diff --git a/packages/aws-cdk/lib/settings.ts b/packages/aws-cdk/lib/settings.ts index af9193d9a6456..b091ba493c6dd 100644 --- a/packages/aws-cdk/lib/settings.ts +++ b/packages/aws-cdk/lib/settings.ts @@ -54,7 +54,7 @@ export class Configuration { public context = new Context(); public readonly defaultConfig = new Settings({ - versionReporting: true, + analyticsReporting: true, pathMetadata: true, output: 'cdk.out', }); @@ -239,7 +239,7 @@ export class Settings { bucketName: argv.bootstrapBucketName, kmsKeyId: argv.bootstrapKmsKeyId, }, - versionReporting: argv.versionReporting, + analyticsReporting: argv.versionReporting, staging: argv.staging, output: argv.output, progress: argv.progress, From 37723e91a68583eeb442ef2f1716b7de6c653fa9 Mon Sep 17 00:00:00 2001 From: Neta Nir Date: Mon, 28 Sep 2020 19:55:36 -0700 Subject: [PATCH 06/10] chore(cfnspec): add junit.xml to ignore files (#10566) When generating a new module, add `junit.xml` to `.npmignore` and `.gitignore`, this is required by `aws-lint` rule. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../@aws-cdk/cfnspec/build-tools/create-missing-libraries.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/@aws-cdk/cfnspec/build-tools/create-missing-libraries.ts b/packages/@aws-cdk/cfnspec/build-tools/create-missing-libraries.ts index ab0cd06c44861..96d958fa11710 100644 --- a/packages/@aws-cdk/cfnspec/build-tools/create-missing-libraries.ts +++ b/packages/@aws-cdk/cfnspec/build-tools/create-missing-libraries.ts @@ -211,6 +211,7 @@ async function main() { 'nyc.config.js', '!.eslintrc.js', '!jest.config.js', + 'junit.xml', ]); await write('.npmignore', [ @@ -237,6 +238,7 @@ async function main() { '', '.eslintrc.js', 'jest.config.js', + 'junit.xml', ]); await write('lib/index.ts', [ From a76428bd8559e497cd631d17ff9af2a01792b4c2 Mon Sep 17 00:00:00 2001 From: Niranjan Jayakar Date: Tue, 29 Sep 2020 07:03:34 +0100 Subject: [PATCH 07/10] chore: migrate constructs to use "constructs" module (#10506) This commits expands on a previous [commit]. A few CDK modules have been migrated to use the `Construct` and `IConstruct` from the "constructs" module instead of the "@aws-cdk/core" module. Migrating modules to use the "constructs" module, prevents merge conflicts from arising in these files when the construct compatibility layer in "@aws-cdk/core" module is removed in the v2 branch. [commit]: https://github.com/aws/aws-cdk/commit/c17969926a2644fc9607dd9b5f105450ed64309a ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/alexa-ask/package.json | 5 ++++- .../@aws-cdk/aws-accessanalyzer/package.json | 5 ++++- packages/@aws-cdk/aws-acmpca/package.json | 5 ++++- packages/@aws-cdk/aws-amazonmq/package.json | 5 ++++- packages/@aws-cdk/aws-apigateway/lib/api-key.ts | 3 ++- .../@aws-cdk/aws-apigateway/lib/authorizer.ts | 3 ++- .../aws-apigateway/lib/authorizers/lambda.ts | 3 ++- .../aws-apigateway/lib/base-path-mapping.ts | 3 ++- .../@aws-cdk/aws-apigateway/lib/deployment.ts | 5 +++-- .../@aws-cdk/aws-apigateway/lib/domain-name.ts | 3 ++- .../aws-apigateway/lib/gateway-response.ts | 3 ++- .../@aws-cdk/aws-apigateway/lib/lambda-api.ts | 4 ++-- packages/@aws-cdk/aws-apigateway/lib/method.ts | 3 ++- packages/@aws-cdk/aws-apigateway/lib/model.ts | 3 ++- .../aws-apigateway/lib/rate-limited-api-key.ts | 3 ++- .../aws-apigateway/lib/requestvalidator.ts | 3 ++- .../@aws-cdk/aws-apigateway/lib/resource.ts | 3 ++- packages/@aws-cdk/aws-apigateway/lib/restapi.ts | 3 ++- packages/@aws-cdk/aws-apigateway/lib/stage.ts | 3 ++- .../@aws-cdk/aws-apigateway/lib/usage-plan.ts | 3 ++- .../@aws-cdk/aws-apigateway/lib/vpc-link.ts | 3 ++- packages/@aws-cdk/aws-apigateway/package.json | 5 ++++- .../aws-apigatewayv2/lib/common/domain-name.ts | 3 ++- .../aws-apigatewayv2/lib/http/api-mapping.ts | 3 ++- .../@aws-cdk/aws-apigatewayv2/lib/http/api.ts | 3 ++- .../aws-apigatewayv2/lib/http/integration.ts | 9 +++++++-- .../@aws-cdk/aws-apigatewayv2/lib/http/route.ts | 3 ++- .../@aws-cdk/aws-apigatewayv2/lib/http/stage.ts | 3 ++- packages/@aws-cdk/aws-apigatewayv2/package.json | 5 ++++- packages/@aws-cdk/aws-appconfig/package.json | 5 ++++- .../lib/base-scalable-attribute.ts | 3 ++- .../lib/scalable-target.ts | 3 ++- .../lib/step-scaling-action.ts | 3 ++- .../lib/step-scaling-policy.ts | 3 ++- .../lib/target-tracking-scaling-policy.ts | 3 ++- .../aws-applicationautoscaling/package.json | 5 ++++- .../aws-applicationinsights/package.json | 5 ++++- packages/@aws-cdk/aws-appmesh/lib/mesh.ts | 8 ++++---- packages/@aws-cdk/aws-appmesh/lib/route.ts | 10 +++++----- .../@aws-cdk/aws-appmesh/lib/virtual-node.ts | 10 +++++----- .../@aws-cdk/aws-appmesh/lib/virtual-router.ts | 12 ++++++------ .../@aws-cdk/aws-appmesh/lib/virtual-service.ts | 10 +++++----- packages/@aws-cdk/aws-appmesh/package.json | 5 ++++- packages/@aws-cdk/aws-appstream/package.json | 5 ++++- packages/@aws-cdk/aws-athena/package.json | 5 ++++- .../aws-autoscaling-common/package.json | 5 +++++ .../aws-autoscaling/lib/auto-scaling-group.ts | 3 ++- .../aws-autoscaling/lib/lifecycle-hook.ts | 3 ++- .../aws-autoscaling/lib/scheduled-action.ts | 3 ++- .../aws-autoscaling/lib/step-scaling-action.ts | 13 +++++++------ .../aws-autoscaling/lib/step-scaling-policy.ts | 13 +++++++------ .../lib/target-tracking-scaling-policy.ts | 11 ++++++----- packages/@aws-cdk/aws-autoscaling/package.json | 5 ++++- .../@aws-cdk/aws-autoscalingplans/package.json | 5 ++++- packages/@aws-cdk/aws-budgets/package.json | 5 ++++- packages/@aws-cdk/aws-cassandra/package.json | 5 ++++- packages/@aws-cdk/aws-ce/package.json | 5 ++++- .../aws-certificatemanager/lib/certificate.ts | 3 ++- .../lib/dns-validated-certificate.ts | 3 ++- .../aws-certificatemanager/package.json | 5 ++++- .../lib/slack-channel-configuration.ts | 7 ++++--- packages/@aws-cdk/aws-chatbot/package.json | 5 ++++- packages/@aws-cdk/aws-cloud9/lib/environment.ts | 5 +++-- packages/@aws-cdk/aws-cloud9/package.json | 5 ++++- .../aws-cloudfront-origins/package.json | 5 ++++- .../@aws-cdk/aws-cloudfront/lib/distribution.ts | 13 +++++++++---- .../lib/origin_access_identity.ts | 7 ++++--- .../aws-cloudfront/lib/web_distribution.ts | 5 +++-- packages/@aws-cdk/aws-cloudfront/package.json | 5 ++++- .../@aws-cdk/aws-cloudtrail/lib/cloudtrail.ts | 3 ++- packages/@aws-cdk/aws-cloudtrail/package.json | 5 ++++- packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts | 3 ++- .../aws-cloudwatch/lib/composite-alarm.ts | 3 ++- .../@aws-cdk/aws-cloudwatch/lib/dashboard.ts | 3 ++- packages/@aws-cdk/aws-cloudwatch/package.json | 5 ++++- .../@aws-cdk/aws-codecommit/lib/repository.ts | 3 ++- packages/@aws-cdk/aws-codecommit/package.json | 5 ++++- .../aws-codedeploy/lib/ecs/application.ts | 3 ++- .../aws-codedeploy/lib/ecs/deployment-config.ts | 4 ++-- .../aws-codedeploy/lib/ecs/deployment-group.ts | 6 +++--- .../aws-codedeploy/lib/lambda/application.ts | 3 ++- .../lib/lambda/deployment-config.ts | 4 ++-- .../lib/lambda/deployment-group.ts | 8 ++++---- .../aws-codedeploy/lib/server/application.ts | 3 ++- .../lib/server/deployment-config.ts | 5 +++-- .../lib/server/deployment-group.ts | 9 +++++---- packages/@aws-cdk/aws-codedeploy/package.json | 5 ++++- .../aws-codeguruprofiler/lib/profiling-group.ts | 3 ++- .../@aws-cdk/aws-codeguruprofiler/package.json | 8 ++++++-- .../@aws-cdk/aws-codegurureviewer/package.json | 5 ++++- .../@aws-cdk/aws-codepipeline/lib/pipeline.ts | 5 +++-- packages/@aws-cdk/aws-codepipeline/package.json | 5 ++++- .../aws-codestar/lib/github-repository.ts | 3 ++- packages/@aws-cdk/aws-codestar/package.json | 5 ++++- .../aws-codestarconnections/package.json | 5 ++++- .../aws-codestarnotifications/package.json | 5 ++++- packages/@aws-cdk/aws-datapipeline/package.json | 5 ++++- packages/@aws-cdk/aws-dax/package.json | 5 ++++- packages/@aws-cdk/aws-detective/package.json | 5 ++++- .../@aws-cdk/aws-directoryservice/package.json | 5 ++++- packages/@aws-cdk/aws-dlm/package.json | 5 ++++- packages/@aws-cdk/aws-dms/package.json | 5 ++++- packages/@aws-cdk/aws-docdb/lib/cluster.ts | 3 ++- .../@aws-cdk/aws-docdb/lib/database-secret.ts | 3 ++- packages/@aws-cdk/aws-docdb/lib/instance.ts | 6 +++--- .../@aws-cdk/aws-docdb/lib/parameter-group.ts | 3 ++- packages/@aws-cdk/aws-docdb/package.json | 5 ++++- packages/@aws-cdk/aws-ec2/lib/bastion-host.ts | 3 ++- packages/@aws-cdk/aws-ec2/lib/instance.ts | 3 ++- packages/@aws-cdk/aws-ec2/lib/network-acl.ts | 3 ++- packages/@aws-cdk/aws-ec2/lib/security-group.ts | 3 ++- packages/@aws-cdk/aws-ec2/lib/util.ts | 4 ++-- packages/@aws-cdk/aws-ec2/lib/volume.ts | 14 ++++++++++---- .../aws-ec2/lib/vpc-endpoint-service.ts | 3 ++- packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts | 3 ++- packages/@aws-cdk/aws-ec2/lib/vpc-flow-logs.ts | 13 +++++++++---- packages/@aws-cdk/aws-ec2/lib/vpc.ts | 17 +++++++++++------ packages/@aws-cdk/aws-ec2/lib/vpn.ts | 5 +++-- packages/@aws-cdk/aws-ec2/package.json | 5 ++++- packages/@aws-cdk/aws-efs/lib/access-point.ts | 3 ++- .../@aws-cdk/aws-efs/lib/efs-file-system.ts | 3 ++- packages/@aws-cdk/aws-efs/package.json | 5 ++++- packages/@aws-cdk/aws-elasticache/package.json | 5 ++++- .../@aws-cdk/aws-elasticbeanstalk/package.json | 5 ++++- .../lib/load-balancer.ts | 3 ++- .../aws-elasticloadbalancing/package.json | 5 ++++- .../package.json | 5 ++++- .../lib/alb/application-listener-certificate.ts | 3 ++- .../lib/alb/application-listener-rule.ts | 3 ++- .../lib/alb/application-listener.ts | 3 ++- .../lib/alb/application-load-balancer.ts | 3 ++- .../lib/alb/application-target-group.ts | 5 +++-- .../lib/nlb/network-listener.ts | 3 ++- .../lib/nlb/network-load-balancer.ts | 3 ++- .../lib/nlb/network-target-group.ts | 7 ++++--- .../lib/shared/base-listener.ts | 3 ++- .../lib/shared/base-load-balancer.ts | 3 ++- .../lib/shared/base-target-group.ts | 3 ++- .../lib/shared/imported.ts | 3 ++- .../aws-elasticloadbalancingv2/package.json | 5 ++++- .../@aws-cdk/aws-elasticsearch/package.json | 5 ++++- packages/@aws-cdk/aws-emr/package.json | 5 ++++- packages/@aws-cdk/aws-events/lib/event-bus.ts | 3 ++- packages/@aws-cdk/aws-events/lib/rule.ts | 5 +++-- packages/@aws-cdk/aws-events/package.json | 5 ++++- packages/@aws-cdk/aws-eventschemas/package.json | 5 ++++- packages/@aws-cdk/aws-fms/package.json | 5 ++++- .../@aws-cdk/aws-fsx/lib/lustre-file-system.ts | 3 ++- packages/@aws-cdk/aws-fsx/package.json | 5 ++++- packages/@aws-cdk/aws-gamelift/package.json | 5 ++++- packages/@aws-cdk/aws-glue/lib/database.ts | 3 ++- packages/@aws-cdk/aws-glue/lib/table.ts | 3 ++- packages/@aws-cdk/aws-glue/package.json | 5 ++++- packages/@aws-cdk/aws-greengrass/package.json | 5 ++++- packages/@aws-cdk/aws-guardduty/package.json | 5 ++++- packages/@aws-cdk/aws-iam/lib/group.ts | 3 ++- packages/@aws-cdk/aws-iam/lib/lazy-role.ts | 3 ++- packages/@aws-cdk/aws-iam/lib/managed-policy.ts | 3 ++- packages/@aws-cdk/aws-iam/lib/oidc-provider.ts | 3 ++- packages/@aws-cdk/aws-iam/lib/policy.ts | 3 ++- .../aws-iam/lib/private/immutable-role.ts | 3 ++- packages/@aws-cdk/aws-iam/lib/role.ts | 5 +++-- .../@aws-cdk/aws-iam/lib/unknown-principal.ts | 5 +++-- packages/@aws-cdk/aws-iam/lib/user.ts | 3 ++- packages/@aws-cdk/aws-iam/lib/util.ts | 3 ++- packages/@aws-cdk/aws-iam/package.json | 3 +++ packages/@aws-cdk/aws-imagebuilder/package.json | 5 ++++- packages/@aws-cdk/aws-inspector/package.json | 5 ++++- packages/@aws-cdk/aws-iot/package.json | 5 ++++- packages/@aws-cdk/aws-iot1click/package.json | 5 ++++- packages/@aws-cdk/aws-iotanalytics/package.json | 5 ++++- packages/@aws-cdk/aws-iotevents/package.json | 5 ++++- .../@aws-cdk/aws-iotthingsgraph/package.json | 5 ++++- packages/@aws-cdk/aws-kendra/package.json | 5 ++++- packages/@aws-cdk/aws-kinesis/lib/stream.ts | 3 ++- packages/@aws-cdk/aws-kinesis/package.json | 5 ++++- .../@aws-cdk/aws-kinesisanalytics/package.json | 5 ++++- .../@aws-cdk/aws-kinesisfirehose/package.json | 5 ++++- packages/@aws-cdk/aws-kms/lib/alias.ts | 3 ++- packages/@aws-cdk/aws-kms/lib/key.ts | 9 +++++---- packages/@aws-cdk/aws-kms/package.json | 5 ++++- .../@aws-cdk/aws-lakeformation/package.json | 5 ++++- packages/@aws-cdk/aws-lambda/lib/alias.ts | 2 +- .../aws-lambda/lib/event-invoke-config.ts | 3 ++- .../aws-lambda/lib/event-source-mapping.ts | 5 +++-- packages/@aws-cdk/aws-lambda/lib/function.ts | 3 ++- .../@aws-cdk/aws-lambda/lib/lambda-version.ts | 3 ++- packages/@aws-cdk/aws-lambda/lib/layers.ts | 3 ++- .../@aws-cdk/aws-lambda/lib/log-retention.ts | 4 ++-- .../@aws-cdk/aws-lambda/lib/singleton-lambda.ts | 3 ++- packages/@aws-cdk/aws-lambda/lib/util.ts | 2 +- packages/@aws-cdk/aws-lambda/package.json | 5 ++++- .../aws-logs/lib/cross-account-destination.ts | 3 ++- packages/@aws-cdk/aws-logs/lib/log-group.ts | 3 ++- packages/@aws-cdk/aws-logs/lib/log-retention.ts | 5 +++-- packages/@aws-cdk/aws-logs/lib/log-stream.ts | 3 ++- packages/@aws-cdk/aws-logs/lib/metric-filter.ts | 3 ++- .../aws-logs/lib/subscription-filter.ts | 9 +++++++-- packages/@aws-cdk/aws-logs/package.json | 5 ++++- packages/@aws-cdk/aws-macie/package.json | 5 ++++- .../@aws-cdk/aws-managedblockchain/package.json | 5 ++++- packages/@aws-cdk/aws-mediaconvert/package.json | 5 ++++- packages/@aws-cdk/aws-medialive/package.json | 5 ++++- packages/@aws-cdk/aws-mediastore/package.json | 5 ++++- packages/@aws-cdk/aws-msk/package.json | 5 ++++- packages/@aws-cdk/aws-neptune/package.json | 5 ++++- .../@aws-cdk/aws-networkmanager/package.json | 5 ++++- packages/@aws-cdk/aws-opsworks/package.json | 5 ++++- packages/@aws-cdk/aws-opsworkscm/package.json | 5 ++++- packages/@aws-cdk/aws-pinpoint/package.json | 5 ++++- .../@aws-cdk/aws-pinpointemail/package.json | 5 ++++- packages/@aws-cdk/aws-qldb/package.json | 5 ++++- packages/@aws-cdk/aws-ram/package.json | 5 ++++- packages/@aws-cdk/aws-redshift/lib/cluster.ts | 3 ++- .../aws-redshift/lib/database-secret.ts | 2 +- .../aws-redshift/lib/parameter-group.ts | 3 ++- .../@aws-cdk/aws-redshift/lib/subnet-group.ts | 3 ++- packages/@aws-cdk/aws-redshift/package.json | 5 ++++- .../@aws-cdk/aws-resourcegroups/package.json | 5 ++++- packages/@aws-cdk/aws-robomaker/package.json | 5 ++++- .../@aws-cdk/aws-route53/lib/hosted-zone.ts | 3 ++- packages/@aws-cdk/aws-route53/lib/record-set.ts | 3 ++- packages/@aws-cdk/aws-route53/package.json | 5 ++++- .../@aws-cdk/aws-route53resolver/package.json | 5 ++++- packages/@aws-cdk/aws-s3-assets/lib/asset.ts | 3 ++- packages/@aws-cdk/aws-s3-assets/package.json | 5 ++++- .../aws-s3-deployment/lib/bucket-deployment.ts | 3 ++- .../@aws-cdk/aws-s3-deployment/package.json | 5 ++++- packages/@aws-cdk/aws-sagemaker/package.json | 5 ++++- packages/@aws-cdk/aws-sam/package.json | 5 ++++- packages/@aws-cdk/aws-sdb/package.json | 5 ++++- .../@aws-cdk/aws-secretsmanager/lib/policy.ts | 3 ++- .../aws-secretsmanager/lib/rotation-schedule.ts | 3 ++- .../aws-secretsmanager/lib/secret-rotation.ts | 9 +++++++-- .../@aws-cdk/aws-secretsmanager/lib/secret.ts | 3 ++- .../@aws-cdk/aws-secretsmanager/package.json | 5 ++++- packages/@aws-cdk/aws-securityhub/package.json | 5 ++++- .../@aws-cdk/aws-servicecatalog/package.json | 5 ++++- .../lib/alias-target-instance.ts | 4 ++-- .../aws-servicediscovery/lib/cname-instance.ts | 4 ++-- .../aws-servicediscovery/lib/http-namespace.ts | 3 ++- .../aws-servicediscovery/lib/ip-instance.ts | 4 ++-- .../aws-servicediscovery/lib/non-ip-instance.ts | 4 ++-- .../lib/private-dns-namespace.ts | 3 ++- .../lib/public-dns-namespace.ts | 3 ++- .../aws-servicediscovery/lib/service.ts | 3 ++- .../@aws-cdk/aws-servicediscovery/package.json | 5 ++++- packages/@aws-cdk/aws-sns/lib/policy.ts | 3 ++- packages/@aws-cdk/aws-sns/lib/subscription.ts | 3 ++- packages/@aws-cdk/aws-sns/lib/topic.ts | 3 ++- packages/@aws-cdk/aws-sns/package.json | 5 ++++- packages/@aws-cdk/aws-sqs/lib/policy.ts | 3 ++- packages/@aws-cdk/aws-sqs/lib/queue.ts | 3 ++- packages/@aws-cdk/aws-sqs/package.json | 5 ++++- packages/@aws-cdk/aws-ssm/lib/parameter.ts | 7 ++++--- packages/@aws-cdk/aws-ssm/lib/util.ts | 3 ++- packages/@aws-cdk/aws-ssm/package.json | 5 ++++- packages/@aws-cdk/aws-sso/package.json | 5 ++++- .../@aws-cdk/aws-stepfunctions/lib/activity.ts | 3 ++- .../aws-stepfunctions/lib/state-machine.ts | 3 ++- .../aws-stepfunctions/lib/states/choice.ts | 4 ++-- .../lib/states/custom-state.ts | 4 ++-- .../aws-stepfunctions/lib/states/fail.ts | 4 ++-- .../aws-stepfunctions/lib/states/map.ts | 4 ++-- .../aws-stepfunctions/lib/states/parallel.ts | 4 ++-- .../aws-stepfunctions/lib/states/pass.ts | 4 ++-- .../aws-stepfunctions/lib/states/state.ts | 7 ++++--- .../aws-stepfunctions/lib/states/succeed.ts | 4 ++-- .../aws-stepfunctions/lib/states/task-base.ts | 3 ++- .../aws-stepfunctions/lib/states/task.ts | 3 ++- .../aws-stepfunctions/lib/states/wait.ts | 3 ++- .../@aws-cdk/aws-stepfunctions/package.json | 5 ++++- packages/@aws-cdk/aws-synthetics/lib/canary.ts | 3 ++- packages/@aws-cdk/aws-synthetics/package.json | 5 ++++- packages/@aws-cdk/aws-transfer/package.json | 5 ++++- packages/@aws-cdk/aws-waf/package.json | 5 ++++- packages/@aws-cdk/aws-wafregional/package.json | 5 ++++- packages/@aws-cdk/aws-wafv2/package.json | 5 ++++- packages/@aws-cdk/aws-workspaces/package.json | 5 ++++- .../build-tools/create-missing-libraries.ts | 3 +++ packages/@aws-cdk/core/lib/annotations.ts | 6 +++--- packages/@aws-cdk/core/lib/context-provider.ts | 4 ++-- packages/@aws-cdk/core/lib/private/resolve.ts | 8 ++++++-- packages/@aws-cdk/core/lib/resource.ts | 5 ++++- packages/@aws-cdk/core/lib/token.ts | 2 +- .../aws-custom-resource/aws-custom-resource.ts | 3 ++- .../lib/provider-framework/provider.ts | 7 ++++--- packages/@aws-cdk/custom-resources/package.json | 5 ++++- packages/awslint/bin/awslint.ts | 2 +- packages/decdk/lib/cdk-schema.ts | 2 +- packages/decdk/lib/jsii2schema.ts | 8 ++++---- 291 files changed, 923 insertions(+), 400 deletions(-) diff --git a/packages/@aws-cdk/alexa-ask/package.json b/packages/@aws-cdk/alexa-ask/package.json index 94f22c5a50b59..8435ce066a29c 100644 --- a/packages/@aws-cdk/alexa-ask/package.json +++ b/packages/@aws-cdk/alexa-ask/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "Alexa::ASK", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-accessanalyzer/package.json b/packages/@aws-cdk/aws-accessanalyzer/package.json index cc3e5f4abadd7..cba163f1e1914 100644 --- a/packages/@aws-cdk/aws-accessanalyzer/package.json +++ b/packages/@aws-cdk/aws-accessanalyzer/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::AccessAnalyzer", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-acmpca/package.json b/packages/@aws-cdk/aws-acmpca/package.json index 4636ccbb5a254..7941394fee2af 100644 --- a/packages/@aws-cdk/aws-acmpca/package.json +++ b/packages/@aws-cdk/aws-acmpca/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::ACMPCA", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-amazonmq/package.json b/packages/@aws-cdk/aws-amazonmq/package.json index 57b006a6d8497..70b7db473e7fc 100644 --- a/packages/@aws-cdk/aws-amazonmq/package.json +++ b/packages/@aws-cdk/aws-amazonmq/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::AmazonMQ", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-apigateway/lib/api-key.ts b/packages/@aws-cdk/aws-apigateway/lib/api-key.ts index dc705e73c939e..30501ff513130 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/api-key.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/api-key.ts @@ -1,4 +1,5 @@ -import { Construct, IResource as IResourceBase, Resource } from '@aws-cdk/core'; +import { IResource as IResourceBase, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnApiKey } from './apigateway.generated'; import { ResourceOptions } from './resource'; import { RestApi } from './restapi'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/authorizer.ts b/packages/@aws-cdk/aws-apigateway/lib/authorizer.ts index ea414a1c43584..8a4c5a020bb9a 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/authorizer.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/authorizer.ts @@ -1,4 +1,5 @@ -import { Construct, Resource, ResourceProps } from '@aws-cdk/core'; +import { Resource, ResourceProps } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { AuthorizationType } from './method'; import { IRestApi } from './restapi'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/authorizers/lambda.ts b/packages/@aws-cdk/aws-apigateway/lib/authorizers/lambda.ts index caf98e5131676..1235b3e0e32fb 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/authorizers/lambda.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/authorizers/lambda.ts @@ -1,6 +1,7 @@ import * as iam from '@aws-cdk/aws-iam'; import * as lambda from '@aws-cdk/aws-lambda'; -import { Construct, Duration, Lazy, Stack } from '@aws-cdk/core'; +import { Duration, Lazy, Stack } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnAuthorizer } from '../apigateway.generated'; import { Authorizer, IAuthorizer } from '../authorizer'; import { IRestApi } from '../restapi'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/base-path-mapping.ts b/packages/@aws-cdk/aws-apigateway/lib/base-path-mapping.ts index 9a23139df0ee4..6026fe3eaecd3 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/base-path-mapping.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/base-path-mapping.ts @@ -1,4 +1,5 @@ -import { Construct, Resource, Token } from '@aws-cdk/core'; +import { Resource, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnBasePathMapping } from './apigateway.generated'; import { IDomainName } from './domain-name'; import { IRestApi, RestApi } from './restapi'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/deployment.ts b/packages/@aws-cdk/aws-apigateway/lib/deployment.ts index e09f0cf1dde35..877af8df471b3 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/deployment.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/deployment.ts @@ -1,5 +1,6 @@ import * as crypto from 'crypto'; -import { Construct, Lazy, RemovalPolicy, Resource, CfnResource } from '@aws-cdk/core'; +import { Construct as CoreConstruct, Lazy, RemovalPolicy, Resource, CfnResource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnDeployment } from './apigateway.generated'; import { Method } from './method'; import { IRestApi, RestApi, SpecRestApi, RestApiBase } from './restapi'; @@ -132,7 +133,7 @@ class LatestDeploymentResource extends CfnDeployment { private readonly originalLogicalId: string; private readonly api: IRestApi; - constructor(scope: Construct, id: string, props: LatestDeploymentResourceProps) { + constructor(scope: CoreConstruct, id: string, props: LatestDeploymentResourceProps) { super(scope, id, { description: props.description, restApiId: props.restApi.restApiId, diff --git a/packages/@aws-cdk/aws-apigateway/lib/domain-name.ts b/packages/@aws-cdk/aws-apigateway/lib/domain-name.ts index f44ebf953dcac..f3b5074fb65a5 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/domain-name.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/domain-name.ts @@ -1,5 +1,6 @@ import * as acm from '@aws-cdk/aws-certificatemanager'; -import { Construct, IResource, Resource, Token } from '@aws-cdk/core'; +import { IResource, Resource, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnDomainName } from './apigateway.generated'; import { BasePathMapping, BasePathMappingOptions } from './base-path-mapping'; import { EndpointType, IRestApi } from './restapi'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/gateway-response.ts b/packages/@aws-cdk/aws-apigateway/lib/gateway-response.ts index 62957167fa881..e28ba7355000a 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/gateway-response.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/gateway-response.ts @@ -1,4 +1,5 @@ -import { Construct, IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnGatewayResponse } from './apigateway.generated'; import { IRestApi } from './restapi'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/lambda-api.ts b/packages/@aws-cdk/aws-apigateway/lib/lambda-api.ts index 9b3e43da970fd..1e7a64c20b3d7 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/lambda-api.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/lambda-api.ts @@ -1,5 +1,5 @@ import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { LambdaIntegration } from './integrations'; import { Method } from './method'; import { ProxyResource, Resource } from './resource'; @@ -42,7 +42,7 @@ export interface LambdaRestApiProps extends RestApiProps { * add resources and methods to the API. */ export class LambdaRestApi extends RestApi { - constructor(scope: cdk.Construct, id: string, props: LambdaRestApiProps) { + constructor(scope: Construct, id: string, props: LambdaRestApiProps) { if ((props.options && props.options.defaultIntegration) || props.defaultIntegration) { throw new Error('Cannot specify "defaultIntegration" since Lambda integration is automatically defined'); } diff --git a/packages/@aws-cdk/aws-apigateway/lib/method.ts b/packages/@aws-cdk/aws-apigateway/lib/method.ts index 172eb77cd1877..e4cfa78c0584e 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/method.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/method.ts @@ -1,4 +1,5 @@ -import { Construct, Resource, Stack } from '@aws-cdk/core'; +import { Resource, Stack } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnMethod, CfnMethodProps } from './apigateway.generated'; import { Authorizer, IAuthorizer } from './authorizer'; import { Integration, IntegrationConfig } from './integration'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/model.ts b/packages/@aws-cdk/aws-apigateway/lib/model.ts index 088dee9b98750..277c0e4fa20b7 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/model.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/model.ts @@ -1,4 +1,5 @@ -import { Construct, Resource } from '@aws-cdk/core'; +import { Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnModel, CfnModelProps } from './apigateway.generated'; import * as jsonSchema from './json-schema'; import { IRestApi, RestApi } from './restapi'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/rate-limited-api-key.ts b/packages/@aws-cdk/aws-apigateway/lib/rate-limited-api-key.ts index 041d34c5ba99d..a82892b112ef7 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/rate-limited-api-key.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/rate-limited-api-key.ts @@ -1,4 +1,5 @@ -import { Construct, Resource } from '@aws-cdk/core'; +import { Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { ApiKey, ApiKeyProps, IApiKey } from './api-key'; import { QuotaSettings, ThrottleSettings, UsagePlan, UsagePlanPerApiStage } from './usage-plan'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/requestvalidator.ts b/packages/@aws-cdk/aws-apigateway/lib/requestvalidator.ts index ce56903f79a0d..02d3e014c24da 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/requestvalidator.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/requestvalidator.ts @@ -1,4 +1,5 @@ -import { Construct, IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnRequestValidator, CfnRequestValidatorProps } from './apigateway.generated'; import { IRestApi, RestApi } from './restapi'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/resource.ts b/packages/@aws-cdk/aws-apigateway/lib/resource.ts index c36f699199a14..1d2c889a8e427 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/resource.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/resource.ts @@ -1,4 +1,5 @@ -import { Construct, IResource as IResourceBase, Resource as ResourceConstruct } from '@aws-cdk/core'; +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'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/restapi.ts b/packages/@aws-cdk/aws-apigateway/lib/restapi.ts index 612b92af1986e..0ab0b458d0b39 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/restapi.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/restapi.ts @@ -1,6 +1,7 @@ import { IVpcEndpoint } from '@aws-cdk/aws-ec2'; import * as iam from '@aws-cdk/aws-iam'; -import { CfnOutput, Construct, IResource as IResourceBase, Resource, Stack } from '@aws-cdk/core'; +import { CfnOutput, IResource as IResourceBase, Resource, Stack } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { ApiDefinition } from './api-definition'; import { ApiKey, ApiKeyOptions, IApiKey } from './api-key'; import { CfnAccount, CfnRestApi } from './apigateway.generated'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/stage.ts b/packages/@aws-cdk/aws-apigateway/lib/stage.ts index 387983a19d86d..67046e5ae3117 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/stage.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/stage.ts @@ -1,4 +1,5 @@ -import { Construct, Duration, IResource, Resource, Stack, Token } from '@aws-cdk/core'; +import { Duration, IResource, Resource, Stack, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { AccessLogFormat, IAccessLogDestination } from './access-log'; import { CfnStage } from './apigateway.generated'; import { Deployment } from './deployment'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/usage-plan.ts b/packages/@aws-cdk/aws-apigateway/lib/usage-plan.ts index 7c2313dd3c025..6e1c5a4266a9e 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/usage-plan.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/usage-plan.ts @@ -1,4 +1,5 @@ -import { Construct, Lazy, Resource, Token } from '@aws-cdk/core'; +import { Lazy, Resource, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { IApiKey } from './api-key'; import { CfnUsagePlan, CfnUsagePlanKey } from './apigateway.generated'; import { Method } from './method'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/vpc-link.ts b/packages/@aws-cdk/aws-apigateway/lib/vpc-link.ts index 9c036a18e582d..85bdf63d0022c 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/vpc-link.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/vpc-link.ts @@ -1,5 +1,6 @@ import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import { Construct, IResource, Lazy, Resource } from '@aws-cdk/core'; +import { IResource, Lazy, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnVpcLink } from './apigateway.generated'; /** diff --git a/packages/@aws-cdk/aws-apigateway/package.json b/packages/@aws-cdk/aws-apigateway/package.json index 90fbaadcf26ab..ccd888c50c0c9 100644 --- a/packages/@aws-cdk/aws-apigateway/package.json +++ b/packages/@aws-cdk/aws-apigateway/package.json @@ -52,7 +52,10 @@ "compat": "cdk-compat" }, "cdk-build": { - "cloudformation": "AWS::ApiGateway" + "cloudformation": "AWS::ApiGateway", + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", 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 93234807bbf09..eaef6605ef897 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/common/domain-name.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/common/domain-name.ts @@ -1,5 +1,6 @@ import { ICertificate } from '@aws-cdk/aws-certificatemanager'; -import { Construct, IResource, Resource, Token } from '@aws-cdk/core'; +import { IResource, Resource, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnDomainName, CfnDomainNameProps } from '../apigatewayv2.generated'; /** diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/http/api-mapping.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/http/api-mapping.ts index 17461f258b288..98410038708d3 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/http/api-mapping.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/http/api-mapping.ts @@ -1,4 +1,5 @@ -import { Construct, Resource } from '@aws-cdk/core'; +import { Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnApiMapping, CfnApiMappingProps } from '../apigatewayv2.generated'; import { IApiMapping, IDomainName } from '../common'; import { IHttpApi } from '../http/api'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/http/api.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/http/api.ts index a15d8e929c6f6..7678a7bbe99e4 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/http/api.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/http/api.ts @@ -1,4 +1,5 @@ -import { Construct, Duration, IResource, Resource } from '@aws-cdk/core'; +import { Duration, IResource, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnApi, CfnApiProps } from '../apigatewayv2.generated'; import { DefaultDomainMappingOptions } from '../http/stage'; import { IHttpRouteIntegration } from './integration'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/http/integration.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/http/integration.ts index 236f533ee746e..237177f31957a 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/http/integration.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/http/integration.ts @@ -1,9 +1,14 @@ -import { Construct, Resource } from '@aws-cdk/core'; +import { Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnIntegration } from '../apigatewayv2.generated'; import { IIntegration } from '../common'; import { IHttpApi } from './api'; import { HttpMethod, IHttpRoute } from './route'; +// v2 - keep this import as a separate section to reduce merge conflict when forward merging with the v2 branch. +// eslint-disable-next-line +import { Construct as CoreConstruct } from '@aws-cdk/core'; + /** * Represents an Integration for an HTTP API. */ @@ -126,7 +131,7 @@ export interface HttpRouteIntegrationBindOptions { * If the `HttpRouteIntegration` being bound creates additional constructs, * this will be used as their parent scope. */ - readonly scope: Construct; + readonly scope: CoreConstruct; } /** diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/http/route.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/http/route.ts index 2f65902a6aaee..6f13c46d9e3d5 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/http/route.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/http/route.ts @@ -1,4 +1,5 @@ -import { Construct, Resource } from '@aws-cdk/core'; +import { Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnRoute, CfnRouteProps } from '../apigatewayv2.generated'; import { IRoute } from '../common'; import { IHttpApi } from './api'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/http/stage.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/http/stage.ts index a9e7de3ce9af2..986649f5301e5 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/http/stage.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/http/stage.ts @@ -1,4 +1,5 @@ -import { Construct, Resource, Stack } from '@aws-cdk/core'; +import { Resource, Stack } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnStage } from '../apigatewayv2.generated'; import { CommonStageOptions, IDomainName, IStage } from '../common'; import { IHttpApi } from './api'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/package.json b/packages/@aws-cdk/aws-apigatewayv2/package.json index 5bc75ca9013d2..24fdaedfee400 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/package.json +++ b/packages/@aws-cdk/aws-apigatewayv2/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::ApiGatewayV2", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-appconfig/package.json b/packages/@aws-cdk/aws-appconfig/package.json index 882b6c95adab8..138ac518ef269 100644 --- a/packages/@aws-cdk/aws-appconfig/package.json +++ b/packages/@aws-cdk/aws-appconfig/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::AppConfig", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-applicationautoscaling/lib/base-scalable-attribute.ts b/packages/@aws-cdk/aws-applicationautoscaling/lib/base-scalable-attribute.ts index 5407fba139087..ee955d6d120d1 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/lib/base-scalable-attribute.ts +++ b/packages/@aws-cdk/aws-applicationautoscaling/lib/base-scalable-attribute.ts @@ -1,5 +1,6 @@ import * as iam from '@aws-cdk/aws-iam'; import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { ScalableTarget, ScalingSchedule, ServiceNamespace } from './scalable-target'; import { BasicStepScalingPolicyProps } from './step-scaling-policy'; import { BasicTargetTrackingScalingPolicyProps } from './target-tracking-scaling-policy'; @@ -46,7 +47,7 @@ export interface BaseScalableAttributeProps extends EnableScalingProps { export abstract class BaseScalableAttribute extends cdk.Construct { private target: ScalableTarget; - public constructor(scope: cdk.Construct, id: string, protected readonly props: BaseScalableAttributeProps) { + public constructor(scope: Construct, id: string, protected readonly props: BaseScalableAttributeProps) { super(scope, id); this.target = new ScalableTarget(this, 'Target', { diff --git a/packages/@aws-cdk/aws-applicationautoscaling/lib/scalable-target.ts b/packages/@aws-cdk/aws-applicationautoscaling/lib/scalable-target.ts index 5cf3f273e891f..14bf3f4913b34 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/lib/scalable-target.ts +++ b/packages/@aws-cdk/aws-applicationautoscaling/lib/scalable-target.ts @@ -1,5 +1,6 @@ import * as iam from '@aws-cdk/aws-iam'; -import { Construct, IResource, Lazy, Resource, withResolved } from '@aws-cdk/core'; +import { IResource, Lazy, Resource, withResolved } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnScalableTarget } from './applicationautoscaling.generated'; import { Schedule } from './schedule'; import { BasicStepScalingPolicyProps, StepScalingPolicy } from './step-scaling-policy'; diff --git a/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-action.ts b/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-action.ts index fac49b523e8ea..44eb88e9475a5 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-action.ts +++ b/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-action.ts @@ -1,4 +1,5 @@ import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnScalingPolicy } from './applicationautoscaling.generated'; import { IScalableTarget } from './scalable-target'; @@ -74,7 +75,7 @@ export class StepScalingAction extends cdk.Construct { private readonly adjustments = new Array(); - constructor(scope: cdk.Construct, id: string, props: StepScalingActionProps) { + constructor(scope: Construct, id: string, props: StepScalingActionProps) { super(scope, id); // Cloudformation requires either the ResourceId, ScalableDimension, and ServiceNamespace diff --git a/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-policy.ts b/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-policy.ts index 8b7b6fd8e5bea..dcead1cf8e37a 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-policy.ts +++ b/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-policy.ts @@ -1,6 +1,7 @@ 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'; @@ -68,7 +69,7 @@ export class StepScalingPolicy extends cdk.Construct { public readonly upperAlarm?: cloudwatch.Alarm; public readonly upperAction?: StepScalingAction; - constructor(scope: cdk.Construct, id: string, props: StepScalingPolicyProps) { + constructor(scope: Construct, id: string, props: StepScalingPolicyProps) { super(scope, id); if (props.scalingSteps.length < 2) { 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 index 59fc471a55673..5270177629f2e 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts +++ b/packages/@aws-cdk/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts @@ -1,5 +1,6 @@ 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'; @@ -120,7 +121,7 @@ export class TargetTrackingScalingPolicy extends cdk.Construct { */ public readonly scalingPolicyArn: string; - constructor(scope: cdk.Construct, id: string, props: TargetTrackingScalingPolicyProps) { + 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.'); } diff --git a/packages/@aws-cdk/aws-applicationautoscaling/package.json b/packages/@aws-cdk/aws-applicationautoscaling/package.json index 874fea95fa0f0..348f11078418d 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/package.json +++ b/packages/@aws-cdk/aws-applicationautoscaling/package.json @@ -52,7 +52,10 @@ "compat": "cdk-compat" }, "cdk-build": { - "cloudformation": "AWS::ApplicationAutoScaling" + "cloudformation": "AWS::ApplicationAutoScaling", + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-applicationinsights/package.json b/packages/@aws-cdk/aws-applicationinsights/package.json index 2d01bb0af2495..0d9cb18068cee 100644 --- a/packages/@aws-cdk/aws-applicationinsights/package.json +++ b/packages/@aws-cdk/aws-applicationinsights/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::ApplicationInsights", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-appmesh/lib/mesh.ts b/packages/@aws-cdk/aws-appmesh/lib/mesh.ts index 8e39cb4657d1e..2aaded50f99bc 100644 --- a/packages/@aws-cdk/aws-appmesh/lib/mesh.ts +++ b/packages/@aws-cdk/aws-appmesh/lib/mesh.ts @@ -1,5 +1,5 @@ import * as cdk from '@aws-cdk/core'; - +import { Construct } from 'constructs'; import { CfnMesh } from './appmesh.generated'; import { VirtualNode, VirtualNodeBaseProps } from './virtual-node'; import { VirtualRouter, VirtualRouterBaseProps } from './virtual-router'; @@ -129,7 +129,7 @@ export class Mesh extends MeshBase { /** * Import an existing mesh by arn */ - public static fromMeshArn(scope: cdk.Construct, id: string, meshArn: string): IMesh { + public static fromMeshArn(scope: Construct, id: string, meshArn: string): IMesh { const parts = cdk.Stack.of(scope).parseArn(meshArn); class Import extends MeshBase { @@ -143,7 +143,7 @@ export class Mesh extends MeshBase { /** * Import an existing mesh by name */ - public static fromMeshName(scope: cdk.Construct, id: string, meshName: string): IMesh { + public static fromMeshName(scope: Construct, id: string, meshName: string): IMesh { const arn = cdk.Stack.of(scope).formatArn({ service: 'appmesh', resource: 'mesh', @@ -168,7 +168,7 @@ export class Mesh extends MeshBase { */ public readonly meshArn: string; - constructor(scope: cdk.Construct, id: string, props: MeshProps = {}) { + constructor(scope: Construct, id: string, props: MeshProps = {}) { super(scope, id, { physicalName: props.meshName || cdk.Lazy.stringValue({ produce: () => this.node.uniqueId }), }); diff --git a/packages/@aws-cdk/aws-appmesh/lib/route.ts b/packages/@aws-cdk/aws-appmesh/lib/route.ts index 8534ad70dcf14..0dfeac897375a 100644 --- a/packages/@aws-cdk/aws-appmesh/lib/route.ts +++ b/packages/@aws-cdk/aws-appmesh/lib/route.ts @@ -1,5 +1,5 @@ import * as cdk from '@aws-cdk/core'; - +import { Construct } from 'constructs'; import { CfnRoute } from './appmesh.generated'; import { IMesh } from './mesh'; import { IVirtualNode } from './virtual-node'; @@ -113,14 +113,14 @@ export class Route extends cdk.Resource implements IRoute { /** * Import an existing route given an ARN */ - public static fromRouteArn(scope: cdk.Construct, id: string, routeArn: string): IRoute { + public static fromRouteArn(scope: Construct, id: string, routeArn: string): IRoute { return new ImportedRoute(scope, id, { routeArn }); } /** * Import an existing route given its name */ - public static fromRouteName(scope: cdk.Construct, id: string, meshName: string, virtualRouterName: string, routeName: string): IRoute { + public static fromRouteName(scope: Construct, id: string, meshName: string, virtualRouterName: string, routeName: string): IRoute { return new ImportedRoute(scope, id, { meshName, virtualRouterName, routeName }); } @@ -143,7 +143,7 @@ export class Route extends cdk.Resource implements IRoute { private readonly httpRoute?: CfnRoute.HttpRouteProperty; private readonly tcpRoute?: CfnRoute.TcpRouteProperty; - constructor(scope: cdk.Construct, id: string, props: RouteProps) { + constructor(scope: Construct, id: string, props: RouteProps) { super(scope, id, { physicalName: props.routeName || cdk.Lazy.stringValue({ produce: () => this.node.uniqueId }), }); @@ -251,7 +251,7 @@ class ImportedRoute extends cdk.Resource implements IRoute { */ public readonly routeArn: string; - constructor(scope: cdk.Construct, id: string, props: RouteAttributes) { + constructor(scope: Construct, id: string, props: RouteAttributes) { super(scope, id); if (props.routeArn) { diff --git a/packages/@aws-cdk/aws-appmesh/lib/virtual-node.ts b/packages/@aws-cdk/aws-appmesh/lib/virtual-node.ts index f7a2548a48e7b..8e48b5143dec8 100644 --- a/packages/@aws-cdk/aws-appmesh/lib/virtual-node.ts +++ b/packages/@aws-cdk/aws-appmesh/lib/virtual-node.ts @@ -1,6 +1,6 @@ import * as cloudmap from '@aws-cdk/aws-servicediscovery'; import * as cdk from '@aws-cdk/core'; - +import { Construct } from 'constructs'; import { CfnVirtualNode } from './appmesh.generated'; import { IMesh } from './mesh'; import { HealthCheck, PortMapping, Protocol, VirtualNodeListener } from './shared-interfaces'; @@ -214,14 +214,14 @@ export class VirtualNode extends VirtualNodeBase { /** * Import an existing VirtualNode given an ARN */ - public static fromVirtualNodeArn(scope: cdk.Construct, id: string, virtualNodeArn: string): IVirtualNode { + public static fromVirtualNodeArn(scope: Construct, id: string, virtualNodeArn: string): IVirtualNode { return new ImportedVirtualNode(scope, id, { virtualNodeArn }); } /** * Import an existing VirtualNode given its name */ - public static fromVirtualNodeName(scope: cdk.Construct, id: string, meshName: string, virtualNodeName: string): IVirtualNode { + public static fromVirtualNodeName(scope: Construct, id: string, meshName: string, virtualNodeName: string): IVirtualNode { return new ImportedVirtualNode(scope, id, { meshName, virtualNodeName, @@ -243,7 +243,7 @@ export class VirtualNode extends VirtualNodeBase { */ public readonly mesh: IMesh; - constructor(scope: cdk.Construct, id: string, props: VirtualNodeProps) { + constructor(scope: Construct, id: string, props: VirtualNodeProps) { super(scope, id, { physicalName: props.virtualNodeName || cdk.Lazy.stringValue({ produce: () => this.node.uniqueId }), }); @@ -325,7 +325,7 @@ class ImportedVirtualNode extends VirtualNodeBase { */ public readonly virtualNodeArn: string; - constructor(scope: cdk.Construct, id: string, props: VirtualNodeAttributes) { + constructor(scope: Construct, id: string, props: VirtualNodeAttributes) { super(scope, id); if (props.virtualNodeArn) { diff --git a/packages/@aws-cdk/aws-appmesh/lib/virtual-router.ts b/packages/@aws-cdk/aws-appmesh/lib/virtual-router.ts index cbfab4d0f7d8a..05fcbb29d5f71 100644 --- a/packages/@aws-cdk/aws-appmesh/lib/virtual-router.ts +++ b/packages/@aws-cdk/aws-appmesh/lib/virtual-router.ts @@ -1,5 +1,5 @@ import * as cdk from '@aws-cdk/core'; - +import { Construct } from 'constructs'; import { CfnVirtualRouter } from './appmesh.generated'; import { IMesh, Mesh } from './mesh'; import { Route, RouteBaseProps } from './route'; @@ -108,21 +108,21 @@ export class VirtualRouter extends VirtualRouterBase { /** * Import an existing VirtualRouter given an ARN */ - public static fromVirtualRouterArn(scope: cdk.Construct, id: string, virtualRouterArn: string): IVirtualRouter { + public static fromVirtualRouterArn(scope: Construct, id: string, virtualRouterArn: string): IVirtualRouter { return new ImportedVirtualRouter(scope, id, { virtualRouterArn }); } /** * Import an existing VirtualRouter given names */ - public static fromVirtualRouterName(scope: cdk.Construct, id: string, meshName: string, virtualRouterName: string): IVirtualRouter { + public static fromVirtualRouterName(scope: Construct, id: string, meshName: string, virtualRouterName: string): IVirtualRouter { return new ImportedVirtualRouter(scope, id, { meshName, virtualRouterName }); } /** * Import an existing virtual router given attributes */ - public static fromVirtualRouterAttributes(scope: cdk.Construct, id: string, attrs: VirtualRouterAttributes): IVirtualRouter { + public static fromVirtualRouterAttributes(scope: Construct, id: string, attrs: VirtualRouterAttributes): IVirtualRouter { return new ImportedVirtualRouter(scope, id, attrs); } @@ -143,7 +143,7 @@ export class VirtualRouter extends VirtualRouterBase { private readonly listeners = new Array(); - constructor(scope: cdk.Construct, id: string, props: VirtualRouterProps) { + constructor(scope: Construct, id: string, props: VirtualRouterProps) { super(scope, id, { physicalName: props.virtualRouterName || cdk.Lazy.stringValue({ produce: () => this.node.uniqueId }), }); @@ -219,7 +219,7 @@ class ImportedVirtualRouter extends VirtualRouterBase { private _mesh?: IMesh; - constructor(scope: cdk.Construct, id: string, props: VirtualRouterAttributes) { + constructor(scope: Construct, id: string, props: VirtualRouterAttributes) { super(scope, id); if (props.mesh) { diff --git a/packages/@aws-cdk/aws-appmesh/lib/virtual-service.ts b/packages/@aws-cdk/aws-appmesh/lib/virtual-service.ts index fc235960141d9..00b48f2d39d80 100644 --- a/packages/@aws-cdk/aws-appmesh/lib/virtual-service.ts +++ b/packages/@aws-cdk/aws-appmesh/lib/virtual-service.ts @@ -1,5 +1,5 @@ import * as cdk from '@aws-cdk/core'; - +import { Construct } from 'constructs'; import { CfnVirtualService } from './appmesh.generated'; import { IMesh } from './mesh'; import { IVirtualNode } from './virtual-node'; @@ -75,7 +75,7 @@ export class VirtualService extends cdk.Resource implements IVirtualService { /** * Import an existing VirtualService given an ARN */ - public static fromVirtualServiceArn(scope: cdk.Construct, id: string, virtualServiceArn: string): IVirtualService { + public static fromVirtualServiceArn(scope: Construct, id: string, virtualServiceArn: string): IVirtualService { return new ImportedVirtualService(scope, id, { virtualServiceArn, }); @@ -84,7 +84,7 @@ export class VirtualService extends cdk.Resource implements IVirtualService { /** * Import an existing VirtualService given mesh and service names */ - public static fromVirtualServiceName(scope: cdk.Construct, id: string, meshName: string, virtualServiceName: string): IVirtualService { + public static fromVirtualServiceName(scope: Construct, id: string, meshName: string, virtualServiceName: string): IVirtualService { return new ImportedVirtualService(scope, id, { meshName, virtualServiceName, @@ -104,7 +104,7 @@ export class VirtualService extends cdk.Resource implements IVirtualService { private readonly virtualServiceProvider?: CfnVirtualService.VirtualServiceProviderProperty; private readonly mesh: IMesh; - constructor(scope: cdk.Construct, id: string, props: VirtualServiceProps) { + constructor(scope: Construct, id: string, props: VirtualServiceProps) { super(scope, id, { physicalName: props.virtualServiceName || cdk.Lazy.stringValue({ produce: () => this.node.uniqueId }), }); @@ -198,7 +198,7 @@ class ImportedVirtualService extends cdk.Resource implements IVirtualService { */ public readonly virtualServiceArn: string; - constructor(scope: cdk.Construct, id: string, props: VirtualServiceAttributes) { + constructor(scope: Construct, id: string, props: VirtualServiceAttributes) { super(scope, id); if (props.virtualServiceArn) { diff --git a/packages/@aws-cdk/aws-appmesh/package.json b/packages/@aws-cdk/aws-appmesh/package.json index 106bbf45d9ee0..94a4d5d7fe0b5 100644 --- a/packages/@aws-cdk/aws-appmesh/package.json +++ b/packages/@aws-cdk/aws-appmesh/package.json @@ -53,7 +53,10 @@ "compat": "cdk-compat" }, "cdk-build": { - "cloudformation": "AWS::AppMesh" + "cloudformation": "AWS::AppMesh", + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "nyc": { "statements": 75 diff --git a/packages/@aws-cdk/aws-appstream/package.json b/packages/@aws-cdk/aws-appstream/package.json index 6f8a6657e471a..d26317e17b8ad 100644 --- a/packages/@aws-cdk/aws-appstream/package.json +++ b/packages/@aws-cdk/aws-appstream/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::AppStream", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-athena/package.json b/packages/@aws-cdk/aws-athena/package.json index 95e98d47c31f5..a33bffbb14686 100644 --- a/packages/@aws-cdk/aws-athena/package.json +++ b/packages/@aws-cdk/aws-athena/package.json @@ -34,7 +34,10 @@ }, "cdk-build": { "cloudformation": "AWS::Athena", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "repository": { "type": "git", diff --git a/packages/@aws-cdk/aws-autoscaling-common/package.json b/packages/@aws-cdk/aws-autoscaling-common/package.json index 61a1295700937..dd4879e599206 100644 --- a/packages/@aws-cdk/aws-autoscaling-common/package.json +++ b/packages/@aws-cdk/aws-autoscaling-common/package.json @@ -110,5 +110,10 @@ "maturity": "experimental", "awscdkio": { "announce": false + }, + "cdk-build": { + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } } } diff --git a/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts b/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts index a030cead38957..8303b73c29dbb 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts +++ b/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts @@ -6,9 +6,10 @@ import * as iam from '@aws-cdk/aws-iam'; import * as sns from '@aws-cdk/aws-sns'; import { - Annotations, CfnAutoScalingRollingUpdate, Construct, Duration, Fn, IResource, Lazy, PhysicalName, Resource, Stack, + Annotations, CfnAutoScalingRollingUpdate, Duration, Fn, IResource, Lazy, PhysicalName, Resource, Stack, Tokenization, withResolved, Tags, } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnAutoScalingGroup, CfnAutoScalingGroupProps, CfnLaunchConfiguration } from './autoscaling.generated'; import { BasicLifecycleHookProps, LifecycleHook } from './lifecycle-hook'; import { BasicScheduledActionProps, ScheduledAction } from './scheduled-action'; diff --git a/packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook.ts b/packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook.ts index 9c6f1d7f15322..4e4e8408ad326 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook.ts +++ b/packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook.ts @@ -1,5 +1,6 @@ import * as iam from '@aws-cdk/aws-iam'; -import { Construct, Duration, IResource, Resource } from '@aws-cdk/core'; +import { Duration, IResource, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { IAutoScalingGroup } from './auto-scaling-group'; import { CfnLifecycleHook } from './autoscaling.generated'; import { ILifecycleHookTarget } from './lifecycle-hook-target'; diff --git a/packages/@aws-cdk/aws-autoscaling/lib/scheduled-action.ts b/packages/@aws-cdk/aws-autoscaling/lib/scheduled-action.ts index a38c9d88bac64..71fde34af72cd 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/scheduled-action.ts +++ b/packages/@aws-cdk/aws-autoscaling/lib/scheduled-action.ts @@ -1,4 +1,5 @@ -import { Construct, Resource } from '@aws-cdk/core'; +import { Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { IAutoScalingGroup } from './auto-scaling-group'; import { CfnScheduledAction } from './autoscaling.generated'; import { Schedule } from './schedule'; diff --git a/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-action.ts b/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-action.ts index 78ea9cbd0e791..76ba4685c0a38 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-action.ts +++ b/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-action.ts @@ -1,4 +1,5 @@ -import * as cdk from '@aws-cdk/core'; +import { Construct as CoreConstruct, Duration, Lazy } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { IAutoScalingGroup } from './auto-scaling-group'; import { CfnScalingPolicy } from './autoscaling.generated'; @@ -16,14 +17,14 @@ export interface StepScalingActionProps { * * @default The default cooldown configured on the AutoScalingGroup */ - readonly cooldown?: cdk.Duration; + readonly cooldown?: Duration; /** * Estimated time until a newly launched instance can send metrics to CloudWatch. * * @default Same as the cooldown */ - readonly estimatedInstanceWarmup?: cdk.Duration; + readonly estimatedInstanceWarmup?: Duration; /** * How the adjustment numbers are interpreted @@ -59,7 +60,7 @@ export interface StepScalingActionProps { * * This Action must be used as the target of a CloudWatch alarm to take effect. */ -export class StepScalingAction extends cdk.Construct { +export class StepScalingAction extends CoreConstruct { /** * ARN of the scaling policy */ @@ -67,7 +68,7 @@ export class StepScalingAction extends cdk.Construct { private readonly adjustments = new Array(); - constructor(scope: cdk.Construct, id: string, props: StepScalingActionProps) { + constructor(scope: Construct, id: string, props: StepScalingActionProps) { super(scope, id); const resource = new CfnScalingPolicy(this, 'Resource', { @@ -78,7 +79,7 @@ export class StepScalingAction extends cdk.Construct { adjustmentType: props.adjustmentType, minAdjustmentMagnitude: props.minAdjustmentMagnitude, metricAggregationType: props.metricAggregationType, - stepAdjustments: cdk.Lazy.anyValue({ produce: () => this.adjustments }), + stepAdjustments: Lazy.anyValue({ produce: () => this.adjustments }), }); this.scalingPolicyArn = resource.ref; diff --git a/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-policy.ts b/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-policy.ts index e9d530804d77c..a3a417bd126d5 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-policy.ts +++ b/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-policy.ts @@ -1,6 +1,7 @@ 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 as CoreConstruct, Duration } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { IAutoScalingGroup } from './auto-scaling-group'; import { AdjustmentType, MetricAggregationType, StepScalingAction } from './step-scaling-action'; @@ -29,14 +30,14 @@ export interface BasicStepScalingPolicyProps { * * @default Default cooldown period on your AutoScalingGroup */ - readonly cooldown?: cdk.Duration; + readonly cooldown?: Duration; /** * Estimated time until a newly launched instance can send metrics to CloudWatch. * * @default Same as the cooldown */ - readonly estimatedInstanceWarmup?: cdk.Duration; + readonly estimatedInstanceWarmup?: Duration; /** * Minimum absolute number to adjust capacity with as result of percentage scaling. @@ -63,13 +64,13 @@ export interface StepScalingPolicyProps extends BasicStepScalingPolicyProps { * * Implemented using one or more CloudWatch alarms and Step Scaling Policies. */ -export class StepScalingPolicy extends cdk.Construct { +export class StepScalingPolicy extends CoreConstruct { public readonly lowerAlarm?: cloudwatch.Alarm; public readonly lowerAction?: StepScalingAction; public readonly upperAlarm?: cloudwatch.Alarm; public readonly upperAction?: StepScalingAction; - constructor(scope: cdk.Construct, id: string, props: StepScalingPolicyProps) { + constructor(scope: Construct, id: string, props: StepScalingPolicyProps) { super(scope, id); if (props.scalingSteps.length < 2) { @@ -210,7 +211,7 @@ class StepScalingAlarmAction implements cloudwatch.IAlarmAction { constructor(private readonly stepScalingAction: StepScalingAction) { } - public bind(_scope: cdk.Construct, _alarm: cloudwatch.IAlarm): cloudwatch.AlarmActionConfig { + public bind(_scope: CoreConstruct, _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 index c57bd62008093..5631016066761 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/target-tracking-scaling-policy.ts +++ b/packages/@aws-cdk/aws-autoscaling/lib/target-tracking-scaling-policy.ts @@ -1,5 +1,6 @@ import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as cdk from '@aws-cdk/core'; +import { Construct as CoreConstruct, Duration } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { IAutoScalingGroup } from './auto-scaling-group'; import { CfnScalingPolicy } from './autoscaling.generated'; @@ -29,14 +30,14 @@ export interface BaseTargetTrackingProps { * * @default - The default cooldown configured on the AutoScalingGroup. */ - readonly cooldown?: cdk.Duration; + readonly cooldown?: Duration; /** * Estimated time until a newly launched instance can send metrics to CloudWatch. * * @default - Same as the cooldown. */ - readonly estimatedInstanceWarmup?: cdk.Duration; + readonly estimatedInstanceWarmup?: Duration; } /** @@ -97,7 +98,7 @@ export interface TargetTrackingScalingPolicyProps extends BasicTargetTrackingSca readonly autoScalingGroup: IAutoScalingGroup; } -export class TargetTrackingScalingPolicy extends cdk.Construct { +export class TargetTrackingScalingPolicy extends CoreConstruct { /** * ARN of the scaling policy */ @@ -108,7 +109,7 @@ export class TargetTrackingScalingPolicy extends cdk.Construct { */ private resource: CfnScalingPolicy; - constructor(scope: cdk.Construct, id: string, props: TargetTrackingScalingPolicyProps) { + 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.'); } diff --git a/packages/@aws-cdk/aws-autoscaling/package.json b/packages/@aws-cdk/aws-autoscaling/package.json index 3d8d1e4a80993..b84adf0699b09 100644 --- a/packages/@aws-cdk/aws-autoscaling/package.json +++ b/packages/@aws-cdk/aws-autoscaling/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::AutoScaling", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-autoscalingplans/package.json b/packages/@aws-cdk/aws-autoscalingplans/package.json index 388a29873ef12..be56095ec1992 100644 --- a/packages/@aws-cdk/aws-autoscalingplans/package.json +++ b/packages/@aws-cdk/aws-autoscalingplans/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::AutoScalingPlans", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-budgets/package.json b/packages/@aws-cdk/aws-budgets/package.json index 5620f490a2d6a..0d685503f4828 100644 --- a/packages/@aws-cdk/aws-budgets/package.json +++ b/packages/@aws-cdk/aws-budgets/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::Budgets", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-cassandra/package.json b/packages/@aws-cdk/aws-cassandra/package.json index 165d47b79cb33..46adae57ddd00 100644 --- a/packages/@aws-cdk/aws-cassandra/package.json +++ b/packages/@aws-cdk/aws-cassandra/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::Cassandra", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-ce/package.json b/packages/@aws-cdk/aws-ce/package.json index 86c100223e0f5..dff5201588b1f 100644 --- a/packages/@aws-cdk/aws-ce/package.json +++ b/packages/@aws-cdk/aws-ce/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::CE", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts b/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts index 9bd10343e1321..df3d3988847ad 100644 --- a/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts +++ b/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts @@ -1,5 +1,6 @@ import * as route53 from '@aws-cdk/aws-route53'; -import { Construct, IResource, Resource, Token } from '@aws-cdk/core'; +import { IResource, Resource, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnCertificate } from './certificatemanager.generated'; import { apexDomain } from './util'; diff --git a/packages/@aws-cdk/aws-certificatemanager/lib/dns-validated-certificate.ts b/packages/@aws-cdk/aws-certificatemanager/lib/dns-validated-certificate.ts index 99e341928fc52..655361ba5b4b7 100644 --- a/packages/@aws-cdk/aws-certificatemanager/lib/dns-validated-certificate.ts +++ b/packages/@aws-cdk/aws-certificatemanager/lib/dns-validated-certificate.ts @@ -3,6 +3,7 @@ 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 { Construct } from 'constructs'; import { CertificateProps, ICertificate } from './certificate'; /** @@ -60,7 +61,7 @@ export class DnsValidatedCertificate extends cdk.Resource implements ICertificat private hostedZoneId: string; private domainName: string; - constructor(scope: cdk.Construct, id: string, props: DnsValidatedCertificateProps) { + constructor(scope: Construct, id: string, props: DnsValidatedCertificateProps) { super(scope, id); this.domainName = props.domainName; diff --git a/packages/@aws-cdk/aws-certificatemanager/package.json b/packages/@aws-cdk/aws-certificatemanager/package.json index 9ad0d12c3d0e1..9985cf3e1d912 100644 --- a/packages/@aws-cdk/aws-certificatemanager/package.json +++ b/packages/@aws-cdk/aws-certificatemanager/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::CertificateManager", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-chatbot/lib/slack-channel-configuration.ts b/packages/@aws-cdk/aws-chatbot/lib/slack-channel-configuration.ts index e686d5b8b3209..425c432fdc5a4 100644 --- a/packages/@aws-cdk/aws-chatbot/lib/slack-channel-configuration.ts +++ b/packages/@aws-cdk/aws-chatbot/lib/slack-channel-configuration.ts @@ -3,6 +3,7 @@ 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 { Construct } from 'constructs'; import { CfnSlackChannelConfiguration } from './chatbot.generated'; /** @@ -193,7 +194,7 @@ export class SlackChannelConfiguration extends SlackChannelConfigurationBase { * * @returns a reference to the existing Slack channel configuration */ - public static fromSlackChannelConfigurationArn(scope: cdk.Construct, id: string, slackChannelConfigurationArn: string): ISlackChannelConfiguration { + public static fromSlackChannelConfigurationArn(scope: Construct, id: string, slackChannelConfigurationArn: string): ISlackChannelConfiguration { const re = /^slack-channel\//; const resourceName = cdk.Stack.of(scope).parseArn(slackChannelConfigurationArn).resourceName as string; @@ -220,7 +221,7 @@ export class SlackChannelConfiguration extends SlackChannelConfigurationBase { */ readonly slackChannelConfigurationName = resourceName.substring('slack-channel/'.length); - constructor(s: cdk.Construct, i: string) { + constructor(s: Construct, i: string) { super(s, i); this.grantPrincipal = new iam.UnknownPrincipal({ resource: this }); } @@ -251,7 +252,7 @@ export class SlackChannelConfiguration extends SlackChannelConfigurationBase { readonly grantPrincipal: iam.IPrincipal; - constructor(scope: cdk.Construct, id: string, props: SlackChannelConfigurationProps) { + constructor(scope: Construct, id: string, props: SlackChannelConfigurationProps) { super(scope, id, { physicalName: props.slackChannelConfigurationName, }); diff --git a/packages/@aws-cdk/aws-chatbot/package.json b/packages/@aws-cdk/aws-chatbot/package.json index ef17794163e93..35b468f95a27b 100644 --- a/packages/@aws-cdk/aws-chatbot/package.json +++ b/packages/@aws-cdk/aws-chatbot/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::Chatbot", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-cloud9/lib/environment.ts b/packages/@aws-cdk/aws-cloud9/lib/environment.ts index d414069e2788b..a28b2627c3b34 100644 --- a/packages/@aws-cdk/aws-cloud9/lib/environment.ts +++ b/packages/@aws-cdk/aws-cloud9/lib/environment.ts @@ -1,6 +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 { Construct } from 'constructs'; import { CfnEnvironmentEC2 } from '../lib/cloud9.generated'; /** @@ -79,7 +80,7 @@ export class Ec2Environment extends cdk.Resource implements IEc2Environment { /** * import from EnvironmentEc2Name */ - public static fromEc2EnvironmentName(scope: cdk.Construct, id: string, ec2EnvironmentName: string): IEc2Environment { + public static fromEc2EnvironmentName(scope: Construct, id: string, ec2EnvironmentName: string): IEc2Environment { class Import extends cdk.Resource { public ec2EnvironmentName = ec2EnvironmentName; public ec2EnvironmentArn = cdk.Stack.of(this).formatArn({ @@ -120,7 +121,7 @@ export class Ec2Environment extends cdk.Resource implements IEc2Environment { */ public readonly vpc: ec2.IVpc; - constructor(scope: cdk.Construct, id: string, props: Ec2EnvironmentProps) { + constructor(scope: Construct, id: string, props: Ec2EnvironmentProps) { super(scope, id); this.vpc = props.vpc; diff --git a/packages/@aws-cdk/aws-cloud9/package.json b/packages/@aws-cdk/aws-cloud9/package.json index de967a9e7a38d..de9042b93d715 100644 --- a/packages/@aws-cdk/aws-cloud9/package.json +++ b/packages/@aws-cdk/aws-cloud9/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::Cloud9", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-cloudfront-origins/package.json b/packages/@aws-cdk/aws-cloudfront-origins/package.json index 70e167f8dd984..e8810f8903394 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/package.json +++ b/packages/@aws-cdk/aws-cloudfront-origins/package.json @@ -51,7 +51,10 @@ "compat": "cdk-compat" }, "cdk-build": { - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-cloudfront/lib/distribution.ts b/packages/@aws-cdk/aws-cloudfront/lib/distribution.ts index 117e79cc26345..39624ab1c1da8 100644 --- a/packages/@aws-cdk/aws-cloudfront/lib/distribution.ts +++ b/packages/@aws-cdk/aws-cloudfront/lib/distribution.ts @@ -1,12 +1,17 @@ import * as acm from '@aws-cdk/aws-certificatemanager'; import * as lambda from '@aws-cdk/aws-lambda'; import * as s3 from '@aws-cdk/aws-s3'; -import { Construct, IResource, Lazy, Resource, Stack, Token, Duration } from '@aws-cdk/core'; +import { IResource, Lazy, Resource, Stack, Token, Duration } from '@aws-cdk/core'; +import { Construct, Node } from 'constructs'; import { CfnDistribution } from './cloudfront.generated'; import { GeoRestriction } from './geo-restriction'; import { IOrigin, OriginBindConfig, OriginBindOptions } from './origin'; import { CacheBehavior } from './private/cache-behavior'; +// v2 - keep this import as a separate section to reduce merge conflict when forward merging with the v2 branch. +// eslint-disable-next-line +import { Construct as CoreConstruct } from '@aws-cdk/core'; + /** * Interface for CloudFront distributions */ @@ -314,8 +319,8 @@ export class Distribution extends Resource implements IDistribution { return existingOrigin.originGroupId ?? existingOrigin.originId; } else { const originIndex = this.boundOrigins.length + 1; - const scope = new Construct(this, `Origin${originIndex}`); - const originId = scope.node.uniqueId; + const scope = new CoreConstruct(this, `Origin${originIndex}`); + const originId = Node.of(scope).uniqueId; const originBindConfig = origin.bind(scope, { originId }); if (!originBindConfig.failoverConfig) { this.boundOrigins.push({ origin, originId, ...originBindConfig }); @@ -324,7 +329,7 @@ export class Distribution extends Resource implements IDistribution { throw new Error('An Origin cannot use an Origin with its own failover configuration as its fallback origin!'); } const groupIndex = this.originGroups.length + 1; - const originGroupId = new Construct(this, `OriginGroup${groupIndex}`).node.uniqueId; + const originGroupId = Node.of(new CoreConstruct(this, `OriginGroup${groupIndex}`)).uniqueId; this.boundOrigins.push({ origin, originId, originGroupId, ...originBindConfig }); const failoverOriginId = this.addOrigin(originBindConfig.failoverConfig.failoverOrigin, true); diff --git a/packages/@aws-cdk/aws-cloudfront/lib/origin_access_identity.ts b/packages/@aws-cdk/aws-cloudfront/lib/origin_access_identity.ts index f62c5ad4d0228..dbb58110c29cf 100644 --- a/packages/@aws-cdk/aws-cloudfront/lib/origin_access_identity.ts +++ b/packages/@aws-cdk/aws-cloudfront/lib/origin_access_identity.ts @@ -1,5 +1,6 @@ import * as iam from '@aws-cdk/aws-iam'; import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnCloudFrontOriginAccessIdentity } from './cloudfront.generated'; /** @@ -62,14 +63,14 @@ export class OriginAccessIdentity extends OriginAccessIdentityBase implements IO * Creates a OriginAccessIdentity by providing the OriginAccessIdentityName */ public static fromOriginAccessIdentityName( - scope: cdk.Construct, + scope: Construct, id: string, originAccessIdentityName: string): IOriginAccessIdentity { class Import extends OriginAccessIdentityBase { public readonly originAccessIdentityName = originAccessIdentityName; public readonly grantPrincipal = new iam.ArnPrincipal(this.arn()); - constructor(s: cdk.Construct, i: string) { + constructor(s: Construct, i: string) { super(s, i, { physicalName: originAccessIdentityName }); } } @@ -103,7 +104,7 @@ export class OriginAccessIdentity extends OriginAccessIdentityBase implements IO */ private readonly resource: CfnCloudFrontOriginAccessIdentity; - constructor(scope: cdk.Construct, id: string, props?: OriginAccessIdentityProps) { + constructor(scope: Construct, id: string, props?: OriginAccessIdentityProps) { super(scope, id); // Comment has a max length of 128. diff --git a/packages/@aws-cdk/aws-cloudfront/lib/web_distribution.ts b/packages/@aws-cdk/aws-cloudfront/lib/web_distribution.ts index 972726dac93af..6889e50739f7e 100644 --- a/packages/@aws-cdk/aws-cloudfront/lib/web_distribution.ts +++ b/packages/@aws-cdk/aws-cloudfront/lib/web_distribution.ts @@ -3,6 +3,7 @@ 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 { Construct } from 'constructs'; import { CfnDistribution } from './cloudfront.generated'; import { HttpVersion, IDistribution, LambdaEdgeEventType, OriginProtocolPolicy, PriceClass, ViewerProtocolPolicy, SSLMethod, SecurityPolicyProtocol } from './distribution'; import { GeoRestriction } from './geo-restriction'; @@ -693,7 +694,7 @@ export class CloudFrontWebDistribution extends cdk.Resource implements IDistribu /** * Creates a construct that represents an external (imported) distribution. */ - public static fromDistributionAttributes(scope: cdk.Construct, id: string, attrs: CloudFrontWebDistributionAttributes): IDistribution { + public static fromDistributionAttributes(scope: Construct, id: string, attrs: CloudFrontWebDistributionAttributes): IDistribution { return new class extends cdk.Resource implements IDistribution { public readonly domainName: string; public readonly distributionDomainName: string; @@ -756,7 +757,7 @@ export class CloudFrontWebDistribution extends cdk.Resource implements IDistribu [SSLMethod.VIP]: [SecurityPolicyProtocol.SSL_V3, SecurityPolicyProtocol.TLS_V1], }; - constructor(scope: cdk.Construct, id: string, props: CloudFrontWebDistributionProps) { + constructor(scope: Construct, id: string, props: CloudFrontWebDistributionProps) { super(scope, id); let distributionConfig: CfnDistribution.DistributionConfigProperty = { diff --git a/packages/@aws-cdk/aws-cloudfront/package.json b/packages/@aws-cdk/aws-cloudfront/package.json index b3b40d712560e..d5642eb629385 100644 --- a/packages/@aws-cdk/aws-cloudfront/package.json +++ b/packages/@aws-cdk/aws-cloudfront/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::CloudFront", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-cloudtrail/lib/cloudtrail.ts b/packages/@aws-cdk/aws-cloudtrail/lib/cloudtrail.ts index 6337437619918..d98c34b8011de 100644 --- a/packages/@aws-cdk/aws-cloudtrail/lib/cloudtrail.ts +++ b/packages/@aws-cdk/aws-cloudtrail/lib/cloudtrail.ts @@ -5,7 +5,8 @@ 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 { Construct, Resource, Stack } from '@aws-cdk/core'; +import { Resource, Stack } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnTrail } from './cloudtrail.generated'; /** diff --git a/packages/@aws-cdk/aws-cloudtrail/package.json b/packages/@aws-cdk/aws-cloudtrail/package.json index 67c6de96f918c..bdddf764b1fe6 100644 --- a/packages/@aws-cdk/aws-cloudtrail/package.json +++ b/packages/@aws-cdk/aws-cloudtrail/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::CloudTrail", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts b/packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts index a159a97f36cbe..94268ae282fcb 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts +++ b/packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts @@ -1,4 +1,5 @@ -import { Construct, Lazy, Stack, Token } from '@aws-cdk/core'; +import { Lazy, Stack, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { AlarmBase, IAlarm } from './alarm-base'; import { CfnAlarm, CfnAlarmProps } from './cloudwatch.generated'; import { HorizontalAnnotation } from './graph'; diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/composite-alarm.ts b/packages/@aws-cdk/aws-cloudwatch/lib/composite-alarm.ts index 4d20f5f3f1300..6f889b5762b58 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/composite-alarm.ts +++ b/packages/@aws-cdk/aws-cloudwatch/lib/composite-alarm.ts @@ -1,4 +1,5 @@ -import { Construct, Lazy, Stack } from '@aws-cdk/core'; +import { Lazy, Stack } from '@aws-cdk/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/aws-cloudwatch/lib/dashboard.ts index 21f266e1375fe..f4a17d634f32f 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/dashboard.ts +++ b/packages/@aws-cdk/aws-cloudwatch/lib/dashboard.ts @@ -1,4 +1,5 @@ -import { Construct, Lazy, Resource, Stack, Token } from '@aws-cdk/core'; +import { Lazy, Resource, Stack, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnDashboard } from './cloudwatch.generated'; import { Column, Row } from './layout'; import { IWidget } from './widget'; diff --git a/packages/@aws-cdk/aws-cloudwatch/package.json b/packages/@aws-cdk/aws-cloudwatch/package.json index 10fcf3bfce240..094f36c166e4b 100644 --- a/packages/@aws-cdk/aws-cloudwatch/package.json +++ b/packages/@aws-cdk/aws-cloudwatch/package.json @@ -52,7 +52,10 @@ "compat": "cdk-compat" }, "cdk-build": { - "cloudformation": "AWS::CloudWatch" + "cloudformation": "AWS::CloudWatch", + "env": { + "AWSLINT_BASE_CONSTRUCT": "true" + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-codecommit/lib/repository.ts b/packages/@aws-cdk/aws-codecommit/lib/repository.ts index b1cc7bd5986eb..f86e2f4a82a11 100644 --- a/packages/@aws-cdk/aws-codecommit/lib/repository.ts +++ b/packages/@aws-cdk/aws-codecommit/lib/repository.ts @@ -1,6 +1,7 @@ import * as events from '@aws-cdk/aws-events'; import * as iam from '@aws-cdk/aws-iam'; -import { Construct, IConstruct, IResource, Lazy, Resource, Stack } from '@aws-cdk/core'; +import { IResource, Lazy, Resource, Stack } from '@aws-cdk/core'; +import { IConstruct, Construct } from 'constructs'; import { CfnRepository } from './codecommit.generated'; export interface IRepository extends IResource { diff --git a/packages/@aws-cdk/aws-codecommit/package.json b/packages/@aws-cdk/aws-codecommit/package.json index ef00706f6eae0..6bc68e1268bd8 100644 --- a/packages/@aws-cdk/aws-codecommit/package.json +++ b/packages/@aws-cdk/aws-codecommit/package.json @@ -52,7 +52,10 @@ "compat": "cdk-compat" }, "cdk-build": { - "cloudformation": "AWS::CodeCommit" + "cloudformation": "AWS::CodeCommit", + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "nyc": { "statements": 30, diff --git a/packages/@aws-cdk/aws-codedeploy/lib/ecs/application.ts b/packages/@aws-cdk/aws-codedeploy/lib/ecs/application.ts index 7ab5833afbb10..e8a06374523b3 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/ecs/application.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/ecs/application.ts @@ -1,4 +1,5 @@ -import { Construct, IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnApplication } from '../codedeploy.generated'; import { arnForApplication } from '../utils'; diff --git a/packages/@aws-cdk/aws-codedeploy/lib/ecs/deployment-config.ts b/packages/@aws-cdk/aws-codedeploy/lib/ecs/deployment-config.ts index 9ebcc42724db8..c531cdd56c965 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/ecs/deployment-config.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/ecs/deployment-config.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { arnForDeploymentConfig } from '../utils'; /** @@ -35,7 +35,7 @@ export class EcsDeploymentConfig { * @param ecsDeploymentConfigName the name of the referenced custom Deployment Configuration * @returns a Construct representing a reference to an existing custom Deployment Configuration */ - public static fromEcsDeploymentConfigName(_scope: cdk.Construct, _id: string, ecsDeploymentConfigName: string): IEcsDeploymentConfig { + public static fromEcsDeploymentConfigName(_scope: Construct, _id: string, ecsDeploymentConfigName: string): IEcsDeploymentConfig { return deploymentConfig(ecsDeploymentConfigName); } diff --git a/packages/@aws-cdk/aws-codedeploy/lib/ecs/deployment-group.ts b/packages/@aws-cdk/aws-codedeploy/lib/ecs/deployment-group.ts index 376e86aef2806..5b893bc9f4f6e 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/ecs/deployment-group.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/ecs/deployment-group.ts @@ -1,5 +1,5 @@ import * as cdk from '@aws-cdk/core'; - +import { Construct } from 'constructs'; import { arnForDeploymentGroup } from '../utils'; import { IEcsApplication } from './application'; import { EcsDeploymentConfig, IEcsDeploymentConfig } from './deployment-config'; @@ -49,7 +49,7 @@ export class EcsDeploymentGroup { * @returns a Construct representing a reference to an existing Deployment Group */ public static fromEcsDeploymentGroupAttributes( - scope: cdk.Construct, + scope:Construct, id: string, attrs: EcsDeploymentGroupAttributes): IEcsDeploymentGroup { return new ImportedEcsDeploymentGroup(scope, id, attrs); @@ -92,7 +92,7 @@ class ImportedEcsDeploymentGroup extends cdk.Resource implements IEcsDeploymentG public readonly deploymentGroupArn: string; public readonly deploymentConfig: IEcsDeploymentConfig; - constructor(scope: cdk.Construct, id: string, props: EcsDeploymentGroupAttributes) { + constructor(scope:Construct, id: string, props: EcsDeploymentGroupAttributes) { super(scope, id); this.application = props.application; this.deploymentGroupName = props.deploymentGroupName; diff --git a/packages/@aws-cdk/aws-codedeploy/lib/lambda/application.ts b/packages/@aws-cdk/aws-codedeploy/lib/lambda/application.ts index a01d96bb0f029..309bd02ba3647 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/lambda/application.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/lambda/application.ts @@ -1,4 +1,5 @@ -import { Construct, IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnApplication } from '../codedeploy.generated'; import { arnForApplication } from '../utils'; diff --git a/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-config.ts b/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-config.ts index 77a71202809eb..ebbd4df337529 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-config.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-config.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { arnForDeploymentConfig } from '../utils'; /** @@ -56,7 +56,7 @@ export class LambdaDeploymentConfig { * @param props the properties of the referenced custom Deployment Configuration * @returns a Construct representing a reference to an existing custom Deployment Configuration */ - public static import(_scope: cdk.Construct, _id: string, props: LambdaDeploymentConfigImportProps): ILambdaDeploymentConfig { + public static import(_scope:Construct, _id: string, props: LambdaDeploymentConfigImportProps): ILambdaDeploymentConfig { return deploymentConfig(props.deploymentConfigName); } diff --git a/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-group.ts b/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-group.ts index c3cc9ba0fab15..7586fd51728c5 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-group.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-group.ts @@ -2,7 +2,7 @@ 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 { Construct } from 'constructs'; import { CfnDeploymentGroup } from '../codedeploy.generated'; import { AutoRollbackConfig } from '../rollback-config'; import { arnForDeploymentGroup, renderAlarmConfiguration, renderAutoRollbackConfiguration } from '../utils'; @@ -130,7 +130,7 @@ export class LambdaDeploymentGroup extends cdk.Resource implements ILambdaDeploy * @returns a Construct representing a reference to an existing Deployment Group */ public static fromLambdaDeploymentGroupAttributes( - scope: cdk.Construct, + scope: Construct, id: string, attrs: LambdaDeploymentGroupAttributes): ILambdaDeploymentGroup { return new ImportedLambdaDeploymentGroup(scope, id, attrs); @@ -146,7 +146,7 @@ export class LambdaDeploymentGroup extends cdk.Resource implements ILambdaDeploy private preHook?: lambda.IFunction; private postHook?: lambda.IFunction; - constructor(scope: cdk.Construct, id: string, props: LambdaDeploymentGroupProps) { + constructor(scope: Construct, id: string, props: LambdaDeploymentGroupProps) { super(scope, id, { physicalName: props.deploymentGroupName, }); @@ -282,7 +282,7 @@ class ImportedLambdaDeploymentGroup extends cdk.Resource implements ILambdaDeplo public readonly deploymentGroupArn: string; public readonly deploymentConfig: ILambdaDeploymentConfig; - constructor(scope: cdk.Construct, id: string, props: LambdaDeploymentGroupAttributes) { + constructor(scope:Construct, id: string, props: LambdaDeploymentGroupAttributes) { super(scope, id); this.application = props.application; this.deploymentGroupName = props.deploymentGroupName; diff --git a/packages/@aws-cdk/aws-codedeploy/lib/server/application.ts b/packages/@aws-cdk/aws-codedeploy/lib/server/application.ts index a4690ad3a05bf..6de47a5fff381 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/server/application.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/server/application.ts @@ -1,4 +1,5 @@ -import { Construct, IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnApplication } from '../codedeploy.generated'; import { arnForApplication } from '../utils'; diff --git a/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-config.ts b/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-config.ts index fda322283cdd5..b6937db3a475d 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-config.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-config.ts @@ -1,4 +1,5 @@ import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnDeploymentConfig } from '../codedeploy.generated'; import { arnForDeploymentConfig } from '../utils'; @@ -93,7 +94,7 @@ export class ServerDeploymentConfig extends cdk.Resource implements IServerDeplo * @returns a Construct representing a reference to an existing custom Deployment Configuration */ public static fromServerDeploymentConfigName( - scope: cdk.Construct, + scope: Construct, id: string, serverDeploymentConfigName: string): IServerDeploymentConfig { @@ -105,7 +106,7 @@ export class ServerDeploymentConfig extends cdk.Resource implements IServerDeplo public readonly deploymentConfigName: string; public readonly deploymentConfigArn: string; - constructor(scope: cdk.Construct, id: string, props: ServerDeploymentConfigProps) { + constructor(scope: Construct, id: string, props: ServerDeploymentConfigProps) { super(scope, id, { physicalName: props.deploymentConfigName, }); diff --git a/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts b/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts index 3aa3f5915cded..9a3d912bb1e0d 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts @@ -4,6 +4,7 @@ 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 { Construct } from 'constructs'; import { CfnDeploymentGroup } from '../codedeploy.generated'; import { AutoRollbackConfig } from '../rollback-config'; import { arnForDeploymentGroup, renderAlarmConfiguration, renderAutoRollbackConfiguration } from '../utils'; @@ -71,7 +72,7 @@ abstract class ServerDeploymentGroupBase extends cdk.Resource implements IServer public readonly deploymentConfig: IServerDeploymentConfig; public abstract readonly autoScalingGroups?: autoscaling.IAutoScalingGroup[]; - constructor(scope: cdk.Construct, id: string, deploymentConfig?: IServerDeploymentConfig, props?: cdk.ResourceProps) { + constructor(scope: Construct, id: string, deploymentConfig?: IServerDeploymentConfig, props?: cdk.ResourceProps) { super(scope, id, props); this.deploymentConfig = deploymentConfig || ServerDeploymentConfig.ONE_AT_A_TIME; } @@ -84,7 +85,7 @@ class ImportedServerDeploymentGroup extends ServerDeploymentGroupBase { public readonly deploymentGroupArn: string; public readonly autoScalingGroups?: autoscaling.AutoScalingGroup[] = undefined; - constructor(scope: cdk.Construct, id: string, props: ServerDeploymentGroupAttributes) { + constructor(scope: Construct, id: string, props: ServerDeploymentGroupAttributes) { super(scope, id, props.deploymentConfig); this.application = props.application; @@ -247,7 +248,7 @@ export class ServerDeploymentGroup extends ServerDeploymentGroupBase { * @returns a Construct representing a reference to an existing Deployment Group */ public static fromServerDeploymentGroupAttributes( - scope: cdk.Construct, + scope: Construct, id: string, attrs: ServerDeploymentGroupAttributes): IServerDeploymentGroup { return new ImportedServerDeploymentGroup(scope, id, attrs); @@ -263,7 +264,7 @@ export class ServerDeploymentGroup extends ServerDeploymentGroupBase { private readonly codeDeployBucket: s3.IBucket; private readonly alarms: cloudwatch.IAlarm[]; - constructor(scope: cdk.Construct, id: string, props: ServerDeploymentGroupProps = {}) { + constructor(scope: Construct, id: string, props: ServerDeploymentGroupProps = {}) { super(scope, id, props.deploymentConfig, { physicalName: props.deploymentGroupName, }); diff --git a/packages/@aws-cdk/aws-codedeploy/package.json b/packages/@aws-cdk/aws-codedeploy/package.json index 136cca68a108f..27e9e2b715745 100644 --- a/packages/@aws-cdk/aws-codedeploy/package.json +++ b/packages/@aws-cdk/aws-codedeploy/package.json @@ -52,7 +52,10 @@ "compat": "cdk-compat" }, "cdk-build": { - "cloudformation": "AWS::CodeDeploy" + "cloudformation": "AWS::CodeDeploy", + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "nyc": { "statements": 79 diff --git a/packages/@aws-cdk/aws-codeguruprofiler/lib/profiling-group.ts b/packages/@aws-cdk/aws-codeguruprofiler/lib/profiling-group.ts index 2a28fdcaa7822..70d159fe6fd8c 100644 --- a/packages/@aws-cdk/aws-codeguruprofiler/lib/profiling-group.ts +++ b/packages/@aws-cdk/aws-codeguruprofiler/lib/profiling-group.ts @@ -1,5 +1,6 @@ import { Grant, IGrantable } from '@aws-cdk/aws-iam'; -import { Construct, IResource, Lazy, Resource, Stack } from '@aws-cdk/core'; +import { IResource, Lazy, Resource, Stack } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnProfilingGroup } from './codeguruprofiler.generated'; /** diff --git a/packages/@aws-cdk/aws-codeguruprofiler/package.json b/packages/@aws-cdk/aws-codeguruprofiler/package.json index b4a35197b310d..8140b965fec4a 100644 --- a/packages/@aws-cdk/aws-codeguruprofiler/package.json +++ b/packages/@aws-cdk/aws-codeguruprofiler/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::CodeGuruProfiler", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", @@ -78,7 +81,8 @@ }, "dependencies": { "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^3.0.4" }, "peerDependencies": { "@aws-cdk/core": "0.0.0", diff --git a/packages/@aws-cdk/aws-codegurureviewer/package.json b/packages/@aws-cdk/aws-codegurureviewer/package.json index 4528848bdf5e6..ff4a52bd233d8 100644 --- a/packages/@aws-cdk/aws-codegurureviewer/package.json +++ b/packages/@aws-cdk/aws-codegurureviewer/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::CodeGuruReviewer", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts b/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts index f43a42238745b..4aacc589b3689 100644 --- a/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts +++ b/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts @@ -3,9 +3,10 @@ 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 { - App, BootstraplessSynthesizer, Construct, DefaultStackSynthesizer, + App, BootstraplessSynthesizer, Construct as CoreConstruct, DefaultStackSynthesizer, IStackSynthesizer, Lazy, PhysicalName, RemovalPolicy, Resource, Stack, Token, TokenComparison, } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { ActionCategory, IAction, IPipeline, IStage } from './action'; import { CfnPipeline } from './codepipeline.generated'; import { CrossRegionSupportConstruct, CrossRegionSupportStack } from './cross-region-support-stack'; @@ -363,7 +364,7 @@ export class Pipeline extends PipelineBase { } /** @internal */ - public _attachActionToPipeline(stage: Stage, action: IAction, actionScope: Construct): FullActionDescriptor { + public _attachActionToPipeline(stage: Stage, action: IAction, actionScope: CoreConstruct): FullActionDescriptor { // handle cross-region actions here const crossRegionInfo = this.ensureReplicationResourcesExistFor(action); diff --git a/packages/@aws-cdk/aws-codepipeline/package.json b/packages/@aws-cdk/aws-codepipeline/package.json index 3ee04f96196e9..69abb3b50581d 100644 --- a/packages/@aws-cdk/aws-codepipeline/package.json +++ b/packages/@aws-cdk/aws-codepipeline/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::CodePipeline", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "nyc": { "statements": 50, diff --git a/packages/@aws-cdk/aws-codestar/lib/github-repository.ts b/packages/@aws-cdk/aws-codestar/lib/github-repository.ts index 0afd45eb0c826..5156ce211b9a8 100644 --- a/packages/@aws-cdk/aws-codestar/lib/github-repository.ts +++ b/packages/@aws-cdk/aws-codestar/lib/github-repository.ts @@ -1,5 +1,6 @@ import * as s3 from '@aws-cdk/aws-s3'; import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import * as codestar from './codestar.generated'; /** @@ -87,7 +88,7 @@ export class GitHubRepository extends cdk.Resource implements IGitHubRepository public readonly owner: string; public readonly repo: string; - constructor(scope: cdk.Construct, id: string, props: GitHubRepositoryProps) { + constructor(scope: Construct, id: string, props: GitHubRepositoryProps) { super(scope, id); const resource = new codestar.CfnGitHubRepository(this, 'Resource', { diff --git a/packages/@aws-cdk/aws-codestar/package.json b/packages/@aws-cdk/aws-codestar/package.json index 65c610745c1a0..5eeb0b43db158 100644 --- a/packages/@aws-cdk/aws-codestar/package.json +++ b/packages/@aws-cdk/aws-codestar/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::CodeStar", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-codestarconnections/package.json b/packages/@aws-cdk/aws-codestarconnections/package.json index 8605bb93ef47f..76647d2d6375e 100644 --- a/packages/@aws-cdk/aws-codestarconnections/package.json +++ b/packages/@aws-cdk/aws-codestarconnections/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::CodeStarConnections", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-codestarnotifications/package.json b/packages/@aws-cdk/aws-codestarnotifications/package.json index 05e6cbadabf23..ffbefc15ca846 100644 --- a/packages/@aws-cdk/aws-codestarnotifications/package.json +++ b/packages/@aws-cdk/aws-codestarnotifications/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::CodeStarNotifications", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-datapipeline/package.json b/packages/@aws-cdk/aws-datapipeline/package.json index 1b24802929d73..349c70d00ebfb 100644 --- a/packages/@aws-cdk/aws-datapipeline/package.json +++ b/packages/@aws-cdk/aws-datapipeline/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::DataPipeline", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-dax/package.json b/packages/@aws-cdk/aws-dax/package.json index a266a83a0124f..d2aba2cfb2787 100644 --- a/packages/@aws-cdk/aws-dax/package.json +++ b/packages/@aws-cdk/aws-dax/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::DAX", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-detective/package.json b/packages/@aws-cdk/aws-detective/package.json index fdbb9dc3a2362..d99077efe02f7 100644 --- a/packages/@aws-cdk/aws-detective/package.json +++ b/packages/@aws-cdk/aws-detective/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::Detective", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-directoryservice/package.json b/packages/@aws-cdk/aws-directoryservice/package.json index 348ce00c60d1f..2625ba019a9c6 100644 --- a/packages/@aws-cdk/aws-directoryservice/package.json +++ b/packages/@aws-cdk/aws-directoryservice/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::DirectoryService", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-dlm/package.json b/packages/@aws-cdk/aws-dlm/package.json index f3123d4187356..6f4a8134dd5e6 100644 --- a/packages/@aws-cdk/aws-dlm/package.json +++ b/packages/@aws-cdk/aws-dlm/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::DLM", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-dms/package.json b/packages/@aws-cdk/aws-dms/package.json index 61637d58edad1..af3bd1ce5e56c 100644 --- a/packages/@aws-cdk/aws-dms/package.json +++ b/packages/@aws-cdk/aws-dms/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::DMS", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-docdb/lib/cluster.ts b/packages/@aws-cdk/aws-docdb/lib/cluster.ts index 339ef8f0b51a0..529f446c265b9 100644 --- a/packages/@aws-cdk/aws-docdb/lib/cluster.ts +++ b/packages/@aws-cdk/aws-docdb/lib/cluster.ts @@ -1,7 +1,8 @@ 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 { CfnResource, Construct, Duration, RemovalPolicy, Resource, Token } from '@aws-cdk/core'; +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'; diff --git a/packages/@aws-cdk/aws-docdb/lib/database-secret.ts b/packages/@aws-cdk/aws-docdb/lib/database-secret.ts index 25a94410674aa..605609b4b6ab2 100644 --- a/packages/@aws-cdk/aws-docdb/lib/database-secret.ts +++ b/packages/@aws-cdk/aws-docdb/lib/database-secret.ts @@ -1,6 +1,7 @@ import { IKey } from '@aws-cdk/aws-kms'; import { ISecret, Secret } from '@aws-cdk/aws-secretsmanager'; -import { Aws, Construct } from '@aws-cdk/core'; +import { Aws } from '@aws-cdk/core'; +import { Construct } from 'constructs'; /** * Construction properties for a DatabaseSecret. diff --git a/packages/@aws-cdk/aws-docdb/lib/instance.ts b/packages/@aws-cdk/aws-docdb/lib/instance.ts index 7c69c626703d4..3208bda7107f7 100644 --- a/packages/@aws-cdk/aws-docdb/lib/instance.ts +++ b/packages/@aws-cdk/aws-docdb/lib/instance.ts @@ -1,6 +1,6 @@ import * as ec2 from '@aws-cdk/aws-ec2'; import * as cdk from '@aws-cdk/core'; - +import { Construct } from 'constructs'; import { IDatabaseCluster } from './cluster-ref'; import { CfnDBInstance } from './docdb.generated'; import { Endpoint } from './endpoint'; @@ -66,7 +66,7 @@ abstract class DatabaseInstanceBase extends cdk.Resource implements IDatabaseIns /** * Import an existing database instance. */ - public static fromDatabaseInstanceAttributes(scope: cdk.Construct, id: string, attrs: DatabaseInstanceAttributes): IDatabaseInstance { + 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; @@ -197,7 +197,7 @@ export class DatabaseInstance extends DatabaseInstanceBase implements IDatabaseI */ public readonly instanceEndpoint: Endpoint; - constructor(scope: cdk.Construct, id: string, props: DatabaseInstanceProps) { + constructor(scope: Construct, id: string, props: DatabaseInstanceProps) { super(scope, id); const instance = new CfnDBInstance(this, 'Resource', { diff --git a/packages/@aws-cdk/aws-docdb/lib/parameter-group.ts b/packages/@aws-cdk/aws-docdb/lib/parameter-group.ts index f98c74cbcf403..5a9e377916f2d 100644 --- a/packages/@aws-cdk/aws-docdb/lib/parameter-group.ts +++ b/packages/@aws-cdk/aws-docdb/lib/parameter-group.ts @@ -1,4 +1,5 @@ -import { Construct, IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnDBClusterParameterGroup } from './docdb.generated'; /** diff --git a/packages/@aws-cdk/aws-docdb/package.json b/packages/@aws-cdk/aws-docdb/package.json index 0959ef2574981..4e1f18ea39357 100644 --- a/packages/@aws-cdk/aws-docdb/package.json +++ b/packages/@aws-cdk/aws-docdb/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::DocDB", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-ec2/lib/bastion-host.ts b/packages/@aws-cdk/aws-ec2/lib/bastion-host.ts index 9795551abf5a4..dbc6c45fe415a 100644 --- a/packages/@aws-cdk/aws-ec2/lib/bastion-host.ts +++ b/packages/@aws-cdk/aws-ec2/lib/bastion-host.ts @@ -1,5 +1,6 @@ import { IPrincipal, IRole, PolicyStatement } from '@aws-cdk/aws-iam'; -import { CfnOutput, Construct, Resource, Stack } from '@aws-cdk/core'; +import { CfnOutput, Resource, Stack } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { AmazonLinuxGeneration, InstanceClass, InstanceSize, InstanceType } from '.'; import { Connections } from './connections'; import { IInstance, Instance } from './instance'; diff --git a/packages/@aws-cdk/aws-ec2/lib/instance.ts b/packages/@aws-cdk/aws-ec2/lib/instance.ts index 7a4ef214101b3..61fb6e20d46b1 100644 --- a/packages/@aws-cdk/aws-ec2/lib/instance.ts +++ b/packages/@aws-cdk/aws-ec2/lib/instance.ts @@ -1,7 +1,8 @@ import * as crypto from 'crypto'; import * as iam from '@aws-cdk/aws-iam'; -import { Annotations, Construct, Duration, Fn, IResource, Lazy, Resource, Stack, Tags } from '@aws-cdk/core'; +import { Annotations, Duration, Fn, IResource, Lazy, Resource, Stack, Tags } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CloudFormationInit } from './cfn-init'; import { Connections, IConnectable } from './connections'; import { CfnInstance } from './ec2.generated'; diff --git a/packages/@aws-cdk/aws-ec2/lib/network-acl.ts b/packages/@aws-cdk/aws-ec2/lib/network-acl.ts index f2d9f75bfbeee..bea1b030d2c9a 100644 --- a/packages/@aws-cdk/aws-ec2/lib/network-acl.ts +++ b/packages/@aws-cdk/aws-ec2/lib/network-acl.ts @@ -1,4 +1,5 @@ -import { Construct, IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnNetworkAcl, CfnNetworkAclEntry, CfnSubnetNetworkAclAssociation } from './ec2.generated'; import { AclCidr, AclTraffic } from './network-acl-types'; import { ISubnet, IVpc, SubnetSelection } from './vpc'; diff --git a/packages/@aws-cdk/aws-ec2/lib/security-group.ts b/packages/@aws-cdk/aws-ec2/lib/security-group.ts index 868db46dd462a..3681c61f686dc 100644 --- a/packages/@aws-cdk/aws-ec2/lib/security-group.ts +++ b/packages/@aws-cdk/aws-ec2/lib/security-group.ts @@ -1,4 +1,5 @@ -import { Annotations, Construct, IResource, Lazy, Resource, ResourceProps, Stack, Token } from '@aws-cdk/core'; +import { Annotations, IResource, Lazy, Resource, ResourceProps, Stack, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { Connections } from './connections'; import { CfnSecurityGroup, CfnSecurityGroupEgress, CfnSecurityGroupIngress } from './ec2.generated'; import { IPeer } from './peer'; diff --git a/packages/@aws-cdk/aws-ec2/lib/util.ts b/packages/@aws-cdk/aws-ec2/lib/util.ts index f43296b5f75d2..56fef8b2a97f5 100644 --- a/packages/@aws-cdk/aws-ec2/lib/util.ts +++ b/packages/@aws-cdk/aws-ec2/lib/util.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { ISubnet, Subnet, SubnetType } from './vpc'; /** @@ -70,7 +70,7 @@ export class ImportSubnetGroup { this.names = this.normalizeNames(names, defaultSubnetName(type), nameField); } - public import(scope: cdk.Construct): ISubnet[] { + public import(scope: Construct): ISubnet[] { return range(this.subnetIds.length).map(i => { const k = Math.floor(i / this.availabilityZones.length); return Subnet.fromSubnetAttributes(scope, subnetId(this.names[k], i), { diff --git a/packages/@aws-cdk/aws-ec2/lib/volume.ts b/packages/@aws-cdk/aws-ec2/lib/volume.ts index e7ce7d52b2977..9270f6d81addb 100644 --- a/packages/@aws-cdk/aws-ec2/lib/volume.ts +++ b/packages/@aws-cdk/aws-ec2/lib/volume.ts @@ -2,10 +2,16 @@ import * as crypto from 'crypto'; import { AccountRootPrincipal, Grant, IGrantable } from '@aws-cdk/aws-iam'; import { IKey, ViaServicePrincipal } from '@aws-cdk/aws-kms'; -import { Annotations, Construct, IResource, Resource, Size, SizeRoundingBehavior, Stack, Token, Tags } from '@aws-cdk/core'; +import { Annotations, IResource, Resource, Size, SizeRoundingBehavior, Stack, Token, Tags } from '@aws-cdk/core'; +import { Construct, Node } from 'constructs'; import { CfnInstance, CfnVolume } from './ec2.generated'; import { IInstance } from './instance'; +// v2 - keep this import as a separate section to reduce merge conflict when forward merging with the v2 branch. +// eslint-disable-next-line +import { Construct as CoreConstruct } from '@aws-cdk/core'; + + /** * Block device */ @@ -508,7 +514,7 @@ abstract class VolumeBase extends Resource implements IVolume { // The ResourceTag condition requires that all resources involved in the operation have // the given tag, so we tag this and all constructs given. Tags.of(this).add(tagKey, tagValue); - constructs.forEach(construct => Tags.of(construct).add(tagKey, tagValue)); + constructs.forEach(construct => Tags.of(construct as CoreConstruct).add(tagKey, tagValue)); return result; } @@ -537,7 +543,7 @@ abstract class VolumeBase extends Resource implements IVolume { // The ResourceTag condition requires that all resources involved in the operation have // the given tag, so we tag this and all constructs given. Tags.of(this).add(tagKey, tagValue); - constructs.forEach(construct => Tags.of(construct).add(tagKey, tagValue)); + constructs.forEach(construct => Tags.of(construct as CoreConstruct).add(tagKey, tagValue)); return result; } @@ -558,7 +564,7 @@ abstract class VolumeBase extends Resource implements IVolume { private calculateResourceTagValue(constructs: Construct[]): string { const md5 = crypto.createHash('md5'); - constructs.forEach(construct => md5.update(construct.node.uniqueId)); + constructs.forEach(construct => md5.update(Node.of(construct).uniqueId)); return md5.digest('hex'); } } diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint-service.ts b/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint-service.ts index 71380476225f3..d5d043eef0dc0 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint-service.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint-service.ts @@ -1,6 +1,7 @@ import { ArnPrincipal } from '@aws-cdk/aws-iam'; -import { Aws, Construct, Fn, IResource, Resource, Stack, Token } from '@aws-cdk/core'; +import { Aws, Fn, IResource, Resource, Stack, Token } from '@aws-cdk/core'; import { Default, RegionInfo } from '@aws-cdk/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/aws-ec2/lib/vpc-endpoint.ts index 6f913dd1d858b..2770ed0f6a5b6 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts @@ -1,6 +1,7 @@ import * as iam from '@aws-cdk/aws-iam'; import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { Aws, Construct, ContextProvider, IResource, Lazy, Resource, Stack, Token } from '@aws-cdk/core'; +import { Aws, ContextProvider, IResource, Lazy, Resource, Stack, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { Connections, IConnectable } from './connections'; import { CfnVPCEndpoint } from './ec2.generated'; import { Peer } from './peer'; diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc-flow-logs.ts b/packages/@aws-cdk/aws-ec2/lib/vpc-flow-logs.ts index cb6dd75ad49eb..bcfb8602aa595 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc-flow-logs.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc-flow-logs.ts @@ -1,10 +1,15 @@ 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 { Construct, IResource, PhysicalName, RemovalPolicy, Resource } from '@aws-cdk/core'; +import { IResource, PhysicalName, RemovalPolicy, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnFlowLog } from './ec2.generated'; import { ISubnet, IVpc } from './vpc'; +// v2 - keep this import as a separate section to reduce merge conflict when forward merging with the v2 branch. +// eslint-disable-next-line +import { Construct as CoreConstruct } from '@aws-cdk/core'; + /** * A FlowLog * @@ -134,7 +139,7 @@ export abstract class FlowLogDestination { /** * Generates a flow log destination configuration */ - public abstract bind(scope: Construct, flowLog: FlowLog): FlowLogDestinationConfig; + public abstract bind(scope: CoreConstruct, flowLog: FlowLog): FlowLogDestinationConfig; } /** @@ -180,7 +185,7 @@ class S3Destination extends FlowLogDestination { super(); } - public bind(scope: Construct, _flowLog: FlowLog): FlowLogDestinationConfig { + public bind(scope: CoreConstruct, _flowLog: FlowLog): FlowLogDestinationConfig { let s3Bucket: s3.IBucket; if (this.props.s3Bucket === undefined) { s3Bucket = new s3.Bucket(scope, 'Bucket', { @@ -205,7 +210,7 @@ class CloudWatchLogsDestination extends FlowLogDestination { super(); } - public bind(scope: Construct, _flowLog: FlowLog): FlowLogDestinationConfig { + public bind(scope: CoreConstruct, _flowLog: FlowLog): FlowLogDestinationConfig { let iamRole: iam.IRole; let logGroup: logs.ILogGroup; if (this.props.iamRole === undefined) { diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc.ts b/packages/@aws-cdk/aws-ec2/lib/vpc.ts index 18ea936893ccb..3e6d5731d8baa 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc.ts @@ -1,9 +1,10 @@ import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import { - Annotations, ConcreteDependable, Construct, ContextProvider, DependableTrait, IConstruct, + Annotations, ConcreteDependable, ContextProvider, DependableTrait, IConstruct, IDependable, IResource, Lazy, Resource, Stack, Token, Tags, } from '@aws-cdk/core'; import * as cxapi from '@aws-cdk/cx-api'; +import { Construct, Node } from 'constructs'; import { CfnEIP, CfnInternetGateway, CfnNatGateway, CfnRoute, CfnRouteTable, CfnSubnet, CfnSubnetRouteTableAssociation, CfnVPC, CfnVPCGatewayAttachment, CfnVPNGatewayRoutePropagation, @@ -18,6 +19,10 @@ import { FlowLog, FlowLogOptions, FlowLogResourceType } from './vpc-flow-logs'; import { VpcLookupOptions } from './vpc-lookup'; import { EnableVpnGatewayOptions, VpnConnection, VpnConnectionOptions, VpnConnectionType, VpnGateway } from './vpn'; +// v2 - keep this import as a separate section to reduce merge conflict when forward merging with the v2 branch. +// eslint-disable-next-line +import { Construct as CoreConstruct } from '@aws-cdk/core'; + const VPC_SUBNET_SYMBOL = Symbol.for('@aws-cdk/aws-ec2.VpcSubnet'); export interface ISubnet extends IResource { @@ -1610,8 +1615,8 @@ export class Subnet extends Resource implements ISubnet { public associateNetworkAcl(id: string, networkAcl: INetworkAcl) { this._networkAcl = networkAcl; - const scope = Construct.isConstruct(networkAcl) ? networkAcl : this; - const other = Construct.isConstruct(networkAcl) ? this : networkAcl; + const scope = CoreConstruct.isConstruct(networkAcl) ? networkAcl : this; + const other = CoreConstruct.isConstruct(networkAcl) ? this : networkAcl; new SubnetNetworkAclAssociation(scope, id + other.node.uniqueId, { networkAcl, subnet: this, @@ -1916,7 +1921,7 @@ class ImportedSubnet extends Resource implements ISubnet, IPublicSubnet, IPrivat if (!attrs.routeTableId) { const ref = Token.isUnresolved(attrs.subnetId) - ? `at '${scope.node.path}/${id}'` + ? `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)`); @@ -1948,8 +1953,8 @@ class ImportedSubnet extends Resource implements ISubnet, IPublicSubnet, IPrivat } public associateNetworkAcl(id: string, networkAcl: INetworkAcl): void { - const scope = Construct.isConstruct(networkAcl) ? networkAcl : this; - const other = Construct.isConstruct(networkAcl) ? this : networkAcl; + const scope = CoreConstruct.isConstruct(networkAcl) ? networkAcl : this; + const other = CoreConstruct.isConstruct(networkAcl) ? this : networkAcl; new SubnetNetworkAclAssociation(scope, id + other.node.uniqueId, { networkAcl, subnet: this, diff --git a/packages/@aws-cdk/aws-ec2/lib/vpn.ts b/packages/@aws-cdk/aws-ec2/lib/vpn.ts index 740bec3f1be6b..409a7599e787e 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpn.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpn.ts @@ -1,6 +1,7 @@ import * as net from 'net'; import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnCustomerGateway, CfnVPNConnection, @@ -154,7 +155,7 @@ export class VpnGateway extends cdk.Resource implements IVpnGateway { */ public readonly gatewayId: string; - constructor(scope: cdk.Construct, id: string, props: VpnGatewayProps) { + constructor(scope: Construct, id: string, props: VpnGatewayProps) { super(scope, id); // This is 'Default' instead of 'Resource', because using 'Default' will generate @@ -213,7 +214,7 @@ export class VpnConnection extends cdk.Resource implements IVpnConnection { public readonly customerGatewayIp: string; public readonly customerGatewayAsn: number; - constructor(scope: cdk.Construct, id: string, props: VpnConnectionProps) { + constructor(scope: Construct, id: string, props: VpnConnectionProps) { super(scope, id); if (!props.vpc.vpnGatewayId) { diff --git a/packages/@aws-cdk/aws-ec2/package.json b/packages/@aws-cdk/aws-ec2/package.json index 530fbd4a7473a..3b4c3c0e04ccb 100644 --- a/packages/@aws-cdk/aws-ec2/package.json +++ b/packages/@aws-cdk/aws-ec2/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::EC2", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": "true" + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-efs/lib/access-point.ts b/packages/@aws-cdk/aws-efs/lib/access-point.ts index 04399991cddb6..7f43d88523bf1 100644 --- a/packages/@aws-cdk/aws-efs/lib/access-point.ts +++ b/packages/@aws-cdk/aws-efs/lib/access-point.ts @@ -1,4 +1,5 @@ -import { Construct, IResource, Resource, Stack } from '@aws-cdk/core'; +import { IResource, Resource, Stack } from '@aws-cdk/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/aws-efs/lib/efs-file-system.ts index 775eaea806af6..ce5fc4eac2e9c 100644 --- a/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts +++ b/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts @@ -1,6 +1,7 @@ import * as ec2 from '@aws-cdk/aws-ec2'; import * as kms from '@aws-cdk/aws-kms'; -import { ConcreteDependable, Construct, IDependable, IResource, RemovalPolicy, Resource, Size, Tags } from '@aws-cdk/core'; +import { ConcreteDependable, IDependable, IResource, RemovalPolicy, Resource, Size, Tags } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { AccessPoint, AccessPointOptions } from './access-point'; import { CfnFileSystem, CfnMountTarget } from './efs.generated'; diff --git a/packages/@aws-cdk/aws-efs/package.json b/packages/@aws-cdk/aws-efs/package.json index 810316d715094..2e297e49cf73c 100644 --- a/packages/@aws-cdk/aws-efs/package.json +++ b/packages/@aws-cdk/aws-efs/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::EFS", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-elasticache/package.json b/packages/@aws-cdk/aws-elasticache/package.json index 04e8b46390fd4..ab6e459939236 100644 --- a/packages/@aws-cdk/aws-elasticache/package.json +++ b/packages/@aws-cdk/aws-elasticache/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::ElastiCache", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-elasticbeanstalk/package.json b/packages/@aws-cdk/aws-elasticbeanstalk/package.json index dc04dcdf44aea..1f907f7aea14a 100644 --- a/packages/@aws-cdk/aws-elasticbeanstalk/package.json +++ b/packages/@aws-cdk/aws-elasticbeanstalk/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::ElasticBeanstalk", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/lib/load-balancer.ts b/packages/@aws-cdk/aws-elasticloadbalancing/lib/load-balancer.ts index 21ef3060fc786..2bb95496a4c74 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancing/lib/load-balancer.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancing/lib/load-balancer.ts @@ -2,7 +2,8 @@ import { Connections, IConnectable, ISecurityGroup, IVpc, Peer, Port, SecurityGroup, SelectedSubnets, SubnetSelection, SubnetType, } from '@aws-cdk/aws-ec2'; -import { Construct, Duration, Lazy, Resource } from '@aws-cdk/core'; +import { Duration, Lazy, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnLoadBalancer } from './elasticloadbalancing.generated'; /** diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/package.json b/packages/@aws-cdk/aws-elasticloadbalancing/package.json index 7187de75b3ad0..a2f49664d154d 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancing/package.json +++ b/packages/@aws-cdk/aws-elasticloadbalancing/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::ElasticLoadBalancing", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/package.json b/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/package.json index 96bf7c63d209c..d5148b9709815 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/package.json +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/package.json @@ -102,6 +102,9 @@ "announce": false }, "cdk-build": { - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } } } diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-certificate.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-certificate.ts index d8497da664e5b..4dab6b23ba2b0 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-certificate.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-certificate.ts @@ -1,4 +1,5 @@ import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnListenerCertificate } from '../elasticloadbalancingv2.generated'; import { IListenerCertificate } from '../shared/listener-certificate'; import { IApplicationListener } from './application-listener'; @@ -36,7 +37,7 @@ export interface ApplicationListenerCertificateProps { * Add certificates to a listener */ export class ApplicationListenerCertificate extends cdk.Construct { - constructor(scope: cdk.Construct, id: string, props: ApplicationListenerCertificateProps) { + constructor(scope: Construct, id: string, props: ApplicationListenerCertificateProps) { super(scope, id); if (!props.certificateArns && !props.certificates) { diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-rule.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-rule.ts index ca80758306777..fe22b97653430 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-rule.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-rule.ts @@ -1,4 +1,5 @@ import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnListenerRule } from '../elasticloadbalancingv2.generated'; import { IListenerAction } from '../shared/listener-action'; import { IApplicationListener } from './application-listener'; @@ -205,7 +206,7 @@ export class ApplicationListenerRule extends cdk.Construct { private readonly listener: IApplicationListener; private action?: IListenerAction; - constructor(scope: cdk.Construct, id: string, props: ApplicationListenerRuleProps) { + constructor(scope: Construct, id: string, props: ApplicationListenerRuleProps) { super(scope, id); this.conditions = props.conditions || []; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts index 65d6465cb9efe..d088008e7ce23 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts @@ -1,5 +1,6 @@ import * as ec2 from '@aws-cdk/aws-ec2'; -import { Construct, Duration, IResource, Lazy, Resource, Token } from '@aws-cdk/core'; +import { Duration, IResource, Lazy, Resource, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { BaseListener } from '../shared/base-listener'; import { HealthCheck } from '../shared/base-target-group'; import { ApplicationProtocol, IpAddressType, SslPolicy } from '../shared/enums'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts index a7678a51dfdf5..278cd8a5fbc44 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts @@ -1,6 +1,7 @@ import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; import * as ec2 from '@aws-cdk/aws-ec2'; -import { Construct, Duration, Lazy, Resource } from '@aws-cdk/core'; +import { Duration, Lazy, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { BaseLoadBalancer, BaseLoadBalancerProps, ILoadBalancerV2 } from '../shared/base-load-balancer'; import { IpAddressType, ApplicationProtocol } from '../shared/enums'; import { ApplicationListener, BaseApplicationListenerProps } from './application-listener'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-target-group.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-target-group.ts index 2e2cfec3089f6..915711cf0e185 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-target-group.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-target-group.ts @@ -1,6 +1,7 @@ import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; import * as ec2 from '@aws-cdk/aws-ec2'; -import { Annotations, Construct, Duration, IConstruct } from '@aws-cdk/core'; +import { Annotations, Construct as CoreConstruct, Duration } from '@aws-cdk/core'; +import { IConstruct, Construct } from 'constructs'; import { BaseTargetGroupProps, ITargetGroup, loadBalancerNameFromListenerArn, LoadBalancerTargetProps, TargetGroupAttributes, TargetGroupBase, TargetGroupImportProps, @@ -159,7 +160,7 @@ export class ApplicationTargetGroup extends TargetGroupBase implements IApplicat listener.registerConnectable(member.connectable, member.portRange); } this.listeners.push(listener); - this.loadBalancerAttachedDependencies.add(associatingConstruct || listener); + this.loadBalancerAttachedDependencies.add((associatingConstruct || listener) as CoreConstruct); } /** diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts index b6ad9b4bde696..17857a2ed4187 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts @@ -1,4 +1,5 @@ -import { Construct, Duration, IResource, Resource } from '@aws-cdk/core'; +import { Duration, IResource, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { BaseListener } from '../shared/base-listener'; import { HealthCheck } from '../shared/base-target-group'; import { Protocol, SslPolicy } from '../shared/enums'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts index 28e23cc56a257..40743f03464a4 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts @@ -2,7 +2,8 @@ import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; import * as ec2 from '@aws-cdk/aws-ec2'; import { PolicyStatement, ServicePrincipal } from '@aws-cdk/aws-iam'; import { IBucket } from '@aws-cdk/aws-s3'; -import { Construct, Resource } from '@aws-cdk/core'; +import { Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { BaseLoadBalancer, BaseLoadBalancerProps, ILoadBalancerV2 } from '../shared/base-load-balancer'; import { BaseNetworkListenerProps, NetworkListener } from './network-listener'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts index eff0a6efc0c97..8ac9769995dda 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts @@ -1,4 +1,5 @@ import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { BaseTargetGroupProps, HealthCheck, ITargetGroup, loadBalancerNameFromListenerArn, LoadBalancerTargetProps, TargetGroupAttributes, TargetGroupBase, TargetGroupImportProps, @@ -50,7 +51,7 @@ export class NetworkTargetGroup extends TargetGroupBase implements INetworkTarge /** * Import an existing target group */ - public static fromTargetGroupAttributes(scope: cdk.Construct, id: string, attrs: TargetGroupAttributes): INetworkTargetGroup { + public static fromTargetGroupAttributes(scope: Construct, id: string, attrs: TargetGroupAttributes): INetworkTargetGroup { return new ImportedNetworkTargetGroup(scope, id, attrs); } @@ -59,13 +60,13 @@ export class NetworkTargetGroup extends TargetGroupBase implements INetworkTarge * * @deprecated Use `fromTargetGroupAttributes` instead */ - public static import(scope: cdk.Construct, id: string, props: TargetGroupImportProps): INetworkTargetGroup { + public static import(scope: Construct, id: string, props: TargetGroupImportProps): INetworkTargetGroup { return NetworkTargetGroup.fromTargetGroupAttributes(scope, id, props); } private readonly listeners: INetworkListener[]; - constructor(scope: cdk.Construct, id: string, props: NetworkTargetGroupProps) { + constructor(scope: Construct, id: string, props: NetworkTargetGroupProps) { const proto = props.protocol || Protocol.TCP; validateNetworkProtocol(proto); diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-listener.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-listener.ts index 8f92a086b1d6b..7866e522e0375 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-listener.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-listener.ts @@ -1,4 +1,5 @@ -import { Annotations, Construct, Lazy, Resource } from '@aws-cdk/core'; +import { Annotations, Lazy, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnListener } from '../elasticloadbalancingv2.generated'; import { IListenerAction } from './listener-action'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts index a5644a22c2ca0..1ca544187038a 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts @@ -1,8 +1,9 @@ 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 { Construct, IResource, Lazy, Resource, Stack, Token } from '@aws-cdk/core'; +import { IResource, Lazy, Resource, Stack, Token } from '@aws-cdk/core'; import { RegionInfo } from '@aws-cdk/region-info'; +import { Construct } from 'constructs'; import { CfnLoadBalancer } from '../elasticloadbalancingv2.generated'; import { Attributes, ifUndefined, renderAttributes } from './util'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-target-group.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-target-group.ts index bb7d211cac80d..fbe3e54b5b757 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-target-group.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-target-group.ts @@ -1,5 +1,6 @@ import * as ec2 from '@aws-cdk/aws-ec2'; import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnTargetGroup } from '../elasticloadbalancingv2.generated'; import { Protocol, TargetType } from './enums'; import { Attributes, renderAttributes } from './util'; @@ -222,7 +223,7 @@ export abstract class TargetGroupBase extends cdk.Construct implements ITargetGr */ private readonly resource: CfnTargetGroup; - constructor(scope: cdk.Construct, id: string, baseProps: BaseTargetGroupProps, additionalProps: any) { + constructor(scope: Construct, id: string, baseProps: BaseTargetGroupProps, additionalProps: any) { super(scope, id); if (baseProps.deregistrationDelay !== undefined) { diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/imported.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/imported.ts index 104f11b67d264..52643b49a97cd 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/imported.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/imported.ts @@ -1,4 +1,5 @@ import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { ITargetGroup, TargetGroupImportProps } from './base-target-group'; /** @@ -20,7 +21,7 @@ export abstract class ImportedTargetGroupBase extends cdk.Construct implements I */ public readonly loadBalancerAttached: cdk.IDependable = new cdk.ConcreteDependable(); - constructor(scope: cdk.Construct, id: string, props: TargetGroupImportProps) { + constructor(scope: Construct, id: string, props: TargetGroupImportProps) { super(scope, id); this.targetGroupArn = props.targetGroupArn; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json b/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json index 86c52cce535ca..f674af8d93d7b 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::ElasticLoadBalancingV2", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-elasticsearch/package.json b/packages/@aws-cdk/aws-elasticsearch/package.json index 0597d412ed6fb..c58a9eb82ed20 100644 --- a/packages/@aws-cdk/aws-elasticsearch/package.json +++ b/packages/@aws-cdk/aws-elasticsearch/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::Elasticsearch", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-emr/package.json b/packages/@aws-cdk/aws-emr/package.json index 775ed37d98345..da8094218409d 100644 --- a/packages/@aws-cdk/aws-emr/package.json +++ b/packages/@aws-cdk/aws-emr/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::EMR", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-events/lib/event-bus.ts b/packages/@aws-cdk/aws-events/lib/event-bus.ts index 366c259685527..db0bf52f65317 100644 --- a/packages/@aws-cdk/aws-events/lib/event-bus.ts +++ b/packages/@aws-cdk/aws-events/lib/event-bus.ts @@ -1,5 +1,6 @@ import * as iam from '@aws-cdk/aws-iam'; -import { Construct, IResource, Lazy, Resource, Stack } from '@aws-cdk/core'; +import { IResource, Lazy, Resource, Stack } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnEventBus } from './events.generated'; /** diff --git a/packages/@aws-cdk/aws-events/lib/rule.ts b/packages/@aws-cdk/aws-events/lib/rule.ts index 1b19b5f1174a9..ca0dcd24bf45e 100644 --- a/packages/@aws-cdk/aws-events/lib/rule.ts +++ b/packages/@aws-cdk/aws-events/lib/rule.ts @@ -1,4 +1,5 @@ -import { App, Construct, Lazy, Resource, Stack, Token } from '@aws-cdk/core'; +import { App, Lazy, Resource, Stack, Token } from '@aws-cdk/core'; +import { Construct, Node } from 'constructs'; import { IEventBus } from './event-bus'; import { EventPattern } from './event-pattern'; import { CfnEventBusPolicy, CfnRule } from './events.generated'; @@ -225,7 +226,7 @@ export class Rule extends Resource implements IRule { if (!sourceApp || !App.isApp(sourceApp)) { throw new Error('Event stack which uses cross-account targets must be part of a CDK app'); } - const targetApp = targetProps.targetResource.node.root; + const targetApp = Node.of(targetProps.targetResource).root; if (!targetApp || !App.isApp(targetApp)) { throw new Error('Target stack which uses cross-account event targets must be part of a CDK app'); } diff --git a/packages/@aws-cdk/aws-events/package.json b/packages/@aws-cdk/aws-events/package.json index 49601a8a03bb2..fe8af611759f3 100644 --- a/packages/@aws-cdk/aws-events/package.json +++ b/packages/@aws-cdk/aws-events/package.json @@ -52,7 +52,10 @@ "compat": "cdk-compat" }, "cdk-build": { - "cloudformation": "AWS::Events" + "cloudformation": "AWS::Events", + "env": { + "AWSLINT_BASE_CONSTRUCT": "true" + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-eventschemas/package.json b/packages/@aws-cdk/aws-eventschemas/package.json index 2f71cc896e3a4..2ad4983c3be32 100644 --- a/packages/@aws-cdk/aws-eventschemas/package.json +++ b/packages/@aws-cdk/aws-eventschemas/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::EventSchemas", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-fms/package.json b/packages/@aws-cdk/aws-fms/package.json index f6820c068b8fd..47ffdc69a57ef 100644 --- a/packages/@aws-cdk/aws-fms/package.json +++ b/packages/@aws-cdk/aws-fms/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::FMS", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-fsx/lib/lustre-file-system.ts b/packages/@aws-cdk/aws-fsx/lib/lustre-file-system.ts index f147677544e74..9d27da5bca3cd 100644 --- a/packages/@aws-cdk/aws-fsx/lib/lustre-file-system.ts +++ b/packages/@aws-cdk/aws-fsx/lib/lustre-file-system.ts @@ -1,5 +1,6 @@ import { Connections, ISecurityGroup, ISubnet, Port, SecurityGroup } from '@aws-cdk/aws-ec2'; -import { Aws, Construct, Token } from '@aws-cdk/core'; +import { Aws, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { FileSystemAttributes, FileSystemBase, FileSystemProps, IFileSystem } from './file-system'; import { CfnFileSystem } from './fsx.generated'; import { LustreMaintenanceTime } from './maintenance-time'; diff --git a/packages/@aws-cdk/aws-fsx/package.json b/packages/@aws-cdk/aws-fsx/package.json index 8c04546c14f52..21da2047de0df 100644 --- a/packages/@aws-cdk/aws-fsx/package.json +++ b/packages/@aws-cdk/aws-fsx/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::FSx", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-gamelift/package.json b/packages/@aws-cdk/aws-gamelift/package.json index 656f5f2979455..306ffd6f328d3 100644 --- a/packages/@aws-cdk/aws-gamelift/package.json +++ b/packages/@aws-cdk/aws-gamelift/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::GameLift", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-glue/lib/database.ts b/packages/@aws-cdk/aws-glue/lib/database.ts index f548317570012..8b359251f54d2 100644 --- a/packages/@aws-cdk/aws-glue/lib/database.ts +++ b/packages/@aws-cdk/aws-glue/lib/database.ts @@ -1,4 +1,5 @@ -import { Construct, IResource, Resource, Stack } from '@aws-cdk/core'; +import { IResource, Resource, Stack } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnDatabase } from './glue.generated'; export interface IDatabase extends IResource { diff --git a/packages/@aws-cdk/aws-glue/lib/table.ts b/packages/@aws-cdk/aws-glue/lib/table.ts index 126d2cfef0226..59b5e551ebc03 100644 --- a/packages/@aws-cdk/aws-glue/lib/table.ts +++ b/packages/@aws-cdk/aws-glue/lib/table.ts @@ -1,7 +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 { Construct, Fn, IResource, Resource, Stack } from '@aws-cdk/core'; +import { Fn, IResource, Resource, Stack } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { DataFormat } from './data-format'; import { IDatabase } from './database'; import { CfnTable } from './glue.generated'; diff --git a/packages/@aws-cdk/aws-glue/package.json b/packages/@aws-cdk/aws-glue/package.json index 0a3afa2014db5..c8ce2ebc7da42 100644 --- a/packages/@aws-cdk/aws-glue/package.json +++ b/packages/@aws-cdk/aws-glue/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::Glue", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": "true" + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-greengrass/package.json b/packages/@aws-cdk/aws-greengrass/package.json index d218c06a135d2..fa80e4b30ba52 100644 --- a/packages/@aws-cdk/aws-greengrass/package.json +++ b/packages/@aws-cdk/aws-greengrass/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::Greengrass", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-guardduty/package.json b/packages/@aws-cdk/aws-guardduty/package.json index bb51020a6e8b1..617b4eeec97fe 100644 --- a/packages/@aws-cdk/aws-guardduty/package.json +++ b/packages/@aws-cdk/aws-guardduty/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::GuardDuty", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-iam/lib/group.ts b/packages/@aws-cdk/aws-iam/lib/group.ts index d04df1948662c..6fc5963fdbeeb 100644 --- a/packages/@aws-cdk/aws-iam/lib/group.ts +++ b/packages/@aws-cdk/aws-iam/lib/group.ts @@ -1,4 +1,5 @@ -import { Construct, Lazy, Resource, Stack } from '@aws-cdk/core'; +import { Lazy, Resource, Stack } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnGroup } from './iam.generated'; import { IIdentity } from './identity-base'; import { IManagedPolicy } from './managed-policy'; diff --git a/packages/@aws-cdk/aws-iam/lib/lazy-role.ts b/packages/@aws-cdk/aws-iam/lib/lazy-role.ts index 8d299c5d14bb6..f5973d663e399 100644 --- a/packages/@aws-cdk/aws-iam/lib/lazy-role.ts +++ b/packages/@aws-cdk/aws-iam/lib/lazy-role.ts @@ -1,4 +1,5 @@ import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { Grant } from './grant'; import { IManagedPolicy } from './managed-policy'; import { Policy } from './policy'; @@ -34,7 +35,7 @@ export class LazyRole extends cdk.Resource implements IRole { private readonly policies = new Array(); private readonly managedPolicies = new Array(); - constructor(scope: cdk.Construct, id: string, private readonly props: LazyRoleProps) { + constructor(scope: Construct, id: string, private readonly props: LazyRoleProps) { super(scope, id); } diff --git a/packages/@aws-cdk/aws-iam/lib/managed-policy.ts b/packages/@aws-cdk/aws-iam/lib/managed-policy.ts index 9c5553d4655eb..8393f71f58a0d 100644 --- a/packages/@aws-cdk/aws-iam/lib/managed-policy.ts +++ b/packages/@aws-cdk/aws-iam/lib/managed-policy.ts @@ -1,4 +1,5 @@ -import { Construct, IResolveContext, Lazy, Resource, Stack } from '@aws-cdk/core'; +import { IResolveContext, Lazy, Resource, Stack } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { IGroup } from './group'; import { CfnManagedPolicy } from './iam.generated'; import { PolicyDocument } from './policy-document'; diff --git a/packages/@aws-cdk/aws-iam/lib/oidc-provider.ts b/packages/@aws-cdk/aws-iam/lib/oidc-provider.ts index 352c6a7bf70b0..3e4dda8a4d7cb 100644 --- a/packages/@aws-cdk/aws-iam/lib/oidc-provider.ts +++ b/packages/@aws-cdk/aws-iam/lib/oidc-provider.ts @@ -1,5 +1,6 @@ import * as path from 'path'; -import { Construct, CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, IResource, Resource, Token } from '@aws-cdk/core'; +import { CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, IResource, Resource, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; const RESOURCE_TYPE = 'Custom::AWSCDKOpenIdConnectProvider'; diff --git a/packages/@aws-cdk/aws-iam/lib/policy.ts b/packages/@aws-cdk/aws-iam/lib/policy.ts index 1d1441f710128..c4fefd21b189d 100644 --- a/packages/@aws-cdk/aws-iam/lib/policy.ts +++ b/packages/@aws-cdk/aws-iam/lib/policy.ts @@ -1,4 +1,5 @@ -import { Construct, IResource, Lazy, Resource } from '@aws-cdk/core'; +import { IResource, Lazy, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { IGroup } from './group'; import { CfnPolicy } from './iam.generated'; import { PolicyDocument } from './policy-document'; diff --git a/packages/@aws-cdk/aws-iam/lib/private/immutable-role.ts b/packages/@aws-cdk/aws-iam/lib/private/immutable-role.ts index f3d03b29ec69b..6f5bf102175ef 100644 --- a/packages/@aws-cdk/aws-iam/lib/private/immutable-role.ts +++ b/packages/@aws-cdk/aws-iam/lib/private/immutable-role.ts @@ -1,4 +1,5 @@ -import { ConcreteDependable, Construct, DependableTrait, Resource } from '@aws-cdk/core'; +import { ConcreteDependable, DependableTrait, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { Grant } from '../grant'; import { IManagedPolicy } from '../managed-policy'; import { Policy } from '../policy'; diff --git a/packages/@aws-cdk/aws-iam/lib/role.ts b/packages/@aws-cdk/aws-iam/lib/role.ts index 42ccfc707582b..3a11bd7fae2d9 100644 --- a/packages/@aws-cdk/aws-iam/lib/role.ts +++ b/packages/@aws-cdk/aws-iam/lib/role.ts @@ -1,4 +1,5 @@ -import { Construct, Duration, Lazy, Resource, Stack, Token, TokenComparison } from '@aws-cdk/core'; +import { Duration, Lazy, Resource, Stack, Token, TokenComparison } from '@aws-cdk/core'; +import { Construct, Node } from 'constructs'; import { Grant } from './grant'; import { CfnRole } from './iam.generated'; import { IIdentity } from './identity-base'; @@ -423,7 +424,7 @@ export class Role extends Resource implements IRole { */ public withoutPolicyUpdates(): IRole { if (!this.immutableRole) { - this.immutableRole = new ImmutableRole(this.node.scope as Construct, `ImmutableRole${this.node.id}`, this); + this.immutableRole = new ImmutableRole(Node.of(this).scope as Construct, `ImmutableRole${this.node.id}`, this); } return this.immutableRole; diff --git a/packages/@aws-cdk/aws-iam/lib/unknown-principal.ts b/packages/@aws-cdk/aws-iam/lib/unknown-principal.ts index 1228ba26ff585..7b06dd27fe381 100644 --- a/packages/@aws-cdk/aws-iam/lib/unknown-principal.ts +++ b/packages/@aws-cdk/aws-iam/lib/unknown-principal.ts @@ -1,4 +1,5 @@ -import { Annotations, ConcreteDependable, IConstruct, Stack } from '@aws-cdk/core'; +import { Annotations, ConcreteDependable, Stack } from '@aws-cdk/core'; +import { IConstruct, Node } from 'constructs'; import { PolicyStatement } from './policy-statement'; import { AddToPrincipalPolicyResult, IPrincipal, PrincipalPolicyFragment } from './principals'; @@ -34,7 +35,7 @@ export class UnknownPrincipal implements IPrincipal { } public get policyFragment(): PrincipalPolicyFragment { - throw new Error(`Cannot get policy fragment of ${this.resource.node.path}, resource imported without a role`); + throw new Error(`Cannot get policy fragment of ${Node.of(this.resource).path}, resource imported without a role`); } public addToPrincipalPolicy(statement: PolicyStatement): AddToPrincipalPolicyResult { diff --git a/packages/@aws-cdk/aws-iam/lib/user.ts b/packages/@aws-cdk/aws-iam/lib/user.ts index 1491d2c454e70..aec5bf735c0ad 100644 --- a/packages/@aws-cdk/aws-iam/lib/user.ts +++ b/packages/@aws-cdk/aws-iam/lib/user.ts @@ -1,4 +1,5 @@ -import { Aws, Construct, Lazy, Resource, SecretValue, Stack } from '@aws-cdk/core'; +import { Aws, Lazy, Resource, SecretValue, Stack } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { IGroup } from './group'; import { CfnUser } from './iam.generated'; import { IIdentity } from './identity-base'; diff --git a/packages/@aws-cdk/aws-iam/lib/util.ts b/packages/@aws-cdk/aws-iam/lib/util.ts index 74f7aebed294c..545d5bc9de439 100644 --- a/packages/@aws-cdk/aws-iam/lib/util.ts +++ b/packages/@aws-cdk/aws-iam/lib/util.ts @@ -1,4 +1,5 @@ -import { DefaultTokenResolver, IConstruct, Lazy, StringConcat, Tokenization } from '@aws-cdk/core'; +import { DefaultTokenResolver, Lazy, StringConcat, Tokenization } from '@aws-cdk/core'; +import { IConstruct } from 'constructs'; import { IPolicy } from './policy'; const MAX_POLICY_NAME_LEN = 128; diff --git a/packages/@aws-cdk/aws-iam/package.json b/packages/@aws-cdk/aws-iam/package.json index b7846eef1d72f..06752ea376812 100644 --- a/packages/@aws-cdk/aws-iam/package.json +++ b/packages/@aws-cdk/aws-iam/package.json @@ -53,6 +53,9 @@ }, "cdk-build": { "cloudformation": "AWS::IAM", + "env": { + "AWSLINT_BASE_CONSTRUCT": "true" + }, "jest": true }, "keywords": [ diff --git a/packages/@aws-cdk/aws-imagebuilder/package.json b/packages/@aws-cdk/aws-imagebuilder/package.json index f17015d928177..256a3b079a760 100644 --- a/packages/@aws-cdk/aws-imagebuilder/package.json +++ b/packages/@aws-cdk/aws-imagebuilder/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::ImageBuilder", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-inspector/package.json b/packages/@aws-cdk/aws-inspector/package.json index 2fbbedd97ff9b..bc46eef38a438 100644 --- a/packages/@aws-cdk/aws-inspector/package.json +++ b/packages/@aws-cdk/aws-inspector/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::Inspector", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-iot/package.json b/packages/@aws-cdk/aws-iot/package.json index 6d132bd45659d..b9d7a26a10987 100644 --- a/packages/@aws-cdk/aws-iot/package.json +++ b/packages/@aws-cdk/aws-iot/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::IoT", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-iot1click/package.json b/packages/@aws-cdk/aws-iot1click/package.json index 852a47810aac3..34f6ad2fc8b5c 100644 --- a/packages/@aws-cdk/aws-iot1click/package.json +++ b/packages/@aws-cdk/aws-iot1click/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::IoT1Click", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-iotanalytics/package.json b/packages/@aws-cdk/aws-iotanalytics/package.json index 90de984540ef8..02bffc449abc1 100644 --- a/packages/@aws-cdk/aws-iotanalytics/package.json +++ b/packages/@aws-cdk/aws-iotanalytics/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::IoTAnalytics", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-iotevents/package.json b/packages/@aws-cdk/aws-iotevents/package.json index 804b64832bd44..299bbb8da8861 100644 --- a/packages/@aws-cdk/aws-iotevents/package.json +++ b/packages/@aws-cdk/aws-iotevents/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::IoTEvents", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-iotthingsgraph/package.json b/packages/@aws-cdk/aws-iotthingsgraph/package.json index fa35752c6d52c..26e80a170a192 100644 --- a/packages/@aws-cdk/aws-iotthingsgraph/package.json +++ b/packages/@aws-cdk/aws-iotthingsgraph/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::IoTThingsGraph", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-kendra/package.json b/packages/@aws-cdk/aws-kendra/package.json index bcc7bca3f8554..1e94ce21c0553 100644 --- a/packages/@aws-cdk/aws-kendra/package.json +++ b/packages/@aws-cdk/aws-kendra/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::Kendra", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-kinesis/lib/stream.ts b/packages/@aws-cdk/aws-kinesis/lib/stream.ts index 98f60e401eb5f..90263b9d0286a 100644 --- a/packages/@aws-cdk/aws-kinesis/lib/stream.ts +++ b/packages/@aws-cdk/aws-kinesis/lib/stream.ts @@ -1,6 +1,7 @@ import * as iam from '@aws-cdk/aws-iam'; import * as kms from '@aws-cdk/aws-kms'; -import { Aws, CfnCondition, Construct, Duration, Fn, IResolvable, IResource, Resource, Stack, Token } from '@aws-cdk/core'; +import { Aws, CfnCondition, Duration, Fn, IResolvable, IResource, Resource, Stack, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnStream } from './kinesis.generated'; const READ_OPERATIONS = [ diff --git a/packages/@aws-cdk/aws-kinesis/package.json b/packages/@aws-cdk/aws-kinesis/package.json index a6cb174544b72..b4e7c21809883 100644 --- a/packages/@aws-cdk/aws-kinesis/package.json +++ b/packages/@aws-cdk/aws-kinesis/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::Kinesis", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-kinesisanalytics/package.json b/packages/@aws-cdk/aws-kinesisanalytics/package.json index 5758ba9abaabd..020baefcf1f97 100644 --- a/packages/@aws-cdk/aws-kinesisanalytics/package.json +++ b/packages/@aws-cdk/aws-kinesisanalytics/package.json @@ -56,7 +56,10 @@ "AWS::KinesisAnalytics", "AWS::KinesisAnalyticsV2" ], - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-kinesisfirehose/package.json b/packages/@aws-cdk/aws-kinesisfirehose/package.json index c6e59d002e10f..dac3480ca17bb 100644 --- a/packages/@aws-cdk/aws-kinesisfirehose/package.json +++ b/packages/@aws-cdk/aws-kinesisfirehose/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::KinesisFirehose", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-kms/lib/alias.ts b/packages/@aws-cdk/aws-kms/lib/alias.ts index 8525bdc2f6549..7e622ef95fae9 100644 --- a/packages/@aws-cdk/aws-kms/lib/alias.ts +++ b/packages/@aws-cdk/aws-kms/lib/alias.ts @@ -1,5 +1,6 @@ import * as iam from '@aws-cdk/aws-iam'; -import { Construct, RemovalPolicy, Resource, Stack, Token } from '@aws-cdk/core'; +import { RemovalPolicy, Resource, Stack, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { IKey } from './key'; import { CfnAlias } from './kms.generated'; diff --git a/packages/@aws-cdk/aws-kms/lib/key.ts b/packages/@aws-cdk/aws-kms/lib/key.ts index cad47395d791b..5dbf1aa54191a 100644 --- a/packages/@aws-cdk/aws-kms/lib/key.ts +++ b/packages/@aws-cdk/aws-kms/lib/key.ts @@ -1,5 +1,6 @@ import * as iam from '@aws-cdk/aws-iam'; -import { Construct, IConstruct, IResource, RemovalPolicy, Resource, Stack } from '@aws-cdk/core'; +import { IResource, RemovalPolicy, Resource, Stack } from '@aws-cdk/core'; +import { IConstruct, Construct } from 'constructs'; import { Alias } from './alias'; import { CfnKey } from './kms.generated'; @@ -208,7 +209,7 @@ abstract class KeyBase extends Resource implements IKey { */ private granteeStackDependsOnKeyStack(grantee: iam.IGrantable): string | undefined { const grantPrincipal = grantee.grantPrincipal; - if (!(Construct.isConstruct(grantPrincipal))) { + if (!(grantPrincipal instanceof Construct)) { return undefined; } // this logic should only apply to newly created @@ -236,7 +237,7 @@ abstract class KeyBase extends Resource implements IKey { } private isGranteeFromAnotherRegion(grantee: iam.IGrantable): boolean { - if (!(Construct.isConstruct(grantee))) { + if (!(grantee instanceof Construct)) { return false; } const bucketStack = Stack.of(this); @@ -245,7 +246,7 @@ abstract class KeyBase extends Resource implements IKey { } private isGranteeFromAnotherAccount(grantee: iam.IGrantable): boolean { - if (!(Construct.isConstruct(grantee))) { + if (!(grantee instanceof Construct)) { return false; } const bucketStack = Stack.of(this); diff --git a/packages/@aws-cdk/aws-kms/package.json b/packages/@aws-cdk/aws-kms/package.json index 79afde054eab0..6d59d572727a9 100644 --- a/packages/@aws-cdk/aws-kms/package.json +++ b/packages/@aws-cdk/aws-kms/package.json @@ -52,7 +52,10 @@ "compat": "cdk-compat" }, "cdk-build": { - "cloudformation": "AWS::KMS" + "cloudformation": "AWS::KMS", + "env": { + "AWSLINT_BASE_CONSTRUCT": "true" + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-lakeformation/package.json b/packages/@aws-cdk/aws-lakeformation/package.json index d1078df39b644..461b0aff0c1b0 100644 --- a/packages/@aws-cdk/aws-lakeformation/package.json +++ b/packages/@aws-cdk/aws-lakeformation/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::LakeFormation", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-lambda/lib/alias.ts b/packages/@aws-cdk/aws-lambda/lib/alias.ts index dc330db3f7ec9..3e22118644ac6 100644 --- a/packages/@aws-cdk/aws-lambda/lib/alias.ts +++ b/packages/@aws-cdk/aws-lambda/lib/alias.ts @@ -1,7 +1,7 @@ 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 { Construct } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { EventInvokeConfigOptions } from './event-invoke-config'; import { IFunction, QualifiedFunctionBase } from './function-base'; import { extractQualifierFromArn, IVersion } from './lambda-version'; diff --git a/packages/@aws-cdk/aws-lambda/lib/event-invoke-config.ts b/packages/@aws-cdk/aws-lambda/lib/event-invoke-config.ts index ca2c148001d93..6c2419c6f8fd5 100644 --- a/packages/@aws-cdk/aws-lambda/lib/event-invoke-config.ts +++ b/packages/@aws-cdk/aws-lambda/lib/event-invoke-config.ts @@ -1,4 +1,5 @@ -import { Construct, Duration, Resource } from '@aws-cdk/core'; +import { Duration, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { DestinationType, IDestination } from './destination'; import { IFunction } from './function-base'; import { CfnEventInvokeConfig } from './lambda.generated'; diff --git a/packages/@aws-cdk/aws-lambda/lib/event-source-mapping.ts b/packages/@aws-cdk/aws-lambda/lib/event-source-mapping.ts index a9fbc97bdea0e..3fdefc2b16e42 100644 --- a/packages/@aws-cdk/aws-lambda/lib/event-source-mapping.ts +++ b/packages/@aws-cdk/aws-lambda/lib/event-source-mapping.ts @@ -1,4 +1,5 @@ import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { IEventSourceDlq } from './dlq'; import { IFunction } from './function-base'; import { CfnEventSourceMapping } from './lambda.generated'; @@ -139,7 +140,7 @@ export class EventSourceMapping extends cdk.Resource implements IEventSourceMapp /** * Import an event source into this stack from its event source id. */ - public static fromEventSourceMappingId(scope: cdk.Construct, id: string, eventSourceMappingId: string): IEventSourceMapping { + public static fromEventSourceMappingId(scope: Construct, id: string, eventSourceMappingId: string): IEventSourceMapping { class Import extends cdk.Resource implements IEventSourceMapping { public readonly eventSourceMappingId = eventSourceMappingId; } @@ -148,7 +149,7 @@ export class EventSourceMapping extends cdk.Resource implements IEventSourceMapp public readonly eventSourceMappingId: string; - constructor(scope: cdk.Construct, id: string, props: EventSourceMappingProps) { + constructor(scope: Construct, id: string, props: EventSourceMappingProps) { super(scope, id); if (props.maxBatchingWindow && props.maxBatchingWindow.toSeconds() > 300) { diff --git a/packages/@aws-cdk/aws-lambda/lib/function.ts b/packages/@aws-cdk/aws-lambda/lib/function.ts index b7a6546077c26..dd16d89b54db8 100644 --- a/packages/@aws-cdk/aws-lambda/lib/function.ts +++ b/packages/@aws-cdk/aws-lambda/lib/function.ts @@ -4,7 +4,8 @@ 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 sqs from '@aws-cdk/aws-sqs'; -import { Annotations, CfnResource, Construct, Duration, Fn, Lazy, Stack } from '@aws-cdk/core'; +import { Annotations, CfnResource, Duration, Fn, Lazy, Stack } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { Code, CodeConfig } from './code'; import { EventInvokeConfigOptions } from './event-invoke-config'; import { IEventSource } from './event-source'; diff --git a/packages/@aws-cdk/aws-lambda/lib/lambda-version.ts b/packages/@aws-cdk/aws-lambda/lib/lambda-version.ts index b62523fd0ef45..2156b2d87cfb5 100644 --- a/packages/@aws-cdk/aws-lambda/lib/lambda-version.ts +++ b/packages/@aws-cdk/aws-lambda/lib/lambda-version.ts @@ -1,5 +1,6 @@ import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { Construct, Fn, Lazy, RemovalPolicy } from '@aws-cdk/core'; +import { Fn, Lazy, RemovalPolicy } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { Alias, AliasOptions } from './alias'; import { EventInvokeConfigOptions } from './event-invoke-config'; import { Function } from './function'; diff --git a/packages/@aws-cdk/aws-lambda/lib/layers.ts b/packages/@aws-cdk/aws-lambda/lib/layers.ts index 03e120223deba..12a92140b511a 100644 --- a/packages/@aws-cdk/aws-lambda/lib/layers.ts +++ b/packages/@aws-cdk/aws-lambda/lib/layers.ts @@ -1,4 +1,5 @@ -import { Construct, IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { Code } from './code'; import { CfnLayerVersion, CfnLayerVersionPermission } from './lambda.generated'; import { Runtime } from './runtime'; diff --git a/packages/@aws-cdk/aws-lambda/lib/log-retention.ts b/packages/@aws-cdk/aws-lambda/lib/log-retention.ts index fed62dc2563ba..e499764f96e20 100644 --- a/packages/@aws-cdk/aws-lambda/lib/log-retention.ts +++ b/packages/@aws-cdk/aws-lambda/lib/log-retention.ts @@ -1,5 +1,5 @@ import * as logs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; /** * Retry options for all AWS API calls. @@ -25,7 +25,7 @@ export interface LogRetentionProps extends logs.LogRetentionProps { * @deprecated use `LogRetention` from '@aws-cdk/aws-logs' instead */ export class LogRetention extends logs.LogRetention { - constructor(scope: cdk.Construct, id: string, props: LogRetentionProps) { + constructor(scope: Construct, id: string, props: LogRetentionProps) { super(scope, id, { ...props }); } } diff --git a/packages/@aws-cdk/aws-lambda/lib/singleton-lambda.ts b/packages/@aws-cdk/aws-lambda/lib/singleton-lambda.ts index 9a8e54472232a..170f1f3e37573 100644 --- a/packages/@aws-cdk/aws-lambda/lib/singleton-lambda.ts +++ b/packages/@aws-cdk/aws-lambda/lib/singleton-lambda.ts @@ -1,5 +1,6 @@ import * as iam from '@aws-cdk/aws-iam'; import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { Function as LambdaFunction, FunctionProps } from './function'; import { FunctionBase } from './function-base'; import { Version } from './lambda-version'; @@ -48,7 +49,7 @@ export class SingletonFunction extends FunctionBase { protected readonly canCreatePermissions: boolean; private lambdaFunction: LambdaFunction; - constructor(scope: cdk.Construct, id: string, props: SingletonFunctionProps) { + constructor(scope: Construct, id: string, props: SingletonFunctionProps) { super(scope, id); this.lambdaFunction = this.ensureLambda(props); diff --git a/packages/@aws-cdk/aws-lambda/lib/util.ts b/packages/@aws-cdk/aws-lambda/lib/util.ts index 16b56e524094c..fd5aa246e63cc 100644 --- a/packages/@aws-cdk/aws-lambda/lib/util.ts +++ b/packages/@aws-cdk/aws-lambda/lib/util.ts @@ -1,4 +1,4 @@ -import { Construct } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { Alias, AliasOptions } from './alias'; import { IVersion } from './lambda-version'; diff --git a/packages/@aws-cdk/aws-lambda/package.json b/packages/@aws-cdk/aws-lambda/package.json index f1394d8950f0a..331234b9f47dc 100644 --- a/packages/@aws-cdk/aws-lambda/package.json +++ b/packages/@aws-cdk/aws-lambda/package.json @@ -52,7 +52,10 @@ "compat": "cdk-compat" }, "cdk-build": { - "cloudformation": "AWS::Lambda" + "cloudformation": "AWS::Lambda", + "env": { + "AWSLINT_BASE_CONSTRUCT": "true" + } }, "nyc": { "statements": 75, diff --git a/packages/@aws-cdk/aws-logs/lib/cross-account-destination.ts b/packages/@aws-cdk/aws-logs/lib/cross-account-destination.ts index b453561e6959f..0f428fb03bc77 100644 --- a/packages/@aws-cdk/aws-logs/lib/cross-account-destination.ts +++ b/packages/@aws-cdk/aws-logs/lib/cross-account-destination.ts @@ -1,5 +1,6 @@ import * as iam from '@aws-cdk/aws-iam'; import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { ILogGroup } from './log-group'; import { CfnDestination } from './logs.generated'; import { ILogSubscriptionDestination, LogSubscriptionDestinationConfig } from './subscription-filter'; @@ -64,7 +65,7 @@ export class CrossAccountDestination extends cdk.Resource implements ILogSubscri */ private readonly resource: CfnDestination; - constructor(scope: cdk.Construct, id: string, props: CrossAccountDestinationProps) { + constructor(scope: Construct, id: string, props: CrossAccountDestinationProps) { super(scope, id, { physicalName: props.destinationName || // In the underlying model, the name is not optional, but we make it so anyway. diff --git a/packages/@aws-cdk/aws-logs/lib/log-group.ts b/packages/@aws-cdk/aws-logs/lib/log-group.ts index 6a5ab9a8847a0..e041b16b29bbd 100644 --- a/packages/@aws-cdk/aws-logs/lib/log-group.ts +++ b/packages/@aws-cdk/aws-logs/lib/log-group.ts @@ -1,6 +1,7 @@ import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; import * as iam from '@aws-cdk/aws-iam'; -import { Construct, IResource, RemovalPolicy, Resource, Stack, Token } from '@aws-cdk/core'; +import { IResource, 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'; diff --git a/packages/@aws-cdk/aws-logs/lib/log-retention.ts b/packages/@aws-cdk/aws-logs/lib/log-retention.ts index 98e23a95d6199..97ea68276b00c 100644 --- a/packages/@aws-cdk/aws-logs/lib/log-retention.ts +++ b/packages/@aws-cdk/aws-logs/lib/log-retention.ts @@ -2,6 +2,7 @@ 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 { Construct } from 'constructs'; import { RetentionDays } from './log-group'; /** @@ -71,7 +72,7 @@ export class LogRetention extends cdk.Construct { */ public readonly logGroupArn: string; - constructor(scope: cdk.Construct, id: string, props: LogRetentionProps) { + constructor(scope: Construct, id: string, props: LogRetentionProps) { super(scope, id); // Custom resource provider @@ -126,7 +127,7 @@ export class LogRetention extends cdk.Construct { class LogRetentionFunction extends cdk.Construct { public readonly functionArn: cdk.Reference; - constructor(scope: cdk.Construct, id: string, props: LogRetentionProps) { + constructor(scope: Construct, id: string, props: LogRetentionProps) { super(scope, id); // Code diff --git a/packages/@aws-cdk/aws-logs/lib/log-stream.ts b/packages/@aws-cdk/aws-logs/lib/log-stream.ts index 952f979577da5..d6e072da8c3d6 100644 --- a/packages/@aws-cdk/aws-logs/lib/log-stream.ts +++ b/packages/@aws-cdk/aws-logs/lib/log-stream.ts @@ -1,4 +1,5 @@ -import { Construct, IResource, RemovalPolicy, Resource } from '@aws-cdk/core'; +import { IResource, RemovalPolicy, Resource } from '@aws-cdk/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/aws-logs/lib/metric-filter.ts index 3b8fe826d053e..8dda5f1728fd3 100644 --- a/packages/@aws-cdk/aws-logs/lib/metric-filter.ts +++ b/packages/@aws-cdk/aws-logs/lib/metric-filter.ts @@ -1,5 +1,6 @@ import { Metric, MetricOptions } from '@aws-cdk/aws-cloudwatch'; -import { Construct, Resource } from '@aws-cdk/core'; +import { Resource } from '@aws-cdk/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/subscription-filter.ts b/packages/@aws-cdk/aws-logs/lib/subscription-filter.ts index 8dd397f0fa76f..290534ea97f97 100644 --- a/packages/@aws-cdk/aws-logs/lib/subscription-filter.ts +++ b/packages/@aws-cdk/aws-logs/lib/subscription-filter.ts @@ -1,8 +1,13 @@ import * as iam from '@aws-cdk/aws-iam'; -import { Construct, Resource } from '@aws-cdk/core'; +import { Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { ILogGroup, SubscriptionFilterOptions } from './log-group'; import { CfnSubscriptionFilter } from './logs.generated'; +// v2 - keep this section separate to reduce merge conflicts when merging forwrad into v2 branch +// eslint-disable-next-line +import { Construct as CoreConstruct } from '@aws-cdk/core'; + /** * Interface for classes that can be the destination of a log Subscription */ @@ -17,7 +22,7 @@ export interface ILogSubscriptionDestination { * The destination may reconfigure its own permissions in response to this * function call. */ - bind(scope: Construct, sourceLogGroup: ILogGroup): LogSubscriptionDestinationConfig; + bind(scope: CoreConstruct, sourceLogGroup: ILogGroup): LogSubscriptionDestinationConfig; } /** diff --git a/packages/@aws-cdk/aws-logs/package.json b/packages/@aws-cdk/aws-logs/package.json index a4eadfdeba946..c2551e40f7b8e 100644 --- a/packages/@aws-cdk/aws-logs/package.json +++ b/packages/@aws-cdk/aws-logs/package.json @@ -52,7 +52,10 @@ "compat": "cdk-compat" }, "cdk-build": { - "cloudformation": "AWS::Logs" + "cloudformation": "AWS::Logs", + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-macie/package.json b/packages/@aws-cdk/aws-macie/package.json index 8bb07789a9ec1..88f4023ea790e 100644 --- a/packages/@aws-cdk/aws-macie/package.json +++ b/packages/@aws-cdk/aws-macie/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::Macie", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-managedblockchain/package.json b/packages/@aws-cdk/aws-managedblockchain/package.json index 78450647f4a65..11963c04905d8 100644 --- a/packages/@aws-cdk/aws-managedblockchain/package.json +++ b/packages/@aws-cdk/aws-managedblockchain/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::ManagedBlockchain", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-mediaconvert/package.json b/packages/@aws-cdk/aws-mediaconvert/package.json index df167a7059c03..90371cff4644f 100644 --- a/packages/@aws-cdk/aws-mediaconvert/package.json +++ b/packages/@aws-cdk/aws-mediaconvert/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::MediaConvert", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-medialive/package.json b/packages/@aws-cdk/aws-medialive/package.json index 523db6cdb0951..ce03aa8f8559d 100644 --- a/packages/@aws-cdk/aws-medialive/package.json +++ b/packages/@aws-cdk/aws-medialive/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::MediaLive", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-mediastore/package.json b/packages/@aws-cdk/aws-mediastore/package.json index 2fae56bae9d03..1d0e9516ac62f 100644 --- a/packages/@aws-cdk/aws-mediastore/package.json +++ b/packages/@aws-cdk/aws-mediastore/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::MediaStore", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-msk/package.json b/packages/@aws-cdk/aws-msk/package.json index 6ea82b33f9988..c2b82ed9b62d0 100644 --- a/packages/@aws-cdk/aws-msk/package.json +++ b/packages/@aws-cdk/aws-msk/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::MSK", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-neptune/package.json b/packages/@aws-cdk/aws-neptune/package.json index f7293686b7aaa..4d99679cc9705 100644 --- a/packages/@aws-cdk/aws-neptune/package.json +++ b/packages/@aws-cdk/aws-neptune/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::Neptune", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-networkmanager/package.json b/packages/@aws-cdk/aws-networkmanager/package.json index 7112c40b8da86..472734536bacb 100644 --- a/packages/@aws-cdk/aws-networkmanager/package.json +++ b/packages/@aws-cdk/aws-networkmanager/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::NetworkManager", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-opsworks/package.json b/packages/@aws-cdk/aws-opsworks/package.json index 2962110e06cce..b33783b40cb45 100644 --- a/packages/@aws-cdk/aws-opsworks/package.json +++ b/packages/@aws-cdk/aws-opsworks/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::OpsWorks", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-opsworkscm/package.json b/packages/@aws-cdk/aws-opsworkscm/package.json index 8ed560f9bc326..107aa2d9a4f47 100644 --- a/packages/@aws-cdk/aws-opsworkscm/package.json +++ b/packages/@aws-cdk/aws-opsworkscm/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::OpsWorksCM", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-pinpoint/package.json b/packages/@aws-cdk/aws-pinpoint/package.json index b2212b78cabf0..fd660c7d8e04c 100644 --- a/packages/@aws-cdk/aws-pinpoint/package.json +++ b/packages/@aws-cdk/aws-pinpoint/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::Pinpoint", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-pinpointemail/package.json b/packages/@aws-cdk/aws-pinpointemail/package.json index b0f9756f2a08c..ec43537f13f82 100644 --- a/packages/@aws-cdk/aws-pinpointemail/package.json +++ b/packages/@aws-cdk/aws-pinpointemail/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::PinpointEmail", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-qldb/package.json b/packages/@aws-cdk/aws-qldb/package.json index 7fe121a6b482f..158598e00ac11 100644 --- a/packages/@aws-cdk/aws-qldb/package.json +++ b/packages/@aws-cdk/aws-qldb/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::QLDB", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-ram/package.json b/packages/@aws-cdk/aws-ram/package.json index fc5fd391233f6..aee469902f46c 100644 --- a/packages/@aws-cdk/aws-ram/package.json +++ b/packages/@aws-cdk/aws-ram/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::RAM", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-redshift/lib/cluster.ts b/packages/@aws-cdk/aws-redshift/lib/cluster.ts index 98a3257924863..0856766b99fb9 100644 --- a/packages/@aws-cdk/aws-redshift/lib/cluster.ts +++ b/packages/@aws-cdk/aws-redshift/lib/cluster.ts @@ -3,7 +3,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 secretsmanager from '@aws-cdk/aws-secretsmanager'; -import { Construct, Duration, IResource, RemovalPolicy, Resource, SecretValue, Token } from '@aws-cdk/core'; +import { Duration, IResource, RemovalPolicy, Resource, SecretValue, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { DatabaseSecret } from './database-secret'; import { Endpoint } from './endpoint'; import { IClusterParameterGroup } from './parameter-group'; diff --git a/packages/@aws-cdk/aws-redshift/lib/database-secret.ts b/packages/@aws-cdk/aws-redshift/lib/database-secret.ts index 7e7617be2be83..2476bfef3f7e0 100644 --- a/packages/@aws-cdk/aws-redshift/lib/database-secret.ts +++ b/packages/@aws-cdk/aws-redshift/lib/database-secret.ts @@ -1,6 +1,6 @@ import * as kms from '@aws-cdk/aws-kms'; import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import { Construct } from '@aws-cdk/core'; +import { Construct } from 'constructs'; /** * Construction properties for a DatabaseSecret. diff --git a/packages/@aws-cdk/aws-redshift/lib/parameter-group.ts b/packages/@aws-cdk/aws-redshift/lib/parameter-group.ts index 9c7f702395790..7fb570bc23ce6 100644 --- a/packages/@aws-cdk/aws-redshift/lib/parameter-group.ts +++ b/packages/@aws-cdk/aws-redshift/lib/parameter-group.ts @@ -1,4 +1,5 @@ -import { Construct, IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnClusterParameterGroup } from './redshift.generated'; /** diff --git a/packages/@aws-cdk/aws-redshift/lib/subnet-group.ts b/packages/@aws-cdk/aws-redshift/lib/subnet-group.ts index b8ef551ad5834..1d4a6cbb25eca 100644 --- a/packages/@aws-cdk/aws-redshift/lib/subnet-group.ts +++ b/packages/@aws-cdk/aws-redshift/lib/subnet-group.ts @@ -1,5 +1,6 @@ import * as ec2 from '@aws-cdk/aws-ec2'; -import { Construct, IResource, RemovalPolicy, Resource } from '@aws-cdk/core'; +import { IResource, RemovalPolicy, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnClusterSubnetGroup } from './redshift.generated'; /** diff --git a/packages/@aws-cdk/aws-redshift/package.json b/packages/@aws-cdk/aws-redshift/package.json index 77790ff7c4b93..77deed8ac0c8e 100644 --- a/packages/@aws-cdk/aws-redshift/package.json +++ b/packages/@aws-cdk/aws-redshift/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::Redshift", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-resourcegroups/package.json b/packages/@aws-cdk/aws-resourcegroups/package.json index cde5efc080d7b..bc9d79393aeaf 100644 --- a/packages/@aws-cdk/aws-resourcegroups/package.json +++ b/packages/@aws-cdk/aws-resourcegroups/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::ResourceGroups", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-robomaker/package.json b/packages/@aws-cdk/aws-robomaker/package.json index 49a3ec2db3b28..5baeb85f6582e 100644 --- a/packages/@aws-cdk/aws-robomaker/package.json +++ b/packages/@aws-cdk/aws-robomaker/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::RoboMaker", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-route53/lib/hosted-zone.ts b/packages/@aws-cdk/aws-route53/lib/hosted-zone.ts index 17dc716ff0f7b..b489ffdcb3584 100644 --- a/packages/@aws-cdk/aws-route53/lib/hosted-zone.ts +++ b/packages/@aws-cdk/aws-route53/lib/hosted-zone.ts @@ -1,6 +1,7 @@ import * as ec2 from '@aws-cdk/aws-ec2'; import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { Construct, ContextProvider, Duration, Lazy, Resource, Stack } from '@aws-cdk/core'; +import { ContextProvider, Duration, Lazy, Resource, Stack } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { HostedZoneProviderProps } from './hosted-zone-provider'; import { HostedZoneAttributes, IHostedZone } from './hosted-zone-ref'; import { CaaAmazonRecord, ZoneDelegationRecord } from './record-set'; diff --git a/packages/@aws-cdk/aws-route53/lib/record-set.ts b/packages/@aws-cdk/aws-route53/lib/record-set.ts index 5519d2a05ff8c..33aec19d9171b 100644 --- a/packages/@aws-cdk/aws-route53/lib/record-set.ts +++ b/packages/@aws-cdk/aws-route53/lib/record-set.ts @@ -1,4 +1,5 @@ -import { Construct, Duration, IResource, Resource, Token } from '@aws-cdk/core'; +import { Duration, IResource, Resource, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { IAliasRecordTarget } from './alias-record-target'; import { IHostedZone } from './hosted-zone-ref'; import { CfnRecordSet } from './route53.generated'; diff --git a/packages/@aws-cdk/aws-route53/package.json b/packages/@aws-cdk/aws-route53/package.json index 3ac3f2a68525c..4aa7c9084b782 100644 --- a/packages/@aws-cdk/aws-route53/package.json +++ b/packages/@aws-cdk/aws-route53/package.json @@ -52,7 +52,10 @@ "compat": "cdk-compat" }, "cdk-build": { - "cloudformation": "AWS::Route53" + "cloudformation": "AWS::Route53", + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-route53resolver/package.json b/packages/@aws-cdk/aws-route53resolver/package.json index 25016c99ea9ad..e0003ac9de3fc 100644 --- a/packages/@aws-cdk/aws-route53resolver/package.json +++ b/packages/@aws-cdk/aws-route53resolver/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::Route53Resolver", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-s3-assets/lib/asset.ts b/packages/@aws-cdk/aws-s3-assets/lib/asset.ts index 87c9c38cd3fc7..d1cb59520e0f0 100644 --- a/packages/@aws-cdk/aws-s3-assets/lib/asset.ts +++ b/packages/@aws-cdk/aws-s3-assets/lib/asset.ts @@ -6,6 +6,7 @@ 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 { toSymlinkFollow } from './compat'; const ARCHIVE_EXTENSIONS = ['.zip', '.jar']; @@ -110,7 +111,7 @@ export class Asset extends cdk.Construct implements cdk.IAsset { public readonly assetHash: string; - constructor(scope: cdk.Construct, id: string, props: AssetProps) { + constructor(scope: Construct, id: string, props: AssetProps) { super(scope, id); // stage the asset source (conditionally). diff --git a/packages/@aws-cdk/aws-s3-assets/package.json b/packages/@aws-cdk/aws-s3-assets/package.json index 0d50839a6e9e7..389e186eae655 100644 --- a/packages/@aws-cdk/aws-s3-assets/package.json +++ b/packages/@aws-cdk/aws-s3-assets/package.json @@ -51,7 +51,10 @@ "compat": "cdk-compat" }, "cdk-build": { - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts b/packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts index cdd4e1413f766..ad6bc3851c8db 100644 --- a/packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts +++ b/packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts @@ -6,6 +6,7 @@ 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 { Construct } from 'constructs'; import { ISource, SourceConfig } from './source'; const handlerCodeBundle = path.join(__dirname, '..', 'lambda', 'bundle.zip'); @@ -163,7 +164,7 @@ export interface BucketDeploymentProps { } export class BucketDeployment extends cdk.Construct { - constructor(scope: cdk.Construct, id: string, props: BucketDeploymentProps) { + constructor(scope: Construct, id: string, props: BucketDeploymentProps) { super(scope, id); if (props.distributionPaths && !props.distribution) { diff --git a/packages/@aws-cdk/aws-s3-deployment/package.json b/packages/@aws-cdk/aws-s3-deployment/package.json index 4639915267e90..429991c20e751 100644 --- a/packages/@aws-cdk/aws-s3-deployment/package.json +++ b/packages/@aws-cdk/aws-s3-deployment/package.json @@ -57,7 +57,10 @@ "test": [ "/bin/bash lambda/test.sh" ], - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-sagemaker/package.json b/packages/@aws-cdk/aws-sagemaker/package.json index db851cbf96644..efca2898af564 100644 --- a/packages/@aws-cdk/aws-sagemaker/package.json +++ b/packages/@aws-cdk/aws-sagemaker/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::SageMaker", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-sam/package.json b/packages/@aws-cdk/aws-sam/package.json index 46e05e90bb0f0..0d39f842f7b10 100644 --- a/packages/@aws-cdk/aws-sam/package.json +++ b/packages/@aws-cdk/aws-sam/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::Serverless", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-sdb/package.json b/packages/@aws-cdk/aws-sdb/package.json index 6287b044f5427..da9bc2cd9ab13 100644 --- a/packages/@aws-cdk/aws-sdb/package.json +++ b/packages/@aws-cdk/aws-sdb/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::SDB", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-secretsmanager/lib/policy.ts b/packages/@aws-cdk/aws-secretsmanager/lib/policy.ts index 54d6b2af5bb03..67769ed403399 100644 --- a/packages/@aws-cdk/aws-secretsmanager/lib/policy.ts +++ b/packages/@aws-cdk/aws-secretsmanager/lib/policy.ts @@ -1,5 +1,6 @@ import * as iam from '@aws-cdk/aws-iam'; -import { Construct, Resource } from '@aws-cdk/core'; +import { Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { ISecret } from './secret'; import { CfnResourcePolicy } from './secretsmanager.generated'; diff --git a/packages/@aws-cdk/aws-secretsmanager/lib/rotation-schedule.ts b/packages/@aws-cdk/aws-secretsmanager/lib/rotation-schedule.ts index ada35925d8b3a..49d6170004e71 100644 --- a/packages/@aws-cdk/aws-secretsmanager/lib/rotation-schedule.ts +++ b/packages/@aws-cdk/aws-secretsmanager/lib/rotation-schedule.ts @@ -1,5 +1,6 @@ import * as lambda from '@aws-cdk/aws-lambda'; -import { Construct, Duration, Resource } from '@aws-cdk/core'; +import { Duration, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { ISecret } from './secret'; import { CfnRotationSchedule } from './secretsmanager.generated'; diff --git a/packages/@aws-cdk/aws-secretsmanager/lib/secret-rotation.ts b/packages/@aws-cdk/aws-secretsmanager/lib/secret-rotation.ts index 6ef72114413cf..f4f24cd2b05e5 100644 --- a/packages/@aws-cdk/aws-secretsmanager/lib/secret-rotation.ts +++ b/packages/@aws-cdk/aws-secretsmanager/lib/secret-rotation.ts @@ -1,9 +1,14 @@ 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 { Construct, Duration, Stack, Token } from '@aws-cdk/core'; +import { Duration, Stack, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { ISecret } from './secret'; +// v2 - keep this import as a separate section to reduce merge conflict when forward merging with the v2 branch. +// eslint-disable-next-line +import { Construct as CoreConstruct } from '@aws-cdk/core'; + /** * Options for a SecretRotationApplication */ @@ -205,7 +210,7 @@ export interface SecretRotationProps { /** * Secret rotation for a service or database */ -export class SecretRotation extends Construct { +export class SecretRotation extends CoreConstruct { constructor(scope: Construct, id: string, props: SecretRotationProps) { super(scope, id); diff --git a/packages/@aws-cdk/aws-secretsmanager/lib/secret.ts b/packages/@aws-cdk/aws-secretsmanager/lib/secret.ts index 1e6bf8d2441a5..ad8e7d0fcf0ef 100644 --- a/packages/@aws-cdk/aws-secretsmanager/lib/secret.ts +++ b/packages/@aws-cdk/aws-secretsmanager/lib/secret.ts @@ -1,6 +1,7 @@ import * as iam from '@aws-cdk/aws-iam'; import * as kms from '@aws-cdk/aws-kms'; -import { Construct, IConstruct, IResource, RemovalPolicy, Resource, SecretValue, Stack, Token } from '@aws-cdk/core'; +import { IResource, RemovalPolicy, Resource, SecretValue, Stack, Token } from '@aws-cdk/core'; +import { IConstruct, Construct } from 'constructs'; import { ResourcePolicy } from './policy'; import { RotationSchedule, RotationScheduleOptions } from './rotation-schedule'; import * as secretsmanager from './secretsmanager.generated'; diff --git a/packages/@aws-cdk/aws-secretsmanager/package.json b/packages/@aws-cdk/aws-secretsmanager/package.json index 5283f7cc04c5f..12af802e6694b 100644 --- a/packages/@aws-cdk/aws-secretsmanager/package.json +++ b/packages/@aws-cdk/aws-secretsmanager/package.json @@ -53,7 +53,10 @@ "compat": "cdk-compat" }, "cdk-build": { - "cloudformation": "AWS::SecretsManager" + "cloudformation": "AWS::SecretsManager", + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-securityhub/package.json b/packages/@aws-cdk/aws-securityhub/package.json index 2465baa3de572..cd4ff6bbc426d 100644 --- a/packages/@aws-cdk/aws-securityhub/package.json +++ b/packages/@aws-cdk/aws-securityhub/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::SecurityHub", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-servicecatalog/package.json b/packages/@aws-cdk/aws-servicecatalog/package.json index a4c3b37f8e1ec..1e93e64585ef2 100644 --- a/packages/@aws-cdk/aws-servicecatalog/package.json +++ b/packages/@aws-cdk/aws-servicecatalog/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::ServiceCatalog", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/alias-target-instance.ts b/packages/@aws-cdk/aws-servicediscovery/lib/alias-target-instance.ts index 2e9eb90f105d6..a8302b5e1dbc9 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/alias-target-instance.ts +++ b/packages/@aws-cdk/aws-servicediscovery/lib/alias-target-instance.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { BaseInstanceProps, InstanceBase } from './instance'; import { NamespaceType } from './namespace'; import { DnsRecordType, IService, RoutingPolicy } from './service'; @@ -41,7 +41,7 @@ export class AliasTargetInstance extends InstanceBase { */ public readonly dnsName: string; - constructor(scope: cdk.Construct, id: string, props: AliasTargetInstanceProps) { + constructor(scope: Construct, id: string, props: AliasTargetInstanceProps) { super(scope, id); if (props.service.namespace.type === NamespaceType.HTTP) { diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/cname-instance.ts b/packages/@aws-cdk/aws-servicediscovery/lib/cname-instance.ts index 0810d4f6489c8..6d948119a4e73 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/cname-instance.ts +++ b/packages/@aws-cdk/aws-servicediscovery/lib/cname-instance.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { BaseInstanceProps, InstanceBase } from './instance'; import { NamespaceType } from './namespace'; import { DnsRecordType, IService } from './service'; @@ -46,7 +46,7 @@ export class CnameInstance extends InstanceBase { */ public readonly cname: string; - constructor(scope: cdk.Construct, id: string, props: CnameInstanceProps) { + constructor(scope: Construct, id: string, props: CnameInstanceProps) { super(scope, id); if (props.service.namespace.type === NamespaceType.HTTP) { diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/http-namespace.ts b/packages/@aws-cdk/aws-servicediscovery/lib/http-namespace.ts index bcb50a3961892..6b614f3f0bfa7 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/http-namespace.ts +++ b/packages/@aws-cdk/aws-servicediscovery/lib/http-namespace.ts @@ -1,4 +1,5 @@ -import { Construct, Resource } from '@aws-cdk/core'; +import { Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { BaseNamespaceProps, INamespace, NamespaceType } from './namespace'; import { BaseServiceProps, Service } from './service'; import { CfnHttpNamespace } from './servicediscovery.generated'; diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/ip-instance.ts b/packages/@aws-cdk/aws-servicediscovery/lib/ip-instance.ts index 85bf49bc896f9..e635fca07cee4 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/ip-instance.ts +++ b/packages/@aws-cdk/aws-servicediscovery/lib/ip-instance.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { BaseInstanceProps, InstanceBase } from './instance'; import { DnsRecordType, IService } from './service'; import { CfnInstance } from './servicediscovery.generated'; @@ -74,7 +74,7 @@ export class IpInstance extends InstanceBase { */ public readonly port: number; - constructor(scope: cdk.Construct, id: string, props: IpInstanceProps) { + constructor(scope: Construct, id: string, props: IpInstanceProps) { super(scope, id); const dnsRecordType = props.service.dnsRecordType; diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/non-ip-instance.ts b/packages/@aws-cdk/aws-servicediscovery/lib/non-ip-instance.ts index a59913200224a..7c51770155893 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/non-ip-instance.ts +++ b/packages/@aws-cdk/aws-servicediscovery/lib/non-ip-instance.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { BaseInstanceProps, InstanceBase } from './instance'; import { NamespaceType } from './namespace'; import { IService } from './service'; @@ -34,7 +34,7 @@ export class NonIpInstance extends InstanceBase { */ public readonly service: IService; - constructor(scope: cdk.Construct, id: string, props: NonIpInstanceProps) { + constructor(scope: Construct, id: string, props: NonIpInstanceProps) { super(scope, id); if (props.service.namespace.type !== NamespaceType.HTTP) { diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/private-dns-namespace.ts b/packages/@aws-cdk/aws-servicediscovery/lib/private-dns-namespace.ts index 1186bcda57e0e..c5b8332c3238c 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/private-dns-namespace.ts +++ b/packages/@aws-cdk/aws-servicediscovery/lib/private-dns-namespace.ts @@ -1,5 +1,6 @@ import * as ec2 from '@aws-cdk/aws-ec2'; -import { Construct, Resource } from '@aws-cdk/core'; +import { Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { BaseNamespaceProps, INamespace, NamespaceType } from './namespace'; import { DnsServiceProps, Service } from './service'; import { CfnPrivateDnsNamespace } from './servicediscovery.generated'; diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/public-dns-namespace.ts b/packages/@aws-cdk/aws-servicediscovery/lib/public-dns-namespace.ts index fdd9f1fdde570..431befda4c22d 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/public-dns-namespace.ts +++ b/packages/@aws-cdk/aws-servicediscovery/lib/public-dns-namespace.ts @@ -1,4 +1,5 @@ -import { Construct, Resource } from '@aws-cdk/core'; +import { Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { BaseNamespaceProps, INamespace, NamespaceType } from './namespace'; import { DnsServiceProps, Service } from './service'; import { CfnPublicDnsNamespace } from './servicediscovery.generated'; diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/service.ts b/packages/@aws-cdk/aws-servicediscovery/lib/service.ts index 9b7fa80466f8c..b0dce1b20c882 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/service.ts +++ b/packages/@aws-cdk/aws-servicediscovery/lib/service.ts @@ -1,5 +1,6 @@ import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import { Construct, Duration, IResource, Resource } from '@aws-cdk/core'; +import { Duration, IResource, Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { AliasTargetInstance } from './alias-target-instance'; import { CnameInstance, CnameInstanceBaseProps } from './cname-instance'; import { IInstance } from './instance'; diff --git a/packages/@aws-cdk/aws-servicediscovery/package.json b/packages/@aws-cdk/aws-servicediscovery/package.json index f90041bcfb1c7..11be7c8fc3b3a 100644 --- a/packages/@aws-cdk/aws-servicediscovery/package.json +++ b/packages/@aws-cdk/aws-servicediscovery/package.json @@ -52,7 +52,10 @@ "compat": "cdk-compat" }, "cdk-build": { - "cloudformation": "AWS::ServiceDiscovery" + "cloudformation": "AWS::ServiceDiscovery", + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "nyc": { "statements": 75 diff --git a/packages/@aws-cdk/aws-sns/lib/policy.ts b/packages/@aws-cdk/aws-sns/lib/policy.ts index 60aec85b13b8c..7d93d863a75f0 100644 --- a/packages/@aws-cdk/aws-sns/lib/policy.ts +++ b/packages/@aws-cdk/aws-sns/lib/policy.ts @@ -1,5 +1,6 @@ import { PolicyDocument } from '@aws-cdk/aws-iam'; -import { Construct, Resource } from '@aws-cdk/core'; +import { Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnTopicPolicy } from './sns.generated'; import { ITopic } from './topic-base'; diff --git a/packages/@aws-cdk/aws-sns/lib/subscription.ts b/packages/@aws-cdk/aws-sns/lib/subscription.ts index 9955260ef4797..88817b6db6fdd 100644 --- a/packages/@aws-cdk/aws-sns/lib/subscription.ts +++ b/packages/@aws-cdk/aws-sns/lib/subscription.ts @@ -1,6 +1,7 @@ import { PolicyStatement, ServicePrincipal } from '@aws-cdk/aws-iam'; import { IQueue } from '@aws-cdk/aws-sqs'; -import { Construct, Resource } from '@aws-cdk/core'; +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'; diff --git a/packages/@aws-cdk/aws-sns/lib/topic.ts b/packages/@aws-cdk/aws-sns/lib/topic.ts index 5f31cb93a88fc..fbabed25ecb51 100644 --- a/packages/@aws-cdk/aws-sns/lib/topic.ts +++ b/packages/@aws-cdk/aws-sns/lib/topic.ts @@ -1,5 +1,6 @@ import { IKey } from '@aws-cdk/aws-kms'; -import { Construct, Stack } from '@aws-cdk/core'; +import { Stack } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnTopic } from './sns.generated'; import { ITopic, TopicBase } from './topic-base'; diff --git a/packages/@aws-cdk/aws-sns/package.json b/packages/@aws-cdk/aws-sns/package.json index fcf94d3403f0f..b5baef7a3135a 100644 --- a/packages/@aws-cdk/aws-sns/package.json +++ b/packages/@aws-cdk/aws-sns/package.json @@ -55,7 +55,10 @@ "compat": "cdk-compat" }, "cdk-build": { - "cloudformation": "AWS::SNS" + "cloudformation": "AWS::SNS", + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-sqs/lib/policy.ts b/packages/@aws-cdk/aws-sqs/lib/policy.ts index 41aa3e8de7f7f..c5d323bf60c63 100644 --- a/packages/@aws-cdk/aws-sqs/lib/policy.ts +++ b/packages/@aws-cdk/aws-sqs/lib/policy.ts @@ -1,5 +1,6 @@ import { PolicyDocument } from '@aws-cdk/aws-iam'; -import { Construct, Resource } from '@aws-cdk/core'; +import { Resource } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { IQueue } from './queue-base'; import { CfnQueuePolicy } from './sqs.generated'; diff --git a/packages/@aws-cdk/aws-sqs/lib/queue.ts b/packages/@aws-cdk/aws-sqs/lib/queue.ts index d335da2c9120f..2d95f60f4748e 100644 --- a/packages/@aws-cdk/aws-sqs/lib/queue.ts +++ b/packages/@aws-cdk/aws-sqs/lib/queue.ts @@ -1,5 +1,6 @@ import * as kms from '@aws-cdk/aws-kms'; -import { Construct, Duration, Stack, Token } from '@aws-cdk/core'; +import { Duration, Stack, Token } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { IQueue, QueueAttributes, QueueBase } from './queue-base'; import { CfnQueue } from './sqs.generated'; import { validateProps } from './validate-props'; diff --git a/packages/@aws-cdk/aws-sqs/package.json b/packages/@aws-cdk/aws-sqs/package.json index 996743744aa5f..68b8431b6a80a 100644 --- a/packages/@aws-cdk/aws-sqs/package.json +++ b/packages/@aws-cdk/aws-sqs/package.json @@ -52,7 +52,10 @@ "compat": "cdk-compat" }, "cdk-build": { - "cloudformation": "AWS::SQS" + "cloudformation": "AWS::SQS", + "env": { + "AWSLINT_BASE_CONSTRUCT": "true" + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-ssm/lib/parameter.ts b/packages/@aws-cdk/aws-ssm/lib/parameter.ts index bc73278bfc267..416454c1ef8cc 100644 --- a/packages/@aws-cdk/aws-ssm/lib/parameter.ts +++ b/packages/@aws-cdk/aws-ssm/lib/parameter.ts @@ -3,8 +3,9 @@ import * as kms from '@aws-cdk/aws-kms'; import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import { CfnDynamicReference, CfnDynamicReferenceService, CfnParameter, - Construct, ContextProvider, Fn, IResource, Resource, Stack, Token, + Construct as CompatConstruct, ContextProvider, Fn, IResource, Resource, Stack, Token, } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import * as ssm from './ssm.generated'; import { arnForParameterName, AUTOGEN_MARKER } from './util'; @@ -324,7 +325,7 @@ export class StringParameter extends ParameterBase implements IStringParameter { const stringValue = attrs.version ? new CfnDynamicReference(CfnDynamicReferenceService.SSM, `${attrs.parameterName}:${attrs.version}`).toString() - : new CfnParameter(scope, `${id}.Parameter`, { type: `AWS::SSM::Parameter::Value<${type}>`, default: attrs.parameterName }).valueAsString; + : new CfnParameter(scope as CompatConstruct, `${id}.Parameter`, { type: `AWS::SSM::Parameter::Value<${type}>`, default: attrs.parameterName }).valueAsString; class Import extends ParameterBase { public readonly parameterName = attrs.parameterName; @@ -360,7 +361,7 @@ export class StringParameter extends ParameterBase implements IStringParameter { * Requires that the stack this scope is defined in will have explicit * account/region information. Otherwise, it will fail during synthesis. */ - public static valueFromLookup(scope: Construct, parameterName: string): string { + public static valueFromLookup(scope: CompatConstruct, parameterName: string): string { const value = ContextProvider.getValue(scope, { provider: cxschema.ContextProvider.SSM_PARAMETER_PROVIDER, props: { parameterName }, diff --git a/packages/@aws-cdk/aws-ssm/lib/util.ts b/packages/@aws-cdk/aws-ssm/lib/util.ts index 05d42ada96690..d023ef902282d 100644 --- a/packages/@aws-cdk/aws-ssm/lib/util.ts +++ b/packages/@aws-cdk/aws-ssm/lib/util.ts @@ -1,4 +1,5 @@ -import { IConstruct, Stack, Token } from '@aws-cdk/core'; +import { Stack, Token } from '@aws-cdk/core'; +import { IConstruct } from 'constructs'; export const AUTOGEN_MARKER = '$$autogen$$'; diff --git a/packages/@aws-cdk/aws-ssm/package.json b/packages/@aws-cdk/aws-ssm/package.json index d7021983ba7b3..3d06a2eedbf03 100644 --- a/packages/@aws-cdk/aws-ssm/package.json +++ b/packages/@aws-cdk/aws-ssm/package.json @@ -52,7 +52,10 @@ "compat": "cdk-compat" }, "cdk-build": { - "cloudformation": "AWS::SSM" + "cloudformation": "AWS::SSM", + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-sso/package.json b/packages/@aws-cdk/aws-sso/package.json index 97c4875ce58e8..c8960a4309e39 100644 --- a/packages/@aws-cdk/aws-sso/package.json +++ b/packages/@aws-cdk/aws-sso/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::SSO", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/activity.ts b/packages/@aws-cdk/aws-stepfunctions/lib/activity.ts index ef97f45e6f8b3..e40673730b1cf 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/activity.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/activity.ts @@ -1,6 +1,7 @@ import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; import * as iam from '@aws-cdk/aws-iam'; -import { Construct, IResource, Lazy, Resource, Stack } from '@aws-cdk/core'; +import { IResource, Lazy, Resource, Stack } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { CfnActivity } from './stepfunctions.generated'; /** diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/state-machine.ts b/packages/@aws-cdk/aws-stepfunctions/lib/state-machine.ts index 13a0b9ea5b7be..46ad90e48660d 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/state-machine.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/state-machine.ts @@ -1,7 +1,8 @@ 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, Construct, Duration, IResource, Resource, Stack } from '@aws-cdk/core'; +import { Arn, Duration, IResource, Resource, Stack } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { StateGraph } from './state-graph'; import { CfnStateMachine } from './stepfunctions.generated'; import { IChainable } from './types'; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/choice.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/choice.ts index df72fb16459ec..e2b3422d227be 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/choice.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/choice.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { Chain } from '../chain'; import { Condition } from '../condition'; import { IChainable, INextable } from '../types'; @@ -46,7 +46,7 @@ export interface ChoiceProps { export class Choice extends State { public readonly endStates: INextable[] = []; - constructor(scope: cdk.Construct, id: string, props: ChoiceProps = {}) { + constructor(scope: Construct, id: string, props: ChoiceProps = {}) { super(scope, id, props); } diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/custom-state.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/custom-state.ts index 005945a4ad20b..eccfad6e9bcc1 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/custom-state.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/custom-state.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { Chain } from '..'; import { IChainable, INextable } from '../types'; import { State } from './state'; @@ -28,7 +28,7 @@ export class CustomState extends State implements IChainable, INextable { */ private readonly stateJson: { [key: string]: any}; - constructor(scope: cdk.Construct, id: string, props: CustomStateProps) { + constructor(scope: Construct, id: string, props: CustomStateProps) { super(scope, id, {}); this.endStates = [this]; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/fail.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/fail.ts index 2f900e935bb62..f7b8e6b10e609 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/fail.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/fail.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { INextable } from '../types'; import { StateType } from './private/state-type'; import { State } from './state'; @@ -40,7 +40,7 @@ export class Fail extends State { private readonly error?: string; private readonly cause?: string; - constructor(scope: cdk.Construct, id: string, props: FailProps = {}) { + constructor(scope: Construct, id: string, props: FailProps = {}) { super(scope, id, props); this.error = props.error; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/map.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/map.ts index 08c375a62bf0b..e3f6e4800991f 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/map.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/map.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { Chain } from '../chain'; import { FieldUtils } from '../fields'; import { StateGraph } from '../state-graph'; @@ -101,7 +101,7 @@ export class Map extends State implements INextable { private readonly maxConcurrency: number | undefined; private readonly itemsPath?: string; - constructor(scope: cdk.Construct, id: string, props: MapProps = {}) { + constructor(scope: Construct, id: string, props: MapProps = {}) { super(scope, id, props); this.endStates = [this]; this.maxConcurrency = props.maxConcurrency; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/parallel.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/parallel.ts index 4bce7313377cf..70ac5819a6888 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/parallel.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/parallel.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { Chain } from '../chain'; import { StateGraph } from '../state-graph'; import { CatchProps, IChainable, INextable, RetryProps } from '../types'; @@ -58,7 +58,7 @@ export interface ParallelProps { export class Parallel extends State implements INextable { public readonly endStates: INextable[]; - constructor(scope: cdk.Construct, id: string, props: ParallelProps = {}) { + constructor(scope: Construct, id: string, props: ParallelProps = {}) { super(scope, id, props); this.endStates = [this]; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/pass.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/pass.ts index 01168a125b90e..de9b4d16aab01 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/pass.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/pass.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { Chain } from '../chain'; import { FieldUtils } from '../fields'; import { IChainable, INextable } from '../types'; @@ -123,7 +123,7 @@ export class Pass extends State implements INextable { private readonly result?: Result; - constructor(scope: cdk.Construct, id: string, props: PassProps = {}) { + constructor(scope: Construct, id: string, props: PassProps = {}) { super(scope, id, props); this.result = props.result; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts index d586a3e472d98..00334a0934323 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts @@ -1,4 +1,5 @@ import * as cdk from '@aws-cdk/core'; +import { IConstruct, Construct, Node } from 'constructs'; import { Condition } from '../condition'; import { JsonPath } from '../fields'; import { StateGraph } from '../state-graph'; @@ -63,14 +64,14 @@ export abstract class State extends cdk.Construct implements IChainable { /** * Add a prefix to the stateId of all States found in a construct tree */ - public static prefixStates(root: cdk.IConstruct, prefix: string) { + public static prefixStates(root: IConstruct, prefix: string) { const queue = [root]; while (queue.length > 0) { const el = queue.splice(0, 1)[0]!; if (isPrefixable(el)) { el.addPrefix(prefix); } - queue.push(...el.node.children); + queue.push(...Node.of(el).children); } } @@ -173,7 +174,7 @@ export abstract class State extends cdk.Construct implements IChainable { */ private readonly incomingStates: State[] = []; - constructor(scope: cdk.Construct, id: string, props: StateProps) { + constructor(scope: Construct, id: string, props: StateProps) { super(scope, id); this.startState = this; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/succeed.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/succeed.ts index 75d51840e0234..0017c9111b3ce 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/succeed.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/succeed.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { INextable } from '../types'; import { StateType } from './private/state-type'; import { State } from './state'; @@ -44,7 +44,7 @@ export interface SucceedProps { export class Succeed extends State { public readonly endStates: INextable[] = []; - constructor(scope: cdk.Construct, id: string, props: SucceedProps = {}) { + constructor(scope: Construct, id: string, props: SucceedProps = {}) { super(scope, id, props); } diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/task-base.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/task-base.ts index af076233f2747..f530113de2202 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/task-base.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/task-base.ts @@ -1,6 +1,7 @@ import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; import * as iam from '@aws-cdk/aws-iam'; import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { Chain } from '../chain'; import { StateGraph } from '../state-graph'; import { CatchProps, IChainable, INextable, RetryProps } from '../types'; @@ -95,7 +96,7 @@ export abstract class TaskStateBase extends State implements INextable { private readonly timeout?: cdk.Duration; private readonly heartbeat?: cdk.Duration; - constructor(scope: cdk.Construct, id: string, props: TaskStateBaseProps) { + constructor(scope: Construct, id: string, props: TaskStateBaseProps) { super(scope, id, props); this.endStates = [this]; this.timeout = props.timeout; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/task.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/task.ts index 29a1d6845aeb9..3c9fc1dca3fd7 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/task.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/task.ts @@ -1,5 +1,6 @@ import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { Chain } from '../chain'; import { FieldUtils } from '../fields'; import { StateGraph } from '../state-graph'; @@ -108,7 +109,7 @@ export class Task extends State implements INextable { private readonly timeout?: cdk.Duration; private readonly taskProps: StepFunctionsTaskConfig; - constructor(scope: cdk.Construct, id: string, props: TaskProps) { + constructor(scope: Construct, id: string, props: TaskProps) { super(scope, id, props); this.timeout = props.timeout; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/wait.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/wait.ts index 014879e7cabde..8386b3ce334b1 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/wait.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/wait.ts @@ -1,4 +1,5 @@ import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { Chain } from '../chain'; import { IChainable, INextable } from '../types'; import { StateType } from './private/state-type'; @@ -72,7 +73,7 @@ export class Wait extends State implements INextable { private readonly time: WaitTime; - constructor(scope: cdk.Construct, id: string, props: WaitProps) { + constructor(scope: Construct, id: string, props: WaitProps) { super(scope, id, props); this.time = props.time; diff --git a/packages/@aws-cdk/aws-stepfunctions/package.json b/packages/@aws-cdk/aws-stepfunctions/package.json index 77d086a781c31..c37edc6fca586 100644 --- a/packages/@aws-cdk/aws-stepfunctions/package.json +++ b/packages/@aws-cdk/aws-stepfunctions/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::StepFunctions", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-synthetics/lib/canary.ts b/packages/@aws-cdk/aws-synthetics/lib/canary.ts index d2adaf68a9335..d3f3d8ee16b43 100644 --- a/packages/@aws-cdk/aws-synthetics/lib/canary.ts +++ b/packages/@aws-cdk/aws-synthetics/lib/canary.ts @@ -3,6 +3,7 @@ import { Metric, MetricOptions } from '@aws-cdk/aws-cloudwatch'; import * as iam from '@aws-cdk/aws-iam'; import * as s3 from '@aws-cdk/aws-s3'; import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; import { Code } from './code'; import { Schedule } from './schedule'; import { CfnCanary } from './synthetics.generated'; @@ -224,7 +225,7 @@ export class Canary extends cdk.Resource { */ public readonly artifactsBucket: s3.IBucket; - public constructor(scope: cdk.Construct, id: string, props: CanaryProps) { + public constructor(scope: Construct, id: string, props: CanaryProps) { if (props.canaryName && !cdk.Token.isUnresolved(props.canaryName)) { validateName(props.canaryName); } diff --git a/packages/@aws-cdk/aws-synthetics/package.json b/packages/@aws-cdk/aws-synthetics/package.json index 55611139e5af8..3c53ad9c2bfa8 100644 --- a/packages/@aws-cdk/aws-synthetics/package.json +++ b/packages/@aws-cdk/aws-synthetics/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::Synthetics", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-transfer/package.json b/packages/@aws-cdk/aws-transfer/package.json index e198102ef0d05..2b11c123c59cc 100644 --- a/packages/@aws-cdk/aws-transfer/package.json +++ b/packages/@aws-cdk/aws-transfer/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::Transfer", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-waf/package.json b/packages/@aws-cdk/aws-waf/package.json index 4a6c0f4fe0e18..03101648417b6 100644 --- a/packages/@aws-cdk/aws-waf/package.json +++ b/packages/@aws-cdk/aws-waf/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::WAF", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-wafregional/package.json b/packages/@aws-cdk/aws-wafregional/package.json index 2944c053d9d25..3f1b6333fcfc2 100644 --- a/packages/@aws-cdk/aws-wafregional/package.json +++ b/packages/@aws-cdk/aws-wafregional/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::WAFRegional", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-wafv2/package.json b/packages/@aws-cdk/aws-wafv2/package.json index 6b4ffcf5a6f07..3469018e07c3b 100644 --- a/packages/@aws-cdk/aws-wafv2/package.json +++ b/packages/@aws-cdk/aws-wafv2/package.json @@ -54,7 +54,10 @@ }, "cdk-build": { "cloudformation": "AWS::WAFv2", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/aws-workspaces/package.json b/packages/@aws-cdk/aws-workspaces/package.json index 13ce6feb407ae..54198f3012d6f 100644 --- a/packages/@aws-cdk/aws-workspaces/package.json +++ b/packages/@aws-cdk/aws-workspaces/package.json @@ -53,7 +53,10 @@ }, "cdk-build": { "cloudformation": "AWS::WorkSpaces", - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/@aws-cdk/cfnspec/build-tools/create-missing-libraries.ts b/packages/@aws-cdk/cfnspec/build-tools/create-missing-libraries.ts index 96d958fa11710..09041b0634d19 100644 --- a/packages/@aws-cdk/cfnspec/build-tools/create-missing-libraries.ts +++ b/packages/@aws-cdk/cfnspec/build-tools/create-missing-libraries.ts @@ -156,6 +156,9 @@ async function main() { 'cdk-build': { cloudformation: namespace, jest: true, + env: { + AWSLINT_BASE_CONSTRUCT: 'true', + }, }, keywords: [ 'aws', diff --git a/packages/@aws-cdk/core/lib/annotations.ts b/packages/@aws-cdk/core/lib/annotations.ts index 8ddeedda108a2..f46c830c25757 100644 --- a/packages/@aws-cdk/core/lib/annotations.ts +++ b/packages/@aws-cdk/core/lib/annotations.ts @@ -1,5 +1,5 @@ import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { IConstruct } from './construct-compat'; +import { IConstruct, Node } from 'constructs'; const DEPRECATIONS_SYMBOL = Symbol.for('@aws-cdk/core.deprecations'); @@ -70,7 +70,7 @@ export class Annotations { // throw if CDK_BLOCK_DEPRECATIONS is set if (process.env.CDK_BLOCK_DEPRECATIONS) { - throw new Error(`${this.scope.node.path}: ${text}`); + throw new Error(`${Node.of(this.scope).path}: ${text}`); } // de-dup based on api key @@ -89,7 +89,7 @@ export class Annotations { * @param message The message itself */ private addMessage(level: string, message: string) { - this.scope.node.addMetadata(level, message); + Node.of(this.scope).addMetadata(level, message); } /** diff --git a/packages/@aws-cdk/core/lib/context-provider.ts b/packages/@aws-cdk/core/lib/context-provider.ts index 6a01a7c5a6506..d0ebaa34705ab 100644 --- a/packages/@aws-cdk/core/lib/context-provider.ts +++ b/packages/@aws-cdk/core/lib/context-provider.ts @@ -1,7 +1,7 @@ import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as cxapi from '@aws-cdk/cx-api'; +import { Construct, Node } from 'constructs'; import { Annotations } from './annotations'; -import { Construct } from './construct-compat'; import { Stack } from './stack'; import { Token } from './token'; @@ -95,7 +95,7 @@ export class ContextProvider { } const { key, props } = this.getKey(scope, options); - const value = scope.node.tryGetContext(key); + const value = Node.of(scope).tryGetContext(key); const providerError = extractProviderError(value); // if context is missing or an error occurred during context retrieval, diff --git a/packages/@aws-cdk/core/lib/private/resolve.ts b/packages/@aws-cdk/core/lib/private/resolve.ts index 43d3afda46830..7098dc4e3ec99 100644 --- a/packages/@aws-cdk/core/lib/private/resolve.ts +++ b/packages/@aws-cdk/core/lib/private/resolve.ts @@ -1,9 +1,13 @@ -import { IConstruct } from '../construct-compat'; +import { IConstruct } from 'constructs'; import { DefaultTokenResolver, IPostProcessor, IResolvable, IResolveContext, ITokenResolver, StringConcat } from '../resolvable'; import { TokenizedStringFragments } from '../string-fragments'; import { containsListTokenElement, TokenString, unresolved } from './encoding'; import { TokenMap } from './token-map'; +// v2 - leave this as a separate section so it reduces merge conflicts when compat is removed +// eslint-disable-next-line import/order +import { IConstruct as ICoreConstruct } from '../construct-compat'; + // This file should not be exported to consumers, resolving should happen through Construct.resolve() const tokenMap = TokenMap.instance(); @@ -44,7 +48,7 @@ export function resolve(obj: any, options: IResolveOptions): any { const context: IResolveContext = { preparing: options.preparing, - scope: options.scope, + scope: options.scope as ICoreConstruct, registerPostProcessor(pp) { postProcessor = pp; }, resolve(x: any) { return resolve(x, { ...options, prefix: newPrefix }); }, }; diff --git a/packages/@aws-cdk/core/lib/resource.ts b/packages/@aws-cdk/core/lib/resource.ts index c437ef98d5d42..6a810b8a971e8 100644 --- a/packages/@aws-cdk/core/lib/resource.ts +++ b/packages/@aws-cdk/core/lib/resource.ts @@ -1,6 +1,9 @@ +// v2 - leave this as a separate section so it reduces merge conflicts when compat is removed +// eslint-disable-next-line import/order +import { IConstruct, Construct as CoreConstruct } from './construct-compat'; + import { Construct } from 'constructs'; import { ArnComponents } from './arn'; -import { IConstruct, Construct as CoreConstruct } from './construct-compat'; import { Lazy } from './lazy'; import { generatePhysicalName, isGeneratedWhenNeededMarker } from './private/physical-name-generator'; import { IResolveContext } from './resolvable'; diff --git a/packages/@aws-cdk/core/lib/token.ts b/packages/@aws-cdk/core/lib/token.ts index 73a43c74f6e7f..35f2667f67365 100644 --- a/packages/@aws-cdk/core/lib/token.ts +++ b/packages/@aws-cdk/core/lib/token.ts @@ -1,4 +1,4 @@ -import { IConstruct } from './construct-compat'; +import { IConstruct } from 'constructs'; import { Lazy } from './lazy'; import { unresolved } from './private/encoding'; import { Intrinsic } from './private/intrinsic'; diff --git a/packages/@aws-cdk/custom-resources/lib/aws-custom-resource/aws-custom-resource.ts b/packages/@aws-cdk/custom-resources/lib/aws-custom-resource/aws-custom-resource.ts index 5169a85839800..730260e3e3779 100644 --- a/packages/@aws-cdk/custom-resources/lib/aws-custom-resource/aws-custom-resource.ts +++ b/packages/@aws-cdk/custom-resources/lib/aws-custom-resource/aws-custom-resource.ts @@ -4,6 +4,7 @@ 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 { Construct } from 'constructs'; import { PHYSICAL_RESOURCE_ID_REFERENCE, flatten } from './runtime'; // don't use "require" since the typescript compiler emits errors since this @@ -303,7 +304,7 @@ export class AwsCustomResource extends cdk.Construct implements iam.IGrantable { // 'props' cannot be optional, even though all its properties are optional. // this is because at least one sdk call must be provided. - constructor(scope: cdk.Construct, id: string, props: AwsCustomResourceProps) { + constructor(scope: Construct, id: string, props: AwsCustomResourceProps) { super(scope, id); if (!props.onCreate && !props.onUpdate && !props.onDelete) { diff --git a/packages/@aws-cdk/custom-resources/lib/provider-framework/provider.ts b/packages/@aws-cdk/custom-resources/lib/provider-framework/provider.ts index 01759f71b7e45..a61e7ab475939 100644 --- a/packages/@aws-cdk/custom-resources/lib/provider-framework/provider.ts +++ b/packages/@aws-cdk/custom-resources/lib/provider-framework/provider.ts @@ -2,7 +2,8 @@ import * as path from 'path'; import * as cfn from '@aws-cdk/aws-cloudformation'; import * as lambda from '@aws-cdk/aws-lambda'; import * as logs from '@aws-cdk/aws-logs'; -import { Construct, Duration } from '@aws-cdk/core'; +import { Construct as CoreConstruct, Duration } from '@aws-cdk/core'; +import { Construct } from 'constructs'; import * as consts from './runtime/consts'; import { calculateRetryPolicy } from './util'; import { WaiterStateMachine } from './waiter-state-machine'; @@ -74,7 +75,7 @@ export interface ProviderProps { /** * Defines an AWS CloudFormation custom resource provider. */ -export class Provider extends Construct implements cfn.ICustomResourceProvider { +export class Provider extends CoreConstruct implements cfn.ICustomResourceProvider { /** * The user-defined AWS Lambda function which is invoked for all resource @@ -138,7 +139,7 @@ export class Provider extends Construct implements cfn.ICustomResourceProvider { * Called by `CustomResource` which uses this provider. * @deprecated use `provider.serviceToken` instead */ - public bind(_: Construct): cfn.CustomResourceProviderConfig { + public bind(_: CoreConstruct): cfn.CustomResourceProviderConfig { return { serviceToken: this.entrypoint.functionArn, }; diff --git a/packages/@aws-cdk/custom-resources/package.json b/packages/@aws-cdk/custom-resources/package.json index 2f370ac8a5968..511c490dae19b 100644 --- a/packages/@aws-cdk/custom-resources/package.json +++ b/packages/@aws-cdk/custom-resources/package.json @@ -54,7 +54,10 @@ "pre": [ "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" ], - "jest": true + "jest": true, + "env": { + "AWSLINT_BASE_CONSTRUCT": true + } }, "keywords": [ "aws", diff --git a/packages/awslint/bin/awslint.ts b/packages/awslint/bin/awslint.ts index 1426ac60885d0..d8b26a253268e 100644 --- a/packages/awslint/bin/awslint.ts +++ b/packages/awslint/bin/awslint.ts @@ -21,7 +21,7 @@ async function main() { .option('exclude', { alias: 'x', type: 'array', desc: 'do not evaludate these rules (takes priority over --include)', default: [] }) .option('save', { type: 'boolean', desc: 'updates package.json with "exclude" statements for all failing rules', default: false }) .option('verbose', { alias: 'v', type: 'boolean', desc: 'verbose output (prints all assertions)', default: false }) - .option('quiet', { alias: 'q', type: 'boolean', desc: 'quiet mode - shows only errors', default: false }) + .option('quiet', { alias: 'q', type: 'boolean', desc: 'quiet mode - shows only errors', default: true }) .option('force', { type: 'boolean', desc: 'succeed silently if this is not a jsii module', default: true }) .option('config', { type: 'boolean', desc: 'reads options from the "awslint" section in package.json', default: true }) .option('debug', { type: 'boolean', desc: 'debug output', default: false }) diff --git a/packages/decdk/lib/cdk-schema.ts b/packages/decdk/lib/cdk-schema.ts index c653d174d66d6..7fde9d38ed7d8 100644 --- a/packages/decdk/lib/cdk-schema.ts +++ b/packages/decdk/lib/cdk-schema.ts @@ -22,7 +22,7 @@ export function renderFullSchema(typeSystem: jsiiReflect.TypeSystem, options: Re // Find all constructs for which the props interface // (transitively) only consists of JSON primitives or interfaces // that consist of JSON primitives - const constructType = typeSystem.findClass('@aws-cdk/core.Construct'); + const constructType = typeSystem.findClass('constructs.Construct'); const constructs = typeSystem.classes.filter(c => c.extends(constructType)); const deconstructs = constructs diff --git a/packages/decdk/lib/jsii2schema.ts b/packages/decdk/lib/jsii2schema.ts index 59d33ce675f7c..2b490d7df2125 100644 --- a/packages/decdk/lib/jsii2schema.ts +++ b/packages/decdk/lib/jsii2schema.ts @@ -557,15 +557,15 @@ export function isConstruct(typeOrTypeRef: jsiiReflect.TypeReference | jsiiRefle } } - // if it is an interface, it should extend cdk.IConstruct + // if it is an interface, it should extend constructs.IConstruct if (type instanceof jsiiReflect.InterfaceType) { - const constructIface = type.system.findFqn('@aws-cdk/core.IConstruct'); + const constructIface = type.system.findFqn('constructs.IConstruct'); return type.extends(constructIface); } - // if it is a class, it should extend cdk.Construct + // if it is a class, it should extend constructs.Construct if (type instanceof jsiiReflect.ClassType) { - const constructClass = type.system.findFqn('@aws-cdk/core.Construct'); + const constructClass = type.system.findFqn('constructs.Construct'); return type.extends(constructClass); } From a8d7282934f02c9e773a0091129fba35b494f2e3 Mon Sep 17 00:00:00 2001 From: Jonathan Goldwasser Date: Tue, 29 Sep 2020 09:39:04 +0200 Subject: [PATCH 08/10] fix(stepfunctions): States.ALL doesn't appear last in Retry and Catch arrays (#10538) Validate that `States.ALL` is not combined with other errors in `Retry` and `Catch` arrays and sort those arrays so that `States.ALL` appears last. Closes #10530 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../aws-stepfunctions/lib/states/state.ts | 38 ++++++- .../aws-stepfunctions/test/task-base.test.ts | 101 ++++++++++++++++++ 2 files changed, 135 insertions(+), 4 deletions(-) diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts index 00334a0934323..c43a7bec159a8 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts @@ -247,6 +247,8 @@ export abstract class State extends cdk.Construct implements IChainable { * @internal */ protected _addRetry(props: RetryProps = {}) { + validateErrors(props.errors); + this.retries.push({ ...props, errors: props.errors ? props.errors : [Errors.ALL], @@ -258,6 +260,8 @@ export abstract class State extends cdk.Construct implements IChainable { * @internal */ protected _addCatch(handler: State, props: CatchProps = {}) { + validateErrors(props.errors); + this.catches.push({ next: handler, props: { @@ -386,8 +390,8 @@ export abstract class State extends cdk.Construct implements IChainable { */ protected renderRetryCatch(): any { return { - Retry: renderList(this.retries, renderRetry), - Catch: renderList(this.catches, renderCatch), + Retry: renderList(this.retries, renderRetry, (a, b) => compareErrors(a.errors, b.errors)), + Catch: renderList(this.catches, renderCatch, (a, b) => compareErrors(a.props.errors, b.props.errors)), }; } @@ -501,12 +505,38 @@ function renderCatch(c: CatchTransition) { }; } +/** + * Compares a list of Errors to move Errors.ALL last in a sort function + */ +function compareErrors(a?: string[], b?: string[]) { + if (a?.includes(Errors.ALL)) { + return 1; + } + if (b?.includes(Errors.ALL)) { + return -1; + } + return 0; +} + +/** + * Validates an errors list + */ +function validateErrors(errors?: string[]) { + if (errors?.includes(Errors.ALL) && errors.length > 1) { + throw new Error(`${Errors.ALL} must appear alone in an error list`); + } +} + /** * Render a list or return undefined for an empty list */ -export function renderList(xs: T[], fn: (x: T) => any): any { +export function renderList(xs: T[], mapFn: (x: T) => any, sortFn?: (a: T, b: T) => number): any { if (xs.length === 0) { return undefined; } - return xs.map(fn); + let list = xs; + if (sortFn) { + list = xs.sort(sortFn); + } + return list.map(mapFn); } /** diff --git a/packages/@aws-cdk/aws-stepfunctions/test/task-base.test.ts b/packages/@aws-cdk/aws-stepfunctions/test/task-base.test.ts index a57e78ae85c6d..eb14a414e20fc 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/task-base.test.ts +++ b/packages/@aws-cdk/aws-stepfunctions/test/task-base.test.ts @@ -76,6 +76,69 @@ describe('Task base', () => { }); }); + test('States.ALL catch appears at end of list', () => { + // GIVEN + const httpFailure = new sfn.Fail(stack, 'http', { error: 'HTTP' }); + const otherFailure = new sfn.Fail(stack, 'other', { error: 'Other' }); + const allFailure = new sfn.Fail(stack, 'all'); + + // WHEN + task + .addCatch(httpFailure, { errors: ['HTTPError'] }) + .addCatch(allFailure) + .addCatch(otherFailure, { errors: ['OtherError'] }); + + // THEN + expect(render(task)).toEqual({ + StartAt: 'my-task', + States: { + 'all': { + Type: 'Fail', + }, + 'http': { + Error: 'HTTP', + Type: 'Fail', + }, + 'my-task': { + End: true, + Catch: [ + { + ErrorEquals: ['HTTPError'], + Next: 'http', + }, + { + ErrorEquals: ['OtherError'], + Next: 'other', + }, + { + ErrorEquals: ['States.ALL'], + Next: 'all', + }, + ], + Type: 'Task', + Resource: 'my-resource', + Parameters: { MyParameter: 'myParameter' }, + }, + 'other': { + Error: 'Other', + Type: 'Fail', + }, + }, + }); + }); + + test('addCatch throws when errors are combined with States.ALL', () => { + // GIVEN + const failure = new sfn.Fail(stack, 'failed', { + error: 'DidNotWork', + cause: 'We got stuck', + }); + + expect(() => task.addCatch(failure, { + errors: ['States.ALL', 'HTTPError'], + })).toThrow(/must appear alone/); + }); + test('add retry configuration', () => { // WHEN task.addRetry({ errors: ['HTTPError'], maxAttempts: 2 }) @@ -104,6 +167,44 @@ describe('Task base', () => { }); }); + test('States.ALL retry appears at end of list', () => { + // WHEN + task + .addRetry({ errors: ['HTTPError'] }) + .addRetry() + .addRetry({ errors: ['OtherError'] }); + + // THEN + expect(render(task)).toEqual({ + StartAt: 'my-task', + States: { + 'my-task': { + End: true, + Retry: [ + { + ErrorEquals: ['HTTPError'], + }, + { + ErrorEquals: ['OtherError'], + }, + { + ErrorEquals: ['States.ALL'], + }, + ], + Type: 'Task', + Resource: 'my-resource', + Parameters: { MyParameter: 'myParameter' }, + }, + }, + }); + }); + + test('addRetry throws when errors are combined with States.ALL', () => { + expect(() => task.addRetry({ + errors: ['States.ALL', 'HTTPError'], + })).toThrow(/must appear alone/); + }); + test('add a next state to the task in the chain', () => { // WHEN task.next(new sfn.Pass(stack, 'passState')); From 84738ee8d6d47ec19846c0e4bc7d7096333f96d3 Mon Sep 17 00:00:00 2001 From: Ana Danilochkina Date: Tue, 29 Sep 2020 09:06:13 +0100 Subject: [PATCH 09/10] feat(stepfunctions-tasks): support for SageMaker APIs: CreateEndpoint, CreateEndpointConfig, CreateModel, and UpdateEndpoint (#10187) **Implementation** Update package `@aws-cdk/aws-stepfunctions-tasks` to include support for SageMaker **CreateEndpoint**, **CreateEndpointConfig**, **CreateModel**, **UpdateEndpoint** API as per documentation here: https://docs.aws.amazon.com/step-functions/latest/dg/connect-sagemaker.html Includes support for the following Amazon SageMaker API calls: * `CreateEndpoint` * `CreateEndpointConfig` * `CreateModel` * `UpdateEndpoint` Closes https://github.com/aws/aws-cdk/issues/6572 --- .../aws-stepfunctions-tasks/README.md | 57 ++ .../aws-stepfunctions-tasks/lib/index.ts | 4 + .../lib/sagemaker/base-types.ts | 212 ++++++ .../lib/sagemaker/create-endpoint-config.ts | 127 ++++ .../lib/sagemaker/create-endpoint.ts | 98 +++ .../lib/sagemaker/create-model.ts | 237 +++++++ .../lib/sagemaker/create-training-job.ts | 7 +- .../lib/sagemaker/create-transform-job.ts | 7 +- .../lib/sagemaker/private/utils.ts | 4 + .../lib/sagemaker/update-endpoint.ts | 79 +++ .../sagemaker/create-endpoint-config.test.ts | 149 ++++ .../test/sagemaker/create-endpoint.test.ts | 118 ++++ .../test/sagemaker/create-model.test.ts | 139 ++++ .../integ.call-sagemaker.expected.json | 637 ++++++++++++++++++ .../test/sagemaker/integ.call-sagemaker.ts | 123 ++++ .../test/sagemaker/update-endpoint.test.ts | 82 +++ 16 files changed, 2070 insertions(+), 10 deletions(-) create mode 100644 packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint-config.ts create mode 100644 packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint.ts create mode 100644 packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-model.ts create mode 100644 packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/private/utils.ts create mode 100644 packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/update-endpoint.ts create mode 100644 packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-endpoint-config.test.ts create mode 100644 packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-endpoint.test.ts create mode 100644 packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-model.test.ts create mode 100644 packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.expected.json create mode 100644 packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.ts create mode 100644 packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/update-endpoint.test.ts diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/README.md b/packages/@aws-cdk/aws-stepfunctions-tasks/README.md index 5faf997549ed6..a663faf7e5325 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/README.md +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/README.md @@ -52,6 +52,10 @@ This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aw - [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) @@ -774,6 +778,59 @@ new sfn.SagemakerTransformTask(this, 'Batch Inference', { ``` +### 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 sfn.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 sfn.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 sfn.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 sfn.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. diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/index.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/index.ts index a0e97e9df77ca..98768ce538697 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/index.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/index.ts @@ -14,6 +14,10 @@ export * from './ecs/run-task'; export * from './sagemaker/base-types'; export * from './sagemaker/create-training-job'; export * from './sagemaker/create-transform-job'; +export * from './sagemaker/create-endpoint'; +export * from './sagemaker/create-endpoint-config'; +export * from './sagemaker/create-model'; +export * from './sagemaker/update-endpoint'; export * from './start-execution'; export * from './stepfunctions/start-execution'; export * from './stepfunctions/invoke-activity'; 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 index f701f9e20d6e9..e5a23cce356c6 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/base-types.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/base-types.ts @@ -625,6 +625,218 @@ export interface TransformResources { readonly volumeEncryptionKey?: kms.IKey; } +/** + * Properties to define a ContainerDefinition + * + * @see https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ContainerDefinition.html + * @experimental + */ +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 + * @experimental + */ +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 + * @experimental + */ +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 + * + * @experimental + */ +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 + * @experimental + */ +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 + * @experimental + */ +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 + * @experimental + */ +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. * diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint-config.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint-config.ts new file mode 100644 index 0000000000000..4b3729614c6ea --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint-config.ts @@ -0,0 +1,127 @@ +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 { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; +import { ProductionVariant } from './base-types'; + +/** + * Properties for creating an Amazon SageMaker endpoint configuration + * + * @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-sagemaker.html + * @experimental + */ +export interface SageMakerCreateEndpointConfigProps extends sfn.TaskStateBaseProps { + /** + * The name of the endpoint configuration. + */ + readonly endpointConfigName: string; + /** + * AWS Key Management Service key that Amazon SageMaker + * uses to encrypt data on the storage volume attached to the ML compute instance that hosts the endpoint. + * + * @default - None + */ + readonly kmsKey?: kms.IKey; + + /** + * An list of ProductionVariant objects, one for each model that you want to host at this endpoint. + * Identifies a model that you want to host and the resources to deploy for hosting it. + * If you are deploying multiple models, tell Amazon SageMaker how to distribute traffic among the models by specifying variant weights. + */ + readonly productionVariants: ProductionVariant[]; + + /** + * Tags to be applied to the endpoint configuration. + * + * @default - No tags + */ + readonly tags?: sfn.TaskInput; +} + +/** + * A Step Functions Task to create a SageMaker endpoint configuration + * + * @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-sagemaker.html + * @experimental + */ +export class SageMakerCreateEndpointConfig extends sfn.TaskStateBase { + private static readonly SUPPORTED_INTEGRATION_PATTERNS: sfn.IntegrationPattern[] = [ + sfn.IntegrationPattern.REQUEST_RESPONSE, + ]; + protected readonly taskMetrics?: sfn.TaskMetricsConfig; + protected readonly taskPolicies?: iam.PolicyStatement[]; + private readonly integrationPattern: sfn.IntegrationPattern; + + constructor(scope: cdk.Construct, id: string, private readonly props: SageMakerCreateEndpointConfigProps) { + super(scope, id, props); + this.integrationPattern = props.integrationPattern || sfn.IntegrationPattern.REQUEST_RESPONSE; + validatePatternSupported(this.integrationPattern, SageMakerCreateEndpointConfig.SUPPORTED_INTEGRATION_PATTERNS); + + this.validateProductionVariants(); + this.taskPolicies = this.makePolicyStatements(); + } + + /** + * @internal + */ + protected _renderTask(): any { + return { + Resource: integrationResourceArn('sagemaker', 'createEndpointConfig', this.integrationPattern), + Parameters: sfn.FieldUtils.renderObject(this.renderParameters()), + }; + } + + private renderParameters(): { [key: string]: any } { + return { + EndpointConfigName: this.props.endpointConfigName, + Tags: this.props.tags?.value, + KmsKeyId: this.props.kmsKey?.keyId, + ProductionVariants: this.props.productionVariants.map((variant) => ({ + InitialInstanceCount: variant.initialInstanceCount ? variant.initialInstanceCount : 1, + InstanceType: `ml.${variant.instanceType}`, + ModelName: variant.modelName, + VariantName: variant.variantName, + AcceleratorType: variant.acceleratorType, + InitialVariantWeight: variant.initialVariantWeight, + }), + ), + }; + } + + private makePolicyStatements(): iam.PolicyStatement[] { + const stack = cdk.Stack.of(this); + // https://docs.aws.amazon.com/sagemaker/latest/dg/api-permissions-reference.html + return [ + new iam.PolicyStatement({ + actions: ['sagemaker:CreateEndpointConfig'], + resources: [ + stack.formatArn({ + service: 'sagemaker', + resource: 'endpoint-config', + // If the endpoint configuration name comes from input, we cannot target the policy to a particular ARN prefix reliably. + // SageMaker uses lowercase for resource name in the arn + resourceName: sfn.JsonPath.isEncodedJsonPath(this.props.endpointConfigName) ? '*' : `${this.props.endpointConfigName.toLowerCase()}`, + }), + ], + }), + new iam.PolicyStatement({ + actions: ['sagemaker:ListTags'], + // https://docs.aws.amazon.com/step-functions/latest/dg/sagemaker-iam.html + resources: ['*'], + }), + ]; + } + + private validateProductionVariants() { + if (this.props.productionVariants.length < 1 || this.props.productionVariants.length > 10) { + throw new Error('Must specify from 1 to 10 production variants per endpoint configuration'); + } + this.props.productionVariants.forEach((variant) => { + if (variant.initialInstanceCount && variant.initialInstanceCount < 1) throw new Error('Must define at least one instance'); + if ( variant.initialVariantWeight && variant.initialVariantWeight <= 0) { + throw new Error('InitialVariantWeight has minimum value of 0'); + } + }); + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint.ts new file mode 100644 index 0000000000000..5aa97a96c9b38 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint.ts @@ -0,0 +1,98 @@ +import * as iam from '@aws-cdk/aws-iam'; +import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as cdk from '@aws-cdk/core'; +import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; + +/** + * Properties for creating an Amazon SageMaker endpoint + * + * @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-sagemaker.html + * @experimental + */ +export interface SageMakerCreateEndpointProps extends sfn.TaskStateBaseProps { + /** + * The name of an endpoint configuration. + */ + readonly endpointConfigName: string; + /** + * The name of the endpoint. The name must be unique within an AWS Region in your AWS account. + */ + readonly endpointName: string; + /** + * Tags to be applied to the endpoint. + * + * @default - No tags + */ + readonly tags?: sfn.TaskInput; +} + +/** + * A Step Functions Task to create a SageMaker endpoint + * + * @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-sagemaker.html + * @experimental + */ +export class SageMakerCreateEndpoint extends sfn.TaskStateBase { + private static readonly SUPPORTED_INTEGRATION_PATTERNS: sfn.IntegrationPattern[] = [ + sfn.IntegrationPattern.REQUEST_RESPONSE, + ]; + protected readonly taskMetrics?: sfn.TaskMetricsConfig; + protected readonly taskPolicies?: iam.PolicyStatement[]; + private readonly integrationPattern: sfn.IntegrationPattern; + + constructor(scope: cdk.Construct, id: string, private readonly props: SageMakerCreateEndpointProps) { + super(scope, id, props); + this.integrationPattern = props.integrationPattern || sfn.IntegrationPattern.REQUEST_RESPONSE; + validatePatternSupported(this.integrationPattern, SageMakerCreateEndpoint.SUPPORTED_INTEGRATION_PATTERNS); + this.taskPolicies = this.makePolicyStatements(); + } + + /** + * @internal + */ + protected _renderTask(): any { + return { + Resource: integrationResourceArn('sagemaker', 'createEndpoint', this.integrationPattern), + Parameters: sfn.FieldUtils.renderObject(this.renderParameters()), + }; + } + + private renderParameters(): { [key: string]: any } { + return { + EndpointConfigName: this.props.endpointConfigName, + EndpointName: this.props.endpointName, + Tags: this.props.tags?.value, + }; + } + + private makePolicyStatements(): iam.PolicyStatement[] { + const stack = cdk.Stack.of(this); + // https://docs.aws.amazon.com/sagemaker/latest/dg/api-permissions-reference.html + return [ + new iam.PolicyStatement({ + actions: ['sagemaker:createEndpoint'], + resources: [ + stack.formatArn({ + service: 'sagemaker', + resource: 'endpoint', + // If the endpoint name comes from input, we cannot target the policy to a particular ARN prefix reliably. + // SageMaker uses lowercase for resource name in the arn + resourceName: sfn.JsonPath.isEncodedJsonPath(this.props.endpointName) ? '*' : `${this.props.endpointName.toLowerCase()}`, + }), + stack.formatArn({ + service: 'sagemaker', + resource: 'endpoint-config', + // If the endpoint config name comes from input, we cannot target the policy to a particular ARN prefix reliably. + // SageMaker uses lowercase for resource name in the arn + resourceName: sfn.JsonPath.isEncodedJsonPath(this.props.endpointConfigName) ? '*' : `${this.props.endpointConfigName.toLowerCase()}`, + }), + ], + }), + new iam.PolicyStatement({ + actions: ['sagemaker:ListTags'], + // https://docs.aws.amazon.com/step-functions/latest/dg/sagemaker-iam.html + resources: ['*'], + }), + ]; + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-model.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-model.ts new file mode 100644 index 0000000000000..220617ee57b22 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-model.ts @@ -0,0 +1,237 @@ +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 { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; +import { IContainerDefinition } from './base-types'; + +/** + * Properties for creating an Amazon SageMaker model + * + * @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-sagemaker.html + * @experimental + */ +export interface SageMakerCreateModelProps extends sfn.TaskStateBaseProps { + /** + * An execution role that you can pass in a CreateModel API request + * + * @default - a role will be created. + */ + readonly role?: iam.IRole; + /** + * The name of the new model. + */ + readonly modelName: string; + /** + * The definition of the primary docker image containing inference code, associated artifacts, + * and custom environment map that the inference code uses when the model is deployed for predictions. + */ + readonly primaryContainer: IContainerDefinition; + /** + * Specifies the containers in the inference pipeline. + * + * @default - None + */ + readonly containers?: IContainerDefinition[]; + + /** + * Isolates the model container. No inbound or outbound network calls can be made to or from the model container. + * + * @default false + */ + readonly enableNetworkIsolation?: boolean; + + /** + * The VPC that is accessible by the hosted model + * + * @default - None + */ + readonly vpc?: ec2.IVpc; + + /** + * The subnets of the VPC to which the hosted model is connected + * (Note this parameter is only used when VPC is provided) + * + * @default - Private Subnets are selected + */ + readonly subnetSelection?: ec2.SubnetSelection; + + /** + * Tags to be applied to the model. + * + * @default - No tags + */ + readonly tags?: sfn.TaskInput; +} + +/** + * A Step Functions Task to create a SageMaker model + * + * @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-sagemaker.html + * @experimental + */ +export class SageMakerCreateModel extends sfn.TaskStateBase implements iam.IGrantable, ec2.IConnectable { + private static readonly SUPPORTED_INTEGRATION_PATTERNS: sfn.IntegrationPattern[] = [ + sfn.IntegrationPattern.REQUEST_RESPONSE, + ]; + /** + * Allows specify security group connections for instances of this fleet. + */ + public readonly connections: ec2.Connections = new ec2.Connections(); + /** + * The execution role for the Sagemaker Create Model API. + */ + public readonly role: iam.IRole; + public readonly grantPrincipal: iam.IPrincipal; + protected readonly taskMetrics?: sfn.TaskMetricsConfig; + protected readonly taskPolicies?: iam.PolicyStatement[]; + private readonly vpc?: ec2.IVpc; + private securityGroup?: ec2.ISecurityGroup; + private readonly securityGroups: ec2.ISecurityGroup[] = []; + private readonly subnets?: string[]; + private readonly integrationPattern: sfn.IntegrationPattern; + + constructor(scope: cdk.Construct, id: string, private readonly props: SageMakerCreateModelProps) { + super(scope, id, props); + this.integrationPattern = props.integrationPattern || sfn.IntegrationPattern.REQUEST_RESPONSE; + validatePatternSupported(this.integrationPattern, SageMakerCreateModel.SUPPORTED_INTEGRATION_PATTERNS); + + // add the security groups to the connections object + if (props.vpc) { + this.vpc = props.vpc; + this.subnets = props.subnetSelection ? this.vpc.selectSubnets(props.subnetSelection).subnetIds : this.vpc.selectSubnets().subnetIds; + } + + this.role = this.props.role || this.createSagemakerRole(); + this.grantPrincipal = this.role; + this.taskPolicies = this.makePolicyStatements(); + } + + /** + * Add the security group to all instances via the launch configuration + * security groups array. + * + * @param securityGroup: The security group to add + */ + public addSecurityGroup(securityGroup: ec2.ISecurityGroup): void { + this.securityGroups.push(securityGroup); + } + + /** + * @internal + */ + protected _renderTask(): any { + return { + Resource: integrationResourceArn('sagemaker', 'createModel', this.integrationPattern), + Parameters: sfn.FieldUtils.renderObject(this.renderParameters()), + }; + } + + private renderParameters(): { [key: string]: any } { + return { + EnableNetworkIsolation: this.props.enableNetworkIsolation, + ExecutionRoleArn: this.role.roleArn, + ModelName: this.props.modelName, + Tags: this.props.tags?.value, + PrimaryContainer: this.props.primaryContainer.bind(this).parameters, + Containers: this.props.containers?.map(container => (container.bind(this))), + ...this.renderVpcConfig(), + }; + } + + private makePolicyStatements(): iam.PolicyStatement[] { + const stack = cdk.Stack.of(this); + return [ + new iam.PolicyStatement({ + actions: ['sagemaker:CreateModel'], + resources: [ + stack.formatArn({ + service: 'sagemaker', + resource: 'model', + // If the model name comes from input, we cannot target the policy to a particular ARN prefix reliably. + // SageMaker uses lowercase for resource name in the arn + resourceName: sfn.JsonPath.isEncodedJsonPath(this.props.modelName) ? '*' : `${this.props.modelName.toLowerCase()}*`, + }), + ], + }), + new iam.PolicyStatement({ + actions: ['sagemaker:ListTags'], + // https://docs.aws.amazon.com/step-functions/latest/dg/sagemaker-iam.html + resources: ['*'], + }), + new iam.PolicyStatement({ + actions: ['iam:PassRole'], + resources: [this.role.roleArn], + conditions: { + StringEquals: { 'iam:PassedToService': 'sagemaker.amazonaws.com' }, + }, + }), + ]; + } + + private createSagemakerRole() { + // https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-roles.html + const role = new iam.Role(this, 'SagemakerRole', { + assumedBy: new iam.ServicePrincipal('sagemaker.amazonaws.com'), + inlinePolicies: { + CreateModel: new iam.PolicyDocument({ + statements: [ + new iam.PolicyStatement({ + actions: [ + // https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazoncloudwatch.html + 'cloudwatch:PutMetricData', + // https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazoncloudwatchlogs.html + 'logs:CreateLogStream', + 'logs:CreateLogGroup', + 'logs:PutLogEvents', + 'logs:DescribeLogStreams', + // https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazonelasticcontainerregistry.html + 'ecr:GetAuthorizationToken', + ], + resources: ['*'], + }), + ], + }), + }, + }); + if (this.props.vpc) { + role.addToPrincipalPolicy( + // https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazonec2.html + new iam.PolicyStatement({ + actions: [ + 'ec2:CreateNetworkInterface', + 'ec2:CreateNetworkInterfacePermission', + 'ec2:DeleteNetworkInterface', + 'ec2:DeleteNetworkInterfacePermission', + 'ec2:DescribeNetworkInterfaces', + 'ec2:DescribeVpcs', + 'ec2:DescribeDhcpOptions', + 'ec2:DescribeSubnets', + 'ec2:DescribeSecurityGroups', + ], + resources: ['*'], + }), + ); + } + return role; + } + + private renderVpcConfig(): { [key: string]: any } { + // create a security group if not defined + if (this.vpc && this.securityGroup === undefined) { + this.securityGroup = new ec2.SecurityGroup(this, 'ModelSecurityGroup', { + vpc: this.vpc, + }); + this.connections.addSecurityGroup(this.securityGroup); + this.securityGroups.push(this.securityGroup); + } + return this.vpc + ? { + VpcConfig: { + SecurityGroupIds: cdk.Lazy.listValue({ produce: () => this.securityGroups.map((sg) => sg.securityGroupId) }), + Subnets: this.subnets, + }, + } + : {}; + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-training-job.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-training-job.ts index 16a74559cf98f..146a78405b4c8 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-training-job.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-training-job.ts @@ -4,6 +4,7 @@ import * as sfn from '@aws-cdk/aws-stepfunctions'; import { Construct, Duration, Lazy, Size, Stack } from '@aws-cdk/core'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; import { AlgorithmSpecification, Channel, InputMode, OutputDataConfig, ResourceConfig, S3DataType, StoppingCondition, VpcConfig } from './base-types'; +import { renderTags } from './private/utils'; /** * Properties for creating an Amazon SageMaker training job @@ -224,7 +225,7 @@ export class SageMakerCreateTrainingJob extends sfn.TaskStateBase implements iam ...this.renderResourceConfig(this.resourceConfig), ...this.renderStoppingCondition(this.stoppingCondition), ...this.renderHyperparameters(this.props.hyperparameters), - ...this.renderTags(this.props.tags), + ...renderTags(this.props.tags), ...this.renderVpcConfig(this.props.vpcConfig), }; } @@ -296,10 +297,6 @@ export class SageMakerCreateTrainingJob extends sfn.TaskStateBase implements iam return params ? { HyperParameters: params } : {}; } - private renderTags(tags: { [key: string]: any } | undefined): { [key: string]: any } { - return tags ? { Tags: Object.keys(tags).map((key) => ({ Key: key, Value: tags[key] })) } : {}; - } - private renderVpcConfig(config: VpcConfig | undefined): { [key: string]: any } { return config ? { diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-transform-job.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-transform-job.ts index b9bdcbf940d3d..d1461de3de7cc 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-transform-job.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-transform-job.ts @@ -4,6 +4,7 @@ import * as sfn from '@aws-cdk/aws-stepfunctions'; import { Construct, Size, Stack } from '@aws-cdk/core'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; import { BatchStrategy, S3DataType, TransformInput, TransformOutput, TransformResources } from './base-types'; +import { renderTags } from './private/utils'; /** * Properties for creating an Amazon SageMaker training job task @@ -163,7 +164,7 @@ export class SageMakerCreateTransformJob extends sfn.TaskStateBase { ...(this.props.maxConcurrentTransforms ? { MaxConcurrentTransforms: this.props.maxConcurrentTransforms } : {}), ...(this.props.maxPayload ? { MaxPayloadInMB: this.props.maxPayload.toMebibytes() } : {}), ModelName: this.props.modelName, - ...this.renderTags(this.props.tags), + ...renderTags(this.props.tags), ...this.renderTransformInput(this.transformInput), TransformJobName: this.props.transformJobName, ...this.renderTransformOutput(this.props.transformOutput), @@ -212,10 +213,6 @@ export class SageMakerCreateTransformJob extends sfn.TaskStateBase { return environment ? { Environment: environment } : {}; } - private renderTags(tags: { [key: string]: any } | undefined): { [key: string]: any } { - return tags ? { Tags: Object.keys(tags).map((key) => ({ Key: key, Value: tags[key] })) } : {}; - } - private makePolicyStatements(): iam.PolicyStatement[] { const stack = Stack.of(this); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/private/utils.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/private/utils.ts new file mode 100644 index 0000000000000..e308fd890864c --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/private/utils.ts @@ -0,0 +1,4 @@ + +export function renderTags(tags: { [key: string]: any } | undefined): { [key: string]: any } { + return tags ? { Tags: Object.keys(tags).map((key) => ({ Key: key, Value: tags[key] })) } : {}; +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/update-endpoint.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/update-endpoint.ts new file mode 100644 index 0000000000000..6e998fd522d15 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/update-endpoint.ts @@ -0,0 +1,79 @@ +import * as iam from '@aws-cdk/aws-iam'; +import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as cdk from '@aws-cdk/core'; +import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; + +/** + * Properties for updating Amazon SageMaker endpoint + * + * @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-sagemaker.html + * @experimental + */ +export interface SageMakerUpdateEndpointProps extends sfn.TaskStateBaseProps { + /** + * The name of the new endpoint configuration + */ + readonly endpointConfigName: string; + /** + * The name of the endpoint whose configuration you want to update. + */ + readonly endpointName: string; +} + +/** + * A Step Functions Task to update a SageMaker endpoint + * + * @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-sagemaker.html + * @experimental + */ +export class SageMakerUpdateEndpoint extends sfn.TaskStateBase { + private static readonly SUPPORTED_INTEGRATION_PATTERNS: sfn.IntegrationPattern[] = [ + sfn.IntegrationPattern.REQUEST_RESPONSE, + ]; + protected readonly taskMetrics?: sfn.TaskMetricsConfig; + protected readonly taskPolicies?: iam.PolicyStatement[]; + private readonly integrationPattern: sfn.IntegrationPattern; + + constructor(scope: cdk.Construct, id: string, private readonly props: SageMakerUpdateEndpointProps) { + super(scope, id, props); + this.integrationPattern = props.integrationPattern || sfn.IntegrationPattern.REQUEST_RESPONSE; + validatePatternSupported(this.integrationPattern, SageMakerUpdateEndpoint.SUPPORTED_INTEGRATION_PATTERNS); + this.taskPolicies = this.makePolicyStatements(); + } + + /** + * @internal + */ + protected _renderTask(): any { + return { + Resource: integrationResourceArn('sagemaker', 'updateEndpoint', this.integrationPattern), + Parameters: sfn.FieldUtils.renderObject(this.renderParameters()), + }; + } + + private renderParameters(): { [key: string]: any } { + return { + EndpointConfigName: this.props.endpointConfigName, + EndpointName: this.props.endpointName, + }; + } + + private makePolicyStatements(): iam.PolicyStatement[] { + const stack = cdk.Stack.of(this); + // https://docs.aws.amazon.com/sagemaker/latest/dg/api-permissions-reference.html + return [ + new iam.PolicyStatement({ + actions: ['sagemaker:updateEndpoint'], + resources: [ + stack.formatArn({ + service: 'sagemaker', + resource: 'endpoint', + // If the endpoint name comes from input, we cannot target the policy to a particular ARN prefix reliably. + // SageMaker uses lowercase for resource name in the arn + resourceName: sfn.JsonPath.isEncodedJsonPath(this.props.endpointName) ? '*' : `${this.props.endpointName.toLowerCase()}`, + }), + ], + }), + ]; + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-endpoint-config.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-endpoint-config.test.ts new file mode 100644 index 0000000000000..f2c24889d1d0e --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-endpoint-config.test.ts @@ -0,0 +1,149 @@ +import '@aws-cdk/assert/jest'; +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 tasks from '../../lib'; + +let stack: cdk.Stack; + +beforeEach(() => { + // GIVEN + stack = new cdk.Stack(); +}); + +test('create basic endpoint config', () => { + // WHEN + const task = new tasks.SageMakerCreateEndpointConfig(stack, 'SagemakerEndpointConfig', { + endpointConfigName: 'MyEndpointConfig', + productionVariants: [{ + initialInstanceCount: 2, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.XLARGE), + modelName: 'MyModel', + variantName: 'awesome-variant', + }], + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::sagemaker:createEndpointConfig', + ], + ], + }, + End: true, + Parameters: { + EndpointConfigName: 'MyEndpointConfig', + ProductionVariants: [{ + InitialInstanceCount: 2, + InstanceType: 'ml.m5.xlarge', + ModelName: 'MyModel', + VariantName: 'awesome-variant', + }], + }, + }); +}); + +test('create complex endpoint config', () => { + // WHEN + const key = new kms.Key(stack, 'Key'); + + const task = new tasks.SageMakerCreateEndpointConfig(stack, 'SagemakerEndpointConfig', { + endpointConfigName: sfn.JsonPath.stringAt('$.Endpoint.EndpointConfig'), + kmsKey: key, + productionVariants: [{ + initialInstanceCount: 1, + initialVariantWeight: 0.8, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.XLARGE), + modelName: 'MyModel', + variantName: 'awesome-variant', + }, + { + initialInstanceCount: 1, + initialVariantWeight: 0.2, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.XLARGE), + modelName: sfn.JsonPath.stringAt('$.Endpoint.Model'), + variantName: 'awesome-variant-2', + }], + tags: sfn.TaskInput.fromObject([{ + Key: 'Project', + Value: 'ML', + }]), + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::sagemaker:createEndpointConfig', + ], + ], + }, + End: true, + Parameters: { + 'EndpointConfigName.$': '$.Endpoint.EndpointConfig', + 'KmsKeyId': { + Ref: 'Key961B73FD', + }, + 'ProductionVariants': [{ + InitialInstanceCount: 1, + InitialVariantWeight: 0.8, + InstanceType: 'ml.m5.xlarge', + ModelName: 'MyModel', + VariantName: 'awesome-variant', + }, + { + 'InitialInstanceCount': 1, + 'InitialVariantWeight': 0.2, + 'InstanceType': 'ml.m4.xlarge', + 'ModelName.$': '$.Endpoint.Model', + 'VariantName': 'awesome-variant-2', + }], + 'Tags': [ + { + Key: 'Project', + Value: 'ML', + }, + ], + }, + }); +}); + +test('Cannot create a SageMaker create enpoint config task with empty production variant', () => { + expect(() => new tasks.SageMakerCreateEndpointConfig(stack, 'EndpointConfig', { + endpointConfigName: 'MyEndpointConfig', + productionVariants: [], + })) + .toThrowError(/Must specify from 1 to 10 production variants per endpoint configuration/); +}); + +test('Task throws if WAIT_FOR_TASK_TOKEN is supplied as service integration pattern', () => { + expect(() => new tasks.SageMakerCreateEndpointConfig(stack, 'EndpointConfig', { + endpointConfigName: 'MyEndpointConfig', + integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, + productionVariants: [{ + initialInstanceCount: 2, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.XLARGE), + modelName: 'MyModel', + variantName: 'awesome-variant', + }], + })) + .toThrowError(/Unsupported service integration pattern. Supported Patterns: REQUEST_RESPONSE. Received: WAIT_FOR_TASK_TOKEN/i); +}); + + diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-endpoint.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-endpoint.test.ts new file mode 100644 index 0000000000000..4e7f67148b731 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-endpoint.test.ts @@ -0,0 +1,118 @@ +import '@aws-cdk/assert/jest'; +import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as cdk from '@aws-cdk/core'; +import * as tasks from '../../lib'; + +let stack: cdk.Stack; + +beforeEach(() => { + // GIVEN + stack = new cdk.Stack(); +}); + +test('create endpoint', () => { + // WHEN + const task = new tasks.SageMakerCreateEndpoint(stack, 'SagemakerEndpoint', { + endpointName: 'MyEndpoint', + endpointConfigName: 'MyEndpointConfig', + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::sagemaker:createEndpoint', + ], + ], + }, + End: true, + Parameters: { + EndpointConfigName: 'MyEndpointConfig', + EndpointName: 'MyEndpoint', + }, + }); +}); + +test('create endpoint with tags', () => { + // WHEN + const task = new tasks.SageMakerCreateEndpoint(stack, 'SagemakerEndpoint', { + endpointName: 'MyEndpoint', + endpointConfigName: 'MyEndpointConfig', + tags: sfn.TaskInput.fromObject([{ + Key: 'Label', + Value: 'ML', + }]), + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::sagemaker:createEndpoint', + ], + ], + }, + End: true, + Parameters: { + EndpointConfigName: 'MyEndpointConfig', + EndpointName: 'MyEndpoint', + Tags: [ + { Key: 'Label', Value: 'ML' }, + ], + }, + }); +}); + +test('create endpoint with input from task', () => { + // WHEN + const task = new tasks.SageMakerCreateEndpoint(stack, 'SagemakerEndpoint', { + endpointName: sfn.JsonPath.stringAt('$.EndpointName'), + endpointConfigName: sfn.JsonPath.stringAt('$.EndpointConfig'), + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::sagemaker:createEndpoint', + ], + ], + }, + End: true, + Parameters: { + 'EndpointConfigName.$': '$.EndpointConfig', + 'EndpointName.$': '$.EndpointName', + }, + }); +}); + +test('Task throws if WAIT_FOR_TASK_TOKEN is supplied as service integration pattern', () => { + expect(() => { + new tasks.SageMakerCreateEndpoint(stack, 'TrainSagemaker', { + integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, + endpointConfigName: 'MyEndpointConfig', + endpointName: 'MyEndpoint', + }); + }).toThrow(/Unsupported service integration pattern. Supported Patterns: REQUEST_RESPONSE. Received: WAIT_FOR_TASK_TOKEN/i); +}); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-model.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-model.test.ts new file mode 100644 index 0000000000000..4a1dedeac1f21 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-model.test.ts @@ -0,0 +1,139 @@ +import '@aws-cdk/assert/jest'; +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 tasks from '../../lib'; + +let stack: cdk.Stack; + +beforeEach(() => { + // GIVEN + stack = new cdk.Stack(); +}); + +test('create basic model', () => { + // WHEN + const task = new tasks.SageMakerCreateModel(stack, 'SagemakerModel', { + 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'), + }), + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::sagemaker:createModel', + ], + ], + }, + End: true, + Parameters: { + ExecutionRoleArn: { 'Fn::GetAtt': ['SagemakerModelSagemakerRoleF5035084', 'Arn'] }, + ModelName: 'MyModel', + PrimaryContainer: { + 'Image.$': '$.Model.imageName', + 'ModelDataUrl.$': '$.TrainingJob.ModelArtifacts.S3ModelArtifacts', + 'Mode': 'SingleModel', + }, + }, + }, + ); +}); + +test('create complex model', () => { + // WHEN + const vpc = new ec2.Vpc(stack, 'VPC'); + const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { vpc, description: 'My SG' }); + securityGroup.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(22), 'allow ssh access from the world'); + const role = new iam.Role(stack, 'Role', { + assumedBy: new iam.ServicePrincipal('sagemaker.amazonaws.com'), + managedPolicies: [ + iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonSageMakerFullAccess'), + ], + }); + + const task = new tasks.SageMakerCreateModel(stack, 'SagemakerModel', { + modelName: sfn.JsonPath.stringAt('$.ModelName'), + primaryContainer: new tasks.ContainerDefinition({ + image: tasks.DockerImage.fromJsonExpression(sfn.JsonPath.stringAt('$.Model.imageName')), + mode: tasks.Mode.MULTI_MODEL, + modelS3Location: tasks.S3Location.fromJsonExpression('$.TrainingJob.ModelArtifacts.S3ModelArtifacts'), + }), + enableNetworkIsolation: true, + role, + tags: sfn.TaskInput.fromObject([{ + Key: 'Project', + Value: 'ML', + }]), + vpc, + }); + task.addSecurityGroup(securityGroup); + + // THEN + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::sagemaker:createModel', + ], + ], + }, + End: true, + Parameters: { + 'ExecutionRoleArn': { 'Fn::GetAtt': ['Role1ABCC5F0', 'Arn'] }, + 'ModelName.$': '$.ModelName', + 'PrimaryContainer': { + 'Image.$': '$.Model.imageName', + 'ModelDataUrl.$': '$.TrainingJob.ModelArtifacts.S3ModelArtifacts', + 'Mode': 'MultiModel', + }, + 'EnableNetworkIsolation': true, + 'Tags': [ + { Key: 'Project', Value: 'ML' }, + ], + 'VpcConfig': { + SecurityGroupIds: [ + { 'Fn::GetAtt': ['SecurityGroupDD263621', 'GroupId'] }, + { 'Fn::GetAtt': ['SagemakerModelModelSecurityGroup4D2A2C36', 'GroupId'] }, + ], + Subnets: [ + { Ref: 'VPCPrivateSubnet1Subnet8BCA10E0' }, + { Ref: 'VPCPrivateSubnet2SubnetCFCDAA7A' }, + ], + }, + }, + }, + ); +}); + +test('Task throws if WAIT_FOR_TASK_TOKEN is supplied as service integration pattern', () => { + expect(() => { + new tasks.SageMakerCreateModel(stack, 'Sagemaker', { + integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, + 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'), + }), + }); + }).toThrow(/Unsupported service integration pattern. Supported Patterns: REQUEST_RESPONSE. Received: WAIT_FOR_TASK_TOKEN/i); +}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.expected.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.expected.json new file mode 100644 index 0000000000000..57244344cbaed --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.expected.json @@ -0,0 +1,637 @@ +{ + "Resources": { + "EncryptionKey1B843E66": { + "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", + "kms:GenerateDataKey", + "kms:TagResource", + "kms:UntagResource" + ], + "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::GetAtt": [ + "TrainTaskSagemakerRoleD5A6F967", + "Arn" + ] + } + }, + "Resource": "*" + }, + { + "Action": [ + "kms:Encrypt", + "kms:ReEncrypt*", + "kms:GenerateDataKey*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::GetAtt": [ + "TrainTaskSagemakerRoleD5A6F967", + "Arn" + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "TrainingData3FDB6D34": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "KMSMasterKeyID": { + "Fn::GetAtt": [ + "EncryptionKey1B843E66", + "Arn" + ] + }, + "SSEAlgorithm": "aws:kms" + } + } + ] + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "TrainTaskSagemakerRoleD5A6F967": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "sagemaker.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "cloudwatch:PutMetricData", + "logs:CreateLogStream", + "logs:PutLogEvents", + "logs:CreateLogGroup", + "logs:DescribeLogStreams", + "ecr:GetAuthorizationToken" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "CreateTrainingJob" + } + ] + } + }, + "TrainTaskSagemakerRoleDefaultPolicy163CCC72": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "s3:GetObject*", + "s3:GetBucket*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "TrainingData3FDB6D34", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "TrainingData3FDB6D34", + "Arn" + ] + }, + "/data/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "EncryptionKey1B843E66", + "Arn" + ] + } + }, + { + "Action": [ + "s3:DeleteObject*", + "s3:PutObject*", + "s3:Abort*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "TrainingData3FDB6D34", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "TrainingData3FDB6D34", + "Arn" + ] + }, + "/result/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Encrypt", + "kms:ReEncrypt*", + "kms:GenerateDataKey*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "EncryptionKey1B843E66", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "TrainTaskSagemakerRoleDefaultPolicy163CCC72", + "Roles": [ + { + "Ref": "TrainTaskSagemakerRoleD5A6F967" + } + ] + } + }, + "CreateModelSagemakerRoleC2E07FC0": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "sagemaker.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "cloudwatch:PutMetricData", + "logs:CreateLogStream", + "logs:CreateLogGroup", + "logs:PutLogEvents", + "logs:DescribeLogStreams", + "ecr:GetAuthorizationToken" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "CreateModel" + } + ] + } + }, + "CreateModelSagemakerRoleDefaultPolicyD7EAA79E": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "ecr:BatchCheckLayerAvailability", + "ecr:GetDownloadUrlForLayer", + "ecr:BatchGetImage" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "s3:GetObject", + "s3:ListBucket" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "CreateModelSagemakerRoleDefaultPolicyD7EAA79E", + "Roles": [ + { + "Ref": "CreateModelSagemakerRoleC2E07FC0" + } + ] + } + }, + "StateMachineRoleB840431D": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": { + "Fn::Join": [ + "", + [ + "states.", + { + "Ref": "AWS::Region" + }, + ".amazonaws.com" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "StateMachineRoleDefaultPolicyDF1E6607": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "sagemaker:CreateTrainingJob", + "sagemaker:DescribeTrainingJob", + "sagemaker:StopTrainingJob" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":sagemaker:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":training-job/mytrainingjob*" + ] + ] + } + }, + { + "Action": "sagemaker:ListTags", + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": "iam:PassRole", + "Condition": { + "StringEquals": { + "iam:PassedToService": "sagemaker.amazonaws.com" + } + }, + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "TrainTaskSagemakerRoleD5A6F967", + "Arn" + ] + } + }, + { + "Action": "sagemaker:CreateModel", + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":sagemaker:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":model/*" + ] + ] + } + }, + { + "Action": "iam:PassRole", + "Condition": { + "StringEquals": { + "iam:PassedToService": "sagemaker.amazonaws.com" + } + }, + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "CreateModelSagemakerRoleC2E07FC0", + "Arn" + ] + } + }, + { + "Action": "sagemaker:CreateEndpointConfig", + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":sagemaker:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":endpoint-config/*" + ] + ] + } + }, + { + "Action": "sagemaker:createEndpoint", + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":sagemaker:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":endpoint/*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":sagemaker:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":endpoint-config/*" + ] + ] + } + ] + }, + { + "Action": "sagemaker:updateEndpoint", + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":sagemaker:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":endpoint/*" + ] + ] + } + } + ], + "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\":{\"Endpoint\":{\"Image\":\"ImageArn\",\"Config\":\"MyEndpointConfig\",\"Name\":\"MyEndpointName\",\"Model\":\"MyEndpointModelName\"}},\"Next\":\"Train Task\"},\"Train Task\":{\"Next\":\"Create Model\",\"Type\":\"Task\",\"ResultPath\":\"$.TrainingJob\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::sagemaker:createTrainingJob\",\"Parameters\":{\"TrainingJobName\":\"mytrainingjob\",\"RoleArn\":\"", + { + "Fn::GetAtt": [ + "TrainTaskSagemakerRoleD5A6F967", + "Arn" + ] + }, + "\",\"AlgorithmSpecification\":{\"TrainingInputMode\":\"File\",\"AlgorithmName\":\"arn:aws:sagemaker:us-east-1:865070037744:algorithm/scikit-decision-trees-15423055-57b73412d2e93e9239e4e16f83298b8f\"},\"InputDataConfig\":[{\"ChannelName\":\"InputData\",\"DataSource\":{\"S3DataSource\":{\"S3Uri\":\"https://s3.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "TrainingData3FDB6D34" + }, + "/data/\",\"S3DataType\":\"S3Prefix\"}}}],\"OutputDataConfig\":{\"S3OutputPath\":\"https://s3.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "TrainingData3FDB6D34" + }, + "/result/\"},\"ResourceConfig\":{\"InstanceCount\":1,\"InstanceType\":\"ml.m4.xlarge\",\"VolumeSizeInGB\":10},\"StoppingCondition\":{\"MaxRuntimeInSeconds\":3600}}},\"Create Model\":{\"Next\":\"Create enpoint config\",\"Type\":\"Task\",\"ResultPath\":\"$.Model\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::sagemaker:createModel\",\"Parameters\":{\"ExecutionRoleArn\":\"", + { + "Fn::GetAtt": [ + "CreateModelSagemakerRoleC2E07FC0", + "Arn" + ] + }, + "\",\"ModelName.$\":\"$.Endpoint.Model\",\"PrimaryContainer\":{\"Image.$\":\"$.Endpoint.Image\",\"Mode\":\"SingleModel\",\"ModelDataUrl.$\":\"$.TrainingJob.ModelArtifacts.S3ModelArtifacts\"}}},\"Create enpoint config\":{\"Next\":\"Create endpoint\",\"Type\":\"Task\",\"ResultPath\":\"$.EndpointConfig\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::sagemaker:createEndpointConfig\",\"Parameters\":{\"EndpointConfigName.$\":\"$.Endpoint.Config\",\"ProductionVariants\":[{\"InitialInstanceCount\":1,\"InstanceType\":\"ml.m5.xlarge\",\"ModelName.$\":\"$.Endpoint.Model\",\"VariantName\":\"awesome-variant\"}]}},\"Create endpoint\":{\"End\":true,\"Catch\":[{\"ErrorEquals\":[\"States.TaskFailed\"],\"ResultPath\":\"$.EndpointDeployed\",\"Next\":\"Update endpoint\"}],\"Type\":\"Task\",\"ResultPath\":\"$.EndpointDeployed\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::sagemaker:createEndpoint\",\"Parameters\":{\"EndpointConfigName.$\":\"$.Endpoint.Config\",\"EndpointName.$\":\"$.Endpoint.Name\",\"Tags\":[{\"Key\":\"Endpoint\",\"Value\":\"New\"}]}},\"Update endpoint\":{\"End\":true,\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::sagemaker:updateEndpoint\",\"Parameters\":{\"EndpointConfigName.$\":\"$.Endpoint.Config\",\"EndpointName.$\":\"$.Endpoint.Name\"}}}}" + ] + ] + } + }, + "DependsOn": [ + "StateMachineRoleDefaultPolicyDF1E6607", + "StateMachineRoleB840431D" + ] + } + }, + "Outputs": { + "StateMachineArn": { + "Value": { + "Ref": "StateMachine2E01A3A5" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.ts new file mode 100644 index 0000000000000..6ede459130439 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.ts @@ -0,0 +1,123 @@ +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'; + + +/* + * 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: cdk.App, id: string, props: cdk.StackProps = {}) { + 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(); + diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/update-endpoint.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/update-endpoint.test.ts new file mode 100644 index 0000000000000..f628ddbe9ed14 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/update-endpoint.test.ts @@ -0,0 +1,82 @@ +import '@aws-cdk/assert/jest'; +import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as cdk from '@aws-cdk/core'; +import * as tasks from '../../lib'; + +let stack: cdk.Stack; + +beforeEach(() => { + // GIVEN + stack = new cdk.Stack(); +}); + +test('update endpoint', () => { + // WHEN + const task = new tasks.SageMakerUpdateEndpoint(stack, 'SagemakerEndpoint', { + endpointName: 'MyEndpoint', + endpointConfigName: 'MyEndpointConfig', + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::sagemaker:updateEndpoint', + ], + ], + }, + End: true, + Parameters: { + EndpointConfigName: 'MyEndpointConfig', + EndpointName: 'MyEndpoint', + }, + }); +}); + +test('pass parameters to update endpoint', () => { + // WHEN + const task = new tasks.SageMakerUpdateEndpoint(stack, 'SagemakerEndpoint', { + endpointName: sfn.JsonPath.stringAt('$.Endpoint.Name'), + endpointConfigName: sfn.JsonPath.stringAt('$.Endpoint.Config'), + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::sagemaker:updateEndpoint', + ], + ], + }, + End: true, + Parameters: { + 'EndpointConfigName.$': '$.Endpoint.Config', + 'EndpointName.$': '$.Endpoint.Name', + }, + }); +}); + + +test('Task throws if WAIT_FOR_TASK_TOKEN is supplied as service integration pattern', () => { + expect(() => { + new tasks.SageMakerUpdateEndpoint(stack, 'UpdateSagemaker', { + integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, + endpointConfigName: 'MyEndpointConfig', + endpointName: 'MyEndpoint', + }); + }).toThrow(/Unsupported service integration pattern. Supported Patterns: REQUEST_RESPONSE. Received: WAIT_FOR_TASK_TOKEN/i); +}); From 56ef837a7831869d2165a0c846f4aa6e43d120b9 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Tue, 29 Sep 2020 10:31:56 +0200 Subject: [PATCH 10/10] chore(cli): undo rename 'versionReporting' => 'analyticsReporting' (#10587) The switch `versionReporting` was renamed to `analyticsReporting` in the framework in order to be more generic. However, this rename was carried through in parts of the CLI as well, especially in parts of the settings handling. This part is however not strongly typed but *stringly* typed (remember that settings are also read from `cdk.json`) and it's rather tricky to change there. Undo this change as it's breaking the integration tests; for now, the switch will still be called `versionReporting` in the CLI. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk/lib/settings.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/aws-cdk/lib/settings.ts b/packages/aws-cdk/lib/settings.ts index b091ba493c6dd..af9193d9a6456 100644 --- a/packages/aws-cdk/lib/settings.ts +++ b/packages/aws-cdk/lib/settings.ts @@ -54,7 +54,7 @@ export class Configuration { public context = new Context(); public readonly defaultConfig = new Settings({ - analyticsReporting: true, + versionReporting: true, pathMetadata: true, output: 'cdk.out', }); @@ -239,7 +239,7 @@ export class Settings { bucketName: argv.bootstrapBucketName, kmsKeyId: argv.bootstrapKmsKeyId, }, - analyticsReporting: argv.versionReporting, + versionReporting: argv.versionReporting, staging: argv.staging, output: argv.output, progress: argv.progress,