diff --git a/packages/@aws-cdk/aws-apigateway/README.md b/packages/@aws-cdk/aws-apigateway/README.md index 2663ef5fcdbbc..10c5c811f87ae 100644 --- a/packages/@aws-cdk/aws-apigateway/README.md +++ b/packages/@aws-cdk/aws-apigateway/README.md @@ -842,12 +842,17 @@ API. The following example will configure API Gateway to emit logs and data traces to AWS CloudWatch for all API calls: -> By default, an IAM role will be created and associated with API Gateway to -allow it to write logs and metrics to AWS CloudWatch unless `cloudWatchRole` is -set to `false`. +> Note: whether or not this is enabled or disabled by default is controlled by the +`@aws-cdk/aws-apigateway:disableCloudWatchRole` feature flag. When this feature flag +is set to `false` the default behavior will set `cloudWatchRole=true` + +This is controlled via the `@aws-cdk/aws-apigateway:disableCloudWatchRole` feature flag and +is disabled by default. When enabled (or `@aws-cdk/aws-apigateway:disableCloudWatchRole=false`), +an IAM role will be created and associated with API Gateway to allow it to write logs and metrics to AWS CloudWatch. ```ts const api = new apigateway.RestApi(this, 'books', { + cloudWatchRole: true, deployOptions: { loggingLevel: apigateway.MethodLoggingLevel.INFO, dataTraceEnabled: true @@ -855,6 +860,12 @@ const api = new apigateway.RestApi(this, 'books', { }) ``` +> Note: there can only be a single apigateway.CfnAccount per AWS environment +so if you create multiple `RestApi`s with `cloudWatchRole=true` each new `RestApi` +will overwrite the `CfnAccount`. It is recommended to set `cloudWatchRole=false` +(the default behavior if `@aws-cdk/aws-apigateway:disableCloudWatchRole` is enabled) +and only create a single CloudWatch role and account per environment. + ### Deep dive: Invalidation of deployments API Gateway deployments are an immutable snapshot of the API. This means that we diff --git a/packages/@aws-cdk/aws-apigateway/lib/restapi.ts b/packages/@aws-cdk/aws-apigateway/lib/restapi.ts index 2eb6a6d2d1e73..69d3d67584ea8 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/restapi.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/restapi.ts @@ -1,7 +1,8 @@ import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; import { IVpcEndpoint } from '@aws-cdk/aws-ec2'; import * as iam from '@aws-cdk/aws-iam'; -import { ArnFormat, CfnOutput, IResource as IResourceBase, Resource, Stack, Token } from '@aws-cdk/core'; +import { ArnFormat, CfnOutput, IResource as IResourceBase, Resource, Stack, Token, FeatureFlags, RemovalPolicy } from '@aws-cdk/core'; +import { APIGATEWAY_DISABLE_CLOUDWATCH_ROLE } from '@aws-cdk/cx-api'; import { Construct } from 'constructs'; import { ApiDefinition } from './api-definition'; import { ApiKey, ApiKeyOptions, IApiKey } from './api-key'; @@ -158,7 +159,7 @@ export interface RestApiBaseProps { /** * Automatically configure an AWS CloudWatch role for API Gateway. * - * @default true + * @default - false if `@aws-cdk/aws-apigateway:disableCloudWatchRole` is enabled, true otherwise */ readonly cloudWatchRole?: boolean; @@ -531,10 +532,12 @@ export abstract class RestApiBase extends Resource implements IRestApi { assumedBy: new iam.ServicePrincipal('apigateway.amazonaws.com'), managedPolicies: [iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonAPIGatewayPushToCloudWatchLogs')], }); + role.applyRemovalPolicy(RemovalPolicy.RETAIN); this.cloudWatchAccount = new CfnAccount(this, 'Account', { cloudWatchRoleArn: role.roleArn, }); + this.cloudWatchAccount.applyRemovalPolicy(RemovalPolicy.RETAIN); this.cloudWatchAccount.node.addDependency(apiResource); } @@ -663,7 +666,8 @@ export class SpecRestApi extends RestApiBase { this.addDomainName('CustomDomain', props.domainName); } - const cloudWatchRole = props.cloudWatchRole ?? true; + const cloudWatchRoleDefault = FeatureFlags.of(this).isEnabled(APIGATEWAY_DISABLE_CLOUDWATCH_ROLE) ? false : true; + const cloudWatchRole = props.cloudWatchRole ?? cloudWatchRoleDefault; if (cloudWatchRole) { this._configureCloudWatchRole(resource); } @@ -769,7 +773,8 @@ export class RestApi extends RestApiBase { this.node.defaultChild = resource; this.restApiId = resource.ref; - const cloudWatchRole = props.cloudWatchRole ?? true; + const cloudWatchRoleDefault = FeatureFlags.of(this).isEnabled(APIGATEWAY_DISABLE_CLOUDWATCH_ROLE) ? false : true; + const cloudWatchRole = props.cloudWatchRole ?? cloudWatchRoleDefault; if (cloudWatchRole) { this._configureCloudWatchRole(resource); } diff --git a/packages/@aws-cdk/aws-apigateway/package.json b/packages/@aws-cdk/aws-apigateway/package.json index b6f3c28297160..03ffea77f6e62 100644 --- a/packages/@aws-cdk/aws-apigateway/package.json +++ b/packages/@aws-cdk/aws-apigateway/package.json @@ -84,6 +84,7 @@ "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", + "@aws-cdk/integ-tests": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/jest": "^27.5.2" diff --git a/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"17.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/integ.json b/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/integ.json index 3887964b6d6ae..116ff17150383 100644 --- a/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/integ.json @@ -1,14 +1,11 @@ { "version": "20.0.0", "testCases": { - "integ.api-definition.asset": { + "restapi-fromdefinition/DefaultTest": { "stacks": [ "integtest-restapi-fromdefinition-asset" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "restapifromdefinitionDefaultTestDeployAssertDF3B0845" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/integtest-restapi-fromdefinition-asset.template.json b/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/integtest-restapi-fromdefinition-asset.template.json index 24bf0f6381d30..c2b1faee4acf6 100644 --- a/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/integtest-restapi-fromdefinition-asset.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/integtest-restapi-fromdefinition-asset.template.json @@ -143,7 +143,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "myapiAccountEC421A0A": { "Type": "AWS::ApiGateway::Account", @@ -157,7 +159,9 @@ }, "DependsOn": [ "myapi4C7BF186" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" } }, "Outputs": { diff --git a/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/manifest.json index 83ffee7788017..218cb54c360cf 100644 --- a/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -109,6 +109,15 @@ ] }, "displayName": "integtest-restapi-fromdefinition-asset" + }, + "restapifromdefinitionDefaultTestDeployAssertDF3B0845": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "restapifromdefinitionDefaultTestDeployAssertDF3B0845.template.json", + "validateOnSynth": false + }, + "displayName": "restapi-fromdefinition/DefaultTest/DeployAssert" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/restapifromdefinitionDefaultTestDeployAssertDF3B0845.template.json b/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/restapifromdefinitionDefaultTestDeployAssertDF3B0845.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/restapifromdefinitionDefaultTestDeployAssertDF3B0845.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/tree.json index 32ed04346ea7d..8863890b26569 100644 --- a/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/api-definition.asset.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "integtest-restapi-fromdefinition-asset": { @@ -362,14 +362,14 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "PetsURL": { @@ -393,6 +393,42 @@ "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } + }, + "restapi-fromdefinition": { + "id": "restapi-fromdefinition", + "path": "restapi-fromdefinition", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "restapi-fromdefinition/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "restapi-fromdefinition/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "restapi-fromdefinition/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"17.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/inlineapidefinitionDefaultTestDeployAssert923CAC29.template.json b/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/inlineapidefinitionDefaultTestDeployAssert923CAC29.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/inlineapidefinitionDefaultTestDeployAssert923CAC29.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/integ.json b/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/integ.json index d48dc17bcd6a7..59c6aa3eb1be5 100644 --- a/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/integ.json @@ -1,14 +1,11 @@ { "version": "20.0.0", "testCases": { - "integ.api-definition.inline": { + "inline-api-definition/DefaultTest": { "stacks": [ "integtest-restapi-fromdefinition-inline" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "inlineapidefinitionDefaultTestDeployAssert923CAC29" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/integtest-restapi-fromdefinition-inline.template.json b/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/integtest-restapi-fromdefinition-inline.template.json index 73049735004de..90380a86cb303 100644 --- a/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/integtest-restapi-fromdefinition-inline.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/integtest-restapi-fromdefinition-inline.template.json @@ -103,7 +103,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "myapiAccountEC421A0A": { "Type": "AWS::ApiGateway::Account", @@ -117,7 +119,9 @@ }, "DependsOn": [ "myapi4C7BF186" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" } }, "Outputs": { diff --git a/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/manifest.json index e44e616dde998..a26f964127b2d 100644 --- a/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -59,6 +59,15 @@ ] }, "displayName": "integtest-restapi-fromdefinition-inline" + }, + "inlineapidefinitionDefaultTestDeployAssert923CAC29": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "inlineapidefinitionDefaultTestDeployAssert923CAC29.template.json", + "validateOnSynth": false + }, + "displayName": "inline-api-definition/DefaultTest/DeployAssert" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/tree.json index 90f38ab9e255d..3f225c07b4ac0 100644 --- a/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/api-definition.inline.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "integtest-restapi-fromdefinition-inline": { @@ -241,6 +241,42 @@ "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } + }, + "inline-api-definition": { + "id": "inline-api-definition", + "path": "inline-api-definition", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "inline-api-definition/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "inline-api-definition/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "inline-api-definition/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/CognitoUserPoolsAuthorizerInteg.template.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/CognitoUserPoolsAuthorizerInteg.template.json index 4c79f5916d2e4..20dcd5bc15060 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/CognitoUserPoolsAuthorizerInteg.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/CognitoUserPoolsAuthorizerInteg.template.json @@ -85,7 +85,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "myrestapiAccountA49A05BE": { "Type": "AWS::ApiGateway::Account", @@ -99,7 +101,9 @@ }, "DependsOn": [ "myrestapi551C8392" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "myrestapiDeployment419B1464b903292b53d7532ca4296973bcb95b1a": { "Type": "AWS::ApiGateway::Deployment", diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"17.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/cognitoauthorizerDefaultTestDeployAssert4551574C.template.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/cognitoauthorizerDefaultTestDeployAssert4551574C.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/cognitoauthorizerDefaultTestDeployAssert4551574C.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/integ.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/integ.json index defc49f07b83c..fa39f999f8d90 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/integ.json @@ -1,14 +1,11 @@ { "version": "20.0.0", "testCases": { - "integ.cognito-authorizer": { + "cognito-authorizer/DefaultTest": { "stacks": [ "CognitoUserPoolsAuthorizerInteg" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "cognitoauthorizerDefaultTestDeployAssert4551574C" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/manifest.json index ea5d4866817f9..89e0a571c4aa7 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -71,6 +71,15 @@ ] }, "displayName": "CognitoUserPoolsAuthorizerInteg" + }, + "cognitoauthorizerDefaultTestDeployAssert4551574C": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "cognitoauthorizerDefaultTestDeployAssert4551574C.template.json", + "validateOnSynth": false + }, + "displayName": "cognito-authorizer/DefaultTest/DeployAssert" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/tree.json index 6bb61ec97b48d..3a1f68e193d38 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito-authorizer.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "CognitoUserPoolsAuthorizerInteg": { @@ -326,6 +326,42 @@ "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } + }, + "cognito-authorizer": { + "id": "cognito-authorizer", + "path": "cognito-authorizer", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "cognito-authorizer/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "cognito-authorizer/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "cognito-authorizer/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.ts b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.ts index 4830dc83ae29f..9bd863efa736b 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.ts +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.ts @@ -1,5 +1,6 @@ import * as cognito from '@aws-cdk/aws-cognito'; import { App, Stack } from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; import { AuthorizationType, CognitoUserPoolsAuthorizer, MockIntegration, PassthroughBehavior, RestApi } from '../../lib'; /* @@ -25,7 +26,7 @@ const authorizer = new CognitoUserPoolsAuthorizer(stack, 'myauthorizer', { cognitoUserPools: [userPool], }); -const restApi = new RestApi(stack, 'myrestapi'); +const restApi = new RestApi(stack, 'myrestapi', { cloudWatchRole: true }); restApi.root.addMethod('ANY', new MockIntegration({ integrationResponses: [ { statusCode: '200' }, @@ -41,3 +42,7 @@ restApi.root.addMethod('ANY', new MockIntegration({ authorizer, authorizationType: AuthorizationType.COGNITO, }); + +new IntegTest(app, 'cognito-authorizer', { + testCases: [stack], +}); diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.ts b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.ts index 066badbe4e0bb..4f79409da4013 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.ts +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.ts @@ -20,7 +20,7 @@ const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', { code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.request-authorizer.handler')), }); -const restapi = new RestApi(stack, 'MyRestApi'); +const restapi = new RestApi(stack, 'MyRestApi', { cloudWatchRole: true }); const authorizer = new RequestAuthorizer(stack, 'MyAuthorizer', { handler: authorizerFn, diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.ts b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.ts index 5890d03f9bc3a..a7f0a367fbd46 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.ts +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.ts @@ -3,6 +3,7 @@ import * as path from 'path'; import * as iam from '@aws-cdk/aws-iam'; import * as lambda from '@aws-cdk/aws-lambda'; import { App, Stack } from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; import { AuthorizationType, MockIntegration, PassthroughBehavior, RestApi, TokenAuthorizer } from '../../lib'; /* @@ -30,7 +31,7 @@ const authorizer = new TokenAuthorizer(stack, 'MyAuthorizer', { assumeRole: role, }); -const restapi = new RestApi(stack, 'MyRestApi'); +const restapi = new RestApi(stack, 'MyRestApi', { cloudWatchRole: true }); restapi.root.addMethod('ANY', new MockIntegration({ integrationResponses: [ @@ -47,3 +48,7 @@ restapi.root.addMethod('ANY', new MockIntegration({ authorizer, authorizationType: AuthorizationType.CUSTOM, }); + +new IntegTest(app, 'iam-token-authorizer', { + testCases: [stack], +}); diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.lit.ts b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.lit.ts index 655fa91962b1a..2b5fc3a62ddc8 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.lit.ts +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.lit.ts @@ -20,7 +20,7 @@ const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', { code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.token-authorizer.handler')), }); -const restapi = new RestApi(stack, 'MyRestApi'); +const restapi = new RestApi(stack, 'MyRestApi', { cloudWatchRole: true }); const authorizer = new TokenAuthorizer(stack, 'MyAuthorizer', { handler: authorizerFn, diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/RequestAuthorizerInteg.assets.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/RequestAuthorizerInteg.assets.json new file mode 100644 index 0000000000000..a5d63e72ed201 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/RequestAuthorizerInteg.assets.json @@ -0,0 +1,32 @@ +{ + "version": "20.0.0", + "files": { + "3dc8c5549b88fef617feef923524902b3650973ae1159c9489ee8405344dd5a0": { + "source": { + "path": "asset.3dc8c5549b88fef617feef923524902b3650973ae1159c9489ee8405344dd5a0.handler", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "3dc8c5549b88fef617feef923524902b3650973ae1159c9489ee8405344dd5a0.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "5ba1108f5d1f7ce23d5bad675df22e0d3beb4f42fc970713488ea99585299b43": { + "source": { + "path": "RequestAuthorizerInteg.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "5ba1108f5d1f7ce23d5bad675df22e0d3beb4f42fc970713488ea99585299b43.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/RequestAuthorizerInteg.template.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/RequestAuthorizerInteg.template.json index 80cc32cf5fa4a..662d5a18277d0 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/RequestAuthorizerInteg.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/RequestAuthorizerInteg.template.json @@ -160,7 +160,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "MyRestApiAccount2FB6DB7A": { "Type": "AWS::ApiGateway::Account", @@ -174,7 +176,9 @@ }, "DependsOn": [ "MyRestApi2D1F47A9" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "MyRestApiDeploymentB555B582dcff966d69deeda8d47e3bf409ce29cb": { "Type": "AWS::ApiGateway::Deployment", diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"17.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/manifest.json index e51d66f00a906..0f45bbe3ed6f3 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/tree.json index ec16b68e7f7c4..49da581699669 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/request-authorizer.lit.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "RequestAuthorizerInteg": { @@ -242,14 +242,14 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "MyRestApi": { diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/TokenAuthorizerIAMRoleInteg.template.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/TokenAuthorizerIAMRoleInteg.template.json index 9e67ba2f39402..9f9f278386e26 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/TokenAuthorizerIAMRoleInteg.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/TokenAuthorizerIAMRoleInteg.template.json @@ -245,7 +245,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "MyRestApiAccount2FB6DB7A": { "Type": "AWS::ApiGateway::Account", @@ -259,7 +261,9 @@ }, "DependsOn": [ "MyRestApi2D1F47A9" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "MyRestApiDeploymentB555B582dcff966d69deeda8d47e3bf409ce29cb": { "Type": "AWS::ApiGateway::Deployment", diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"17.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/iamtokenauthorizerDefaultTestDeployAssert87D47FBB.template.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/iamtokenauthorizerDefaultTestDeployAssert87D47FBB.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/iamtokenauthorizerDefaultTestDeployAssert87D47FBB.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/integ.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/integ.json index efcfb432b580f..b89b94e273d2e 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/integ.json @@ -1,14 +1,11 @@ { "version": "20.0.0", "testCases": { - "integ.token-authorizer-iam-role": { + "iam-token-authorizer/DefaultTest": { "stacks": [ "TokenAuthorizerIAMRoleInteg" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "iamtokenauthorizerDefaultTestDeployAssert87D47FBB" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/manifest.json index db9c48a9bab36..96a8e5ecfd82e 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -121,6 +121,15 @@ ] }, "displayName": "TokenAuthorizerIAMRoleInteg" + }, + "iamtokenauthorizerDefaultTestDeployAssert87D47FBB": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "iamtokenauthorizerDefaultTestDeployAssert87D47FBB.template.json", + "validateOnSynth": false + }, + "displayName": "iam-token-authorizer/DefaultTest/DeployAssert" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/tree.json index 0577d868c1eab..8d177e6414fad 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer-iam-role.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "TokenAuthorizerIAMRoleInteg": { @@ -194,14 +194,14 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "authorizerRole": { @@ -609,6 +609,42 @@ "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } + }, + "iam-token-authorizer": { + "id": "iam-token-authorizer", + "path": "iam-token-authorizer", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "iam-token-authorizer/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "iam-token-authorizer/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "iam-token-authorizer/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/TokenAuthorizerInteg.assets.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/TokenAuthorizerInteg.assets.json new file mode 100644 index 0000000000000..e9587f517510e --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/TokenAuthorizerInteg.assets.json @@ -0,0 +1,32 @@ +{ + "version": "20.0.0", + "files": { + "fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3": { + "source": { + "path": "asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "d121ee9744a20c9af43e516c8fb4fe93d1ed9b26130e2db68ed9534c7104c866": { + "source": { + "path": "TokenAuthorizerInteg.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "d121ee9744a20c9af43e516c8fb4fe93d1ed9b26130e2db68ed9534c7104c866.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/TokenAuthorizerInteg.template.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/TokenAuthorizerInteg.template.json index 4a24a48545d36..d06c5133e382f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/TokenAuthorizerInteg.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/TokenAuthorizerInteg.template.json @@ -160,7 +160,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "MyRestApiAccount2FB6DB7A": { "Type": "AWS::ApiGateway::Account", @@ -174,7 +176,9 @@ }, "DependsOn": [ "MyRestApi2D1F47A9" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "MyRestApiDeploymentB555B582dcff966d69deeda8d47e3bf409ce29cb": { "Type": "AWS::ApiGateway::Deployment", diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"17.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/manifest.json index ff0bbc5043a36..4246ff0d86914 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/tokenauthorizerDefaultTestDeployAssert533B8FDF.template.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/tokenauthorizerDefaultTestDeployAssert533B8FDF.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/tokenauthorizerDefaultTestDeployAssert533B8FDF.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/tree.json index 5ac62c00bd566..857c9e1840805 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/authorizers/token-authorizer.lit.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "TokenAuthorizerInteg": { @@ -242,14 +242,14 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "MyRestApi": { diff --git a/packages/@aws-cdk/aws-apigateway/test/cloudwatch-disabled.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/cloudwatch-disabled.integ.snapshot/cdk.out new file mode 100644 index 0000000000000..588d7b269d34f --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/cloudwatch-disabled.integ.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/cloudwatch-disabled.integ.snapshot/cloudwatchlogsdisabledDefaultTestDeployAssert6C87D47C.template.json b/packages/@aws-cdk/aws-apigateway/test/cloudwatch-disabled.integ.snapshot/cloudwatchlogsdisabledDefaultTestDeployAssert6C87D47C.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/cloudwatch-disabled.integ.snapshot/cloudwatchlogsdisabledDefaultTestDeployAssert6C87D47C.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/cloudwatch-disabled.integ.snapshot/default-api.template.json b/packages/@aws-cdk/aws-apigateway/test/cloudwatch-disabled.integ.snapshot/default-api.template.json new file mode 100644 index 0000000000000..c9e9db754072e --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/cloudwatch-disabled.integ.snapshot/default-api.template.json @@ -0,0 +1,83 @@ +{ + "Resources": { + "myapi4C7BF186": { + "Type": "AWS::ApiGateway::RestApi", + "Properties": { + "Name": "my-api" + } + }, + "myapiDeployment92F2CB4972a890db5063ec679071ba7eefc76f2a": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "myapi4C7BF186" + }, + "Description": "Automatically created by the RestApi construct" + }, + "DependsOn": [ + "myapiGETF990CE3C" + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "myapiDeploymentStageprod298F01AF": { + "Type": "AWS::ApiGateway::Stage", + "Properties": { + "RestApiId": { + "Ref": "myapi4C7BF186" + }, + "DeploymentId": { + "Ref": "myapiDeployment92F2CB4972a890db5063ec679071ba7eefc76f2a" + }, + "StageName": "prod" + } + }, + "myapiGETF990CE3C": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "GET", + "ResourceId": { + "Fn::GetAtt": [ + "myapi4C7BF186", + "RootResourceId" + ] + }, + "RestApiId": { + "Ref": "myapi4C7BF186" + }, + "AuthorizationType": "NONE", + "Integration": { + "Type": "MOCK" + } + } + } + }, + "Outputs": { + "myapiEndpoint3628AFE3": { + "Value": { + "Fn::Join": [ + "", + [ + "https://", + { + "Ref": "myapi4C7BF186" + }, + ".execute-api.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "myapiDeploymentStageprod298F01AF" + }, + "/" + ] + ] + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/cloudwatch-disabled.integ.snapshot/integ.json b/packages/@aws-cdk/aws-apigateway/test/cloudwatch-disabled.integ.snapshot/integ.json new file mode 100644 index 0000000000000..312033e8d4dc8 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/cloudwatch-disabled.integ.snapshot/integ.json @@ -0,0 +1,11 @@ +{ + "version": "20.0.0", + "testCases": { + "cloudwatch-logs-disabled/DefaultTest": { + "stacks": [ + "default-api" + ], + "assertionStack": "cloudwatchlogsdisabledDefaultTestDeployAssert6C87D47C" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/cloudwatch-disabled.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/cloudwatch-disabled.integ.snapshot/manifest.json new file mode 100644 index 0000000000000..2f1ae99617438 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/cloudwatch-disabled.integ.snapshot/manifest.json @@ -0,0 +1,61 @@ +{ + "version": "20.0.0", + "artifacts": { + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + }, + "default-api": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "default-api.template.json", + "validateOnSynth": false + }, + "metadata": { + "/default-api/my-api/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myapi4C7BF186" + } + ], + "/default-api/my-api/Deployment/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myapiDeployment92F2CB4972a890db5063ec679071ba7eefc76f2a" + } + ], + "/default-api/my-api/DeploymentStage.prod/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myapiDeploymentStageprod298F01AF" + } + ], + "/default-api/my-api/Endpoint": [ + { + "type": "aws:cdk:logicalId", + "data": "myapiEndpoint3628AFE3" + } + ], + "/default-api/my-api/Default/GET/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myapiGETF990CE3C" + } + ] + }, + "displayName": "default-api" + }, + "cloudwatchlogsdisabledDefaultTestDeployAssert6C87D47C": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "cloudwatchlogsdisabledDefaultTestDeployAssert6C87D47C.template.json", + "validateOnSynth": false + }, + "displayName": "cloudwatch-logs-disabled/DefaultTest/DeployAssert" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/cloudwatch-disabled.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/cloudwatch-disabled.integ.snapshot/tree.json new file mode 100644 index 0000000000000..27d98495a9aee --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/cloudwatch-disabled.integ.snapshot/tree.json @@ -0,0 +1,203 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "default-api": { + "id": "default-api", + "path": "default-api", + "children": { + "my-api": { + "id": "my-api", + "path": "default-api/my-api", + "children": { + "Resource": { + "id": "Resource", + "path": "default-api/my-api/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::RestApi", + "aws:cdk:cloudformation:props": { + "name": "my-api" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnRestApi", + "version": "0.0.0" + } + }, + "Deployment": { + "id": "Deployment", + "path": "default-api/my-api/Deployment", + "children": { + "Resource": { + "id": "Resource", + "path": "default-api/my-api/Deployment/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Deployment", + "aws:cdk:cloudformation:props": { + "restApiId": { + "Ref": "myapi4C7BF186" + }, + "description": "Automatically created by the RestApi construct" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnDeployment", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.Deployment", + "version": "0.0.0" + } + }, + "DeploymentStage.prod": { + "id": "DeploymentStage.prod", + "path": "default-api/my-api/DeploymentStage.prod", + "children": { + "Resource": { + "id": "Resource", + "path": "default-api/my-api/DeploymentStage.prod/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Stage", + "aws:cdk:cloudformation:props": { + "restApiId": { + "Ref": "myapi4C7BF186" + }, + "deploymentId": { + "Ref": "myapiDeployment92F2CB4972a890db5063ec679071ba7eefc76f2a" + }, + "stageName": "prod" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnStage", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.Stage", + "version": "0.0.0" + } + }, + "Endpoint": { + "id": "Endpoint", + "path": "default-api/my-api/Endpoint", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + }, + "Default": { + "id": "Default", + "path": "default-api/my-api/Default", + "children": { + "GET": { + "id": "GET", + "path": "default-api/my-api/Default/GET", + "children": { + "Resource": { + "id": "Resource", + "path": "default-api/my-api/Default/GET/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Method", + "aws:cdk:cloudformation:props": { + "httpMethod": "GET", + "resourceId": { + "Fn::GetAtt": [ + "myapi4C7BF186", + "RootResourceId" + ] + }, + "restApiId": { + "Ref": "myapi4C7BF186" + }, + "authorizationType": "NONE", + "integration": { + "type": "MOCK" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnMethod", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.Method", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.ResourceBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.RestApi", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + }, + "cloudwatch-logs-disabled": { + "id": "cloudwatch-logs-disabled", + "path": "cloudwatch-logs-disabled", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "cloudwatch-logs-disabled/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "cloudwatch-logs-disabled/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "cloudwatch-logs-disabled/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"17.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/cors-twitch-test.template.json b/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/cors-twitch-test.template.json index 8a68668d7438a..f345bb3482731 100644 --- a/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/cors-twitch-test.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/cors-twitch-test.template.json @@ -35,7 +35,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "corsapitestAccount7D1D6854": { "Type": "AWS::ApiGateway::Account", @@ -49,7 +51,9 @@ }, "DependsOn": [ "corsapitest8682546E" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "corsapitestDeployment2BF1633A51392cbce1ac2785bd0e53063423e203": { "Type": "AWS::ApiGateway::Deployment", diff --git a/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/corsDefaultTestDeployAssert5CF8F851.template.json b/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/corsDefaultTestDeployAssert5CF8F851.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/corsDefaultTestDeployAssert5CF8F851.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/integ.json b/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/integ.json index 8ff60c232380e..0532adbe1ad9a 100644 --- a/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/integ.json @@ -1,14 +1,11 @@ { "version": "20.0.0", "testCases": { - "integ.cors": { + "cors/DefaultTest": { "stacks": [ "cors-twitch-test" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "corsDefaultTestDeployAssert5CF8F851" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/manifest.json index 286cf1052ca30..ef2b998e64df7 100644 --- a/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -163,6 +163,15 @@ ] }, "displayName": "cors-twitch-test" + }, + "corsDefaultTestDeployAssert5CF8F851": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "corsDefaultTestDeployAssert5CF8F851.template.json", + "validateOnSynth": false + }, + "displayName": "cors/DefaultTest/DeployAssert" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/tree.json index 1050c0c10bca0..35c0ec1a18f09 100644 --- a/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/cors.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "cors-twitch-test": { @@ -912,19 +912,55 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", + "fqn": "constructs.Construct", + "version": "10.1.63" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + }, + "cors": { + "id": "cors", + "path": "cors", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "cors/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "cors/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "cors/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", + "fqn": "@aws-cdk/integ-tests.IntegTestCase", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/core.Stack", + "fqn": "@aws-cdk/integ-tests.IntegTest", "version": "0.0.0" } } diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.ts b/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.ts index 1d807c6caac7d..272951a7b4602 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.ts @@ -1,5 +1,6 @@ import * as path from 'path'; import * as cdk from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; import * as apigateway from '../lib'; /* @@ -12,6 +13,7 @@ const app = new cdk.App(); const stack = new cdk.Stack(app, 'integtest-restapi-fromdefinition-asset'); const api = new apigateway.SpecRestApi(stack, 'my-api', { + cloudWatchRole: true, apiDefinition: apigateway.ApiDefinition.fromAsset(path.join(__dirname, 'sample-definition.yaml')), }); @@ -35,4 +37,6 @@ new cdk.CfnOutput(stack, 'BooksURL', { value: api.urlForPath('/books'), }); -app.synth(); +new IntegTest(app, 'restapi-fromdefinition', { + testCases: [stack], +}); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.ts b/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.ts index 4d9f3bcf76364..5c0843293744e 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.ts @@ -1,4 +1,5 @@ import * as cdk from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; import * as apigateway from '../lib'; /* @@ -10,6 +11,7 @@ const app = new cdk.App(); const stack = new cdk.Stack(app, 'integtest-restapi-fromdefinition-inline'); const api = new apigateway.SpecRestApi(stack, 'my-api', { + cloudWatchRole: true, apiDefinition: apigateway.ApiDefinition.fromInline({ openapi: '3.0.2', info: { @@ -63,4 +65,6 @@ new cdk.CfnOutput(stack, 'PetsURL', { value: api.urlForPath('/pets'), }); -app.synth(); +new IntegTest(app, 'inline-api-definition', { + testCases: [stack], +}); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.ts b/packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.ts new file mode 100644 index 0000000000000..41017a976de4b --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.ts @@ -0,0 +1,20 @@ +import * as cdk from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; +import * as apigateway from '../lib'; + +export class Test extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + const api = new apigateway.RestApi(this, 'my-api', { + retainDeployments: true, + }); + api.root.addMethod('GET'); // must have at least one method or an API definition + } +} + +const app = new cdk.App(); +new IntegTest(app, 'cloudwatch-logs-disabled', { + testCases: [ + new Test(app, 'default-api'), + ], +}); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cors.ts b/packages/@aws-cdk/aws-apigateway/test/integ.cors.ts index e5617f4c9b202..5c7ac6eb8d4cf 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.cors.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.cors.ts @@ -4,12 +4,15 @@ import * as lambda from '@aws-cdk/aws-lambda'; import { App, Stack, StackProps } from '@aws-cdk/core'; import { Construct } from 'constructs'; import * as apigw from '../lib'; +import { IntegTest } from '@aws-cdk/integ-tests'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { super(scope, id, props); - const api = new apigw.RestApi(this, 'cors-api-test'); + const api = new apigw.RestApi(this, 'cors-api-test', { + cloudWatchRole: true, + }); const handler = new lambda.Function(this, 'handler', { runtime: lambda.Runtime.NODEJS_14_X, @@ -28,5 +31,8 @@ class TestStack extends Stack { } const app = new App(); -new TestStack(app, 'cors-twitch-test'); +const testCase = new TestStack(app, 'cors-twitch-test'); +new IntegTest(app, 'cors', { + testCases: [testCase], +}); app.synth(); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.ts b/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.ts index 2e890d42c9ee8..214e4dde30911 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.ts @@ -1,5 +1,6 @@ import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; import { App, Stack } from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; import { Construct } from 'constructs'; import { LambdaRestApi, PassthroughBehavior } from '../lib'; @@ -14,6 +15,7 @@ class LambdaApiIntegrationOptionsNonProxyIntegrationStack extends Stack { }); new LambdaRestApi(this, 'lambdarestapi', { + cloudWatchRole: true, handler: fn, integrationOptions: { proxy: false, @@ -32,4 +34,7 @@ class LambdaApiIntegrationOptionsNonProxyIntegrationStack extends Stack { } const app = new App(); -new LambdaApiIntegrationOptionsNonProxyIntegrationStack(app); +const testCase = new LambdaApiIntegrationOptionsNonProxyIntegrationStack(app); +new IntegTest(app, 'lambda-non-proxy-integration', { + testCases: [testCase], +}); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.ts b/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.ts index 615c934f918fe..8f3a6c63736a2 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.ts @@ -1,5 +1,6 @@ import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; import { App, Stack } from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; import { Construct } from 'constructs'; import { Deployment, LambdaRestApi, Stage } from '../lib'; @@ -14,6 +15,7 @@ class LateBoundDeploymentStageStack extends Stack { }); const api = new LambdaRestApi(this, 'lambdarestapi', { + cloudWatchRole: true, deploy: false, handler: fn, }); @@ -27,4 +29,7 @@ class LateBoundDeploymentStageStack extends Stack { } const app = new App(); -new LateBoundDeploymentStageStack(app); \ No newline at end of file +const testCase = new LateBoundDeploymentStageStack(app); +new IntegTest(app, 'lambda-api-latebound-deploymentstage', { + testCases: [testCase], +}); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.ts b/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.ts index 0351d7ec3813f..4462535b60d3a 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.ts @@ -1,5 +1,6 @@ import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; import { App, Duration, Stack } from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; import { Construct } from 'constructs'; import { LambdaRestApi } from '../lib'; @@ -15,6 +16,7 @@ class LambdaApiIntegrationOptionsStack extends Stack { new LambdaRestApi(this, 'lambdarestapi', { handler: fn, + cloudWatchRole: true, integrationOptions: { timeout: Duration.seconds(1), }, @@ -23,4 +25,7 @@ class LambdaApiIntegrationOptionsStack extends Stack { } const app = new App(); -new LambdaApiIntegrationOptionsStack(app); +const testCase = new LambdaApiIntegrationOptionsStack(app); +new IntegTest(app, 'lambda-integration', { + testCases: [testCase], +}); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.ts b/packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.ts index 77094eb60b600..4552292571e8c 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.ts @@ -17,6 +17,7 @@ class RootStack extends Stack { super(scope, 'integ-restapi-import-RootStack'); const restApi = new RestApi(this, 'RestApi', { + cloudWatchRole: true, deploy: false, }); restApi.root.addMethod('ANY'); @@ -126,4 +127,4 @@ class DeployStack extends NestedStack { } } -new RootStack(new App()); \ No newline at end of file +new RootStack(new App()); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.ts b/packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.ts index e4b39f4a6590d..01092efe56642 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.ts @@ -5,7 +5,7 @@ import * as apigw from '../lib'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'restapi-metrics'); -const restApi = new apigw.RestApi(stack, 'Api'); +const restApi = new apigw.RestApi(stack, 'Api', { cloudWatchRole: true }); const stage = restApi.deploymentStage; const method = restApi.root.addMethod('GET'); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.ts b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.ts index 0ec001e3d1a3a..a25cd1ba43d69 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.ts @@ -1,5 +1,6 @@ import * as lambda from '@aws-cdk/aws-lambda'; import * as cdk from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; import * as apigw from '../lib'; class BookStack extends cdk.Stack { @@ -24,7 +25,7 @@ class BookStack extends cdk.Stack { code: lambda.Code.fromInline(`exports.handler = ${helloCode}`), })); - const api = new apigw.RestApi(this, 'books-api'); + const api = new apigw.RestApi(this, 'books-api', { cloudWatchRole: true }); api.root.addMethod('ANY', hello); const books = api.root.addResource('books', { @@ -45,13 +46,12 @@ class BookStack extends cdk.Stack { } } -class BookApp extends cdk.App { - constructor() { - super(); +const app = new cdk.App(); - new BookStack(this, 'restapi-books-example'); - } -} +const testCase = new BookStack(app, 'restapi-books-example'); +new IntegTest(app, 'restapi-books', { + testCases: [testCase], +}); function echoHandlerCode(event: any, _: any, callback: any) { return callback(undefined, { @@ -68,5 +68,3 @@ function helloCode(_event: any, _context: any, callback: any) { body: 'hello, world!', }); } - -new BookApp().synth(); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.ts b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.ts index 900a2b553bd56..102818881d324 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.ts @@ -1,13 +1,16 @@ import * as cdk from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; import * as apigateway from '../lib'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'test-apigateway-restapi-defaults'); -const api = new apigateway.RestApi(stack, 'my-api'); +const api = new apigateway.RestApi(stack, 'my-api', { cloudWatchRole: true }); // at least one method is required api.root.addMethod('GET'); -app.synth(); +new IntegTest(app, 'apigateway-restapi-defaults', { + testCases: [stack], +}); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.ts b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.ts index 75b6e219613de..13fb7d19b9833 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.ts @@ -1,7 +1,6 @@ -/// !cdk-integ * - import * as lambda from '@aws-cdk/aws-lambda'; import * as cdk from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; import * as constructs from 'constructs'; import * as apig from '../lib'; @@ -34,6 +33,7 @@ class SecondStack extends cdk.Stack { super(scope, id, props); const api = new apig.RestApi(this, 'BooksApi', { + cloudWatchRole: true, restApiName: 'SecondRestAPI', }); api.root.addMethod('ANY'); @@ -45,5 +45,9 @@ class SecondStack extends cdk.Stack { const app = new cdk.App(); const first = new FirstStack(app, 'FirstStack'); -new SecondStack(app, 'SecondStack', { lambda: first.firstLambda }); -app.synth(); +const testCase = new SecondStack(app, 'SecondStack', { lambda: first.firstLambda }); + +// will deploy dependent stacks, i.e. first +new IntegTest(app, 'restapi-multistack', { + testCases: [testCase], +}); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.ts b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.ts index 612bd0e83b963..83968e997f98a 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.ts @@ -1,5 +1,6 @@ import * as lambda from '@aws-cdk/aws-lambda'; import * as cdk from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; import * as apigw from '../lib'; class MultiStack extends cdk.Stack { @@ -12,21 +13,20 @@ class MultiStack extends cdk.Stack { code: lambda.Code.fromInline(`exports.handler = ${helloCode}`), })); - const api = new apigw.RestApi(this, 'hello-api'); + const api = new apigw.RestApi(this, 'hello-api', { cloudWatchRole: true }); api.root.resourceForPath('/hello').addMethod('GET', hello); - const api2 = new apigw.RestApi(this, 'second-api'); + const api2 = new apigw.RestApi(this, 'second-api', { cloudWatchRole: true }); api2.root.resourceForPath('/hello').addMethod('GET', hello); } } -class MultiApp extends cdk.App { - constructor() { - super(); +const app = new cdk.App(); +const testCase = new MultiStack(app, 'restapi-multiuse-example'); - new MultiStack(this, 'restapi-multiuse-example'); - } -} +new IntegTest(app, 'restapi-multiuse', { + testCases: [testCase], +}); function helloCode(_event: any, _context: any, callback: any) { return callback(undefined, { @@ -35,4 +35,3 @@ function helloCode(_event: any, _context: any, callback: any) { }); } -new MultiApp().synth(); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.ts b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.ts index 537ec3031d58a..a6acb0c0c1439 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.ts @@ -1,5 +1,6 @@ import * as lambda from '@aws-cdk/aws-lambda'; import * as cdk from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; import * as apigateway from '../lib'; class Test extends cdk.Stack { @@ -8,6 +9,7 @@ class Test extends cdk.Stack { const api = new apigateway.RestApi(this, 'my-api', { retainDeployments: true, + cloudWatchRole: true, deployOptions: { cacheClusterEnabled: true, stageName: 'beta', @@ -81,6 +83,8 @@ class Test extends cdk.Stack { const app = new cdk.App(); -new Test(app, 'test-apigateway-restapi'); +const testCase = new Test(app, 'test-apigateway-restapi'); +new IntegTest(app, 'apigateway-restapi', { + testCases: [testCase], +}); -app.synth(); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.ts b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.ts index 89912e35a83b7..2e7c0e0c01113 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.ts @@ -1,6 +1,7 @@ import * as ec2 from '@aws-cdk/aws-ec2'; import * as iam from '@aws-cdk/aws-iam'; import * as cdk from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; import * as apigateway from '../lib'; /* @@ -19,6 +20,7 @@ class Test extends cdk.Stack { }); const api = new apigateway.RestApi(this, 'MyApi', { + cloudWatchRole: true, endpointConfiguration: { types: [apigateway.EndpointType.PRIVATE], vpcEndpoints: [vpcEndpoint], @@ -39,6 +41,9 @@ class Test extends cdk.Stack { const app = new cdk.App(); -new Test(app, 'test-apigateway-vpcendpoint'); +const testCase = new Test(app, 'test-apigateway-vpcendpoint'); +new IntegTest(app, 'apigateway-vpcendpoint', { + testCases: [testCase], +}); app.synth(); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.ts b/packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.ts index baa43fb1e97e3..3ba3d13d38e7a 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.ts @@ -1,5 +1,6 @@ import * as sfn from '@aws-cdk/aws-stepfunctions'; import * as cdk from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; import { Construct } from 'constructs'; import * as apigw from '../lib'; @@ -25,6 +26,7 @@ class StepFunctionsRestApiDeploymentStack extends cdk.Stack { const api = new apigw.StepFunctionsRestApi(this, 'StepFunctionsRestApi', { deploy: false, + cloudWatchRole: true, stateMachine: stateMachine, headers: true, path: false, @@ -48,5 +50,9 @@ class StepFunctionsRestApiDeploymentStack extends cdk.Stack { } const app = new cdk.App(); -new StepFunctionsRestApiDeploymentStack(app); +const testCase = new StepFunctionsRestApiDeploymentStack(app); + +new IntegTest(app, 'step-functions-restapi', { + testCases: [testCase], +}); app.synth(); diff --git a/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/LambdaApiIntegrationOptionsNonProxyIntegrationStack.template.json b/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/LambdaApiIntegrationOptionsNonProxyIntegrationStack.template.json index ca65fda1f1e17..737af8edfc3ac 100644 --- a/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/LambdaApiIntegrationOptionsNonProxyIntegrationStack.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/LambdaApiIntegrationOptionsNonProxyIntegrationStack.template.json @@ -85,7 +85,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "lambdarestapiAccount856938D8": { "Type": "AWS::ApiGateway::Account", @@ -99,7 +101,9 @@ }, "DependsOn": [ "lambdarestapiF559E4F2" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "lambdarestapiDeployment2E401BD8b6af71d9ba27b2c75a61008a85fc6b38": { "Type": "AWS::ApiGateway::Deployment", diff --git a/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/cdk.out index 2efc89439fab8..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"18.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/integ.json b/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/integ.json index e1cd8fb5be3b4..93237ea2a39a1 100644 --- a/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/integ.json @@ -1,14 +1,11 @@ { "version": "20.0.0", "testCases": { - "integ.lambda-api-nonproxy": { + "lambda-non-proxy-integration/DefaultTest": { "stacks": [ "LambdaApiIntegrationOptionsNonProxyIntegrationStack" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "lambdanonproxyintegrationDefaultTestDeployAssert31D3AA1B" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/lambdanonproxyintegrationDefaultTestDeployAssert31D3AA1B.template.json b/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/lambdanonproxyintegrationDefaultTestDeployAssert31D3AA1B.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/lambdanonproxyintegrationDefaultTestDeployAssert31D3AA1B.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/manifest.json index 97aba0f95066b..8018cd3ef920e 100644 --- a/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "18.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -107,6 +107,15 @@ ] }, "displayName": "LambdaApiIntegrationOptionsNonProxyIntegrationStack" + }, + "lambdanonproxyintegrationDefaultTestDeployAssert31D3AA1B": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "lambdanonproxyintegrationDefaultTestDeployAssert31D3AA1B.template.json", + "validateOnSynth": false + }, + "displayName": "lambda-non-proxy-integration/DefaultTest/DeployAssert" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/tree.json index 313dbdaafd0c9..8aab8ed7b21b2 100644 --- a/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/lambda-api-nonproxy.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "LambdaApiIntegrationOptionsNonProxyIntegrationStack": { @@ -629,6 +629,42 @@ "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } + }, + "lambda-non-proxy-integration": { + "id": "lambda-non-proxy-integration", + "path": "lambda-non-proxy-integration", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "lambda-non-proxy-integration/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "lambda-non-proxy-integration/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "lambda-non-proxy-integration/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/CallRestApiInteg.assets.json b/packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/LambdaApiIntegrationOptionsStack.assets.json similarity index 65% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/CallRestApiInteg.assets.json rename to packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/LambdaApiIntegrationOptionsStack.assets.json index 818b47d18d4ec..3ef8665be717c 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/CallRestApiInteg.assets.json +++ b/packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/LambdaApiIntegrationOptionsStack.assets.json @@ -1,15 +1,15 @@ { "version": "20.0.0", "files": { - "2ea05cc9ad78e1bdf0e32b4b0421585a64ea8c70a59ee1ff69dd251f4a108988": { + "d2917ea4195aa0183538531b99a1ccb6369a7a90926d79378d84278263b33b46": { "source": { - "path": "CallRestApiInteg.template.json", + "path": "LambdaApiIntegrationOptionsStack.template.json", "packaging": "file" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "2ea05cc9ad78e1bdf0e32b4b0421585a64ea8c70a59ee1ff69dd251f4a108988.json", + "objectKey": "d2917ea4195aa0183538531b99a1ccb6369a7a90926d79378d84278263b33b46.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/LambdaApiIntegrationOptionsStack.template.json b/packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/LambdaApiIntegrationOptionsStack.template.json index c6b9ea2e875fd..7d01cec5c12da 100644 --- a/packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/LambdaApiIntegrationOptionsStack.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/LambdaApiIntegrationOptionsStack.template.json @@ -85,7 +85,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "lambdarestapiAccount856938D8": { "Type": "AWS::ApiGateway::Account", @@ -99,7 +101,9 @@ }, "DependsOn": [ "lambdarestapiF559E4F2" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "lambdarestapiDeployment2E401BD85ca559db3bb9b4a52bf7250ba64df032": { "Type": "AWS::ApiGateway::Deployment", diff --git a/packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/cdk.out index 2efc89439fab8..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"18.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/manifest.json index 65f9d4a13d726..d59d8e2a7983c 100644 --- a/packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "18.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", diff --git a/packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/tree.json index 89a999fbad6b7..6066090a41464 100644 --- a/packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/lambda-api.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "LambdaApiIntegrationOptionsStack": { diff --git a/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/LateBoundDeploymentStageStack.template.json b/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/LateBoundDeploymentStageStack.template.json index c19363fea7a8d..0b12813a20bab 100644 --- a/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/LateBoundDeploymentStageStack.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/LateBoundDeploymentStageStack.template.json @@ -85,7 +85,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "lambdarestapiAccount856938D8": { "Type": "AWS::ApiGateway::Account", @@ -99,7 +101,9 @@ }, "DependsOn": [ "lambdarestapiF559E4F2" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "lambdarestapiproxyB0E963B7": { "Type": "AWS::ApiGateway::Resource", diff --git a/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"17.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/integ.json b/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/integ.json index 1df4121a880ed..f9dc153063c7c 100644 --- a/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/integ.json @@ -1,14 +1,11 @@ { "version": "20.0.0", "testCases": { - "integ.lambda-api.latebound-deploymentstage": { + "lambda-api-latebound-deploymentstage/DefaultTest": { "stacks": [ "LateBoundDeploymentStageStack" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "lambdaapilatebounddeploymentstageDefaultTestDeployAssert678919C4" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/lambdaapilatebounddeploymentstageDefaultTestDeployAssert678919C4.template.json b/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/lambdaapilatebounddeploymentstageDefaultTestDeployAssert678919C4.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/lambdaapilatebounddeploymentstageDefaultTestDeployAssert678919C4.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/manifest.json index 9958acef6c57b..a2bcc1270c32a 100644 --- a/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -101,6 +101,15 @@ ] }, "displayName": "LateBoundDeploymentStageStack" + }, + "lambdaapilatebounddeploymentstageDefaultTestDeployAssert678919C4": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "lambdaapilatebounddeploymentstageDefaultTestDeployAssert678919C4.template.json", + "validateOnSynth": false + }, + "displayName": "lambda-api-latebound-deploymentstage/DefaultTest/DeployAssert" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/tree.json index cccb65aaddb97..040cc092d6820 100644 --- a/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/lambda-api.latebound-deploymentstage.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "LateBoundDeploymentStageStack": { @@ -602,6 +602,42 @@ "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } + }, + "lambda-api-latebound-deploymentstage": { + "id": "lambda-api-latebound-deploymentstage", + "path": "lambda-api-latebound-deploymentstage", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "lambda-api-latebound-deploymentstage/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "lambda-api-latebound-deploymentstage/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "lambda-api-latebound-deploymentstage/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"17.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/integ-restapi-import-RootStack.assets.json b/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/integ-restapi-import-RootStack.assets.json new file mode 100644 index 0000000000000..abbc3beb25911 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/integ-restapi-import-RootStack.assets.json @@ -0,0 +1,58 @@ +{ + "version": "20.0.0", + "files": { + "c6464ef3a9925cfe5c28d912ee7fc0952eb5135b281419c8d450a3aa8825e1ef": { + "source": { + "path": "integrestapiimportRootStackintegrestapiimportPetsStackC2B0DDC8.nested.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "c6464ef3a9925cfe5c28d912ee7fc0952eb5135b281419c8d450a3aa8825e1ef.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "480caddfb9aa669df64905982e75c672d967ce9d9ed261ee8c73f6bdcaf97141": { + "source": { + "path": "integrestapiimportRootStackintegrestapiimportBooksStack8A2BCEFB.nested.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "480caddfb9aa669df64905982e75c672d967ce9d9ed261ee8c73f6bdcaf97141.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "04407a85c5bf6d4da110e25ee35b1f67903f760cd7835965518b0f7ad37e86ab": { + "source": { + "path": "integrestapiimportRootStackintegrestapiimportDeployStack7C4FC449.nested.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "04407a85c5bf6d4da110e25ee35b1f67903f760cd7835965518b0f7ad37e86ab.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "6849599551963dc4cd40238860f77914226f82e391747b4166e2bcda2cc01d04": { + "source": { + "path": "integ-restapi-import-RootStack.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "6849599551963dc4cd40238860f77914226f82e391747b4166e2bcda2cc01d04.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/integ-restapi-import-RootStack.template.json b/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/integ-restapi-import-RootStack.template.json index 71e426918771b..92f9360d802f6 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/integ-restapi-import-RootStack.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/integ-restapi-import-RootStack.template.json @@ -35,7 +35,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "RestApiAccount7C83CF5A": { "Type": "AWS::ApiGateway::Account", @@ -49,7 +51,9 @@ }, "DependsOn": [ "RestApi0C43BF4B" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "RestApiANYA7C1DC94": { "Type": "AWS::ApiGateway::Method", diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/manifest.json index 3829116e1825d..882b101a400fa 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/restapiimportDefaultTestDeployAssertFA646903.template.json b/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/restapiimportDefaultTestDeployAssertFA646903.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/restapiimportDefaultTestDeployAssertFA646903.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/tree.json index b9416eec1fb3a..9ab1c0743ea95 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi-import.lit.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "integ-restapi-import-RootStack": { @@ -355,8 +355,8 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "integ-restapi-import-BooksStack": { @@ -559,8 +559,8 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "integ-restapi-import-DeployStack": { @@ -715,8 +715,8 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "PetsURL": { @@ -769,8 +769,8 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "480caddfb9aa669df64905982e75c672d967ce9d9ed261ee8c73f6bdcaf97141": { @@ -803,8 +803,8 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "04407a85c5bf6d4da110e25ee35b1f67903f760cd7835965518b0f7ad37e86ab": { @@ -837,14 +837,14 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } } }, diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/restapi-metrics.template.json b/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/restapi-metrics.template.json index fee56e0a5be32..90b583490afac 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/restapi-metrics.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/restapi-metrics.template.json @@ -35,7 +35,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "ApiAccountA18C9B29": { "Type": "AWS::ApiGateway::Account", @@ -49,7 +51,9 @@ }, "DependsOn": [ "ApiF70053CD" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "ApiDeploymentB17BE62Df672ad8455f9678e4a3db5854bdb8d73": { "Type": "AWS::ApiGateway::Deployment", diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/tree.json index 33d2c195a4e95..aa3e48eb46bdc 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/tree.json @@ -9,7 +9,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.33" + "version": "10.1.63" } }, "restapi-metrics": { @@ -367,7 +367,7 @@ "path": "MetricsTest/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.33" + "version": "10.1.63" } }, "DeployAssert": { diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"17.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/integ.json b/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/integ.json index 35d7610a44e52..58583dd84b4f5 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/integ.json @@ -1,14 +1,11 @@ { "version": "20.0.0", "testCases": { - "integ.restapi.books": { + "restapi-books/DefaultTest": { "stacks": [ "restapi-books-example" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "restapibooksDefaultTestDeployAssert1D3FCB77" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/manifest.json index 84b0450a6bc21..fd5ff2e41d452 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -191,6 +191,15 @@ ] }, "displayName": "restapi-books-example" + }, + "restapibooksDefaultTestDeployAssert1D3FCB77": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "restapibooksDefaultTestDeployAssert1D3FCB77.template.json", + "validateOnSynth": false + }, + "displayName": "restapi-books/DefaultTest/DeployAssert" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/restapi-books-example.template.json b/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/restapi-books-example.template.json index f598212206a7e..c794e4b57e429 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/restapi-books-example.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/restapi-books-example.template.json @@ -185,7 +185,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "booksapiAccountDBA98FB9": { "Type": "AWS::ApiGateway::Account", @@ -199,7 +201,9 @@ }, "DependsOn": [ "booksapiE1885304" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "booksapiDeployment308B08F132cc25cf8168bd5e99b9e6d4915866b5": { "Type": "AWS::ApiGateway::Deployment", diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/restapibooksDefaultTestDeployAssert1D3FCB77.template.json b/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/restapibooksDefaultTestDeployAssert1D3FCB77.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/restapibooksDefaultTestDeployAssert1D3FCB77.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/tree.json index 7e7348da43639..227571d4a2954 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.books.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "restapi-books-example": { @@ -1263,6 +1263,42 @@ "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } + }, + "restapi-books": { + "id": "restapi-books", + "path": "restapi-books", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "restapi-books/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "restapi-books/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "restapi-books/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"17.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/manifest.json index e790a4ea7b518..bed782c50dd68 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/test-apigateway-restapi.assets.json b/packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/test-apigateway-restapi-defaults.assets.json similarity index 61% rename from packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/test-apigateway-restapi.assets.json rename to packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/test-apigateway-restapi-defaults.assets.json index d936ca21b68a7..b1aefb7faa035 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/test-apigateway-restapi.assets.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/test-apigateway-restapi-defaults.assets.json @@ -1,15 +1,15 @@ { - "version": "17.0.0", + "version": "20.0.0", "files": { - "91e92be1c45d9307b8ecc9cc21f05824a2bec4293e94cd55e3603934c966abed": { + "e844f3b4c9b696adb45b069b99230e7d794390a9c9847d246b0d6f2d06b6191c": { "source": { - "path": "test-apigateway-restapi.template.json", + "path": "test-apigateway-restapi-defaults.template.json", "packaging": "file" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "91e92be1c45d9307b8ecc9cc21f05824a2bec4293e94cd55e3603934c966abed.json", + "objectKey": "e844f3b4c9b696adb45b069b99230e7d794390a9c9847d246b0d6f2d06b6191c.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/test-apigateway-restapi-defaults.template.json b/packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/test-apigateway-restapi-defaults.template.json index 4dfc275ce9227..11c747c8fd44b 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/test-apigateway-restapi-defaults.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/test-apigateway-restapi-defaults.template.json @@ -35,7 +35,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "myapiAccountEC421A0A": { "Type": "AWS::ApiGateway::Account", @@ -49,7 +51,9 @@ }, "DependsOn": [ "myapi4C7BF186" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "myapiDeployment92F2CB4972a890db5063ec679071ba7eefc76f2a": { "Type": "AWS::ApiGateway::Deployment", diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/tree.json index 3f41e91f8b863..3c54fa692a2de 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.defaults.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "test-apigateway-restapi-defaults": { diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/apigatewayrestapiDefaultTestDeployAssert6A9696A7.template.json b/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/apigatewayrestapiDefaultTestDeployAssert6A9696A7.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/apigatewayrestapiDefaultTestDeployAssert6A9696A7.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"17.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/integ.json b/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/integ.json index 990442c3f647e..10c900615dcab 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/integ.json @@ -1,14 +1,11 @@ { "version": "20.0.0", "testCases": { - "integ.restapi": { + "apigateway-restapi/DefaultTest": { "stacks": [ "test-apigateway-restapi" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "apigatewayrestapiDefaultTestDeployAssert6A9696A7" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/manifest.json index f792b3d0e47a1..0dd1e411c18aa 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -176,18 +176,18 @@ "type": "aws:cdk:logicalId", "data": "MyHandler6B74D312" } - ], - "myapiUsagePlanUsagePlanKeyResource050D133F": [ - { - "type": "aws:cdk:logicalId", - "data": "myapiUsagePlanUsagePlanKeyResource050D133F", - "trace": [ - "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" - ] - } ] }, "displayName": "test-apigateway-restapi" + }, + "apigatewayrestapiDefaultTestDeployAssert6A9696A7": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "apigatewayrestapiDefaultTestDeployAssert6A9696A7.template.json", + "validateOnSynth": false + }, + "displayName": "apigateway-restapi/DefaultTest/DeployAssert" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/test-apigateway-restapi.template.json b/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/test-apigateway-restapi.template.json index 98f09586f59c9..87a46a4de892b 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/test-apigateway-restapi.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/test-apigateway-restapi.template.json @@ -35,7 +35,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "myapiAccountEC421A0A": { "Type": "AWS::ApiGateway::Account", @@ -49,7 +51,9 @@ }, "DependsOn": [ "myapi4C7BF186" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "myapiDeployment92F2CB4963d40685c54c6f8da21d80a83f16d3d5": { "Type": "AWS::ApiGateway::Deployment", diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/tree.json index 2113e6b835b90..747ad9ce2e9a6 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.integ.snapshot/tree.json @@ -9,7 +9,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.63" } }, "test-apigateway-restapi": { @@ -1072,6 +1072,42 @@ "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } + }, + "apigateway-restapi": { + "id": "apigateway-restapi", + "path": "apigateway-restapi", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "apigateway-restapi/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "apigateway-restapi/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "apigateway-restapi/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/SecondStack.template.json b/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/SecondStack.template.json index 55678bf1e9bec..fdecbf50edfaf 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/SecondStack.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/SecondStack.template.json @@ -35,7 +35,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "BooksApiAccount9C44AF8E": { "Type": "AWS::ApiGateway::Account", @@ -49,7 +51,9 @@ }, "DependsOn": [ "BooksApi60AC975F" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "BooksApiDeployment86CA39AF4ff82f86c127f53c9de94d266b1906be": { "Type": "AWS::ApiGateway::Deployment", diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"17.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/integ.json b/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/integ.json index cb06df0063fbc..fba2ffd7c1a71 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/integ.json @@ -1,14 +1,11 @@ { "version": "20.0.0", "testCases": { - "integ.restapi.multistack": { + "restapi-multistack/DefaultTest": { "stacks": [ - "*" + "SecondStack" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "restapimultistackDefaultTestDeployAssertFCCAE394" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/manifest.json index 6e4920401afdb..f48380a621a33 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -115,6 +115,15 @@ ] }, "displayName": "SecondStack" + }, + "restapimultistackDefaultTestDeployAssertFCCAE394": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "restapimultistackDefaultTestDeployAssertFCCAE394.template.json", + "validateOnSynth": false + }, + "displayName": "restapi-multistack/DefaultTest/DeployAssert" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/restapimultistackDefaultTestDeployAssertFCCAE394.template.json b/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/restapimultistackDefaultTestDeployAssertFCCAE394.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/restapimultistackDefaultTestDeployAssertFCCAE394.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/tree.json index f6e66ca9e0534..74d2a644c1f8d 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.multistack.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "FirstStack": { @@ -114,8 +114,8 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } } }, @@ -513,6 +513,42 @@ "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } + }, + "restapi-multistack": { + "id": "restapi-multistack", + "path": "restapi-multistack", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "restapi-multistack/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "restapi-multistack/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "restapi-multistack/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"17.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/integ.json b/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/integ.json index 822a287c59c16..d6cf734542dd9 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/integ.json @@ -1,14 +1,11 @@ { "version": "20.0.0", "testCases": { - "integ.restapi.multiuse": { + "restapi-multiuse/DefaultTest": { "stacks": [ "restapi-multiuse-example" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "restapimultiuseDefaultTestDeployAssert47DF66CC" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/manifest.json index 96baa754633ee..efc3d1e09c415 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -149,6 +149,15 @@ ] }, "displayName": "restapi-multiuse-example" + }, + "restapimultiuseDefaultTestDeployAssert47DF66CC": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "restapimultiuseDefaultTestDeployAssert47DF66CC.template.json", + "validateOnSynth": false + }, + "displayName": "restapi-multiuse/DefaultTest/DeployAssert" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/restapi-multiuse-example.template.json b/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/restapi-multiuse-example.template.json index a0f473c3f868d..29e4706d29c77 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/restapi-multiuse-example.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/restapi-multiuse-example.template.json @@ -85,7 +85,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "helloapiAccountD8C38BCE": { "Type": "AWS::ApiGateway::Account", @@ -99,7 +101,9 @@ }, "DependsOn": [ "helloapi4446A35B" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "helloapiDeploymentFA89AEEC3622d8c965f356a33fd95586d24bf138": { "Type": "AWS::ApiGateway::Deployment", @@ -297,7 +301,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "secondapiAccountDF729874": { "Type": "AWS::ApiGateway::Account", @@ -311,7 +317,9 @@ }, "DependsOn": [ "secondapi730EF3C7" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "secondapiDeployment20F2C70088fa5a027620045bea3e5043c6d31f5a": { "Type": "AWS::ApiGateway::Deployment", diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/restapimultiuseDefaultTestDeployAssert47DF66CC.template.json b/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/restapimultiuseDefaultTestDeployAssert47DF66CC.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/restapimultiuseDefaultTestDeployAssert47DF66CC.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/tree.json index f35e5035c1de1..1338f3e1f7831 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.multiuse.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "restapi-multiuse-example": { @@ -808,6 +808,42 @@ "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } + }, + "restapi-multiuse": { + "id": "restapi-multiuse", + "path": "restapi-multiuse", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "restapi-multiuse/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "restapi-multiuse/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "restapi-multiuse/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.test.ts b/packages/@aws-cdk/aws-apigateway/test/restapi.test.ts index a9c581bd4e6c7..effde882e6497 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.test.ts +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.test.ts @@ -53,6 +53,7 @@ describe('restapi', () => { }, myapiCloudWatchRole095452E5: { Type: 'AWS::IAM::Role', + DeletionPolicy: 'Retain', Properties: { AssumeRolePolicyDocument: { Statement: [ @@ -71,6 +72,7 @@ describe('restapi', () => { }, myapiAccountEC421A0A: { Type: 'AWS::ApiGateway::Account', + DeletionPolicy: 'Retain', Properties: { CloudWatchRoleArn: { 'Fn::GetAtt': ['myapiCloudWatchRole095452E5', 'Arn'] }, }, @@ -333,6 +335,22 @@ describe('restapi', () => { Template.fromStack(stack).resourceCountIs('AWS::ApiGateway::Account', 1); }); + test('featureFlag @aws-cdk/aws-apigateway:disableCloudWatchRole CloudWatch role is not created created for API Gateway', () => { + // GIVEN + const app = new App({ + context: { + '@aws-cdk/aws-apigateway:disableCloudWatchRole': true, + }, + }); + const stack = new Stack(app); + const api = new apigw.RestApi(stack, 'myapi'); + api.root.addMethod('GET'); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::IAM::Role', 0); + Template.fromStack(stack).resourceCountIs('AWS::ApiGateway::Account', 0); + }); + test('"url" and "urlForPath" return the URL endpoints of the deployed API', () => { // GIVEN const stack = new Stack(); @@ -986,6 +1004,28 @@ describe('restapi', () => { Value: '01234567890ABCDEFabcdef', }); }); + + test('featureFlag @aws-cdk/aws-apigateway:disableCloudWatchRole CloudWatch role is not created created for API Gateway', () => { + // GIVEN + const app = new App({ + context: { + '@aws-cdk/aws-apigateway:disableCloudWatchRole': true, + }, + }); + + const stack = new Stack(app); + const api = new apigw.SpecRestApi(stack, 'SpecRestApi', { + apiDefinition: apigw.ApiDefinition.fromInline({ foo: 'bar' }), + }); + + // WHEN + const resource = api.root.addResource('pets'); + resource.addMethod('GET'); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::IAM::Role', 0); + Template.fromStack(stack).resourceCountIs('AWS::ApiGateway::Account', 0); + }); }); describe('Metrics', () => { diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/apigatewayvpcendpointDefaultTestDeployAssert95ED9392.template.json b/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/apigatewayvpcendpointDefaultTestDeployAssert95ED9392.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/apigatewayvpcendpointDefaultTestDeployAssert95ED9392.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"17.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/integ.json b/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/integ.json index a1c561eb525e5..a530d31fe1662 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/integ.json @@ -1,14 +1,11 @@ { "version": "20.0.0", "testCases": { - "integ.restapi.vpc-endpoint": { + "apigateway-vpcendpoint/DefaultTest": { "stacks": [ "test-apigateway-vpcendpoint" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "apigatewayvpcendpointDefaultTestDeployAssert95ED9392" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/manifest.json index 643c4dd34b89f..e9c7377ab9f17 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -209,6 +209,15 @@ ] }, "displayName": "test-apigateway-vpcendpoint" + }, + "apigatewayvpcendpointDefaultTestDeployAssert95ED9392": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "apigatewayvpcendpointDefaultTestDeployAssert95ED9392.template.json", + "validateOnSynth": false + }, + "displayName": "apigateway-vpcendpoint/DefaultTest/DeployAssert" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/test-apigateway-vpcendpoint.template.json b/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/test-apigateway-vpcendpoint.template.json index 5c51e23494de8..6ba50a70fd128 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/test-apigateway-vpcendpoint.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/test-apigateway-vpcendpoint.template.json @@ -528,7 +528,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "MyApiAccount13882D84": { "Type": "AWS::ApiGateway::Account", @@ -542,7 +544,9 @@ }, "DependsOn": [ "MyApi49610EDF" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "MyApiDeploymentECB0D05E58dcfc85d01f2b81270e177f5347476d": { "Type": "AWS::ApiGateway::Deployment", diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/tree.json index e0125f4f4383c..cba1c34cac06c 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.vpc-endpoint.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "test-apigateway-vpcendpoint": { @@ -1014,6 +1014,42 @@ "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } + }, + "apigateway-vpcendpoint": { + "id": "apigateway-vpcendpoint", + "path": "apigateway-vpcendpoint", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "apigateway-vpcendpoint/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "apigateway-vpcendpoint/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "apigateway-vpcendpoint/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/StepFunctionsRestApiDeploymentStack.template.json b/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/StepFunctionsRestApiDeploymentStack.template.json index 2b3e23721ccb5..64c1f274c5593 100644 --- a/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/StepFunctionsRestApiDeploymentStack.template.json +++ b/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/StepFunctionsRestApiDeploymentStack.template.json @@ -76,7 +76,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "StepFunctionsRestApiAccountBD0CCC0E": { "Type": "AWS::ApiGateway::Account", @@ -90,7 +92,9 @@ }, "DependsOn": [ "StepFunctionsRestApiC6E3E883" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "StepFunctionsRestApiANYStartSyncExecutionRole425C03BB": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/cdk.out index 2efc89439fab8..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"18.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/integ.json b/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/integ.json index 687eaa8d9490f..86b2aa94145cf 100644 --- a/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/integ.json @@ -1,14 +1,11 @@ { "version": "20.0.0", "testCases": { - "integ.stepfunctions-api": { + "step-functions-restapi/DefaultTest": { "stacks": [ "StepFunctionsRestApiDeploymentStack" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "stepfunctionsrestapiDefaultTestDeployAssert53C3797F" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/manifest.json index ae33bd6923c7c..0decd8af04329 100644 --- a/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "18.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -89,6 +89,15 @@ ] }, "displayName": "StepFunctionsRestApiDeploymentStack" + }, + "stepfunctionsrestapiDefaultTestDeployAssert53C3797F": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "stepfunctionsrestapiDefaultTestDeployAssert53C3797F.template.json", + "validateOnSynth": false + }, + "displayName": "step-functions-restapi/DefaultTest/DeployAssert" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/stepfunctionsrestapiDefaultTestDeployAssert53C3797F.template.json b/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/stepfunctionsrestapiDefaultTestDeployAssert53C3797F.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/stepfunctionsrestapiDefaultTestDeployAssert53C3797F.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/tree.json index 5f471045630af..6a3882834179a 100644 --- a/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "StepFunctionsRestApiDeploymentStack": { @@ -470,6 +470,42 @@ "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } + }, + "step-functions-restapi": { + "id": "step-functions-restapi", + "path": "step-functions-restapi", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "step-functions-restapi/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "step-functions-restapi/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "step-functions-restapi/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-cloudfront-origins/package.json b/packages/@aws-cdk/aws-cloudfront-origins/package.json index 63cb74afa2245..143fca34ea916 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/package.json +++ b/packages/@aws-cdk/aws-cloudfront-origins/package.json @@ -82,6 +82,7 @@ "@aws-cdk/aws-ec2": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", + "@aws-cdk/integ-tests": "0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/jest": "^27.5.2", "aws-sdk": "^2.848.0" diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.ts b/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.ts index 5c130da58aa00..29c691545a592 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.ts +++ b/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.ts @@ -1,17 +1,20 @@ import * as apigateway from '@aws-cdk/aws-apigateway'; import * as cloudfront from '@aws-cdk/aws-cloudfront'; import * as cdk from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; import * as origins from '../lib'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-cloudfront-rest-api-origin'); -const api = new apigateway.RestApi(stack, 'RestApi', { endpointTypes: [apigateway.EndpointType.REGIONAL] }); +const api = new apigateway.RestApi(stack, 'RestApi', { endpointTypes: [apigateway.EndpointType.REGIONAL], cloudWatchRole: true }); api.root.addMethod('GET'); new cloudfront.Distribution(stack, 'Distribution', { defaultBehavior: { origin: new origins.RestApiOrigin(api) }, }); -app.synth(); +new IntegTest(app, 'rest-api-origin', { + testCases: [stack], +}); diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/cdk.out index 2efc89439fab8..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"18.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/integ-cloudfront-rest-api-origin.template.json b/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/integ-cloudfront-rest-api-origin.template.json index e2df5f2ac56bd..929115ba4bd54 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/integ-cloudfront-rest-api-origin.template.json +++ b/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/integ-cloudfront-rest-api-origin.template.json @@ -40,7 +40,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "RestApiAccount7C83CF5A": { "Type": "AWS::ApiGateway::Account", @@ -54,7 +56,9 @@ }, "DependsOn": [ "RestApi0C43BF4B" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "RestApiDeployment180EC50368af6d4b358eff290c08cb2de07c4042": { "Type": "AWS::ApiGateway::Deployment", diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/integ.json b/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/integ.json index c2f598a0870b1..1a14360fb1413 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/integ.json @@ -1,14 +1,11 @@ { "version": "20.0.0", "testCases": { - "integ.rest-api-origin": { + "rest-api-origin/DefaultTest": { "stacks": [ "integ-cloudfront-rest-api-origin" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "restapioriginDefaultTestDeployAssert6BBA15BA" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/manifest.json index 6c1cd993b1fe4..49b9353f0397b 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "18.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -65,6 +65,15 @@ ] }, "displayName": "integ-cloudfront-rest-api-origin" + }, + "restapioriginDefaultTestDeployAssert6BBA15BA": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "restapioriginDefaultTestDeployAssert6BBA15BA.template.json", + "validateOnSynth": false + }, + "displayName": "rest-api-origin/DefaultTest/DeployAssert" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/restapioriginDefaultTestDeployAssert6BBA15BA.template.json b/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/restapioriginDefaultTestDeployAssert6BBA15BA.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/restapioriginDefaultTestDeployAssert6BBA15BA.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/tree.json b/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/tree.json index 21004e47d97fb..8d3765b0e615e 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "integ-cloudfront-rest-api-origin": { @@ -160,7 +160,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/core.Resource", + "fqn": "@aws-cdk/aws-apigateway.Stage", "version": "0.0.0" } }, @@ -221,7 +221,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/core.Resource", + "fqn": "@aws-cdk/aws-apigateway.RestApi", "version": "0.0.0" } }, @@ -233,8 +233,8 @@ "id": "Origin1", "path": "integ-cloudfront-rest-api-origin/Distribution/Origin1", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "Resource": { @@ -360,6 +360,42 @@ "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } + }, + "rest-api-origin": { + "id": "rest-api-origin", + "path": "rest-api-origin", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "rest-api-origin/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "rest-api-origin/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "rest-api-origin/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-route53-targets/package.json b/packages/@aws-cdk/aws-route53-targets/package.json index 6349874d6261b..3cda914f25011 100644 --- a/packages/@aws-cdk/aws-route53-targets/package.json +++ b/packages/@aws-cdk/aws-route53-targets/package.json @@ -78,6 +78,7 @@ "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", + "@aws-cdk/integ-tests": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/jest": "^27.5.2", diff --git a/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/apigatewaydomainnameDefaultTestDeployAssertC8336909.template.json b/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/apigatewaydomainnameDefaultTestDeployAssertC8336909.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/apigatewaydomainnameDefaultTestDeployAssertC8336909.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/aws-cdk-apigw-alias-integ.template.json b/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/aws-cdk-apigw-alias-integ.template.json index 4cfd5ed160949..4837ece4efd08 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/aws-cdk-apigw-alias-integ.template.json +++ b/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/aws-cdk-apigw-alias-integ.template.json @@ -85,7 +85,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "apiAccount57E28B43": { "Type": "AWS::ApiGateway::Account", @@ -99,7 +101,9 @@ }, "DependsOn": [ "apiC8550315" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "apiDeployment149F1294891f10d69bae7c4d19bdee7af013a950": { "Type": "AWS::ApiGateway::Deployment", diff --git a/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"17.0.0"} \ No newline at end of file +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/integ.json b/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/integ.json index 5f277f69a9473..b396bf2546f1f 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/integ.json @@ -1,14 +1,11 @@ { "version": "20.0.0", "testCases": { - "integ.api-gateway-domain-name": { + "apigateway-domain-name/DefaultTest": { "stacks": [ "aws-cdk-apigw-alias-integ" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "apigatewaydomainnameDefaultTestDeployAssertC8336909" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/manifest.json index 62766417ade2d..72fc2f6e8b108 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -125,6 +125,15 @@ ] }, "displayName": "aws-cdk-apigw-alias-integ" + }, + "apigatewaydomainnameDefaultTestDeployAssertC8336909": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "apigatewaydomainnameDefaultTestDeployAssertC8336909.template.json", + "validateOnSynth": false + }, + "displayName": "apigateway-domain-name/DefaultTest/DeployAssert" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/tree.json b/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/tree.json index 6f239ae67f127..64d870199d2b9 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-route53-targets/test/api-gateway-domain-name.integ.snapshot/tree.json @@ -8,8 +8,8 @@ "id": "Tree", "path": "Tree", "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.63" } }, "aws-cdk-apigw-alias-integ": { @@ -729,6 +729,42 @@ "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } + }, + "apigateway-domain-name": { + "id": "apigateway-domain-name", + "path": "apigateway-domain-name", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "apigateway-domain-name/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "apigateway-domain-name/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "apigateway-domain-name/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.ts b/packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.ts index e6f4741aeddf1..55d39480a9e1b 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.ts +++ b/packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.ts @@ -4,6 +4,7 @@ import * as acm from '@aws-cdk/aws-certificatemanager'; import * as lambda from '@aws-cdk/aws-lambda'; import * as route53 from '@aws-cdk/aws-route53'; import { App, Stack } from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; import { Construct } from 'constructs'; import * as targets from '../lib'; @@ -29,6 +30,7 @@ class TestStack extends Stack { const certificate = acm.Certificate.fromCertificateArn(this, 'cert', certArn); const api = new apig.LambdaRestApi(this, 'api', { + cloudWatchRole: true, handler, domainName: { certificate, @@ -50,5 +52,7 @@ class TestStack extends Stack { } const app = new App(); -new TestStack(app, 'aws-cdk-apigw-alias-integ'); -app.synth(); +const testCase = new TestStack(app, 'aws-cdk-apigw-alias-integ'); +new IntegTest(app, 'apigateway-domain-name', { + testCases: [testCase], +}); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/CallRestApiInteg.template.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/CallRestApiInteg.template.json index 592576b3c7075..f223912fb2e03 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/CallRestApiInteg.template.json +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/CallRestApiInteg.template.json @@ -35,7 +35,9 @@ ] } ] - } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "MyRestApiAccount2FB6DB7A": { "Type": "AWS::ApiGateway::Account", @@ -49,7 +51,9 @@ }, "DependsOn": [ "MyRestApi2D1F47A9" - ] + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" }, "MyRestApiDeploymentB555B582d61dc696e12272a0706c826196fa8d62": { "Type": "AWS::ApiGateway::Deployment", diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/callrestapiDefaultTestDeployAssert9913150A.template.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/callrestapiDefaultTestDeployAssert9913150A.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/callrestapiDefaultTestDeployAssert9913150A.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/integ.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/integ.json index 0be4036e75808..7af9381ebc06d 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/integ.json @@ -1,14 +1,11 @@ { "version": "20.0.0", "testCases": { - "integ.call-rest-api": { + "call-rest-api/DefaultTest": { "stacks": [ "CallRestApiInteg" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "assertionStack": "callrestapiDefaultTestDeployAssert9913150A" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/manifest.json index 17f2cb6bbbabf..5a0c9939b0754 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/manifest.json @@ -113,6 +113,15 @@ ] }, "displayName": "CallRestApiInteg" + }, + "callrestapiDefaultTestDeployAssert9913150A": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "callrestapiDefaultTestDeployAssert9913150A.template.json", + "validateOnSynth": false + }, + "displayName": "call-rest-api/DefaultTest/DeployAssert" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/tree.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/tree.json index 1cac10276bece..0d2e525716dd1 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.integ.snapshot/tree.json @@ -9,7 +9,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.63" } }, "CallRestApiInteg": { @@ -608,6 +608,42 @@ "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" } + }, + "call-rest-api": { + "id": "call-rest-api", + "path": "call-rest-api", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "call-rest-api/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "call-rest-api/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "call-rest-api/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.ts index 0117651011a38..78e3f3800d726 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.ts @@ -2,6 +2,7 @@ import * as apigateway from '@aws-cdk/aws-apigateway'; import * as lambda from '@aws-cdk/aws-lambda'; import * as sfn from '@aws-cdk/aws-stepfunctions'; import * as cdk from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; import { AuthType, HttpMethod, CallApiGatewayRestApiEndpoint } from '../../lib'; /* @@ -14,7 +15,7 @@ import { AuthType, HttpMethod, CallApiGatewayRestApiEndpoint } from '../../lib'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'CallRestApiInteg'); -const restApi = new apigateway.RestApi(stack, 'MyRestApi'); +const restApi = new apigateway.RestApi(stack, 'MyRestApi', { cloudWatchRole: true }); const hello = new apigateway.LambdaIntegration(new lambda.Function(stack, 'Hello', { runtime: lambda.Runtime.NODEJS_14_X, @@ -41,3 +42,7 @@ const sm = new sfn.StateMachine(stack, 'StateMachine', { new cdk.CfnOutput(stack, 'stateMachineArn', { value: sm.stateMachineArn, }); + +new IntegTest(app, 'call-rest-api', { + testCases: [stack], +}); diff --git a/packages/@aws-cdk/cx-api/README.md b/packages/@aws-cdk/cx-api/README.md index ede41d0e01bb1..ba2b89724a96d 100644 --- a/packages/@aws-cdk/cx-api/README.md +++ b/packages/@aws-cdk/cx-api/README.md @@ -58,6 +58,27 @@ _cdk.json_ } ``` +* @aws-cdk/aws-apigateway:disableCloudWatchRole + +Enable this feature flag to change the default behavior for aws-apigateway.RestApi and aws-apigateway.SpecRestApi +to _not_ create a CloudWatch role and Account. There is only a single ApiGateway account per AWS +environment which means that each time you create a RestApi in your account the ApiGateway account +is overwritten. If at some point the newest RestApi is deleted, the ApiGateway Account and CloudWatch +role will also be deleted, breaking any existing ApiGateways that were depending on them. + +When this flag is enabled you should either create the ApiGateway account and CloudWatch role +separately _or_ only enable the cloudWatchRole on a single RestApi. + +_cdk.json_ + +```json +{ + "context": { + "@aws-cdk/aws-apigateway:disableCloudWatchRole": true + } +} +``` + * `@aws-cdk/core:enablePartitionLiterals` Enable this feature flag to have `Stack.partition` return a literal string for a stack's partition diff --git a/packages/@aws-cdk/cx-api/lib/features.ts b/packages/@aws-cdk/cx-api/lib/features.ts index e7229978cba43..e991c1e285b45 100644 --- a/packages/@aws-cdk/cx-api/lib/features.ts +++ b/packages/@aws-cdk/cx-api/lib/features.ts @@ -313,6 +313,18 @@ export const S3_CREATE_DEFAULT_LOGGING_POLICY = '@aws-cdk/aws-s3:createDefaultLo */ export const SNS_SUBSCRIPTIONS_SQS_DECRYPTION_POLICY = '@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption'; +/** + * Enable this feature flag to change the default behavior for aws-apigateway.RestApi and aws-apigateway.SpecRestApi + * to _not_ create a CloudWatch role and Account. There is only a single ApiGateway account per AWS + * environment which means that each time you create a RestApi in your account the ApiGateway account + * is overwritten. If at some point the newest RestApi is deleted, the ApiGateway Account and CloudWatch + * role will also be deleted, breaking any existing ApiGateways that were depending on them. + * + * When this flag is enabled you should either create the ApiGateway account and CloudWatch role + * separately _or_ only enable the cloudWatchRole on a single RestApi. + */ +export const APIGATEWAY_DISABLE_CLOUDWATCH_ROLE = '@aws-cdk/aws-apigateway:disableCloudWatchRole'; + /** * Enable this feature flag to get partition names as string literals in Stacks with known regions defined in * their environment, such as "aws" or "aws-cn". Previously the CloudFormation intrinsic function @@ -373,6 +385,7 @@ export const FUTURE_FLAGS: { [key: string]: boolean } = { [CODEPIPELINE_CROSS_ACCOUNT_KEY_ALIAS_STACK_SAFE_RESOURCE_NAME]: true, [S3_CREATE_DEFAULT_LOGGING_POLICY]: true, [SNS_SUBSCRIPTIONS_SQS_DECRYPTION_POLICY]: true, + [APIGATEWAY_DISABLE_CLOUDWATCH_ROLE]: true, [ENABLE_PARTITION_LITERALS]: true, };