diff --git a/CHANGELOG.v2.alpha.md b/CHANGELOG.v2.alpha.md index cdcc281243a3c..d487a00514868 100644 --- a/CHANGELOG.v2.alpha.md +++ b/CHANGELOG.v2.alpha.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.35.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.34.2-alpha.0...v2.35.0-alpha.0) (2022-08-02) + + +### Bug Fixes + +* **cognito-identitypool:** providerUrl causes error when mappingKey is not provided and it is a token ([#21191](https://github.com/aws/aws-cdk/issues/21191)) ([d91c904](https://github.com/aws/aws-cdk/commit/d91c9045b2ca027947c94ff8b93adb80f8ca8434)), closes [#19222](https://github.com/aws/aws-cdk/issues/19222) [/github.com/aws/aws-cdk/pull/21056#issuecomment-1178879318](https://github.com/aws//github.com/aws/aws-cdk/pull/21056/issues/issuecomment-1178879318) + ## [2.34.2-alpha.0](https://github.com/aws/aws-cdk/compare/v2.34.1-alpha.0...v2.34.2-alpha.0) (2022-07-29) ## [2.34.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.34.0-alpha.0...v2.34.1-alpha.0) (2022-07-29) diff --git a/CHANGELOG.v2.md b/CHANGELOG.v2.md index 350acc9cf3102..d8af952ec722f 100644 --- a/CHANGELOG.v2.md +++ b/CHANGELOG.v2.md @@ -2,6 +2,37 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.35.0](https://github.com/aws/aws-cdk/compare/v2.34.2...v2.35.0) (2022-08-02) + + +### Features + +* **config:** add support for eks-cluster-xxx-version managed rule ([#21344](https://github.com/aws/aws-cdk/issues/21344)) ([82e8100](https://github.com/aws/aws-cdk/commit/82e81008c08669429c19c5b864292b256aaf976e)), closes [#21254](https://github.com/aws/aws-cdk/issues/21254) +* **core:** cache fingerprints of large assets ([#21321](https://github.com/aws/aws-cdk/issues/21321)) ([17f1ec8](https://github.com/aws/aws-cdk/commit/17f1ec881ba8fb300bd4cf8674a87640ab05c31a)), closes [#21297](https://github.com/aws/aws-cdk/issues/21297) +* **ec2:** add missing endpoints to InterfaceVpcEndpointAwsService ([#21401](https://github.com/aws/aws-cdk/issues/21401)) ([c64cccb](https://github.com/aws/aws-cdk/commit/c64cccb0f17d014f978b8df38f47dcfa254c89e6)), closes [#21402](https://github.com/aws/aws-cdk/issues/21402) [#21220](https://github.com/aws/aws-cdk/issues/21220) [#21338](https://github.com/aws/aws-cdk/issues/21338) [#19420](https://github.com/aws/aws-cdk/issues/19420) +* **events-targets:** add dlq support for ecs target ([#21396](https://github.com/aws/aws-cdk/issues/21396)) ([e82ba52](https://github.com/aws/aws-cdk/commit/e82ba52ac5c27863cc30309502ecd45810f96803)), closes [#21118](https://github.com/aws/aws-cdk/issues/21118) +* **fsx:** support AutoImportPolicy in LustreFilesystem ([#21301](https://github.com/aws/aws-cdk/issues/21301)) ([b1ce472](https://github.com/aws/aws-cdk/commit/b1ce472ed2a15480980286f21a028fdc20cdb91d)) +* **fsx:** support DataCompressionType in LustreConfiguration ([#21392](https://github.com/aws/aws-cdk/issues/21392)) ([214a792](https://github.com/aws/aws-cdk/commit/214a7921616fa2cf3031e17cc26308772878fefd)), closes [#16431](https://github.com/aws/aws-cdk/issues/16431) +* **opensearch:** add support for latest amazon opensearch service 1.3 ([#21413](https://github.com/aws/aws-cdk/issues/21413)) ([aa55715](https://github.com/aws/aws-cdk/commit/aa5571532f046158cde3da6080a8b19d9b1339e0)), closes [#21414](https://github.com/aws/aws-cdk/issues/21414) +* **pipelines:** allow use of custom role for pipeline ([#21299](https://github.com/aws/aws-cdk/issues/21299)) ([ff3c01a](https://github.com/aws/aws-cdk/commit/ff3c01a85d1bd32c149e83fda5bf44ec3253e99d)), closes [#21412](https://github.com/aws/aws-cdk/issues/21412) +* **rds:** add copyTagsToSnapshot to the construct props for ServerlessCluster and ServerlessClusterFromSnapshot ([#21056](https://github.com/aws/aws-cdk/issues/21056)) ([47333a1](https://github.com/aws/aws-cdk/commit/47333a12f83fbac6c8174bd7fe13f1e41159f8ae)), closes [#20968](https://github.com/aws/aws-cdk/issues/20968) + + +### Bug Fixes + +* **appmesh:** routes with weight 0 are assigned a weight of 1 ([#21400](https://github.com/aws/aws-cdk/issues/21400)) ([fa0341f](https://github.com/aws/aws-cdk/commit/fa0341f9caceff040a1af5b6ee7b4f8a736d02bf)) +* **cognito:** UserPoolClient doesn't correctly respect authFlows ([#21386](https://github.com/aws/aws-cdk/issues/21386)) ([daf178a](https://github.com/aws/aws-cdk/commit/daf178aa38632c9b830c20924a77b27b04698ce9)), closes [#16236](https://github.com/aws/aws-cdk/issues/16236) +* **core:** asset fingerprint cache invalidation incorrectly uses mtime ([#21374](https://github.com/aws/aws-cdk/issues/21374)) ([65a210a](https://github.com/aws/aws-cdk/commit/65a210aaaf8f45095170bca7779fd274aab54a00)), closes [#21321](https://github.com/aws/aws-cdk/issues/21321) +* **ecs:** ec2Service placement strategies use incorrect casing which causes drift ([#20946](https://github.com/aws/aws-cdk/issues/20946)) ([715158f](https://github.com/aws/aws-cdk/commit/715158f44ae1576361b93ec529f09d7dc0472c3b)), closes [#20812](https://github.com/aws/aws-cdk/issues/20812) +* **ecs:** new arn format not supported (under feature flag) ([#18140](https://github.com/aws/aws-cdk/issues/18140)) ([9749a57](https://github.com/aws/aws-cdk/commit/9749a5725c4f5cb13313a3d28d6b52e85c59548b)), closes [#16634](https://github.com/aws/aws-cdk/issues/16634) [#18137](https://github.com/aws/aws-cdk/issues/18137) +* **eks:** cannot disable cluster logging once it has been enabled ([#21185](https://github.com/aws/aws-cdk/issues/21185)) ([e41b073](https://github.com/aws/aws-cdk/commit/e41b073415bf68c8862219242d8f92c7fb6c16bb)), closes [#18112](https://github.com/aws/aws-cdk/issues/18112) [#20707](https://github.com/aws/aws-cdk/issues/20707) [#19898](https://github.com/aws/aws-cdk/issues/19898) +* **events:** archive construct does not have defaultChild set ([#21345](https://github.com/aws/aws-cdk/issues/21345)) ([de7d825](https://github.com/aws/aws-cdk/commit/de7d825a32e7d4ab7fd168ee61eb4243d87f41ff)), closes [#21263](https://github.com/aws/aws-cdk/issues/21263) + + +### Reverts + +* **cli:** cannot pass objects and numbers as context arguments ([#21387](https://github.com/aws/aws-cdk/issues/21387)) ([2fa85b9](https://github.com/aws/aws-cdk/commit/2fa85b99d643cd35c9685a0bd7d857ffdf55c486)), closes [aws/aws-cdk#20068](https://github.com/aws/aws-cdk/issues/20068) + ## [2.34.2](https://github.com/aws/aws-cdk/compare/v2.34.1...v2.34.2) (2022-07-29) ### Bug Fixes diff --git a/package.json b/package.json index 8933473fef6b1..67cbc706c2342 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "devDependencies": { "@types/prettier": "2.6.0", "@yarnpkg/lockfile": "^1.1.0", - "cdk-generate-synthetic-examples": "^0.1.12", + "cdk-generate-synthetic-examples": "^0.1.14", "conventional-changelog-cli": "^2.2.2", "fs-extra": "^9.1.0", "graceful-fs": "^4.2.10", diff --git a/packages/@aws-cdk/aws-apigateway/README.md b/packages/@aws-cdk/aws-apigateway/README.md index e5e0a146e5e14..2663ef5fcdbbc 100644 --- a/packages/@aws-cdk/aws-apigateway/README.md +++ b/packages/@aws-cdk/aws-apigateway/README.md @@ -1305,13 +1305,19 @@ in your openApi file. ## Metrics The API Gateway service sends metrics around the performance of Rest APIs to Amazon CloudWatch. -These metrics can be referred to using the metric APIs available on the `RestApi` construct. -The APIs with the `metric` prefix can be used to get reference to specific metrics for this API. For example, -the method below refers to the client side errors metric for this API. +These metrics can be referred to using the metric APIs available on the `RestApi`, `Stage` and `Method` constructs. +Note that detailed metrics must be enabled for a stage to use the `Method` metrics. +Read more about [API Gateway metrics](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html), including enabling detailed metrics. +The APIs with the `metric` prefix can be used to get reference to specific metrics for this API. For example: ```ts const api = new apigateway.RestApi(this, 'my-api'); -const clientErrorMetric = api.metricClientError(); +const stage = api.deploymentStage; +const method = api.root.addMethod('GET'); + +const clientErrorApiMetric = api.metricClientError(); +const serverErrorStageMetric = stage.metricServerError(); +const latencyMethodMetric = method.metricLatency(stage); ``` ## APIGateway v2 diff --git a/packages/@aws-cdk/aws-apigateway/lib/method.ts b/packages/@aws-cdk/aws-apigateway/lib/method.ts index 8746189f9bdaa..b2b32f8aa752e 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/method.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/method.ts @@ -1,5 +1,7 @@ +import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; import { ArnFormat, Lazy, Resource, Stack } from '@aws-cdk/core'; import { Construct } from 'constructs'; +import { ApiGatewayMetrics } from './apigateway-canned-metrics.generated'; import { CfnMethod, CfnMethodProps } from './apigateway.generated'; import { Authorizer, IAuthorizer } from './authorizer'; import { Integration, IntegrationConfig } from './integration'; @@ -9,6 +11,7 @@ import { IModel } from './model'; import { IRequestValidator, RequestValidatorOptions } from './requestvalidator'; import { IResource } from './resource'; import { IRestApi, RestApi, RestApiBase } from './restapi'; +import { IStage } from './stage'; import { validateHttpMethod } from './util'; export interface MethodOptions { @@ -364,6 +367,100 @@ export class Method extends Resource { // For backward compatibility return options.requestValidator?.requestValidatorId; } + + /** + * Returns the given named metric for this API method + */ + public metric(metricName: string, stage: IStage, props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return new cloudwatch.Metric({ + namespace: 'AWS/ApiGateway', + metricName, + dimensionsMap: { ApiName: this.api.restApiName, Method: this.httpMethod, Resource: this.resource.path, Stage: stage.stageName }, + ...props, + }).attachTo(this); + } + + /** + * Metric for the number of client-side errors captured in a given period. + * + * @default - sum over 5 minutes + */ + public metricClientError(stage: IStage, props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics._4XxErrorSum, stage, props); + } + + /** + * Metric for the number of server-side errors captured in a given period. + * + * @default - sum over 5 minutes + */ + public metricServerError(stage: IStage, props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics._5XxErrorSum, stage, props); + } + + /** + * Metric for the number of requests served from the API cache in a given period. + * + * @default - sum over 5 minutes + */ + public metricCacheHitCount(stage: IStage, props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics.cacheHitCountSum, stage, props); + } + + /** + * Metric for the number of requests served from the backend in a given period, + * when API caching is enabled. + * + * @default - sum over 5 minutes + */ + public metricCacheMissCount(stage: IStage, props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics.cacheMissCountSum, stage, props); + } + + /** + * Metric for the total number API requests in a given period. + * + * @default - sample count over 5 minutes + */ + public metricCount(stage: IStage, props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics.countSum, stage, { + statistic: 'SampleCount', + ...props, + }); + } + + /** + * Metric for the time between when API Gateway relays a request to the backend + * and when it receives a response from the backend. + * + * @default - average over 5 minutes. + */ + public metricIntegrationLatency(stage: IStage, props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics.integrationLatencyAverage, stage, props); + } + + /** + * The time between when API Gateway receives a request from a client + * and when it returns a response to the client. + * The latency includes the integration latency and other API Gateway overhead. + * + * @default - average over 5 minutes. + */ + public metricLatency(stage: IStage, props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics.latencyAverage, stage, props); + } + + private cannedMetric(fn: (dims: { + ApiName: string; + Method: string; + Resource: string; + Stage: string; + }) => cloudwatch.MetricProps, stage: IStage, props?: cloudwatch.MetricOptions) { + return new cloudwatch.Metric({ + ...fn({ ApiName: this.api.restApiName, Method: this.httpMethod, Resource: this.resource.path, Stage: stage.stageName }), + ...props, + }).attachTo(this); + } } export enum AuthorizationType { diff --git a/packages/@aws-cdk/aws-apigateway/lib/restapi.ts b/packages/@aws-cdk/aws-apigateway/lib/restapi.ts index 450df5003dc39..2eb6a6d2d1e73 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/restapi.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/restapi.ts @@ -28,6 +28,12 @@ export interface IRestApi extends IResourceBase { */ readonly restApiId: string; + /** + * The name of this API Gateway RestApi. + * @attribute + */ + readonly restApiName: string; + /** * The resource ID of the root resource. * @attribute @@ -673,6 +679,13 @@ export interface RestApiAttributes { */ readonly restApiId: string; + /** + * The name of the API Gateway RestApi. + * + * @default - ID of the RestApi construct. + */ + readonly restApiName?: string; + /** * The resource ID of the root resource. */ @@ -713,6 +726,7 @@ export class RestApi extends RestApiBase { public static fromRestApiAttributes(scope: Construct, id: string, attrs: RestApiAttributes): IRestApi { class Import extends RestApiBase { public readonly restApiId = attrs.restApiId; + public readonly restApiName = attrs.restApiName ?? id; public readonly restApiRootResourceId = attrs.rootResourceId; public readonly root: IResource = new RootResource(this, {}, this.restApiRootResourceId); } diff --git a/packages/@aws-cdk/aws-apigateway/lib/stage.ts b/packages/@aws-cdk/aws-apigateway/lib/stage.ts index 846eebfc5d613..281ee326db34d 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/stage.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/stage.ts @@ -1,6 +1,8 @@ +import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; import { ArnFormat, Duration, IResource, Resource, Stack, Token } from '@aws-cdk/core'; import { Construct } from 'constructs'; import { AccessLogFormat, IAccessLogDestination } from './access-log'; +import { ApiGatewayMetrics } from './apigateway-canned-metrics.generated'; import { CfnStage } from './apigateway.generated'; import { Deployment } from './deployment'; import { IRestApi, RestApiBase } from './restapi'; @@ -348,4 +350,93 @@ export class Stage extends Resource implements IStage { }; } } + + /** + * Returns the given named metric for this stage + */ + public metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return new cloudwatch.Metric({ + namespace: 'AWS/ApiGateway', + metricName, + dimensionsMap: { ApiName: this.restApi.restApiName, Stage: this.stageName }, + ...props, + }).attachTo(this); + } + + /** + * Metric for the number of client-side errors captured in a given period. + * + * @default - sum over 5 minutes + */ + public metricClientError(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics._4XxErrorSum, props); + } + + /** + * Metric for the number of server-side errors captured in a given period. + * + * @default - sum over 5 minutes + */ + public metricServerError(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics._5XxErrorSum, props); + } + + /** + * Metric for the number of requests served from the API cache in a given period. + * + * @default - sum over 5 minutes + */ + public metricCacheHitCount(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics.cacheHitCountSum, props); + } + + /** + * Metric for the number of requests served from the backend in a given period, + * when API caching is enabled. + * + * @default - sum over 5 minutes + */ + public metricCacheMissCount(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics.cacheMissCountSum, props); + } + + /** + * Metric for the total number API requests in a given period. + * + * @default - sample count over 5 minutes + */ + public metricCount(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics.countSum, { + statistic: 'SampleCount', + ...props, + }); + } + + /** + * Metric for the time between when API Gateway relays a request to the backend + * and when it receives a response from the backend. + * + * @default - average over 5 minutes. + */ + public metricIntegrationLatency(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics.integrationLatencyAverage, props); + } + + /** + * The time between when API Gateway receives a request from a client + * and when it returns a response to the client. + * The latency includes the integration latency and other API Gateway overhead. + * + * @default - average over 5 minutes. + */ + public metricLatency(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics.latencyAverage, props); + } + + private cannedMetric(fn: (dims: { ApiName: string; Stage: string }) => cloudwatch.MetricProps, props?: cloudwatch.MetricOptions) { + return new cloudwatch.Metric({ + ...fn({ ApiName: this.restApi.restApiName, Stage: this.stageName }), + ...props, + }).attachTo(this); + } } diff --git a/packages/@aws-cdk/aws-apigateway/package.json b/packages/@aws-cdk/aws-apigateway/package.json index 20b88e9516ce4..b6f3c28297160 100644 --- a/packages/@aws-cdk/aws-apigateway/package.json +++ b/packages/@aws-cdk/aws-apigateway/package.json @@ -80,6 +80,7 @@ }, "license": "Apache-2.0", "devDependencies": { + "@aws-cdk/integ-tests": "0.0.0", "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.ts b/packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.ts new file mode 100644 index 0000000000000..e4b39f4a6590d --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.ts @@ -0,0 +1,34 @@ +import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; +import * as cdk from '@aws-cdk/core'; +import * as integ from '@aws-cdk/integ-tests'; +import * as apigw from '../lib'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'restapi-metrics'); +const restApi = new apigw.RestApi(stack, 'Api'); +const stage = restApi.deploymentStage; +const method = restApi.root.addMethod('GET'); + +new cloudwatch.Alarm(stack, 'RestApiAlarm', { + metric: restApi.metricClientError(), + evaluationPeriods: 1, + threshold: 1, +}); + +new cloudwatch.Alarm(stack, 'MethodAlarm', { + metric: method.metricServerError(stage), + evaluationPeriods: 1, + threshold: 1, +}); + +new cloudwatch.Alarm(stack, 'StageAlarm', { + metric: stage.metricCount(), + evaluationPeriods: 1, + threshold: 1, +}); + +new integ.IntegTest(app, 'MetricsTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk/aws-apigateway/test/method.test.ts b/packages/@aws-cdk/aws-apigateway/test/method.test.ts index 1540a7d27ad16..a84f0e023b12c 100644 --- a/packages/@aws-cdk/aws-apigateway/test/method.test.ts +++ b/packages/@aws-cdk/aws-apigateway/test/method.test.ts @@ -935,4 +935,143 @@ describe('method', () => { }); + + describe('Metrics', () => { + test('metric', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigw.RestApi(stack, 'test-api'); + const method = api.root.addResource('pets').addMethod('GET'); + const metricName = '4XXError'; + const statistic = 'Sum'; + const metric = method.metric(metricName, api.deploymentStage, { statistic }); + + // THEN + expect(metric.namespace).toEqual('AWS/ApiGateway'); + expect(metric.metricName).toEqual(metricName); + expect(metric.statistic).toEqual(statistic); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Method: 'GET', Resource: '/pets', Stage: api.deploymentStage.stageName }); + }); + + test('metricClientError', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigw.RestApi(stack, 'test-api'); + const method = api.root.addResource('pets').addMethod('GET'); + const color = '#00ff00'; + const metric = method.metricClientError(api.deploymentStage, { color }); + + // THEN + expect(metric.metricName).toEqual('4XXError'); + expect(metric.statistic).toEqual('Sum'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Method: 'GET', Resource: '/pets', Stage: api.deploymentStage.stageName }); + }); + + test('metricServerError', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigw.RestApi(stack, 'test-api'); + const method = api.root.addResource('pets').addMethod('GET'); + const color = '#00ff00'; + const metric = method.metricServerError(api.deploymentStage, { color }); + + // THEN + expect(metric.metricName).toEqual('5XXError'); + expect(metric.statistic).toEqual('Sum'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Method: 'GET', Resource: '/pets', Stage: api.deploymentStage.stageName }); + }); + + test('metricCacheHitCount', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigw.RestApi(stack, 'test-api'); + const method = api.root.addResource('pets').addMethod('GET'); + const color = '#00ff00'; + const metric = method.metricCacheHitCount(api.deploymentStage, { color }); + + // THEN + expect(metric.metricName).toEqual('CacheHitCount'); + expect(metric.statistic).toEqual('Sum'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Method: 'GET', Resource: '/pets', Stage: api.deploymentStage.stageName }); + }); + + test('metricCacheMissCount', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigw.RestApi(stack, 'test-api'); + const method = api.root.addResource('pets').addMethod('GET'); + const color = '#00ff00'; + const metric = method.metricCacheMissCount(api.deploymentStage, { color }); + + // THEN + expect(metric.metricName).toEqual('CacheMissCount'); + expect(metric.statistic).toEqual('Sum'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Method: 'GET', Resource: '/pets', Stage: api.deploymentStage.stageName }); + }); + + test('metricCount', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigw.RestApi(stack, 'test-api'); + const method = api.root.addResource('pets').addMethod('GET'); + const color = '#00ff00'; + const metric = method.metricCount(api.deploymentStage, { color }); + + // THEN + expect(metric.metricName).toEqual('Count'); + expect(metric.statistic).toEqual('SampleCount'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Method: 'GET', Resource: '/pets', Stage: api.deploymentStage.stageName }); + }); + + test('metricIntegrationLatency', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigw.RestApi(stack, 'test-api'); + const method = api.root.addResource('pets').addMethod('GET'); + const color = '#00ff00'; + const metric = method.metricIntegrationLatency(api.deploymentStage, { color }); + + // THEN + expect(metric.metricName).toEqual('IntegrationLatency'); + expect(metric.statistic).toEqual('Average'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Method: 'GET', Resource: '/pets', Stage: api.deploymentStage.stageName }); + }); + + test('metricLatency', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigw.RestApi(stack, 'test-api'); + const method = api.root.addResource('pets').addMethod('GET'); + const color = '#00ff00'; + const metric = method.metricLatency(api.deploymentStage, { color }); + + // THEN + expect(metric.metricName).toEqual('Latency'); + expect(metric.statistic).toEqual('Average'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Method: 'GET', Resource: '/pets', Stage: api.deploymentStage.stageName }); + }); + }); }); diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/MetricsTestDefaultTestDeployAssertEA4ED73F.template.json b/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/MetricsTestDefaultTestDeployAssertEA4ED73F.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/MetricsTestDefaultTestDeployAssertEA4ED73F.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/cdk.out new file mode 100644 index 0000000000000..588d7b269d34f --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.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/restapi-metrics.integ.snapshot/integ.json b/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/integ.json new file mode 100644 index 0000000000000..22a4b89662dc8 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/integ.json @@ -0,0 +1,11 @@ +{ + "version": "20.0.0", + "testCases": { + "MetricsTest/DefaultTest": { + "stacks": [ + "restapi-metrics" + ], + "assertionStack": "MetricsTestDefaultTestDeployAssertEA4ED73F" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/manifest.json new file mode 100644 index 0000000000000..726c21d8d70fb --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/manifest.json @@ -0,0 +1,91 @@ +{ + "version": "20.0.0", + "artifacts": { + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + }, + "restapi-metrics": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "restapi-metrics.template.json", + "validateOnSynth": false + }, + "metadata": { + "/restapi-metrics/Api/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiF70053CD" + } + ], + "/restapi-metrics/Api/CloudWatchRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiCloudWatchRole73EC6FC4" + } + ], + "/restapi-metrics/Api/Account": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiAccountA18C9B29" + } + ], + "/restapi-metrics/Api/Deployment/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiDeploymentB17BE62Df672ad8455f9678e4a3db5854bdb8d73" + } + ], + "/restapi-metrics/Api/DeploymentStage.prod/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiDeploymentStageprod3EB9684E" + } + ], + "/restapi-metrics/Api/Endpoint": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiEndpoint4F160690" + } + ], + "/restapi-metrics/Api/Default/GET/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiGET9257B917" + } + ], + "/restapi-metrics/RestApiAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "RestApiAlarm9B915321" + } + ], + "/restapi-metrics/MethodAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MethodAlarm14370C32" + } + ], + "/restapi-metrics/StageAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "StageAlarm5DB1CE5B" + } + ] + }, + "displayName": "restapi-metrics" + }, + "MetricsTestDefaultTestDeployAssertEA4ED73F": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "MetricsTestDefaultTestDeployAssertEA4ED73F.template.json", + "validateOnSynth": false + }, + "displayName": "MetricsTest/DefaultTest/DeployAssert" + } + } +} \ No newline at end of file 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 new file mode 100644 index 0000000000000..fee56e0a5be32 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/restapi-metrics.template.json @@ -0,0 +1,203 @@ +{ + "Resources": { + "ApiF70053CD": { + "Type": "AWS::ApiGateway::RestApi", + "Properties": { + "Name": "Api" + } + }, + "ApiCloudWatchRole73EC6FC4": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs" + ] + ] + } + ] + } + }, + "ApiAccountA18C9B29": { + "Type": "AWS::ApiGateway::Account", + "Properties": { + "CloudWatchRoleArn": { + "Fn::GetAtt": [ + "ApiCloudWatchRole73EC6FC4", + "Arn" + ] + } + }, + "DependsOn": [ + "ApiF70053CD" + ] + }, + "ApiDeploymentB17BE62Df672ad8455f9678e4a3db5854bdb8d73": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ApiF70053CD" + }, + "Description": "Automatically created by the RestApi construct" + }, + "DependsOn": [ + "ApiGET9257B917" + ] + }, + "ApiDeploymentStageprod3EB9684E": { + "Type": "AWS::ApiGateway::Stage", + "Properties": { + "RestApiId": { + "Ref": "ApiF70053CD" + }, + "DeploymentId": { + "Ref": "ApiDeploymentB17BE62Df672ad8455f9678e4a3db5854bdb8d73" + }, + "StageName": "prod" + }, + "DependsOn": [ + "ApiAccountA18C9B29" + ] + }, + "ApiGET9257B917": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "GET", + "ResourceId": { + "Fn::GetAtt": [ + "ApiF70053CD", + "RootResourceId" + ] + }, + "RestApiId": { + "Ref": "ApiF70053CD" + }, + "AuthorizationType": "NONE", + "Integration": { + "Type": "MOCK" + } + } + }, + "RestApiAlarm9B915321": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "EvaluationPeriods": 1, + "Dimensions": [ + { + "Name": "ApiName", + "Value": "Api" + } + ], + "MetricName": "4XXError", + "Namespace": "AWS/ApiGateway", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "MethodAlarm14370C32": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "EvaluationPeriods": 1, + "Dimensions": [ + { + "Name": "ApiName", + "Value": "Api" + }, + { + "Name": "Method", + "Value": "GET" + }, + { + "Name": "Resource", + "Value": "/" + }, + { + "Name": "Stage", + "Value": { + "Ref": "ApiDeploymentStageprod3EB9684E" + } + } + ], + "MetricName": "5XXError", + "Namespace": "AWS/ApiGateway", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "StageAlarm5DB1CE5B": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "EvaluationPeriods": 1, + "Dimensions": [ + { + "Name": "ApiName", + "Value": "Api" + }, + { + "Name": "Stage", + "Value": { + "Ref": "ApiDeploymentStageprod3EB9684E" + } + } + ], + "MetricName": "Count", + "Namespace": "AWS/ApiGateway", + "Period": 300, + "Statistic": "SampleCount", + "Threshold": 1 + } + } + }, + "Outputs": { + "ApiEndpoint4F160690": { + "Value": { + "Fn::Join": [ + "", + [ + "https://", + { + "Ref": "ApiF70053CD" + }, + ".execute-api.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "ApiDeploymentStageprod3EB9684E" + }, + "/" + ] + ] + } + } + } +} \ No newline at end of file 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 new file mode 100644 index 0000000000000..33d2c195a4e95 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/restapi-metrics.integ.snapshot/tree.json @@ -0,0 +1,399 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.33" + } + }, + "restapi-metrics": { + "id": "restapi-metrics", + "path": "restapi-metrics", + "children": { + "Api": { + "id": "Api", + "path": "restapi-metrics/Api", + "children": { + "Resource": { + "id": "Resource", + "path": "restapi-metrics/Api/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::RestApi", + "aws:cdk:cloudformation:props": { + "name": "Api" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnRestApi", + "version": "0.0.0" + } + }, + "CloudWatchRole": { + "id": "CloudWatchRole", + "path": "restapi-metrics/Api/CloudWatchRole", + "children": { + "Resource": { + "id": "Resource", + "path": "restapi-metrics/Api/CloudWatchRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Role", + "version": "0.0.0" + } + }, + "Account": { + "id": "Account", + "path": "restapi-metrics/Api/Account", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Account", + "aws:cdk:cloudformation:props": { + "cloudWatchRoleArn": { + "Fn::GetAtt": [ + "ApiCloudWatchRole73EC6FC4", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnAccount", + "version": "0.0.0" + } + }, + "Deployment": { + "id": "Deployment", + "path": "restapi-metrics/Api/Deployment", + "children": { + "Resource": { + "id": "Resource", + "path": "restapi-metrics/Api/Deployment/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Deployment", + "aws:cdk:cloudformation:props": { + "restApiId": { + "Ref": "ApiF70053CD" + }, + "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": "restapi-metrics/Api/DeploymentStage.prod", + "children": { + "Resource": { + "id": "Resource", + "path": "restapi-metrics/Api/DeploymentStage.prod/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Stage", + "aws:cdk:cloudformation:props": { + "restApiId": { + "Ref": "ApiF70053CD" + }, + "deploymentId": { + "Ref": "ApiDeploymentB17BE62Df672ad8455f9678e4a3db5854bdb8d73" + }, + "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": "restapi-metrics/Api/Endpoint", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + }, + "Default": { + "id": "Default", + "path": "restapi-metrics/Api/Default", + "children": { + "GET": { + "id": "GET", + "path": "restapi-metrics/Api/Default/GET", + "children": { + "Resource": { + "id": "Resource", + "path": "restapi-metrics/Api/Default/GET/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Method", + "aws:cdk:cloudformation:props": { + "httpMethod": "GET", + "resourceId": { + "Fn::GetAtt": [ + "ApiF70053CD", + "RootResourceId" + ] + }, + "restApiId": { + "Ref": "ApiF70053CD" + }, + "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" + } + }, + "RestApiAlarm": { + "id": "RestApiAlarm", + "path": "restapi-metrics/RestApiAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "restapi-metrics/RestApiAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "evaluationPeriods": 1, + "dimensions": [ + { + "name": "ApiName", + "value": "Api" + } + ], + "metricName": "4XXError", + "namespace": "AWS/ApiGateway", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-cloudwatch.CfnAlarm", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-cloudwatch.Alarm", + "version": "0.0.0" + } + }, + "MethodAlarm": { + "id": "MethodAlarm", + "path": "restapi-metrics/MethodAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "restapi-metrics/MethodAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "evaluationPeriods": 1, + "dimensions": [ + { + "name": "ApiName", + "value": "Api" + }, + { + "name": "Method", + "value": "GET" + }, + { + "name": "Resource", + "value": "/" + }, + { + "name": "Stage", + "value": { + "Ref": "ApiDeploymentStageprod3EB9684E" + } + } + ], + "metricName": "5XXError", + "namespace": "AWS/ApiGateway", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-cloudwatch.CfnAlarm", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-cloudwatch.Alarm", + "version": "0.0.0" + } + }, + "StageAlarm": { + "id": "StageAlarm", + "path": "restapi-metrics/StageAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "restapi-metrics/StageAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "evaluationPeriods": 1, + "dimensions": [ + { + "name": "ApiName", + "value": "Api" + }, + { + "name": "Stage", + "value": { + "Ref": "ApiDeploymentStageprod3EB9684E" + } + } + ], + "metricName": "Count", + "namespace": "AWS/ApiGateway", + "period": 300, + "statistic": "SampleCount", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-cloudwatch.CfnAlarm", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-cloudwatch.Alarm", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + }, + "MetricsTest": { + "id": "MetricsTest", + "path": "MetricsTest", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "MetricsTest/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "MetricsTest/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.33" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "MetricsTest/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/restapi.test.ts b/packages/@aws-cdk/aws-apigateway/test/restapi.test.ts index ee7cce939bb91..a9c581bd4e6c7 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.test.ts +++ b/packages/@aws-cdk/aws-apigateway/test/restapi.test.ts @@ -860,6 +860,7 @@ describe('restapi', () => { // THEN expect(stack.resolve(imported.restApiId)).toEqual('api-rxt4498f'); + expect(imported.restApiName).toEqual('imported-api'); }); test('fromRestApiAttributes()', () => { @@ -883,6 +884,32 @@ describe('restapi', () => { HttpMethod: 'GET', ResourceId: stack.resolve(resource.resourceId), }); + expect(imported.restApiName).toEqual('imported-api'); + }); + + test('fromRestApiAttributes() with restApiName', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + const imported = apigw.RestApi.fromRestApiAttributes(stack, 'imported-api', { + restApiId: 'test-restapi-id', + rootResourceId: 'test-root-resource-id', + restApiName: 'test-restapi-name', + }); + const resource = imported.root.addResource('pets'); + resource.addMethod('GET'); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Resource', { + PathPart: 'pets', + ParentId: stack.resolve(imported.restApiRootResourceId), + }); + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'GET', + ResourceId: stack.resolve(resource.resourceId), + }); + expect(imported.restApiName).toEqual('test-restapi-name'); }); }); diff --git a/packages/@aws-cdk/aws-apigateway/test/stage.test.ts b/packages/@aws-cdk/aws-apigateway/test/stage.test.ts index b4181ce2f1af0..01be121666278 100644 --- a/packages/@aws-cdk/aws-apigateway/test/stage.test.ts +++ b/packages/@aws-cdk/aws-apigateway/test/stage.test.ts @@ -423,4 +423,135 @@ describe('stage', () => { }], }); }); + + describe('Metrics', () => { + test('metric', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigateway.RestApi(stack, 'test-api'); + const metricName = '4XXError'; + const statistic = 'Sum'; + const metric = api.deploymentStage.metric(metricName, { statistic }); + + // THEN + expect(metric.namespace).toEqual('AWS/ApiGateway'); + expect(metric.metricName).toEqual(metricName); + expect(metric.statistic).toEqual(statistic); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); + }); + + test('metricClientError', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigateway.RestApi(stack, 'test-api'); + const color = '#00ff00'; + const metric = api.deploymentStage.metricClientError({ color }); + + // THEN + expect(metric.metricName).toEqual('4XXError'); + expect(metric.statistic).toEqual('Sum'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); + }); + + test('metricServerError', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigateway.RestApi(stack, 'test-api'); + const color = '#00ff00'; + const metric = api.deploymentStage.metricServerError({ color }); + + // THEN + expect(metric.metricName).toEqual('5XXError'); + expect(metric.statistic).toEqual('Sum'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); + }); + + test('metricCacheHitCount', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigateway.RestApi(stack, 'test-api'); + const color = '#00ff00'; + const metric = api.deploymentStage.metricCacheHitCount({ color }); + + // THEN + expect(metric.metricName).toEqual('CacheHitCount'); + expect(metric.statistic).toEqual('Sum'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); + }); + + test('metricCacheMissCount', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigateway.RestApi(stack, 'test-api'); + const color = '#00ff00'; + const metric = api.deploymentStage.metricCacheMissCount({ color }); + + // THEN + expect(metric.metricName).toEqual('CacheMissCount'); + expect(metric.statistic).toEqual('Sum'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); + }); + + test('metricCount', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigateway.RestApi(stack, 'test-api'); + const color = '#00ff00'; + const metric = api.deploymentStage.metricCount({ color }); + + // THEN + expect(metric.metricName).toEqual('Count'); + expect(metric.statistic).toEqual('SampleCount'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); + }); + + test('metricIntegrationLatency', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigateway.RestApi(stack, 'test-api'); + const color = '#00ff00'; + const metric = api.deploymentStage.metricIntegrationLatency({ color }); + + // THEN + expect(metric.metricName).toEqual('IntegrationLatency'); + expect(metric.statistic).toEqual('Average'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); + }); + + test('metricLatency', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigateway.RestApi(stack, 'test-api'); + const color = '#00ff00'; + const metric = api.deploymentStage.metricLatency({ color }); + + // THEN + expect(metric.metricName).toEqual('Latency'); + expect(metric.statistic).toEqual('Average'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); + }); + }); }); diff --git a/packages/@aws-cdk/aws-appsync/README.md b/packages/@aws-cdk/aws-appsync/README.md index e562a0b267342..32d44938c8eed 100644 --- a/packages/@aws-cdk/aws-appsync/README.md +++ b/packages/@aws-cdk/aws-appsync/README.md @@ -264,7 +264,7 @@ import * as opensearch from '@aws-cdk/aws-opensearchservice'; const user = new iam.User(this, 'User'); const domain = new opensearch.Domain(this, 'Domain', { - version: opensearch.EngineVersion.OPENSEARCH_1_2, + version: opensearch.EngineVersion.OPENSEARCH_1_3, removalPolicy: RemovalPolicy.DESTROY, fineGrainedAccessControl: { masterUserArn: user.userArn }, encryptionAtRest: { enabled: true }, @@ -334,6 +334,29 @@ new route53.CnameRecord(this, `CnameApiRecord`, { }); ``` +## Log Group + +AppSync automatically create a log group with the name `/aws/appsync/apis/` upon deployment with +log data set to never expire. If you want to set a different expiration period, use the `logConfig.retention` property. + +To obtain the GraphQL API's log group as a `logs.ILogGroup` use the `logGroup` property of the +`GraphqlApi` construct. + +```ts +import * as logs from '@aws-cdk/aws-logs'; + +const logConfig: appsync.LogConfig = { + retention: logs.RetentionDays.ONE_WEEK, +}; + +new appsync.GraphqlApi(this, 'api', { + authorizationConfig: {}, + name: 'myApi', + schema: appsync.Schema.fromAsset(path.join(__dirname, 'myApi.graphql')), + logConfig, +}); +``` + ## Schema Every GraphQL Api needs a schema to define the Api. CDK offers `appsync.Schema` @@ -427,7 +450,7 @@ new appsync.GraphqlApi(this, 'api', { defaultAuthorization: { authorizationType: appsync.AuthorizationType.LAMBDA, lambdaAuthorizerConfig: { - handler: authFunction, + handler: authFunction, // can also specify `resultsCacheTtl` and `validationRegex`. }, }, diff --git a/packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts b/packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts index ab740aac4cfb2..d384713310581 100644 --- a/packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts +++ b/packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts @@ -2,6 +2,7 @@ import { ICertificate } from '@aws-cdk/aws-certificatemanager'; import { IUserPool } from '@aws-cdk/aws-cognito'; import { ManagedPolicy, Role, IRole, ServicePrincipal, Grant, IGrantable } from '@aws-cdk/aws-iam'; import { IFunction } from '@aws-cdk/aws-lambda'; +import { ILogGroup, LogGroup, LogRetention, RetentionDays } from '@aws-cdk/aws-logs'; import { ArnFormat, CfnResource, Duration, Expiration, IResolvable, Stack } from '@aws-cdk/core'; import { Construct } from 'constructs'; import { CfnApiKey, CfnGraphQLApi, CfnGraphQLSchema, CfnDomainName, CfnDomainNameApiAssociation } from './appsync.generated'; @@ -248,6 +249,16 @@ export interface LogConfig { * @default - None */ readonly role?: IRole; + + /** + * The number of days log events are kept in CloudWatch Logs. + * By default AppSync keeps the logs infinitely. When updating this property, + * unsetting it doesn't remove the log retention policy. + * To remove the retention policy, set the value to `INFINITE` + * + * @default RetentionDays.INFINITE + */ + readonly retention?: RetentionDays } /** @@ -459,6 +470,11 @@ export class GraphqlApi extends GraphqlApiBase { */ public readonly apiKey?: string; + /** + * the CloudWatch Log Group for this API + */ + public readonly logGroup: ILogGroup; + private schemaResource: CfnGraphQLSchema; private api: CfnGraphQLApi; private apiKeyResource?: CfnApiKey; @@ -527,6 +543,16 @@ export class GraphqlApi extends GraphqlApiBase { }); } + const logGroupName = `/aws/appsync/apis/${this.apiId}`; + + this.logGroup = LogGroup.fromLogGroupName(this, 'LogGroup', logGroupName); + + if (props.logConfig?.retention) { + new LogRetention(this, 'LogRetention', { + logGroupName: this.logGroup.logGroupName, + retention: props.logConfig.retention, + }); + }; } /** @@ -620,10 +646,11 @@ export class GraphqlApi extends GraphqlApiBase { ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSAppSyncPushToCloudWatchLogs'), ], }).roleArn; + const fieldLogLevel: FieldLogLevel = config.fieldLogLevel ?? FieldLogLevel.NONE; return { cloudWatchLogsRoleArn: logsRoleArn, excludeVerboseContent: config.excludeVerboseContent, - fieldLogLevel: config.fieldLogLevel, + fieldLogLevel: fieldLogLevel, }; } diff --git a/packages/@aws-cdk/aws-appsync/package.json b/packages/@aws-cdk/aws-appsync/package.json index 480e781af2bbc..b0e9b8c1320d8 100644 --- a/packages/@aws-cdk/aws-appsync/package.json +++ b/packages/@aws-cdk/aws-appsync/package.json @@ -84,6 +84,7 @@ "@aws-cdk/aws-stepfunctions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", + "@aws-cdk/integ-tests": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/jest": "^27.5.2", @@ -97,6 +98,7 @@ "@aws-cdk/aws-elasticsearch": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", + "@aws-cdk/aws-logs": "0.0.0", "@aws-cdk/aws-opensearchservice": "0.0.0", "@aws-cdk/aws-rds": "0.0.0", "@aws-cdk/aws-s3-assets": "0.0.0", @@ -113,6 +115,7 @@ "@aws-cdk/aws-elasticsearch": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", + "@aws-cdk/aws-logs": "0.0.0", "@aws-cdk/aws-opensearchservice": "0.0.0", "@aws-cdk/aws-rds": "0.0.0", "@aws-cdk/aws-s3-assets": "0.0.0", diff --git a/packages/@aws-cdk/aws-appsync/test/appsync.test.ts b/packages/@aws-cdk/aws-appsync/test/appsync.test.ts index 350fbff6229db..1ed2a95b6aeae 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync.test.ts +++ b/packages/@aws-cdk/aws-appsync/test/appsync.test.ts @@ -2,6 +2,7 @@ import * as path from 'path'; import { Template } from '@aws-cdk/assertions'; import { Certificate } from '@aws-cdk/aws-certificatemanager'; import * as iam from '@aws-cdk/aws-iam'; +import * as logs from '@aws-cdk/aws-logs'; import * as cdk from '@aws-cdk/core'; import * as appsync from '../lib'; @@ -191,3 +192,49 @@ test('appsync GraphqlApi should be configured with custom domain when specified' DomainName: domainName, }); }); + +test('log retention should be configured with given retention time when specified', () => { + // GIVEN + const retentionTime = logs.RetentionDays.ONE_WEEK; + + // WHEN + new appsync.GraphqlApi(stack, 'log-retention', { + authorizationConfig: {}, + name: 'log-retention', + schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), + logConfig: { + retention: retentionTime, + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('Custom::LogRetention', { + LogGroupName: { + 'Fn::Join': [ + '', + [ + '/aws/appsync/apis/', + { + 'Fn::GetAtt': [ + 'logretentionB69DFB48', + 'ApiId', + ], + }, + ], + ], + }, + RetentionInDays: 7, + }); +}); + +test('log retention should not appear when no retention time is specified', () => { + // WHEN + new appsync.GraphqlApi(stack, 'no-log-retention', { + authorizationConfig: {}, + name: 'no-log-retention', + schema: appsync.Schema.fromAsset(path.join(__dirname, 'appsync.test.graphql')), + }); + + // THEN + Template.fromStack(stack).resourceCountIs('Custom::LogRetention', 0); +}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/graphql-opensearch.integ.snapshot/appsync-opensearch.template.json b/packages/@aws-cdk/aws-appsync/test/graphql-opensearch.integ.snapshot/appsync-opensearch.template.json index 0f075d2196757..85003197d3261 100644 --- a/packages/@aws-cdk/aws-appsync/test/graphql-opensearch.integ.snapshot/appsync-opensearch.template.json +++ b/packages/@aws-cdk/aws-appsync/test/graphql-opensearch.integ.snapshot/appsync-opensearch.template.json @@ -24,9 +24,6 @@ "InstanceType": "r5.large.search", "ZoneAwarenessEnabled": false }, - "CognitoOptions": { - "Enabled": false - }, "DomainEndpointOptions": { "EnforceHTTPS": true, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" @@ -39,7 +36,7 @@ "EncryptionAtRestOptions": { "Enabled": true }, - "EngineVersion": "OpenSearch_1.2", + "EngineVersion": "OpenSearch_1.3", "LogPublishingOptions": {}, "NodeToNodeEncryptionOptions": { "Enabled": true @@ -207,4 +204,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-appsync/test/graphql-opensearch.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-appsync/test/graphql-opensearch.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-appsync/test/graphql-opensearch.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-appsync/test/graphql-opensearch.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-appsync/test/graphql-opensearch.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-appsync/test/graphql-opensearch.integ.snapshot/manifest.json index 95c7efb1806d3..f0a3426f2a5e4 100644 --- a/packages/@aws-cdk/aws-appsync/test/graphql-opensearch.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-appsync/test/graphql-opensearch.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-appsync/test/graphql-opensearch.integ.snapshot/tree.json b/packages/@aws-cdk/aws-appsync/test/graphql-opensearch.integ.snapshot/tree.json index 08425f5b4e387..ab3fd9f94d633 100644 --- a/packages/@aws-cdk/aws-appsync/test/graphql-opensearch.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-appsync/test/graphql-opensearch.integ.snapshot/tree.json @@ -9,7 +9,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.58" } }, "appsync-opensearch": { @@ -66,9 +66,6 @@ "instanceType": "r5.large.search", "zoneAwarenessEnabled": false }, - "cognitoOptions": { - "enabled": false - }, "domainEndpointOptions": { "enforceHttps": true, "tlsSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.ts b/packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.ts index cb96dee17e90f..a8c8984c04e14 100644 --- a/packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.ts +++ b/packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.ts @@ -8,7 +8,7 @@ const app = new cdk.App(); const stack = new cdk.Stack(app, 'appsync-opensearch'); const user = new User(stack, 'User'); const domain = new opensearch.Domain(stack, 'Domain', { - version: opensearch.EngineVersion.OPENSEARCH_1_2, + version: opensearch.EngineVersion.OPENSEARCH_1_3, removalPolicy: cdk.RemovalPolicy.DESTROY, fineGrainedAccessControl: { masterUserArn: user.userArn, diff --git a/packages/@aws-cdk/aws-appsync/test/integ.log-retention.ts b/packages/@aws-cdk/aws-appsync/test/integ.log-retention.ts new file mode 100644 index 0000000000000..664c28ceee237 --- /dev/null +++ b/packages/@aws-cdk/aws-appsync/test/integ.log-retention.ts @@ -0,0 +1,40 @@ +import { join } from 'path'; +import { RetentionDays } from '@aws-cdk/aws-logs'; +import { App, Stack } from '@aws-cdk/core'; +import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests'; +import { GraphqlApi, LogConfig, Schema } from '../lib'; + +const app = new App(); +const stack = new Stack(app, 'AppSyncIntegLogRetention'); + + +const retentionTime = RetentionDays.ONE_WEEK; +const logConfig: LogConfig = { + retention: retentionTime, +}; + +const api = new GraphqlApi(stack, 'GraphqlApi', { + authorizationConfig: {}, + name: 'IntegLogRetention', + schema: Schema.fromAsset(join(__dirname, 'appsync.test.graphql')), + logConfig, +}); + +const integ = new IntegTest(app, 'Integ', { testCases: [stack] }); + +const describe = integ.assertions.awsApiCall('CloudWatchLogs', + 'describeLogGroups', + { + logGroupNamePrefix: api.logGroup.logGroupName, + }); + +describe.expect(ExpectedResult.objectLike({ + logGroups: [ + { + logGroupName: api.logGroup.logGroupName, + retentionInDays: retentionTime, + }, + ], +})); + +app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/AppSyncIntegLogRetention.template.json b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/AppSyncIntegLogRetention.template.json new file mode 100644 index 0000000000000..1dc3cc6f7eaa2 --- /dev/null +++ b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/AppSyncIntegLogRetention.template.json @@ -0,0 +1,240 @@ +{ + "Resources": { + "GraphqlApiApiLogsRoleBB9E6BAD": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "appsync.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSAppSyncPushToCloudWatchLogs" + ] + ] + } + ] + } + }, + "GraphqlApi1B6CF24C": { + "Type": "AWS::AppSync::GraphQLApi", + "Properties": { + "AuthenticationType": "API_KEY", + "Name": "IntegLogRetention", + "LogConfig": { + "CloudWatchLogsRoleArn": { + "Fn::GetAtt": [ + "GraphqlApiApiLogsRoleBB9E6BAD", + "Arn" + ] + }, + "FieldLogLevel": "NONE" + } + } + }, + "GraphqlApiSchema1B71CE4F": { + "Type": "AWS::AppSync::GraphQLSchema", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "GraphqlApi1B6CF24C", + "ApiId" + ] + }, + "Definition": "type test {\n version: String!\n}\ntype Query {\n getTests: [test]!\n}\ntype Mutation {\n addTest(version: String!): test\n}\n" + } + }, + "GraphqlApiDefaultApiKey47EE7128": { + "Type": "AWS::AppSync::ApiKey", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "GraphqlApi1B6CF24C", + "ApiId" + ] + } + }, + "DependsOn": [ + "GraphqlApiSchema1B71CE4F" + ] + }, + "GraphqlApiLogRetention082A7017": { + "Type": "Custom::LogRetention", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A", + "Arn" + ] + }, + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/appsync/apis/", + { + "Fn::GetAtt": [ + "GraphqlApi1B6CF24C", + "ApiId" + ] + } + ] + ] + }, + "RetentionInDays": 7 + } + }, + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRole9741ECFB": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRoleDefaultPolicyADDA7DEB": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:DeleteRetentionPolicy", + "logs:PutRetentionPolicy" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRoleDefaultPolicyADDA7DEB", + "Roles": [ + { + "Ref": "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRole9741ECFB" + } + ] + } + }, + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Handler": "index.handler", + "Runtime": "nodejs14.x", + "Code": { + "S3Bucket": { + "Ref": "AssetParametersc70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13aS3BucketB4787383" + }, + "S3Key": { + "Fn::Join": [ + "", + [ + { + "Fn::Select": [ + 0, + { + "Fn::Split": [ + "||", + { + "Ref": "AssetParametersc70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13aS3VersionKey8CF8E820" + } + ] + } + ] + }, + { + "Fn::Select": [ + 1, + { + "Fn::Split": [ + "||", + { + "Ref": "AssetParametersc70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13aS3VersionKey8CF8E820" + } + ] + } + ] + } + ] + ] + } + }, + "Role": { + "Fn::GetAtt": [ + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRole9741ECFB", + "Arn" + ] + } + }, + "DependsOn": [ + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRoleDefaultPolicyADDA7DEB", + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRole9741ECFB" + ] + } + }, + "Parameters": { + "AssetParametersc70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13aS3BucketB4787383": { + "Type": "String", + "Description": "S3 bucket for asset \"c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a\"" + }, + "AssetParametersc70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13aS3VersionKey8CF8E820": { + "Type": "String", + "Description": "S3 key for asset version \"c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a\"" + }, + "AssetParametersc70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13aArtifactHashC9560B34": { + "Type": "String", + "Description": "Artifact hash for asset \"c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a\"" + } + }, + "Outputs": { + "ExportsOutputFnGetAttGraphqlApi1B6CF24CApiIdE34D50AD": { + "Value": { + "Fn::GetAtt": [ + "GraphqlApi1B6CF24C", + "ApiId" + ] + }, + "Export": { + "Name": "AppSyncIntegLogRetention:ExportsOutputFnGetAttGraphqlApi1B6CF24CApiIdE34D50AD" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json new file mode 100644 index 0000000000000..ddbbd027583b6 --- /dev/null +++ b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json @@ -0,0 +1,183 @@ +{ + "Resources": { + "AwsApiCallCloudWatchLogsdescribeLogGroups": { + "Type": "Custom::DeployAssert@SdkCallCloudWatchLogsdescribeLogGroups", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F", + "Arn" + ] + }, + "service": "CloudWatchLogs", + "api": "describeLogGroups", + "parameters": { + "logGroupNamePrefix": { + "Fn::Join": [ + "", + [ + "/aws/appsync/apis/", + { + "Fn::ImportValue": "AppSyncIntegLogRetention:ExportsOutputFnGetAttGraphqlApi1B6CF24CApiIdE34D50AD" + } + ] + ] + } + }, + "flattenResponse": "false", + "salt": "1659609543121" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "AwsApiCallCloudWatchLogsdescribeLogGroupsAssertEqualsCloudWatchLogsdescribeLogGroupsD2E2CD37": { + "Type": "Custom::DeployAssert@AssertEquals", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F", + "Arn" + ] + }, + "actual": { + "Fn::GetAtt": [ + "AwsApiCallCloudWatchLogsdescribeLogGroups", + "apiCallResponse" + ] + }, + "expected": { + "Fn::Join": [ + "", + [ + "{\"$ObjectLike\":{\"logGroups\":[{\"logGroupName\":\"/aws/appsync/apis/", + { + "Fn::ImportValue": "AppSyncIntegLogRetention:ExportsOutputFnGetAttGraphqlApi1B6CF24CApiIdE34D50AD" + }, + "\",\"retentionInDays\":7}]}}" + ] + ] + }, + "salt": "1659609543122" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ] + }, + "ManagedPolicyArns": [ + { + "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + } + ], + "Policies": [ + { + "PolicyName": "Inline", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "logs:DescribeLogGroups" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + } + ] + } + } + ] + } + }, + "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Runtime": "nodejs14.x", + "Code": { + "S3Bucket": { + "Ref": "AssetParameters0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbdS3BucketF94385B7" + }, + "S3Key": { + "Fn::Join": [ + "", + [ + { + "Fn::Select": [ + 0, + { + "Fn::Split": [ + "||", + { + "Ref": "AssetParameters0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbdS3VersionKey66DB0F9E" + } + ] + } + ] + }, + { + "Fn::Select": [ + 1, + { + "Fn::Split": [ + "||", + { + "Ref": "AssetParameters0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbdS3VersionKey66DB0F9E" + } + ] + } + ] + } + ] + ] + } + }, + "Timeout": 120, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73", + "Arn" + ] + } + } + } + }, + "Outputs": { + "AssertionResultsAssertEqualsCloudWatchLogsdescribeLogGroups": { + "Value": { + "Fn::GetAtt": [ + "AwsApiCallCloudWatchLogsdescribeLogGroupsAssertEqualsCloudWatchLogsdescribeLogGroupsD2E2CD37", + "data" + ] + } + } + }, + "Parameters": { + "AssetParameters0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbdS3BucketF94385B7": { + "Type": "String", + "Description": "S3 bucket for asset \"0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbd\"" + }, + "AssetParameters0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbdS3VersionKey66DB0F9E": { + "Type": "String", + "Description": "S3 key for asset version \"0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbd\"" + }, + "AssetParameters0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbdArtifactHash2AC894D9": { + "Type": "String", + "Description": "Artifact hash for asset \"0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbd\"" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/asset.0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbd.bundle/index.js b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/asset.0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbd.bundle/index.js new file mode 100644 index 0000000000000..b3ec1b8c53d30 --- /dev/null +++ b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/asset.0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbd.bundle/index.js @@ -0,0 +1,612 @@ +"use strict"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// lib/assertions/providers/lambda-handler/index.ts +var lambda_handler_exports = {}; +__export(lambda_handler_exports, { + handler: () => handler +}); +module.exports = __toCommonJS(lambda_handler_exports); + +// ../assertions/lib/matcher.ts +var Matcher = class { + static isMatcher(x) { + return x && x instanceof Matcher; + } +}; +var MatchResult = class { + constructor(target) { + this.failures = []; + this.captures = /* @__PURE__ */ new Map(); + this.finalized = false; + this.target = target; + } + push(matcher, path, message) { + return this.recordFailure({ matcher, path, message }); + } + recordFailure(failure) { + this.failures.push(failure); + return this; + } + hasFailed() { + return this.failures.length !== 0; + } + get failCount() { + return this.failures.length; + } + compose(id, inner) { + const innerF = inner.failures; + this.failures.push(...innerF.map((f) => { + return { path: [id, ...f.path], message: f.message, matcher: f.matcher }; + })); + inner.captures.forEach((vals, capture) => { + vals.forEach((value) => this.recordCapture({ capture, value })); + }); + return this; + } + finished() { + if (this.finalized) { + return this; + } + if (this.failCount === 0) { + this.captures.forEach((vals, cap) => cap._captured.push(...vals)); + } + this.finalized = true; + return this; + } + toHumanStrings() { + return this.failures.map((r) => { + const loc = r.path.length === 0 ? "" : ` at ${r.path.join("")}`; + return "" + r.message + loc + ` (using ${r.matcher.name} matcher)`; + }); + } + recordCapture(options) { + let values = this.captures.get(options.capture); + if (values === void 0) { + values = []; + } + values.push(options.value); + this.captures.set(options.capture, values); + } +}; + +// ../assertions/lib/private/matchers/absent.ts +var AbsentMatch = class extends Matcher { + constructor(name) { + super(); + this.name = name; + } + test(actual) { + const result = new MatchResult(actual); + if (actual !== void 0) { + result.recordFailure({ + matcher: this, + path: [], + message: `Received ${actual}, but key should be absent` + }); + } + return result; + } +}; + +// ../assertions/lib/private/type.ts +function getType(obj) { + return Array.isArray(obj) ? "array" : typeof obj; +} + +// ../assertions/lib/match.ts +var Match = class { + static absent() { + return new AbsentMatch("absent"); + } + static arrayWith(pattern) { + return new ArrayMatch("arrayWith", pattern); + } + static arrayEquals(pattern) { + return new ArrayMatch("arrayEquals", pattern, { subsequence: false }); + } + static exact(pattern) { + return new LiteralMatch("exact", pattern, { partialObjects: false }); + } + static objectLike(pattern) { + return new ObjectMatch("objectLike", pattern); + } + static objectEquals(pattern) { + return new ObjectMatch("objectEquals", pattern, { partial: false }); + } + static not(pattern) { + return new NotMatch("not", pattern); + } + static serializedJson(pattern) { + return new SerializedJson("serializedJson", pattern); + } + static anyValue() { + return new AnyMatch("anyValue"); + } + static stringLikeRegexp(pattern) { + return new StringLikeRegexpMatch("stringLikeRegexp", pattern); + } +}; +var LiteralMatch = class extends Matcher { + constructor(name, pattern, options = {}) { + super(); + this.name = name; + this.pattern = pattern; + this.partialObjects = options.partialObjects ?? false; + if (Matcher.isMatcher(this.pattern)) { + throw new Error("LiteralMatch cannot directly contain another matcher. Remove the top-level matcher or nest it more deeply."); + } + } + test(actual) { + if (Array.isArray(this.pattern)) { + return new ArrayMatch(this.name, this.pattern, { subsequence: false, partialObjects: this.partialObjects }).test(actual); + } + if (typeof this.pattern === "object") { + return new ObjectMatch(this.name, this.pattern, { partial: this.partialObjects }).test(actual); + } + const result = new MatchResult(actual); + if (typeof this.pattern !== typeof actual) { + result.recordFailure({ + matcher: this, + path: [], + message: `Expected type ${typeof this.pattern} but received ${getType(actual)}` + }); + return result; + } + if (actual !== this.pattern) { + result.recordFailure({ + matcher: this, + path: [], + message: `Expected ${this.pattern} but received ${actual}` + }); + } + return result; + } +}; +var ArrayMatch = class extends Matcher { + constructor(name, pattern, options = {}) { + super(); + this.name = name; + this.pattern = pattern; + this.subsequence = options.subsequence ?? true; + this.partialObjects = options.partialObjects ?? false; + } + test(actual) { + if (!Array.isArray(actual)) { + return new MatchResult(actual).recordFailure({ + matcher: this, + path: [], + message: `Expected type array but received ${getType(actual)}` + }); + } + if (!this.subsequence && this.pattern.length !== actual.length) { + return new MatchResult(actual).recordFailure({ + matcher: this, + path: [], + message: `Expected array of length ${this.pattern.length} but received ${actual.length}` + }); + } + let patternIdx = 0; + let actualIdx = 0; + const result = new MatchResult(actual); + while (patternIdx < this.pattern.length && actualIdx < actual.length) { + const patternElement = this.pattern[patternIdx]; + const matcher = Matcher.isMatcher(patternElement) ? patternElement : new LiteralMatch(this.name, patternElement, { partialObjects: this.partialObjects }); + const matcherName = matcher.name; + if (this.subsequence && (matcherName == "absent" || matcherName == "anyValue")) { + throw new Error(`The Matcher ${matcherName}() cannot be nested within arrayWith()`); + } + const innerResult = matcher.test(actual[actualIdx]); + if (!this.subsequence || !innerResult.hasFailed()) { + result.compose(`[${actualIdx}]`, innerResult); + patternIdx++; + actualIdx++; + } else { + actualIdx++; + } + } + for (; patternIdx < this.pattern.length; patternIdx++) { + const pattern = this.pattern[patternIdx]; + const element = Matcher.isMatcher(pattern) || typeof pattern === "object" ? " " : ` [${pattern}] `; + result.recordFailure({ + matcher: this, + path: [], + message: `Missing element${element}at pattern index ${patternIdx}` + }); + } + return result; + } +}; +var ObjectMatch = class extends Matcher { + constructor(name, pattern, options = {}) { + super(); + this.name = name; + this.pattern = pattern; + this.partial = options.partial ?? true; + } + test(actual) { + if (typeof actual !== "object" || Array.isArray(actual)) { + return new MatchResult(actual).recordFailure({ + matcher: this, + path: [], + message: `Expected type object but received ${getType(actual)}` + }); + } + const result = new MatchResult(actual); + if (!this.partial) { + for (const a of Object.keys(actual)) { + if (!(a in this.pattern)) { + result.recordFailure({ + matcher: this, + path: [`/${a}`], + message: "Unexpected key" + }); + } + } + } + for (const [patternKey, patternVal] of Object.entries(this.pattern)) { + if (!(patternKey in actual) && !(patternVal instanceof AbsentMatch)) { + result.recordFailure({ + matcher: this, + path: [`/${patternKey}`], + message: `Missing key '${patternKey}' among {${Object.keys(actual).join(",")}}` + }); + continue; + } + const matcher = Matcher.isMatcher(patternVal) ? patternVal : new LiteralMatch(this.name, patternVal, { partialObjects: this.partial }); + const inner = matcher.test(actual[patternKey]); + result.compose(`/${patternKey}`, inner); + } + return result; + } +}; +var SerializedJson = class extends Matcher { + constructor(name, pattern) { + super(); + this.name = name; + this.pattern = pattern; + } + test(actual) { + const result = new MatchResult(actual); + if (getType(actual) !== "string") { + result.recordFailure({ + matcher: this, + path: [], + message: `Expected JSON as a string but found ${getType(actual)}` + }); + return result; + } + let parsed; + try { + parsed = JSON.parse(actual); + } catch (err) { + if (err instanceof SyntaxError) { + result.recordFailure({ + matcher: this, + path: [], + message: `Invalid JSON string: ${actual}` + }); + return result; + } else { + throw err; + } + } + const matcher = Matcher.isMatcher(this.pattern) ? this.pattern : new LiteralMatch(this.name, this.pattern); + const innerResult = matcher.test(parsed); + result.compose(`(${this.name})`, innerResult); + return result; + } +}; +var NotMatch = class extends Matcher { + constructor(name, pattern) { + super(); + this.name = name; + this.pattern = pattern; + } + test(actual) { + const matcher = Matcher.isMatcher(this.pattern) ? this.pattern : new LiteralMatch(this.name, this.pattern); + const innerResult = matcher.test(actual); + const result = new MatchResult(actual); + if (innerResult.failCount === 0) { + result.recordFailure({ + matcher: this, + path: [], + message: `Found unexpected match: ${JSON.stringify(actual, void 0, 2)}` + }); + } + return result; + } +}; +var AnyMatch = class extends Matcher { + constructor(name) { + super(); + this.name = name; + } + test(actual) { + const result = new MatchResult(actual); + if (actual == null) { + result.recordFailure({ + matcher: this, + path: [], + message: "Expected a value but found none" + }); + } + return result; + } +}; +var StringLikeRegexpMatch = class extends Matcher { + constructor(name, pattern) { + super(); + this.name = name; + this.pattern = pattern; + } + test(actual) { + const result = new MatchResult(actual); + const regex = new RegExp(this.pattern, "gm"); + if (typeof actual !== "string") { + result.recordFailure({ + matcher: this, + path: [], + message: `Expected a string, but got '${typeof actual}'` + }); + } + if (!regex.test(actual)) { + result.recordFailure({ + matcher: this, + path: [], + message: `String '${actual}' did not match pattern '${this.pattern}'` + }); + } + return result; + } +}; + +// lib/assertions/providers/lambda-handler/base.ts +var https = __toESM(require("https")); +var url = __toESM(require("url")); +var CustomResourceHandler = class { + constructor(event, context) { + this.event = event; + this.context = context; + this.timedOut = false; + this.timeout = setTimeout(async () => { + await this.respond({ + status: "FAILED", + reason: "Lambda Function Timeout", + data: this.context.logStreamName + }); + this.timedOut = true; + }, context.getRemainingTimeInMillis() - 1200); + this.event = event; + this.physicalResourceId = extractPhysicalResourceId(event); + } + async handle() { + try { + console.log(`Event: ${JSON.stringify({ ...this.event, ResponseURL: "..." })}`); + const response = await this.processEvent(this.event.ResourceProperties); + console.log(`Event output : ${JSON.stringify(response)}`); + await this.respond({ + status: "SUCCESS", + reason: "OK", + data: response + }); + } catch (e) { + console.log(e); + await this.respond({ + status: "FAILED", + reason: e.message ?? "Internal Error" + }); + } finally { + clearTimeout(this.timeout); + } + } + respond(response) { + if (this.timedOut) { + return; + } + const cfResponse = { + Status: response.status, + Reason: response.reason, + PhysicalResourceId: this.physicalResourceId, + StackId: this.event.StackId, + RequestId: this.event.RequestId, + LogicalResourceId: this.event.LogicalResourceId, + NoEcho: false, + Data: response.data + }; + const responseBody = JSON.stringify(cfResponse); + console.log("Responding to CloudFormation", responseBody); + const parsedUrl = url.parse(this.event.ResponseURL); + const requestOptions = { + hostname: parsedUrl.hostname, + path: parsedUrl.path, + method: "PUT", + headers: { "content-type": "", "content-length": responseBody.length } + }; + return new Promise((resolve, reject) => { + try { + const request2 = https.request(requestOptions, resolve); + request2.on("error", reject); + request2.write(responseBody); + request2.end(); + } catch (e) { + reject(e); + } + }); + } +}; +function extractPhysicalResourceId(event) { + switch (event.RequestType) { + case "Create": + return event.LogicalResourceId; + case "Update": + case "Delete": + return event.PhysicalResourceId; + } +} + +// lib/assertions/providers/lambda-handler/assertion.ts +var AssertionHandler = class extends CustomResourceHandler { + async processEvent(request2) { + let actual = decodeCall(request2.actual); + const expected = decodeCall(request2.expected); + let result; + const matcher = new MatchCreator(expected).getMatcher(); + console.log(`Testing equality between ${JSON.stringify(request2.actual)} and ${JSON.stringify(request2.expected)}`); + const matchResult = matcher.test(actual); + matchResult.finished(); + if (matchResult.hasFailed()) { + result = { + data: JSON.stringify({ + status: "fail", + message: [ + ...matchResult.toHumanStrings(), + JSON.stringify(matchResult.target, void 0, 2) + ].join("\n") + }) + }; + if (request2.failDeployment) { + throw new Error(result.data); + } + } else { + result = { + data: JSON.stringify({ + status: "pass" + }) + }; + } + return result; + } +}; +var MatchCreator = class { + constructor(obj) { + this.parsedObj = { + matcher: obj + }; + } + getMatcher() { + try { + const final = JSON.parse(JSON.stringify(this.parsedObj), function(_k, v) { + const nested = Object.keys(v)[0]; + switch (nested) { + case "$ArrayWith": + return Match.arrayWith(v[nested]); + case "$ObjectLike": + return Match.objectLike(v[nested]); + case "$StringLike": + return Match.stringLikeRegexp(v[nested]); + default: + return v; + } + }); + if (Matcher.isMatcher(final.matcher)) { + return final.matcher; + } + return Match.exact(final.matcher); + } catch { + return Match.exact(this.parsedObj.matcher); + } + } +}; +function decodeCall(call) { + if (!call) { + return void 0; + } + try { + const parsed = JSON.parse(call); + return parsed; + } catch (e) { + return call; + } +} + +// lib/assertions/providers/lambda-handler/utils.ts +function decode(object) { + return JSON.parse(JSON.stringify(object), (_k, v) => { + switch (v) { + case "TRUE:BOOLEAN": + return true; + case "FALSE:BOOLEAN": + return false; + default: + return v; + } + }); +} + +// lib/assertions/providers/lambda-handler/sdk.ts +function flatten(object) { + return Object.assign( + {}, + ...function _flatten(child, path = []) { + return [].concat(...Object.keys(child).map((key) => { + const childKey = Buffer.isBuffer(child[key]) ? child[key].toString("utf8") : child[key]; + return typeof childKey === "object" && childKey !== null ? _flatten(childKey, path.concat([key])) : { [path.concat([key]).join(".")]: childKey }; + })); + }(object) + ); +} +var AwsApiCallHandler = class extends CustomResourceHandler { + async processEvent(request2) { + const AWS = require("aws-sdk"); + console.log(`AWS SDK VERSION: ${AWS.VERSION}`); + const service = new AWS[request2.service](); + const response = await service[request2.api](request2.parameters && decode(request2.parameters)).promise(); + console.log(`SDK response received ${JSON.stringify(response)}`); + delete response.ResponseMetadata; + const respond = { + apiCallResponse: response + }; + const flatData = { + ...flatten(respond) + }; + return request2.flattenResponse === "true" ? flatData : respond; + } +}; + +// lib/assertions/providers/lambda-handler/types.ts +var ASSERT_RESOURCE_TYPE = "Custom::DeployAssert@AssertEquals"; +var SDK_RESOURCE_TYPE_PREFIX = "Custom::DeployAssert@SdkCall"; + +// lib/assertions/providers/lambda-handler/index.ts +async function handler(event, context) { + const provider = createResourceHandler(event, context); + await provider.handle(); +} +function createResourceHandler(event, context) { + if (event.ResourceType.startsWith(SDK_RESOURCE_TYPE_PREFIX)) { + return new AwsApiCallHandler(event, context); + } + switch (event.ResourceType) { + case ASSERT_RESOURCE_TYPE: + return new AssertionHandler(event, context); + default: + throw new Error(`Unsupported resource type "${event.ResourceType}`); + } +} +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + handler +}); diff --git a/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/asset.c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a/index.d.ts b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/asset.c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a/index.d.ts new file mode 100644 index 0000000000000..9bbf5854684b6 --- /dev/null +++ b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/asset.c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a/index.d.ts @@ -0,0 +1 @@ +export declare function handler(event: AWSLambda.CloudFormationCustomResourceEvent, context: AWSLambda.Context): Promise; diff --git a/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/asset.c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a/index.js b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/asset.c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a/index.js new file mode 100644 index 0000000000000..a844de880012a --- /dev/null +++ b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/asset.c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a/index.js @@ -0,0 +1,174 @@ +"use strict"; +/* eslint-disable no-console */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.handler = void 0; +// eslint-disable-next-line import/no-extraneous-dependencies +const AWS = require("aws-sdk"); +/** + * Creates a log group and doesn't throw if it exists. + * + * @param logGroupName the name of the log group to create. + * @param region to create the log group in + * @param options CloudWatch API SDK options. + */ +async function createLogGroupSafe(logGroupName, region, options) { + // If we set the log retention for a lambda, then due to the async nature of + // Lambda logging there could be a race condition when the same log group is + // already being created by the lambda execution. This can sometime result in + // an error "OperationAbortedException: A conflicting operation is currently + // in progress...Please try again." + // To avoid an error, we do as requested and try again. + let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; + const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; + do { + try { + const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); + await cloudwatchlogs.createLogGroup({ logGroupName }).promise(); + return; + } + catch (error) { + if (error.code === 'ResourceAlreadyExistsException') { + // The log group is already created by the lambda execution + return; + } + if (error.code === 'OperationAbortedException') { + if (retryCount > 0) { + retryCount--; + await new Promise(resolve => setTimeout(resolve, delay)); + continue; + } + else { + // The log group is still being created by another execution but we are out of retries + throw new Error('Out of attempts to create a logGroup'); + } + } + throw error; + } + } while (true); // exit happens on retry count check +} +/** + * Puts or deletes a retention policy on a log group. + * + * @param logGroupName the name of the log group to create + * @param region the region of the log group + * @param options CloudWatch API SDK options. + * @param retentionInDays the number of days to retain the log events in the specified log group. + */ +async function setRetentionPolicy(logGroupName, region, options, retentionInDays) { + // The same as in createLogGroupSafe(), here we could end up with the race + // condition where a log group is either already being created or its retention + // policy is being updated. This would result in an OperationAbortedException, + // which we will try to catch and retry the command a number of times before failing + let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; + const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; + do { + try { + const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); + if (!retentionInDays) { + await cloudwatchlogs.deleteRetentionPolicy({ logGroupName }).promise(); + } + else { + await cloudwatchlogs.putRetentionPolicy({ logGroupName, retentionInDays }).promise(); + } + return; + } + catch (error) { + if (error.code === 'OperationAbortedException') { + if (retryCount > 0) { + retryCount--; + await new Promise(resolve => setTimeout(resolve, delay)); + continue; + } + else { + // The log group is still being created by another execution but we are out of retries + throw new Error('Out of attempts to create a logGroup'); + } + } + throw error; + } + } while (true); // exit happens on retry count check +} +async function handler(event, context) { + try { + console.log(JSON.stringify({ ...event, ResponseURL: '...' })); + // The target log group + const logGroupName = event.ResourceProperties.LogGroupName; + // The region of the target log group + const logGroupRegion = event.ResourceProperties.LogGroupRegion; + // Parse to AWS SDK retry options + const retryOptions = parseRetryOptions(event.ResourceProperties.SdkRetry); + if (event.RequestType === 'Create' || event.RequestType === 'Update') { + // Act on the target log group + await createLogGroupSafe(logGroupName, logGroupRegion, retryOptions); + await setRetentionPolicy(logGroupName, logGroupRegion, retryOptions, parseInt(event.ResourceProperties.RetentionInDays, 10)); + if (event.RequestType === 'Create') { + // Set a retention policy of 1 day on the logs of this very function. + // Due to the async nature of the log group creation, the log group for this function might + // still be not created yet at this point. Therefore we attempt to create it. + // In case it is being created, createLogGroupSafe will handle the conflict. + const region = process.env.AWS_REGION; + await createLogGroupSafe(`/aws/lambda/${context.functionName}`, region, retryOptions); + // If createLogGroupSafe fails, the log group is not created even after multiple attempts. + // In this case we have nothing to set the retention policy on but an exception will skip + // the next line. + await setRetentionPolicy(`/aws/lambda/${context.functionName}`, region, retryOptions, 1); + } + } + await respond('SUCCESS', 'OK', logGroupName); + } + catch (e) { + console.log(e); + await respond('FAILED', e.message, event.ResourceProperties.LogGroupName); + } + function respond(responseStatus, reason, physicalResourceId) { + const responseBody = JSON.stringify({ + Status: responseStatus, + Reason: reason, + PhysicalResourceId: physicalResourceId, + StackId: event.StackId, + RequestId: event.RequestId, + LogicalResourceId: event.LogicalResourceId, + Data: { + // Add log group name as part of the response so that it's available via Fn::GetAtt + LogGroupName: event.ResourceProperties.LogGroupName, + }, + }); + console.log('Responding', responseBody); + // eslint-disable-next-line @typescript-eslint/no-require-imports + const parsedUrl = require('url').parse(event.ResponseURL); + const requestOptions = { + hostname: parsedUrl.hostname, + path: parsedUrl.path, + method: 'PUT', + headers: { 'content-type': '', 'content-length': responseBody.length }, + }; + return new Promise((resolve, reject) => { + try { + // eslint-disable-next-line @typescript-eslint/no-require-imports + const request = require('https').request(requestOptions, resolve); + request.on('error', reject); + request.write(responseBody); + request.end(); + } + catch (e) { + reject(e); + } + }); + } + function parseRetryOptions(rawOptions) { + const retryOptions = {}; + if (rawOptions) { + if (rawOptions.maxRetries) { + retryOptions.maxRetries = parseInt(rawOptions.maxRetries, 10); + } + if (rawOptions.base) { + retryOptions.retryOptions = { + base: parseInt(rawOptions.base, 10), + }; + } + } + return retryOptions; + } +} +exports.handler = handler; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsK0JBQStCOzs7QUFFL0IsNkRBQTZEO0FBQzdELCtCQUErQjtBQVMvQjs7Ozs7O0dBTUc7QUFDSCxLQUFLLFVBQVUsa0JBQWtCLENBQUMsWUFBb0IsRUFBRSxNQUFlLEVBQUUsT0FBeUI7SUFDaEcsNEVBQTRFO0lBQzVFLDRFQUE0RTtJQUM1RSw2RUFBNkU7SUFDN0UsNEVBQTRFO0lBQzVFLG1DQUFtQztJQUNuQyx1REFBdUQ7SUFDdkQsSUFBSSxVQUFVLEdBQUcsT0FBTyxFQUFFLFVBQVUsSUFBSSxTQ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pb25zLm1heFJldHJpZXMgPSBwYXJzZUludChyYXdPcHRpb25zLm1heFJldHJpZXMsIDEwKTtcbiAgICAgIH1cbiAgICAgIGlmIChyYXdPcHRpb25zLmJhc2UpIHtcbiAgICAgICAgcmV0cnlPcHRpb25zLnJldHJ5T3B0aW9ucyA9IHtcbiAgICAgICAgICBiYXNlOiBwYXJzZUludChyYXdPcHRpb25zLmJhc2UsIDEwKSxcbiAgICAgICAgfTtcbiAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIHJldHJ5T3B0aW9ucztcbiAgfVxufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/asset.c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a/index.ts b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/asset.c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a/index.ts new file mode 100644 index 0000000000000..b78be3cb5c1ec --- /dev/null +++ b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/asset.c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a/index.ts @@ -0,0 +1,186 @@ +/* eslint-disable no-console */ + +// eslint-disable-next-line import/no-extraneous-dependencies +import * as AWS from 'aws-sdk'; +// eslint-disable-next-line import/no-extraneous-dependencies +import type { RetryDelayOptions } from 'aws-sdk/lib/config-base'; + +interface SdkRetryOptions { + maxRetries?: number; + retryOptions?: RetryDelayOptions; +} + +/** + * Creates a log group and doesn't throw if it exists. + * + * @param logGroupName the name of the log group to create. + * @param region to create the log group in + * @param options CloudWatch API SDK options. + */ +async function createLogGroupSafe(logGroupName: string, region?: string, options?: SdkRetryOptions) { + // If we set the log retention for a lambda, then due to the async nature of + // Lambda logging there could be a race condition when the same log group is + // already being created by the lambda execution. This can sometime result in + // an error "OperationAbortedException: A conflicting operation is currently + // in progress...Please try again." + // To avoid an error, we do as requested and try again. + let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; + const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; + do { + try { + const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); + await cloudwatchlogs.createLogGroup({ logGroupName }).promise(); + return; + } catch (error) { + if (error.code === 'ResourceAlreadyExistsException') { + // The log group is already created by the lambda execution + return; + } + if (error.code === 'OperationAbortedException') { + if (retryCount > 0) { + retryCount--; + await new Promise(resolve => setTimeout(resolve, delay)); + continue; + } else { + // The log group is still being created by another execution but we are out of retries + throw new Error('Out of attempts to create a logGroup'); + } + } + throw error; + } + } while (true); // exit happens on retry count check +} + +/** + * Puts or deletes a retention policy on a log group. + * + * @param logGroupName the name of the log group to create + * @param region the region of the log group + * @param options CloudWatch API SDK options. + * @param retentionInDays the number of days to retain the log events in the specified log group. + */ +async function setRetentionPolicy(logGroupName: string, region?: string, options?: SdkRetryOptions, retentionInDays?: number) { + // The same as in createLogGroupSafe(), here we could end up with the race + // condition where a log group is either already being created or its retention + // policy is being updated. This would result in an OperationAbortedException, + // which we will try to catch and retry the command a number of times before failing + let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; + const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; + do { + try { + const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); + if (!retentionInDays) { + await cloudwatchlogs.deleteRetentionPolicy({ logGroupName }).promise(); + } else { + await cloudwatchlogs.putRetentionPolicy({ logGroupName, retentionInDays }).promise(); + } + return; + + } catch (error) { + if (error.code === 'OperationAbortedException') { + if (retryCount > 0) { + retryCount--; + await new Promise(resolve => setTimeout(resolve, delay)); + continue; + } else { + // The log group is still being created by another execution but we are out of retries + throw new Error('Out of attempts to create a logGroup'); + } + } + throw error; + } + } while (true); // exit happens on retry count check +} + +export async function handler(event: AWSLambda.CloudFormationCustomResourceEvent, context: AWSLambda.Context) { + try { + console.log(JSON.stringify({ ...event, ResponseURL: '...' })); + + // The target log group + const logGroupName = event.ResourceProperties.LogGroupName; + + // The region of the target log group + const logGroupRegion = event.ResourceProperties.LogGroupRegion; + + // Parse to AWS SDK retry options + const retryOptions = parseRetryOptions(event.ResourceProperties.SdkRetry); + + if (event.RequestType === 'Create' || event.RequestType === 'Update') { + // Act on the target log group + await createLogGroupSafe(logGroupName, logGroupRegion, retryOptions); + await setRetentionPolicy(logGroupName, logGroupRegion, retryOptions, parseInt(event.ResourceProperties.RetentionInDays, 10)); + + if (event.RequestType === 'Create') { + // Set a retention policy of 1 day on the logs of this very function. + // Due to the async nature of the log group creation, the log group for this function might + // still be not created yet at this point. Therefore we attempt to create it. + // In case it is being created, createLogGroupSafe will handle the conflict. + const region = process.env.AWS_REGION; + await createLogGroupSafe(`/aws/lambda/${context.functionName}`, region, retryOptions); + // If createLogGroupSafe fails, the log group is not created even after multiple attempts. + // In this case we have nothing to set the retention policy on but an exception will skip + // the next line. + await setRetentionPolicy(`/aws/lambda/${context.functionName}`, region, retryOptions, 1); + } + } + + await respond('SUCCESS', 'OK', logGroupName); + } catch (e) { + console.log(e); + + await respond('FAILED', e.message, event.ResourceProperties.LogGroupName); + } + + function respond(responseStatus: string, reason: string, physicalResourceId: string) { + const responseBody = JSON.stringify({ + Status: responseStatus, + Reason: reason, + PhysicalResourceId: physicalResourceId, + StackId: event.StackId, + RequestId: event.RequestId, + LogicalResourceId: event.LogicalResourceId, + Data: { + // Add log group name as part of the response so that it's available via Fn::GetAtt + LogGroupName: event.ResourceProperties.LogGroupName, + }, + }); + + console.log('Responding', responseBody); + + // eslint-disable-next-line @typescript-eslint/no-require-imports + const parsedUrl = require('url').parse(event.ResponseURL); + const requestOptions = { + hostname: parsedUrl.hostname, + path: parsedUrl.path, + method: 'PUT', + headers: { 'content-type': '', 'content-length': responseBody.length }, + }; + + return new Promise((resolve, reject) => { + try { + // eslint-disable-next-line @typescript-eslint/no-require-imports + const request = require('https').request(requestOptions, resolve); + request.on('error', reject); + request.write(responseBody); + request.end(); + } catch (e) { + reject(e); + } + }); + } + + function parseRetryOptions(rawOptions: any): SdkRetryOptions { + const retryOptions: SdkRetryOptions = {}; + if (rawOptions) { + if (rawOptions.maxRetries) { + retryOptions.maxRetries = parseInt(rawOptions.maxRetries, 10); + } + if (rawOptions.base) { + retryOptions.retryOptions = { + base: parseInt(rawOptions.base, 10), + }; + } + } + return retryOptions; + } +} diff --git a/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/cdk.out new file mode 100644 index 0000000000000..588d7b269d34f --- /dev/null +++ b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/integ.json b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/integ.json new file mode 100644 index 0000000000000..2e53939a47b06 --- /dev/null +++ b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/integ.json @@ -0,0 +1,11 @@ +{ + "version": "20.0.0", + "testCases": { + "Integ/DefaultTest": { + "stacks": [ + "AppSyncIntegLogRetention" + ], + "assertionStack": "IntegDefaultTestDeployAssert4E6713E1" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/manifest.json new file mode 100644 index 0000000000000..f5d5110397c91 --- /dev/null +++ b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/manifest.json @@ -0,0 +1,184 @@ +{ + "version": "20.0.0", + "artifacts": { + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + }, + "AppSyncIntegLogRetention": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "AppSyncIntegLogRetention.template.json", + "validateOnSynth": false + }, + "metadata": { + "/AppSyncIntegLogRetention": [ + { + "type": "aws:cdk:asset", + "data": { + "path": "asset.c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a", + "id": "c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a", + "packaging": "zip", + "sourceHash": "c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a", + "s3BucketParameter": "AssetParametersc70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13aS3BucketB4787383", + "s3KeyParameter": "AssetParametersc70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13aS3VersionKey8CF8E820", + "artifactHashParameter": "AssetParametersc70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13aArtifactHashC9560B34" + } + } + ], + "/AppSyncIntegLogRetention/GraphqlApi/ApiLogsRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "GraphqlApiApiLogsRoleBB9E6BAD" + } + ], + "/AppSyncIntegLogRetention/GraphqlApi/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "GraphqlApi1B6CF24C" + } + ], + "/AppSyncIntegLogRetention/GraphqlApi/Schema": [ + { + "type": "aws:cdk:logicalId", + "data": "GraphqlApiSchema1B71CE4F" + } + ], + "/AppSyncIntegLogRetention/GraphqlApi/DefaultApiKey": [ + { + "type": "aws:cdk:logicalId", + "data": "GraphqlApiDefaultApiKey47EE7128" + } + ], + "/AppSyncIntegLogRetention/GraphqlApi/LogRetention/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "GraphqlApiLogRetention082A7017" + } + ], + "/AppSyncIntegLogRetention/LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRole9741ECFB" + } + ], + "/AppSyncIntegLogRetention/LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a/ServiceRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRoleDefaultPolicyADDA7DEB" + } + ], + "/AppSyncIntegLogRetention/LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A" + } + ], + "/AppSyncIntegLogRetention/AssetParameters/c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a/S3Bucket": [ + { + "type": "aws:cdk:logicalId", + "data": "AssetParametersc70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13aS3BucketB4787383" + } + ], + "/AppSyncIntegLogRetention/AssetParameters/c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a/S3VersionKey": [ + { + "type": "aws:cdk:logicalId", + "data": "AssetParametersc70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13aS3VersionKey8CF8E820" + } + ], + "/AppSyncIntegLogRetention/AssetParameters/c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a/ArtifactHash": [ + { + "type": "aws:cdk:logicalId", + "data": "AssetParametersc70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13aArtifactHashC9560B34" + } + ], + "/AppSyncIntegLogRetention/Exports/Output{\"Fn::GetAtt\":[\"GraphqlApi1B6CF24C\",\"ApiId\"]}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputFnGetAttGraphqlApi1B6CF24CApiIdE34D50AD" + } + ] + }, + "displayName": "AppSyncIntegLogRetention" + }, + "IntegDefaultTestDeployAssert4E6713E1": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "IntegDefaultTestDeployAssert4E6713E1.template.json", + "validateOnSynth": false + }, + "dependencies": [ + "AppSyncIntegLogRetention" + ], + "metadata": { + "/Integ/DefaultTest/DeployAssert": [ + { + "type": "aws:cdk:asset", + "data": { + "path": "asset.0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbd.bundle", + "id": "0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbd", + "packaging": "zip", + "sourceHash": "0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbd", + "s3BucketParameter": "AssetParameters0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbdS3BucketF94385B7", + "s3KeyParameter": "AssetParameters0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbdS3VersionKey66DB0F9E", + "artifactHashParameter": "AssetParameters0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbdArtifactHash2AC894D9" + } + } + ], + "/Integ/DefaultTest/DeployAssert/AwsApiCallCloudWatchLogsdescribeLogGroups/Default/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "AwsApiCallCloudWatchLogsdescribeLogGroups" + } + ], + "/Integ/DefaultTest/DeployAssert/AwsApiCallCloudWatchLogsdescribeLogGroups/AssertEqualsCloudWatchLogsdescribeLogGroups/Default/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "AwsApiCallCloudWatchLogsdescribeLogGroupsAssertEqualsCloudWatchLogsdescribeLogGroupsD2E2CD37" + } + ], + "/Integ/DefaultTest/DeployAssert/AwsApiCallCloudWatchLogsdescribeLogGroups/AssertEqualsCloudWatchLogsdescribeLogGroups/AssertionResults": [ + { + "type": "aws:cdk:logicalId", + "data": "AssertionResultsAssertEqualsCloudWatchLogsdescribeLogGroups" + } + ], + "/Integ/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81/Role": [ + { + "type": "aws:cdk:logicalId", + "data": "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73" + } + ], + "/Integ/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81/Handler": [ + { + "type": "aws:cdk:logicalId", + "data": "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F" + } + ], + "/Integ/DefaultTest/DeployAssert/AssetParameters/0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbd/S3Bucket": [ + { + "type": "aws:cdk:logicalId", + "data": "AssetParameters0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbdS3BucketF94385B7" + } + ], + "/Integ/DefaultTest/DeployAssert/AssetParameters/0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbd/S3VersionKey": [ + { + "type": "aws:cdk:logicalId", + "data": "AssetParameters0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbdS3VersionKey66DB0F9E" + } + ], + "/Integ/DefaultTest/DeployAssert/AssetParameters/0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbd/ArtifactHash": [ + { + "type": "aws:cdk:logicalId", + "data": "AssetParameters0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbdArtifactHash2AC894D9" + } + ] + }, + "displayName": "Integ/DefaultTest/DeployAssert" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/tree.json b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/tree.json new file mode 100644 index 0000000000000..cd73d74dee554 --- /dev/null +++ b/packages/@aws-cdk/aws-appsync/test/log-retention.integ.snapshot/tree.json @@ -0,0 +1,592 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "AppSyncIntegLogRetention": { + "id": "AppSyncIntegLogRetention", + "path": "AppSyncIntegLogRetention", + "children": { + "GraphqlApi": { + "id": "GraphqlApi", + "path": "AppSyncIntegLogRetention/GraphqlApi", + "children": { + "ApiLogsRole": { + "id": "ApiLogsRole", + "path": "AppSyncIntegLogRetention/GraphqlApi/ApiLogsRole", + "children": { + "Resource": { + "id": "Resource", + "path": "AppSyncIntegLogRetention/GraphqlApi/ApiLogsRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "appsync.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSAppSyncPushToCloudWatchLogs" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "AppSyncIntegLogRetention/GraphqlApi/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::AppSync::GraphQLApi", + "aws:cdk:cloudformation:props": { + "authenticationType": "API_KEY", + "name": "IntegLogRetention", + "logConfig": { + "cloudWatchLogsRoleArn": { + "Fn::GetAtt": [ + "GraphqlApiApiLogsRoleBB9E6BAD", + "Arn" + ] + }, + "fieldLogLevel": "NONE" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-appsync.CfnGraphQLApi", + "version": "0.0.0" + } + }, + "Schema": { + "id": "Schema", + "path": "AppSyncIntegLogRetention/GraphqlApi/Schema", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::AppSync::GraphQLSchema", + "aws:cdk:cloudformation:props": { + "apiId": { + "Fn::GetAtt": [ + "GraphqlApi1B6CF24C", + "ApiId" + ] + }, + "definition": "type test {\n version: String!\n}\ntype Query {\n getTests: [test]!\n}\ntype Mutation {\n addTest(version: String!): test\n}\n" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-appsync.CfnGraphQLSchema", + "version": "0.0.0" + } + }, + "DefaultApiKey": { + "id": "DefaultApiKey", + "path": "AppSyncIntegLogRetention/GraphqlApi/DefaultApiKey", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::AppSync::ApiKey", + "aws:cdk:cloudformation:props": { + "apiId": { + "Fn::GetAtt": [ + "GraphqlApi1B6CF24C", + "ApiId" + ] + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-appsync.CfnApiKey", + "version": "0.0.0" + } + }, + "LogGroup": { + "id": "LogGroup", + "path": "AppSyncIntegLogRetention/GraphqlApi/LogGroup", + "constructInfo": { + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" + } + }, + "LogRetention": { + "id": "LogRetention", + "path": "AppSyncIntegLogRetention/GraphqlApi/LogRetention", + "children": { + "Resource": { + "id": "Resource", + "path": "AppSyncIntegLogRetention/GraphqlApi/LogRetention/Resource", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-logs.LogRetention", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-appsync.GraphqlApi", + "version": "0.0.0" + } + }, + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a": { + "id": "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a", + "path": "AppSyncIntegLogRetention/LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a", + "children": { + "Code": { + "id": "Code", + "path": "AppSyncIntegLogRetention/LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a/Code", + "children": { + "Stage": { + "id": "Stage", + "path": "AppSyncIntegLogRetention/LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a/Code/Stage", + "constructInfo": { + "fqn": "@aws-cdk/core.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "AppSyncIntegLogRetention/LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a/Code/AssetBucket", + "constructInfo": { + "fqn": "@aws-cdk/aws-s3.BucketBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-s3-assets.Asset", + "version": "0.0.0" + } + }, + "ServiceRole": { + "id": "ServiceRole", + "path": "AppSyncIntegLogRetention/LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a/ServiceRole", + "children": { + "Resource": { + "id": "Resource", + "path": "AppSyncIntegLogRetention/LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "AppSyncIntegLogRetention/LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a/ServiceRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "AppSyncIntegLogRetention/LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a/ServiceRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:DeleteRetentionPolicy", + "logs:PutRetentionPolicy" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRoleDefaultPolicyADDA7DEB", + "roles": [ + { + "Ref": "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRole9741ECFB" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "AppSyncIntegLogRetention/LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a/Resource", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "AssetParameters": { + "id": "AssetParameters", + "path": "AppSyncIntegLogRetention/AssetParameters", + "children": { + "c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a": { + "id": "c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a", + "path": "AppSyncIntegLogRetention/AssetParameters/c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a", + "children": { + "S3Bucket": { + "id": "S3Bucket", + "path": "AppSyncIntegLogRetention/AssetParameters/c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a/S3Bucket", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "S3VersionKey": { + "id": "S3VersionKey", + "path": "AppSyncIntegLogRetention/AssetParameters/c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a/S3VersionKey", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "ArtifactHash": { + "id": "ArtifactHash", + "path": "AppSyncIntegLogRetention/AssetParameters/c70c1d1695771af4771fd98971e16bb3e6443c62c2994b002b2c3d76e707b13a/ArtifactHash", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "Exports": { + "id": "Exports", + "path": "AppSyncIntegLogRetention/Exports", + "children": { + "Output{\"Fn::GetAtt\":[\"GraphqlApi1B6CF24C\",\"ApiId\"]}": { + "id": "Output{\"Fn::GetAtt\":[\"GraphqlApi1B6CF24C\",\"ApiId\"]}", + "path": "AppSyncIntegLogRetention/Exports/Output{\"Fn::GetAtt\":[\"GraphqlApi1B6CF24C\",\"ApiId\"]}", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + }, + "Integ": { + "id": "Integ", + "path": "Integ", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "Integ/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "Integ/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "Integ/DefaultTest/DeployAssert", + "children": { + "AwsApiCallCloudWatchLogsdescribeLogGroups": { + "id": "AwsApiCallCloudWatchLogsdescribeLogGroups", + "path": "Integ/DefaultTest/DeployAssert/AwsApiCallCloudWatchLogsdescribeLogGroups", + "children": { + "SdkProvider": { + "id": "SdkProvider", + "path": "Integ/DefaultTest/DeployAssert/AwsApiCallCloudWatchLogsdescribeLogGroups/SdkProvider", + "children": { + "AssertionsProvider": { + "id": "AssertionsProvider", + "path": "Integ/DefaultTest/DeployAssert/AwsApiCallCloudWatchLogsdescribeLogGroups/SdkProvider/AssertionsProvider", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.AssertionsProvider", + "version": "0.0.0" + } + }, + "Default": { + "id": "Default", + "path": "Integ/DefaultTest/DeployAssert/AwsApiCallCloudWatchLogsdescribeLogGroups/Default", + "children": { + "Default": { + "id": "Default", + "path": "Integ/DefaultTest/DeployAssert/AwsApiCallCloudWatchLogsdescribeLogGroups/Default/Default", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.CustomResource", + "version": "0.0.0" + } + }, + "AssertEqualsCloudWatchLogsdescribeLogGroups": { + "id": "AssertEqualsCloudWatchLogsdescribeLogGroups", + "path": "Integ/DefaultTest/DeployAssert/AwsApiCallCloudWatchLogsdescribeLogGroups/AssertEqualsCloudWatchLogsdescribeLogGroups", + "children": { + "AssertionProvider": { + "id": "AssertionProvider", + "path": "Integ/DefaultTest/DeployAssert/AwsApiCallCloudWatchLogsdescribeLogGroups/AssertEqualsCloudWatchLogsdescribeLogGroups/AssertionProvider", + "children": { + "AssertionsProvider": { + "id": "AssertionsProvider", + "path": "Integ/DefaultTest/DeployAssert/AwsApiCallCloudWatchLogsdescribeLogGroups/AssertEqualsCloudWatchLogsdescribeLogGroups/AssertionProvider/AssertionsProvider", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.AssertionsProvider", + "version": "0.0.0" + } + }, + "Default": { + "id": "Default", + "path": "Integ/DefaultTest/DeployAssert/AwsApiCallCloudWatchLogsdescribeLogGroups/AssertEqualsCloudWatchLogsdescribeLogGroups/Default", + "children": { + "Default": { + "id": "Default", + "path": "Integ/DefaultTest/DeployAssert/AwsApiCallCloudWatchLogsdescribeLogGroups/AssertEqualsCloudWatchLogsdescribeLogGroups/Default/Default", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.CustomResource", + "version": "0.0.0" + } + }, + "AssertionResults": { + "id": "AssertionResults", + "path": "Integ/DefaultTest/DeployAssert/AwsApiCallCloudWatchLogsdescribeLogGroups/AssertEqualsCloudWatchLogsdescribeLogGroups/AssertionResults", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.EqualsAssertion", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.AwsApiCall", + "version": "0.0.0" + } + }, + "SingletonFunction1488541a7b23466481b69b4408076b81": { + "id": "SingletonFunction1488541a7b23466481b69b4408076b81", + "path": "Integ/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81", + "children": { + "Staging": { + "id": "Staging", + "path": "Integ/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81/Staging", + "constructInfo": { + "fqn": "@aws-cdk/core.AssetStaging", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "Integ/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81/Role", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + }, + "Handler": { + "id": "Handler", + "path": "Integ/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81/Handler", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "AssetParameters": { + "id": "AssetParameters", + "path": "Integ/DefaultTest/DeployAssert/AssetParameters", + "children": { + "0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbd": { + "id": "0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbd", + "path": "Integ/DefaultTest/DeployAssert/AssetParameters/0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbd", + "children": { + "S3Bucket": { + "id": "S3Bucket", + "path": "Integ/DefaultTest/DeployAssert/AssetParameters/0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbd/S3Bucket", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "S3VersionKey": { + "id": "S3VersionKey", + "path": "Integ/DefaultTest/DeployAssert/AssetParameters/0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbd/S3VersionKey", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "ArtifactHash": { + "id": "ArtifactHash", + "path": "Integ/DefaultTest/DeployAssert/AssetParameters/0d8d96305807ac805d23c6d7b279eef238715605efad63c839ad1e7e8236bdbd/ArtifactHash", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "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" + } + } + }, + "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-autoscaling/lib/auto-scaling-group.ts b/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts index d3939f6a3971c..3a5061fc0ff58 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts +++ b/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts @@ -119,10 +119,10 @@ export interface CommonAutoScalingGroupProps { * This is applied when any of the settings on the ASG are changed that * affect how the instances should be created (VPC, instance type, startup * scripts, etc.). It indicates how the existing instances should be - * replaced with new instances matching the new config. By default, nothing - * is done and only new instances are launched with the new config. + * replaced with new instances matching the new config. By default, + * `updatePolicy` takes precedence over `updateType`. * - * @default UpdateType.None + * @default UpdateType.REPLACING_UPDATE, unless updatePolicy has been set * @deprecated Use `updatePolicy` instead */ readonly updateType?: UpdateType; diff --git a/packages/@aws-cdk/aws-autoscaling/test/asg-lt.integ.snapshot/aws-cdk-asg-integ.template.json b/packages/@aws-cdk/aws-autoscaling/test/asg-lt.integ.snapshot/aws-cdk-asg-integ.template.json index fa29f0359ac7f..127c588e7aee2 100644 --- a/packages/@aws-cdk/aws-autoscaling/test/asg-lt.integ.snapshot/aws-cdk-asg-integ.template.json +++ b/packages/@aws-cdk/aws-autoscaling/test/asg-lt.integ.snapshot/aws-cdk-asg-integ.template.json @@ -28,7 +28,18 @@ ] } ] - } + }, + "TagSpecifications": [ + { + "ResourceType": "launch-template", + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-asg-integ/MainLT" + } + ] + } + ] } }, "T4gLT8FF7D308": { @@ -59,7 +70,18 @@ ] } ] - } + }, + "TagSpecifications": [ + { + "ResourceType": "launch-template", + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-asg-integ/T4gLT" + } + ] + } + ] } }, "VPCB9E5F0B4": { diff --git a/packages/@aws-cdk/aws-ec2/lib/launch-template.ts b/packages/@aws-cdk/aws-ec2/lib/launch-template.ts index ea25070ff7b62..790940efc6e95 100644 --- a/packages/@aws-cdk/aws-ec2/lib/launch-template.ts +++ b/packages/@aws-cdk/aws-ec2/lib/launch-template.ts @@ -563,6 +563,7 @@ export class LaunchTemplate extends Resource implements ILaunchTemplate, iam.IGr } this.tags = new TagManager(TagType.KEY_VALUE, 'AWS::EC2::LaunchTemplate'); + const tagsToken = Lazy.any({ produce: () => { if (this.tags.hasTags()) { @@ -588,6 +589,27 @@ export class LaunchTemplate extends Resource implements ILaunchTemplate, iam.IGr }, }); + const ltTagsToken = Lazy.any({ + produce: () => { + if (this.tags.hasTags()) { + const renderedTags = this.tags.renderTags(); + const lowerCaseRenderedTags = renderedTags.map( (tag: { [key: string]: string}) => { + return { + key: tag.Key, + value: tag.Value, + }; + }); + return [ + { + resourceType: 'launch-template', + tags: lowerCaseRenderedTags, + }, + ]; + } + return undefined; + }, + }); + const resource = new CfnLaunchTemplate(this, 'Resource', { launchTemplateName: props?.launchTemplateName, launchTemplateData: { @@ -655,6 +677,7 @@ export class LaunchTemplate extends Resource implements ILaunchTemplate, iam.IGr // placement: undefined, }, + tagSpecifications: ltTagsToken, }); Tags.of(this).add(NAME_TAG, this.node.path); diff --git a/packages/@aws-cdk/aws-ec2/test/launch-template.test.ts b/packages/@aws-cdk/aws-ec2/test/launch-template.test.ts index 90916eea165f5..29b4f25676418 100644 --- a/packages/@aws-cdk/aws-ec2/test/launch-template.test.ts +++ b/packages/@aws-cdk/aws-ec2/test/launch-template.test.ts @@ -74,6 +74,17 @@ describe('LaunchTemplate', () => { }, ], }, + TagSpecifications: [ + { + ResourceType: 'launch-template', + Tags: [ + { + Key: 'Name', + Value: 'Default/Template', + }, + ], + }, + ], }); Template.fromStack(stack).resourceCountIs('AWS::IAM::InstanceProfile', 0); expect(() => { template.grantPrincipal; }).toThrow(); @@ -248,6 +259,17 @@ describe('LaunchTemplate', () => { }, ], }, + TagSpecifications: [ + { + ResourceType: 'launch-template', + Tags: [ + { + Key: 'Name', + Value: 'Default/Template', + }, + ], + }, + ], }); expect(template.role).toBeDefined(); expect(template.grantPrincipal).toBeDefined(); @@ -533,6 +555,21 @@ describe('LaunchTemplate', () => { }, ], }, + TagSpecifications: [ + { + ResourceType: 'launch-template', + Tags: [ + { + Key: 'Name', + Value: 'Default/Template', + }, + { + Key: 'TestKey', + Value: 'TestValue', + }, + ], + }, + ], }); }); diff --git a/packages/@aws-cdk/aws-ecs/lib/cluster.ts b/packages/@aws-cdk/aws-ecs/lib/cluster.ts index 5666e7f6403ac..dc42dacb975e0 100644 --- a/packages/@aws-cdk/aws-ecs/lib/cluster.ts +++ b/packages/@aws-cdk/aws-ecs/lib/cluster.ts @@ -338,7 +338,7 @@ export class Cluster extends Resource implements ICluster { const autoScalingGroup = new autoscaling.AutoScalingGroup(this, id, { vpc: this.vpc, machineImage, - updateType: options.updateType || autoscaling.UpdateType.REPLACING_UPDATE, + updateType: !!options.updatePolicy ? undefined : options.updateType || autoscaling.UpdateType.REPLACING_UPDATE, ...options, }); diff --git a/packages/@aws-cdk/aws-ecs/test/cluster.test.ts b/packages/@aws-cdk/aws-ecs/test/cluster.test.ts index 11394fb74622a..5e2e0403ac33b 100644 --- a/packages/@aws-cdk/aws-ecs/test/cluster.test.ts +++ b/packages/@aws-cdk/aws-ecs/test/cluster.test.ts @@ -1725,6 +1725,143 @@ describe('cluster', () => { }); + testDeprecated('updatePolicy set when passed without updateType', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + cluster.addCapacity('bottlerocket-asg', { + instanceType: new ec2.InstanceType('c5.large'), + machineImage: new ecs.BottleRocketImage(), + updatePolicy: autoscaling.UpdatePolicy.replacingUpdate(), + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + UpdatePolicy: { + AutoScalingReplacingUpdate: { + WillReplace: true, + }, + }, + }); + }); + + testDeprecated('undefined updateType & updatePolicy replaced by default updatePolicy', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + cluster.addCapacity('bottlerocket-asg', { + instanceType: new ec2.InstanceType('c5.large'), + machineImage: new ecs.BottleRocketImage(), + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + UpdatePolicy: { + AutoScalingReplacingUpdate: { + WillReplace: true, + }, + }, + }); + }); + + testDeprecated('updateType.NONE replaced by updatePolicy equivalent', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + cluster.addCapacity('bottlerocket-asg', { + instanceType: new ec2.InstanceType('c5.large'), + machineImage: new ecs.BottleRocketImage(), + updateType: autoscaling.UpdateType.NONE, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + UpdatePolicy: { + AutoScalingScheduledAction: { + IgnoreUnmodifiedGroupSizeProperties: true, + }, + }, + }); + }); + + testDeprecated('updateType.REPLACING_UPDATE replaced by updatePolicy equivalent', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + cluster.addCapacity('bottlerocket-asg', { + instanceType: new ec2.InstanceType('c5.large'), + machineImage: new ecs.BottleRocketImage(), + updateType: autoscaling.UpdateType.REPLACING_UPDATE, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + UpdatePolicy: { + AutoScalingReplacingUpdate: { + WillReplace: true, + }, + }, + }); + }); + + testDeprecated('updateType.ROLLING_UPDATE replaced by updatePolicy equivalent', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + cluster.addCapacity('bottlerocket-asg', { + instanceType: new ec2.InstanceType('c5.large'), + machineImage: new ecs.BottleRocketImage(), + updateType: autoscaling.UpdateType.ROLLING_UPDATE, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + UpdatePolicy: { + AutoScalingRollingUpdate: { + WaitOnResourceSignals: false, + PauseTime: 'PT0S', + SuspendProcesses: [ + 'HealthCheck', + 'ReplaceUnhealthy', + 'AZRebalance', + 'AlarmNotification', + 'ScheduledActions', + ], + }, + AutoScalingScheduledAction: { + IgnoreUnmodifiedGroupSizeProperties: true, + }, + }, + }); + }); + + testDeprecated('throws when updatePolicy and updateType both specified', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + + expect(() => { + cluster.addCapacity('bottlerocket-asg', { + instanceType: new ec2.InstanceType('c5.large'), + machineImage: new ecs.BottleRocketImage(), + updatePolicy: autoscaling.UpdatePolicy.replacingUpdate(), + updateType: autoscaling.UpdateType.REPLACING_UPDATE, + }); + }).toThrow("Cannot set 'signals'/'updatePolicy' and 'updateType' together. Prefer 'signals'/'updatePolicy'"); + }); + testDeprecated('allows specifying capacityProviders (deprecated)', () => { // GIVEN const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/environment-file.integ.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk/aws-ecs/test/ec2/environment-file.integ.snapshot/aws-ecs-integ.template.json index 0f3734dc75d0e..803cae34a9f34 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/environment-file.integ.snapshot/aws-ecs-integ.template.json +++ b/packages/@aws-cdk/aws-ecs/test/ec2/environment-file.integ.snapshot/aws-ecs-integ.template.json @@ -1460,7 +1460,7 @@ "Ref": "EnvFileDeploymentAwsCliLayerA8FC897D" } ], - "Runtime": "python3.7", + "Runtime": "python3.9", "Timeout": 900 }, "DependsOn": [ diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/environment-file.integ.snapshot/tree.json b/packages/@aws-cdk/aws-ecs/test/ec2/environment-file.integ.snapshot/tree.json index a8afb7f3d8803..6e784ccb82867 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/environment-file.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-ecs/test/ec2/environment-file.integ.snapshot/tree.json @@ -2330,7 +2330,7 @@ "Ref": "EnvFileDeploymentAwsCliLayerA8FC897D" } ], - "runtime": "python3.7", + "runtime": "python3.9", "timeout": 900 } }, diff --git a/packages/@aws-cdk/aws-eks/package.json b/packages/@aws-cdk/aws-eks/package.json index 97a5e6e9e6b56..15e92dde9593a 100644 --- a/packages/@aws-cdk/aws-eks/package.json +++ b/packages/@aws-cdk/aws-eks/package.json @@ -90,7 +90,7 @@ "@types/sinon": "^9.0.11", "@types/yaml": "1.9.6", "aws-sdk": "^2.848.0", - "cdk8s": "^2.3.72", + "cdk8s": "^2.3.74", "cdk8s-plus-21": "^2.0.0-beta.12", "jest": "^27.5.1", "sinon": "^9.2.4" diff --git a/packages/@aws-cdk/aws-iot-actions/README.md b/packages/@aws-cdk/aws-iot-actions/README.md index 088fda5f3e5b8..2572003a0fab7 100644 --- a/packages/@aws-cdk/aws-iot-actions/README.md +++ b/packages/@aws-cdk/aws-iot-actions/README.md @@ -31,6 +31,7 @@ Currently supported are: - Put records to Kinesis Data Firehose stream - Send messages to SQS queues - Publish messages on SNS topics +- Write messages into columns of DynamoDB ## Republish a message to another MQTT topic @@ -278,3 +279,23 @@ const topicRule = new iot.TopicRule(this, 'TopicRule', { ], }); ``` + +## Write attributes of a message to DynamoDB + +The code snippet below creates an AWS IoT rule that writes all or part of an +MQTT message to DynamoDB using the DynamoDBv2 action. + +```ts +import * as dynamodb from '@aws-cdk/aws-dynamodb'; + +declare const table: dynamodb.Table; + +const topicRule = new iot.TopicRule(this, 'TopicRule', { + sql: iot.IotSql.fromStringAsVer20160323( + "SELECT * FROM 'device/+/data'", + ), + actions: [ + new actions.DynamoDBv2PutItemAction(table) + ], +}); +``` diff --git a/packages/@aws-cdk/aws-iot-actions/lib/dynamodbv2-put-item-action.ts b/packages/@aws-cdk/aws-iot-actions/lib/dynamodbv2-put-item-action.ts new file mode 100644 index 0000000000000..606ad3f0036f0 --- /dev/null +++ b/packages/@aws-cdk/aws-iot-actions/lib/dynamodbv2-put-item-action.ts @@ -0,0 +1,44 @@ +import * as dynamodb from '@aws-cdk/aws-dynamodb'; +import * as iam from '@aws-cdk/aws-iam'; +import * as iot from '@aws-cdk/aws-iot'; +import { CommonActionProps } from './common-action-props'; +import { singletonActionRole } from './private/role'; + +/** + * Configuration properties of an action for the dynamodb table. + */ +export interface DynamoDBv2PutItemActionProps extends CommonActionProps { +} + +/** + * The action to put the record from an MQTT message to the DynamoDB table. + */ +export class DynamoDBv2PutItemAction implements iot.IAction { + private readonly role?: iam.IRole; + + /** + * @param table the DynamoDB table in which to put the items. + * @param props Optional properties to not use default + */ + constructor(private readonly table: dynamodb.ITable, props: DynamoDBv2PutItemActionProps = {}) { + this.role = props.role; + } + + bind(rule: iot.ITopicRule): iot.ActionConfig { + const role = this.role ?? singletonActionRole(rule); + role.addToPrincipalPolicy(new iam.PolicyStatement({ + actions: ['dynamodb:PutItem'], + resources: [this.table.tableArn], + })); + return { + configuration: { + dynamoDBv2: { + putItem: { + tableName: this.table.tableName, + }, + roleArn: role.roleArn, + }, + }, + }; + } +} diff --git a/packages/@aws-cdk/aws-iot-actions/lib/index.ts b/packages/@aws-cdk/aws-iot-actions/lib/index.ts index 5c214f4143309..91dd24ac32cd1 100644 --- a/packages/@aws-cdk/aws-iot-actions/lib/index.ts +++ b/packages/@aws-cdk/aws-iot-actions/lib/index.ts @@ -2,6 +2,7 @@ export * from './cloudwatch-logs-action'; export * from './cloudwatch-put-metric-action'; export * from './cloudwatch-set-alarm-state-action'; export * from './common-action-props'; +export * from './dynamodbv2-put-item-action'; export * from './firehose-put-record-action'; export * from './iot-republish-action'; export * from './kinesis-put-record-action'; diff --git a/packages/@aws-cdk/aws-iot-actions/package-lock.json b/packages/@aws-cdk/aws-iot-actions/package-lock.json new file mode 100644 index 0000000000000..094a8191aafc5 --- /dev/null +++ b/packages/@aws-cdk/aws-iot-actions/package-lock.json @@ -0,0 +1,173 @@ +{ + "name": "@aws-cdk/aws-iot-actions", + "version": "0.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@aws-cdk/cloud-assembly-schema": { + "version": "1.166.1", + "resolved": "https://registry.npmjs.org/@aws-cdk/cloud-assembly-schema/-/cloud-assembly-schema-1.166.1.tgz", + "integrity": "sha512-QL8IKpaUngtqQipLO6/7uvbR7HE8CTr2z3JLKcLjofountigs6l4VdL8wR6XMbzZ18DaOJ6iLWHGpbT4BBoHPg==", + "requires": { + "jsonschema": "^1.4.1", + "semver": "^7.3.7" + }, + "dependencies": { + "jsonschema": { + "version": "1.4.1", + "bundled": true + }, + "lru-cache": { + "version": "6.0.0", + "bundled": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.3.7", + "bundled": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "bundled": true + } + } + }, + "@aws-cdk/cx-api": { + "version": "1.166.1", + "resolved": "https://registry.npmjs.org/@aws-cdk/cx-api/-/cx-api-1.166.1.tgz", + "integrity": "sha512-cCsRe8wRGVhGaKFcW2l4b2LInzc9FeDsoaRTRreT3I+MxYyCAYlwWmx0RYoLg6r5eq6TD9PLAbOcCC6Y46CZ1g==", + "requires": { + "@aws-cdk/cloud-assembly-schema": "1.166.1", + "semver": "^7.3.7" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "bundled": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.3.7", + "bundled": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "bundled": true + } + } + }, + "@aws-cdk/integ-tests": { + "version": "1.166.1", + "resolved": "https://registry.npmjs.org/@aws-cdk/integ-tests/-/integ-tests-1.166.1.tgz", + "integrity": "sha512-x+KHKQDjKYbqTEUnTcbQa7Ubqu25N3/6PTeXpYs2staBB0HQPySjwbY87I6Lxpi1AexlJb+YhwfBofC7B/qoBQ==", + "requires": { + "@aws-cdk/cloud-assembly-schema": "1.166.1", + "@aws-cdk/core": "1.166.1", + "constructs": "^3.3.69" + }, + "dependencies": { + "@aws-cdk/core": { + "version": "1.166.1", + "resolved": "https://registry.npmjs.org/@aws-cdk/core/-/core-1.166.1.tgz", + "integrity": "sha512-C0xNgePI1o6+RJqiXSG3RgiQu7q9uKf56QxeRgvCLsgDDrS/DBZFe7erAC/cO6R7mxhqyOOIWJSHuCdUWPmkqg==", + "requires": { + "@aws-cdk/cloud-assembly-schema": "1.166.1", + "@aws-cdk/cx-api": "1.166.1", + "@aws-cdk/region-info": "1.166.1", + "@balena/dockerignore": "^1.0.2", + "constructs": "^3.3.69", + "fs-extra": "^9.1.0", + "ignore": "^5.2.0", + "minimatch": "^3.1.2" + }, + "dependencies": { + "@balena/dockerignore": { + "version": "1.0.2", + "bundled": true + }, + "at-least-node": { + "version": "1.0.0", + "bundled": true + }, + "balanced-match": { + "version": "1.0.2", + "bundled": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "concat-map": { + "version": "0.0.1", + "bundled": true + }, + "fs-extra": { + "version": "9.1.0", + "bundled": true, + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "graceful-fs": { + "version": "4.2.10", + "bundled": true + }, + "ignore": { + "version": "5.2.0", + "bundled": true + }, + "jsonfile": { + "version": "6.1.0", + "bundled": true, + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "minimatch": { + "version": "3.1.2", + "bundled": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "universalify": { + "version": "2.0.0", + "bundled": true + } + } + }, + "constructs": { + "version": "3.4.57", + "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.57.tgz", + "integrity": "sha512-jQyF6jFUJFqew13gDMZ9G8TkgFIJ7jMIG56FX9i3j/4pfGHrT+zwu6C95uuFIrBveC2RctxuDup23xBzs/XgUA==" + } + } + }, + "@aws-cdk/region-info": { + "version": "1.166.1", + "resolved": "https://registry.npmjs.org/@aws-cdk/region-info/-/region-info-1.166.1.tgz", + "integrity": "sha512-yxjMjXNhG+Iqo04P1U0JNBGeR3kfDe3Ecc72ywuxi+QH/bhCEGnf+783BjYqXHWh4olTwZbMYQ/BcsOO0Dchkw==" + }, + "case": { + "version": "1.6.3" + } + } +} diff --git a/packages/@aws-cdk/aws-iot-actions/package.json b/packages/@aws-cdk/aws-iot-actions/package.json index 769fa94121569..44b052ec6db66 100644 --- a/packages/@aws-cdk/aws-iot-actions/package.json +++ b/packages/@aws-cdk/aws-iot-actions/package.json @@ -81,6 +81,7 @@ "@aws-cdk/aws-kinesisfirehose-destinations": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", + "@aws-cdk/integ-tests": "0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/jest": "^27.5.2", "jest": "^27.5.1", @@ -88,6 +89,7 @@ }, "dependencies": { "@aws-cdk/aws-cloudwatch": "0.0.0", + "@aws-cdk/aws-dynamodb": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-iot": "0.0.0", "@aws-cdk/aws-kinesis": "0.0.0", @@ -104,6 +106,7 @@ "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-cloudwatch": "0.0.0", + "@aws-cdk/aws-dynamodb": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-iot": "0.0.0", "@aws-cdk/aws-kinesis": "0.0.0", diff --git a/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.integ.snapshot/cdk.out new file mode 100644 index 0000000000000..588d7b269d34f --- /dev/null +++ b/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.integ.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.integ.snapshot/dynamodbv2integtestDefaultTestDeployAssertEF9A9A37.template.json b/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.integ.snapshot/dynamodbv2integtestDefaultTestDeployAssertEF9A9A37.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.integ.snapshot/dynamodbv2integtestDefaultTestDeployAssertEF9A9A37.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.integ.snapshot/integ.json b/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.integ.snapshot/integ.json new file mode 100644 index 0000000000000..c30fa81cf3bd9 --- /dev/null +++ b/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.integ.snapshot/integ.json @@ -0,0 +1,11 @@ +{ + "version": "20.0.0", + "testCases": { + "dynamodbv2-integtest/DefaultTest": { + "stacks": [ + "test-dynamodbv2-put-item-action-stack" + ], + "assertionStack": "dynamodbv2integtestDefaultTestDeployAssertEF9A9A37" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.integ.snapshot/manifest.json new file mode 100644 index 0000000000000..50a2778c1a195 --- /dev/null +++ b/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.integ.snapshot/manifest.json @@ -0,0 +1,63 @@ +{ + "version": "20.0.0", + "artifacts": { + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + }, + "test-dynamodbv2-put-item-action-stack": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "test-dynamodbv2-put-item-action-stack.template.json", + "validateOnSynth": false + }, + "metadata": { + "/test-dynamodbv2-put-item-action-stack/TopicRule/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "TopicRule40A4EA44" + } + ], + "/test-dynamodbv2-put-item-action-stack/TopicRule/TopicRuleActionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "TopicRuleTopicRuleActionRole246C4F77" + } + ], + "/test-dynamodbv2-put-item-action-stack/TopicRule/TopicRuleActionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "TopicRuleTopicRuleActionRoleDefaultPolicy99ADD687" + } + ], + "/test-dynamodbv2-put-item-action-stack/MyTable": [ + { + "type": "aws:cdk:hasPhysicalName", + "data": { + "Ref": "MyTable794EDED1" + } + } + ], + "/test-dynamodbv2-put-item-action-stack/MyTable/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyTable794EDED1" + } + ] + }, + "displayName": "test-dynamodbv2-put-item-action-stack" + }, + "dynamodbv2integtestDefaultTestDeployAssertEF9A9A37": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dynamodbv2integtestDefaultTestDeployAssertEF9A9A37.template.json", + "validateOnSynth": false + }, + "displayName": "dynamodbv2-integtest/DefaultTest/DeployAssert" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.integ.snapshot/test-dynamodbv2-put-item-action-stack.template.json b/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.integ.snapshot/test-dynamodbv2-put-item-action-stack.template.json new file mode 100644 index 0000000000000..d7fa86d112450 --- /dev/null +++ b/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.integ.snapshot/test-dynamodbv2-put-item-action-stack.template.json @@ -0,0 +1,105 @@ +{ + "Resources": { + "TopicRule40A4EA44": { + "Type": "AWS::IoT::TopicRule", + "Properties": { + "TopicRulePayload": { + "Actions": [ + { + "DynamoDBv2": { + "PutItem": { + "TableName": { + "Ref": "MyTable794EDED1" + } + }, + "RoleArn": { + "Fn::GetAtt": [ + "TopicRuleTopicRuleActionRole246C4F77", + "Arn" + ] + } + } + } + ], + "AwsIotSqlVersion": "2016-03-23", + "Sql": "SELECT * FROM 'device/+/data'" + } + } + }, + "TopicRuleTopicRuleActionRole246C4F77": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "iot.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "TopicRuleTopicRuleActionRoleDefaultPolicy99ADD687": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "dynamodb:PutItem", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "MyTable794EDED1", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "TopicRuleTopicRuleActionRoleDefaultPolicy99ADD687", + "Roles": [ + { + "Ref": "TopicRuleTopicRuleActionRole246C4F77" + } + ] + } + }, + "MyTable794EDED1": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "KeySchema": [ + { + "AttributeName": "hashKey", + "KeyType": "HASH" + }, + { + "AttributeName": "sortKey", + "KeyType": "RANGE" + } + ], + "AttributeDefinitions": [ + { + "AttributeName": "hashKey", + "AttributeType": "S" + }, + { + "AttributeName": "sortKey", + "AttributeType": "N" + } + ], + "ProvisionedThroughput": { + "ReadCapacityUnits": 1, + "WriteCapacityUnits": 1 + }, + "TableName": "MyTable" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.integ.snapshot/tree.json b/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.integ.snapshot/tree.json new file mode 100644 index 0000000000000..995b3a6a9f21f --- /dev/null +++ b/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.integ.snapshot/tree.json @@ -0,0 +1,246 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "test-dynamodbv2-put-item-action-stack": { + "id": "test-dynamodbv2-put-item-action-stack", + "path": "test-dynamodbv2-put-item-action-stack", + "children": { + "TopicRule": { + "id": "TopicRule", + "path": "test-dynamodbv2-put-item-action-stack/TopicRule", + "children": { + "Resource": { + "id": "Resource", + "path": "test-dynamodbv2-put-item-action-stack/TopicRule/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IoT::TopicRule", + "aws:cdk:cloudformation:props": { + "topicRulePayload": { + "actions": [ + { + "dynamoDBv2": { + "putItem": { + "tableName": { + "Ref": "MyTable794EDED1" + } + }, + "roleArn": { + "Fn::GetAtt": [ + "TopicRuleTopicRuleActionRole246C4F77", + "Arn" + ] + } + } + } + ], + "awsIotSqlVersion": "2016-03-23", + "sql": "SELECT * FROM 'device/+/data'" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iot.CfnTopicRule", + "version": "0.0.0" + } + }, + "TopicRuleActionRole": { + "id": "TopicRuleActionRole", + "path": "test-dynamodbv2-put-item-action-stack/TopicRule/TopicRuleActionRole", + "children": { + "Resource": { + "id": "Resource", + "path": "test-dynamodbv2-put-item-action-stack/TopicRule/TopicRuleActionRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "iot.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "test-dynamodbv2-put-item-action-stack/TopicRule/TopicRuleActionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "test-dynamodbv2-put-item-action-stack/TopicRule/TopicRuleActionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "dynamodb:PutItem", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "MyTable794EDED1", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "TopicRuleTopicRuleActionRoleDefaultPolicy99ADD687", + "roles": [ + { + "Ref": "TopicRuleTopicRuleActionRole246C4F77" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Role", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iot.TopicRule", + "version": "0.0.0" + } + }, + "MyTable": { + "id": "MyTable", + "path": "test-dynamodbv2-put-item-action-stack/MyTable", + "children": { + "Resource": { + "id": "Resource", + "path": "test-dynamodbv2-put-item-action-stack/MyTable/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", + "aws:cdk:cloudformation:props": { + "keySchema": [ + { + "attributeName": "hashKey", + "keyType": "HASH" + }, + { + "attributeName": "sortKey", + "keyType": "RANGE" + } + ], + "attributeDefinitions": [ + { + "attributeName": "hashKey", + "attributeType": "S" + }, + { + "attributeName": "sortKey", + "attributeType": "N" + } + ], + "provisionedThroughput": { + "readCapacityUnits": 1, + "writeCapacityUnits": 1 + }, + "tableName": "MyTable" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-dynamodb.CfnTable", + "version": "0.0.0" + } + }, + "ScalingRole": { + "id": "ScalingRole", + "path": "test-dynamodbv2-put-item-action-stack/MyTable/ScalingRole", + "constructInfo": { + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-dynamodb.Table", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + }, + "dynamodbv2-integtest": { + "id": "dynamodbv2-integtest", + "path": "dynamodbv2-integtest", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "dynamodbv2-integtest/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "dynamodbv2-integtest/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.63" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "dynamodbv2-integtest/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-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.test.ts b/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.test.ts new file mode 100644 index 0000000000000..f4ddf926ed6f5 --- /dev/null +++ b/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/dynamodbv2-put-item-action.test.ts @@ -0,0 +1,96 @@ +import { Template, Match } from '@aws-cdk/assertions'; +import * as dynamodb from '@aws-cdk/aws-dynamodb'; +import * as iam from '@aws-cdk/aws-iam'; +import * as iot from '@aws-cdk/aws-iot'; +import * as cdk from '@aws-cdk/core'; +import * as actions from '../../lib'; + +test('Default dynamoDBv2 action', () => { + // GIVEN + const stack = new cdk.Stack(); + const topicRule = new iot.TopicRule(stack, 'MyTopicRule', { + sql: iot.IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id FROM 'device/+/data'"), + }); + const table = dynamodb.Table.fromTableArn(stack, 'MyTable', 'arn:aws:dynamodb:xx-west-1:111122223333:table/my-table'); + + // WHEN + topicRule.addAction(new actions.DynamoDBv2PutItemAction(table)); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IoT::TopicRule', { + TopicRulePayload: { + Actions: [ + { + DynamoDBv2: { + PutItem: { + TableName: 'my-table', + }, + RoleArn: { + 'Fn::GetAtt': ['MyTopicRuleTopicRuleActionRoleCE2D05DA', 'Arn'], + }, + }, + }, + ], + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'iot.amazonaws.com', + }, + }, + ], + Version: '2012-10-17', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: 'dynamodb:PutItem', + Effect: 'Allow', + Resource: 'arn:aws:dynamodb:xx-west-1:111122223333:table/my-table', + }, + ], + Version: '2012-10-17', + }, + PolicyName: 'MyTopicRuleTopicRuleActionRoleDefaultPolicy54A701F7', + Roles: [ + { Ref: 'MyTopicRuleTopicRuleActionRoleCE2D05DA' }, + ], + }); +}); + + +test('can set role', () => { + // GIVEN + const stack = new cdk.Stack(); + const topicRule = new iot.TopicRule(stack, 'MyTopicRule', { + sql: iot.IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id FROM 'device/+/data'"), + }); + const table = dynamodb.Table.fromTableArn(stack, 'MyTable', 'arn:aws:dynamodb:xx-west-1:111122223333:table/my-table'); + const role = iam.Role.fromRoleArn(stack, 'MyRole', 'arn:aws:iam::123456789012:role/ForTest'); + + // WHEN + topicRule.addAction(new actions.DynamoDBv2PutItemAction(table, { role })); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IoT::TopicRule', { + TopicRulePayload: { + Actions: [ + Match.objectLike({ DynamoDBv2: { RoleArn: 'arn:aws:iam::123456789012:role/ForTest' } }), + ], + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyName: 'MyRolePolicy64AB00A5', + Roles: ['ForTest'], + }); +}); diff --git a/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/integ.dynamodbv2-put-item-action.ts b/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/integ.dynamodbv2-put-item-action.ts new file mode 100644 index 0000000000000..1dc0e7c2eb509 --- /dev/null +++ b/packages/@aws-cdk/aws-iot-actions/test/dynamodbv2/integ.dynamodbv2-put-item-action.ts @@ -0,0 +1,41 @@ +import * as dynamodb from '@aws-cdk/aws-dynamodb'; +import * as iot from '@aws-cdk/aws-iot'; +import * as cdk from '@aws-cdk/core'; +import * as integ from '@aws-cdk/integ-tests'; +import * as actions from '../../lib'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'test-dynamodbv2-put-item-action-stack'); + +const topicRule = new iot.TopicRule(stack, 'TopicRule', { + sql: iot.IotSql.fromStringAsVer20160323( + "SELECT * FROM 'device/+/data'", + ), +}); + +const tablePartitionKey: dynamodb.Attribute = { + name: 'hashKey', + type: dynamodb.AttributeType.STRING, +}; + +const tableSortKey: dynamodb.Attribute = { + name: 'sortKey', + type: dynamodb.AttributeType.NUMBER, +}; + +const table = new dynamodb.Table(stack, 'MyTable', { + tableName: 'MyTable', + readCapacity: 1, + writeCapacity: 1, + partitionKey: tablePartitionKey, + sortKey: tableSortKey, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); + +topicRule.addAction(new actions.DynamoDBv2PutItemAction(table)); + +new integ.IntegTest(app, 'dynamodbv2-integtest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk/aws-iotevents-actions/README.md b/packages/@aws-cdk/aws-iotevents-actions/README.md index 486ddd8124c34..c4c9eaa13d96d 100644 --- a/packages/@aws-cdk/aws-iotevents-actions/README.md +++ b/packages/@aws-cdk/aws-iotevents-actions/README.md @@ -24,9 +24,78 @@ AWS IoT Events can trigger actions when it detects a specified event or transiti Currently supported are: +- Use timer - Set variable to detector instanse - Invoke a Lambda function +## Use timer + +The code snippet below creates an Action that creates the timer with duration in seconds. + +```ts +import * as iotevents from '@aws-cdk/aws-iotevents'; +import * as actions from '@aws-cdk/aws-iotevents-actions'; + +declare const input: iotevents.IInput; + +const state = new iotevents.State({ + stateName: 'MyState', + onEnter: [{ + eventName: 'test-event', + condition: iotevents.Expression.currentInput(input), + actions: [ + new actions.SetTimerAction('MyTimer', { + duration: cdk.Duration.seconds(60), + }), + ], + }], +}); +``` + +Setting duration by [IoT Events Expression](https://docs.aws.amazon.com/iotevents/latest/developerguide/iotevents-expressions.html): + +```ts +new actions.SetTimerAction('MyTimer', { + durationExpression: iotevents.Expression.inputAttribute(input, 'payload.durationSeconds'), +}) +``` + +And the timer can be reset and cleared. Below is an example of general +[Device HeartBeat](https://docs.aws.amazon.com/iotevents/latest/developerguide/iotevents-examples-dhb.html) +Detector Model: + +```ts +const online = new iotevents.State({ + stateName: 'Online', + onEnter: [{ + eventName: 'enter-event', + condition: iotevents.Expression.currentInput(input), + actions: [ + new actions.SetTimerAction('MyTimer', { + duration: cdk.Duration.seconds(60), + }), + ], + }], + onInput: [{ + eventName: 'input-event', + condition: iotevents.Expression.currentInput(input), + actions: [ + new actions.ResetTimerAction('MyTimer'), + ], + }], + onExit: [{ + eventName: 'exit-event', + actions: [ + new actions.ClearTimerAction('MyTimer'), + ], + }], +}); +const offline = new iotevents.State({ stateName: 'Offline' }); + +online.transitionTo(offline, { when: iotevents.Expression.timeout('MyTimer') }); +offline.transitionTo(online, { when: iotevents.Expression.currentInput(input) }); +``` + ## Set variable to detector instanse The code snippet below creates an Action that set variable to detector instanse @@ -44,12 +113,10 @@ const state = new iotevents.State({ eventName: 'test-event', condition: iotevents.Expression.currentInput(input), actions: [ - actions: [ - new actions.SetVariableAction( - 'MyVariable', - iotevents.Expression.inputAttribute(input, 'payload.temperature'), - ), - ], + new actions.SetVariableAction( + 'MyVariable', + iotevents.Expression.inputAttribute(input, 'payload.temperature'), + ), ], }], }); diff --git a/packages/@aws-cdk/aws-iotevents-actions/lib/clear-timer-action.ts b/packages/@aws-cdk/aws-iotevents-actions/lib/clear-timer-action.ts new file mode 100644 index 0000000000000..c533b8171cc8b --- /dev/null +++ b/packages/@aws-cdk/aws-iotevents-actions/lib/clear-timer-action.ts @@ -0,0 +1,25 @@ +import * as iotevents from '@aws-cdk/aws-iotevents'; +import { Construct } from 'constructs'; + +/** + * The action to delete an existing timer. + */ +export class ClearTimerAction implements iotevents.IAction { + /** + * @param timerName the name of the timer + */ + constructor(private readonly timerName: string) {} + + /** + * @internal + */ + public _bind(_scope: Construct, _options: iotevents.ActionBindOptions): iotevents.ActionConfig { + return { + configuration: { + clearTimer: { + timerName: this.timerName, + }, + }, + }; + } +} diff --git a/packages/@aws-cdk/aws-iotevents-actions/lib/index.ts b/packages/@aws-cdk/aws-iotevents-actions/lib/index.ts index e51394d301376..77b06b1419f2d 100644 --- a/packages/@aws-cdk/aws-iotevents-actions/lib/index.ts +++ b/packages/@aws-cdk/aws-iotevents-actions/lib/index.ts @@ -1,2 +1,6 @@ +export * from './clear-timer-action'; export * from './set-variable-action'; export * from './lambda-invoke-action'; +export * from './reset-timer-action'; +export * from './set-timer-action'; +export * from './timer-duration'; diff --git a/packages/@aws-cdk/aws-iotevents-actions/lib/lambda-invoke-action.ts b/packages/@aws-cdk/aws-iotevents-actions/lib/lambda-invoke-action.ts index af9dec5d32472..f7c291d0c80e9 100644 --- a/packages/@aws-cdk/aws-iotevents-actions/lib/lambda-invoke-action.ts +++ b/packages/@aws-cdk/aws-iotevents-actions/lib/lambda-invoke-action.ts @@ -12,7 +12,10 @@ export class LambdaInvokeAction implements iotevents.IAction { constructor(private readonly func: lambda.IFunction) { } - bind(_scope: Construct, options: iotevents.ActionBindOptions): iotevents.ActionConfig { + /** + * @internal + */ + public _bind(_scope: Construct, options: iotevents.ActionBindOptions): iotevents.ActionConfig { this.func.grantInvoke(options.role); return { configuration: { diff --git a/packages/@aws-cdk/aws-iotevents-actions/lib/reset-timer-action.ts b/packages/@aws-cdk/aws-iotevents-actions/lib/reset-timer-action.ts new file mode 100644 index 0000000000000..2e2868da8c540 --- /dev/null +++ b/packages/@aws-cdk/aws-iotevents-actions/lib/reset-timer-action.ts @@ -0,0 +1,25 @@ +import * as iotevents from '@aws-cdk/aws-iotevents'; +import { Construct } from 'constructs'; + +/** + * The action to reset an existing timer. + */ +export class ResetTimerAction implements iotevents.IAction { + /** + * @param timerName the name of the timer + */ + constructor(private readonly timerName: string) {} + + /** + * @internal + */ + public _bind(_scope: Construct, _options: iotevents.ActionBindOptions): iotevents.ActionConfig { + return { + configuration: { + resetTimer: { + timerName: this.timerName, + }, + }, + }; + } +} diff --git a/packages/@aws-cdk/aws-iotevents-actions/lib/set-timer-action.ts b/packages/@aws-cdk/aws-iotevents-actions/lib/set-timer-action.ts new file mode 100644 index 0000000000000..3a656bb53de49 --- /dev/null +++ b/packages/@aws-cdk/aws-iotevents-actions/lib/set-timer-action.ts @@ -0,0 +1,32 @@ +import * as iotevents from '@aws-cdk/aws-iotevents'; +import { Construct } from 'constructs'; +import { TimerDuration } from './timer-duration'; + +/** + * The action to create a timer with duration in seconds. + */ +export class SetTimerAction implements iotevents.IAction { + /** + * @param timerName the name of the timer + * @param timerDuration the duration of the timer + */ + constructor( + private readonly timerName: string, + private readonly timerDuration: TimerDuration, + ) { + } + + /** + * @internal + */ + public _bind(_scope: Construct, _options: iotevents.ActionBindOptions): iotevents.ActionConfig { + return { + configuration: { + setTimer: { + timerName: this.timerName, + durationExpression: this.timerDuration._bind(), + }, + }, + }; + } +} diff --git a/packages/@aws-cdk/aws-iotevents-actions/lib/set-variable-action.ts b/packages/@aws-cdk/aws-iotevents-actions/lib/set-variable-action.ts index 1d2596ddb866b..a719d3cc2522a 100644 --- a/packages/@aws-cdk/aws-iotevents-actions/lib/set-variable-action.ts +++ b/packages/@aws-cdk/aws-iotevents-actions/lib/set-variable-action.ts @@ -12,7 +12,10 @@ export class SetVariableAction implements iotevents.IAction { constructor(private readonly variableName: string, private readonly value: iotevents.Expression) { } - bind(_scope: Construct, _options: iotevents.ActionBindOptions): iotevents.ActionConfig { + /** + * @internal + */ + public _bind(_scope: Construct, _options: iotevents.ActionBindOptions): iotevents.ActionConfig { return { configuration: { setVariable: { diff --git a/packages/@aws-cdk/aws-iotevents-actions/lib/timer-duration.ts b/packages/@aws-cdk/aws-iotevents-actions/lib/timer-duration.ts new file mode 100644 index 0000000000000..e9fe41be3c544 --- /dev/null +++ b/packages/@aws-cdk/aws-iotevents-actions/lib/timer-duration.ts @@ -0,0 +1,54 @@ +import * as iotevents from '@aws-cdk/aws-iotevents'; +import { Duration } from '@aws-cdk/core'; + +/** + * The duration of the timer. + */ +export abstract class TimerDuration { + /** + * Create a timer-duration from Duration. + * + * The range of the duration is 60-31622400 seconds. + * The evaluated result of the duration expression is rounded down to the nearest whole number. + * For example, if you set the timer to 60.99 seconds, the evaluated result of the duration expression is 60 seconds. + */ + public static fromDuration(duration: Duration): TimerDuration { + const seconds = duration.toSeconds(); + if (seconds < 60) { + throw new Error(`duration cannot be less than 60 seconds, got: ${duration.toString()}`); + } + if (seconds > 31622400) { + throw new Error(`duration cannot be greater than 31622400 seconds, got: ${duration.toString()}`); + } + return new TimerDurationImpl(seconds.toString()); + } + + /** + * Create a timer-duration from Expression. + * + * You can use a string expression that includes numbers, variables ($variable.), + * and input values ($input..) as the duration. + * + * The range of the duration is 60-31622400 seconds. + * The evaluated result of the duration expression is rounded down to the nearest whole number. + * For example, if you set the timer to 60.99 seconds, the evaluated result of the duration expression is 60 seconds. + */ + public static fromExpression(expression: iotevents.Expression): TimerDuration { + return new TimerDurationImpl(expression.evaluate()); + } + + /** + * @internal + */ + public abstract _bind(): string; +} + +class TimerDurationImpl extends TimerDuration { + constructor(private readonly durationExpression: string) { + super(); + } + + public _bind() { + return this.durationExpression; + } +} diff --git a/packages/@aws-cdk/aws-iotevents-actions/package.json b/packages/@aws-cdk/aws-iotevents-actions/package.json index 8f6edec334e5f..63c6c90ea0e15 100644 --- a/packages/@aws-cdk/aws-iotevents-actions/package.json +++ b/packages/@aws-cdk/aws-iotevents-actions/package.json @@ -73,6 +73,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/pkglint": "0.0.0", "@types/jest": "^27.5.2", "jest": "^27.5.1" diff --git a/packages/@aws-cdk/aws-iotevents-actions/test/iot/clear-timer-action.test.ts b/packages/@aws-cdk/aws-iotevents-actions/test/iot/clear-timer-action.test.ts new file mode 100644 index 0000000000000..1f3d2195633a2 --- /dev/null +++ b/packages/@aws-cdk/aws-iotevents-actions/test/iot/clear-timer-action.test.ts @@ -0,0 +1,44 @@ +import { Template } from '@aws-cdk/assertions'; +import * as iotevents from '@aws-cdk/aws-iotevents'; +import * as cdk from '@aws-cdk/core'; +import * as actions from '../../lib'; + +let stack: cdk.Stack; +let input: iotevents.IInput; +beforeEach(() => { + stack = new cdk.Stack(); + input = iotevents.Input.fromInputName(stack, 'MyInput', 'test-input'); +}); + +test('Default property', () => { + // WHEN + new iotevents.DetectorModel(stack, 'MyDetectorModel', { + initialState: new iotevents.State({ + stateName: 'test-state', + onEnter: [{ + eventName: 'test-eventName', + condition: iotevents.Expression.currentInput(input), + actions: [ + new actions.ClearTimerAction('MyTimer'), + ], + }], + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IoTEvents::DetectorModel', { + DetectorModelDefinition: { + States: [{ + OnEnter: { + Events: [{ + Actions: [{ + ClearTimer: { + TimerName: 'MyTimer', + }, + }], + }], + }, + }], + }, + }); +}); diff --git a/packages/@aws-cdk/aws-iotevents-actions/test/iot/integ.timer-actions.ts b/packages/@aws-cdk/aws-iotevents-actions/test/iot/integ.timer-actions.ts new file mode 100644 index 0000000000000..cdaf780145a25 --- /dev/null +++ b/packages/@aws-cdk/aws-iotevents-actions/test/iot/integ.timer-actions.ts @@ -0,0 +1,64 @@ +/** + * Stack verification steps: + * * put a message + * * aws iotevents-data batch-put-message --region=us-east-1 --messages=messageId=(date | md5),inputName=test_input,payload=(echo '{"payload":{"deviceId":"000"}}' | base64) + */ +import * as iotevents from '@aws-cdk/aws-iotevents'; +import * as cdk from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; +import * as actions from '../../lib'; + +/** + * This example will creates the detector model for Device HeartBeat Monitoring. + * + * @see https://docs.aws.amazon.com/iotevents/latest/developerguide/iotevents-examples-dhb.html + */ +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + const input = new iotevents.Input(this, 'MyInput', { + inputName: 'test_input', + attributeJsonPaths: ['payload.deviceId'], + }); + + const online = new iotevents.State({ + stateName: 'Online', + onEnter: [{ + eventName: 'enter-event', + condition: iotevents.Expression.currentInput(input), + actions: [ + new actions.SetTimerAction('MyTimer', actions.TimerDuration.fromDuration(cdk.Duration.seconds(60))), + ], + }], + onInput: [{ + eventName: 'input-event', + condition: iotevents.Expression.currentInput(input), + actions: [ + new actions.ResetTimerAction('MyTimer'), + ], + }], + onExit: [{ + eventName: 'exit-event', + actions: [ + new actions.ClearTimerAction('MyTimer'), + ], + }], + }); + const offline = new iotevents.State({ stateName: 'Offline' }); + + online.transitionTo(offline, { when: iotevents.Expression.timeout('MyTimer') }); + offline.transitionTo(online, { when: iotevents.Expression.currentInput(input) }); + + new iotevents.DetectorModel(this, 'MyDetectorModel', { + detectorKey: 'payload.deviceId', + initialState: online, + }); + } +} + +// GIVEN +const app = new cdk.App(); +const stack = new TestStack(app, 'iotevents-timer-actions-test-stack'); +new IntegTest(app, 'TimerActions', { testCases: [stack] }); +app.synth(); diff --git a/packages/@aws-cdk/aws-iotevents-actions/test/iot/reset-timer-action.test.ts b/packages/@aws-cdk/aws-iotevents-actions/test/iot/reset-timer-action.test.ts new file mode 100644 index 0000000000000..40c9ff5e7e91a --- /dev/null +++ b/packages/@aws-cdk/aws-iotevents-actions/test/iot/reset-timer-action.test.ts @@ -0,0 +1,44 @@ +import { Template } from '@aws-cdk/assertions'; +import * as iotevents from '@aws-cdk/aws-iotevents'; +import * as cdk from '@aws-cdk/core'; +import * as actions from '../../lib'; + +let stack: cdk.Stack; +let input: iotevents.IInput; +beforeEach(() => { + stack = new cdk.Stack(); + input = iotevents.Input.fromInputName(stack, 'MyInput', 'test-input'); +}); + +test('Default property', () => { + // WHEN + new iotevents.DetectorModel(stack, 'MyDetectorModel', { + initialState: new iotevents.State({ + stateName: 'test-state', + onEnter: [{ + eventName: 'test-eventName', + condition: iotevents.Expression.currentInput(input), + actions: [ + new actions.ResetTimerAction('MyTimer'), + ], + }], + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IoTEvents::DetectorModel', { + DetectorModelDefinition: { + States: [{ + OnEnter: { + Events: [{ + Actions: [{ + ResetTimer: { + TimerName: 'MyTimer', + }, + }], + }], + }, + }], + }, + }); +}); diff --git a/packages/@aws-cdk/aws-iotevents-actions/test/iot/set-timer-action.test.ts b/packages/@aws-cdk/aws-iotevents-actions/test/iot/set-timer-action.test.ts new file mode 100644 index 0000000000000..5f2653c620222 --- /dev/null +++ b/packages/@aws-cdk/aws-iotevents-actions/test/iot/set-timer-action.test.ts @@ -0,0 +1,57 @@ +import { Template } from '@aws-cdk/assertions'; +import * as iotevents from '@aws-cdk/aws-iotevents'; +import * as cdk from '@aws-cdk/core'; +import * as actions from '../../lib'; + +let stack: cdk.Stack; +let input: iotevents.IInput; +beforeEach(() => { + stack = new cdk.Stack(); + input = iotevents.Input.fromInputName(stack, 'MyInput', 'test-input'); +}); + +test.each([ + ['Can set duration', actions.TimerDuration.fromDuration(cdk.Duration.minutes(2)), '120'], + ['Can set durationExpression', actions.TimerDuration.fromExpression(iotevents.Expression.fromString('test-expression')), 'test-expression'], +])('%s', (_, durationOption, durationExpression) => { + // WHEN + new iotevents.DetectorModel(stack, 'MyDetectorModel', { + initialState: new iotevents.State({ + stateName: 'test-state', + onEnter: [{ + eventName: 'test-eventName', + condition: iotevents.Expression.currentInput(input), + actions: [ + new actions.SetTimerAction('MyTimer', durationOption), + ], + }], + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IoTEvents::DetectorModel', { + DetectorModelDefinition: { + States: [{ + OnEnter: { + Events: [{ + Actions: [{ + SetTimer: { + TimerName: 'MyTimer', + DurationExpression: durationExpression, + }, + }], + }], + }, + }], + }, + }); +}); + +test.each([ + ['duration less than 60 seconds', cdk.Duration.seconds(59), 'duration cannot be less than 60 seconds, got: Duration.seconds(59)'], + ['duration greater than 31622400 seconds', cdk.Duration.seconds(31622401), 'duration cannot be greater than 31622400 seconds, got: Duration.seconds(31622401)'], +])('Cannot set %', (_, duration, errorMessage) => { + expect(() => { + actions.TimerDuration.fromDuration(duration); + }).toThrow(errorMessage); +}); diff --git a/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/TimerActionsDefaultTestDeployAssert89D9000B.template.json b/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/TimerActionsDefaultTestDeployAssert89D9000B.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/TimerActionsDefaultTestDeployAssert89D9000B.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/cdk.out new file mode 100644 index 0000000000000..588d7b269d34f --- /dev/null +++ b/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/integ.json b/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/integ.json new file mode 100644 index 0000000000000..be3cb597b0fe5 --- /dev/null +++ b/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/integ.json @@ -0,0 +1,11 @@ +{ + "version": "20.0.0", + "testCases": { + "TimerActions/DefaultTest": { + "stacks": [ + "iotevents-timer-actions-test-stack" + ], + "assertionStack": "TimerActionsDefaultTestDeployAssert89D9000B" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/iotevents-timer-actions-test-stack.assets.json b/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/iotevents-timer-actions-test-stack.assets.json new file mode 100644 index 0000000000000..69a4b6590cf96 --- /dev/null +++ b/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/iotevents-timer-actions-test-stack.assets.json @@ -0,0 +1,19 @@ +{ + "version": "20.0.0", + "files": { + "2e8c935c8b92198714514946548737d7e2ec921f7635995c80095bcb79441bea": { + "source": { + "path": "iotevents-timer-actions-test-stack.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "2e8c935c8b92198714514946548737d7e2ec921f7635995c80095bcb79441bea.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-iotevents-actions/test/iot/timer-actions.integ.snapshot/iotevents-timer-actions-test-stack.template.json b/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/iotevents-timer-actions-test-stack.template.json new file mode 100644 index 0000000000000..cf78b96310b13 --- /dev/null +++ b/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/iotevents-timer-actions-test-stack.template.json @@ -0,0 +1,151 @@ +{ + "Resources": { + "MyInput08947B23": { + "Type": "AWS::IoTEvents::Input", + "Properties": { + "InputDefinition": { + "Attributes": [ + { + "JsonPath": "payload.deviceId" + } + ] + }, + "InputName": "test_input" + } + }, + "MyDetectorModelDetectorModelRoleF2FB4D88": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "iotevents.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "MyDetectorModel559C0B0E": { + "Type": "AWS::IoTEvents::DetectorModel", + "Properties": { + "DetectorModelDefinition": { + "InitialStateName": "Online", + "States": [ + { + "OnEnter": { + "Events": [ + { + "Actions": [ + { + "SetTimer": { + "DurationExpression": "60", + "TimerName": "MyTimer" + } + } + ], + "Condition": { + "Fn::Join": [ + "", + [ + "currentInput(\"", + { + "Ref": "MyInput08947B23" + }, + "\")" + ] + ] + }, + "EventName": "enter-event" + } + ] + }, + "OnExit": { + "Events": [ + { + "Actions": [ + { + "ClearTimer": { + "TimerName": "MyTimer" + } + } + ], + "EventName": "exit-event" + } + ] + }, + "OnInput": { + "Events": [ + { + "Actions": [ + { + "ResetTimer": { + "TimerName": "MyTimer" + } + } + ], + "Condition": { + "Fn::Join": [ + "", + [ + "currentInput(\"", + { + "Ref": "MyInput08947B23" + }, + "\")" + ] + ] + }, + "EventName": "input-event" + } + ], + "TransitionEvents": [ + { + "Condition": "timeout(\"MyTimer\")", + "EventName": "Online_to_Offline", + "NextState": "Offline" + } + ] + }, + "StateName": "Online" + }, + { + "OnInput": { + "TransitionEvents": [ + { + "Condition": { + "Fn::Join": [ + "", + [ + "currentInput(\"", + { + "Ref": "MyInput08947B23" + }, + "\")" + ] + ] + }, + "EventName": "Offline_to_Online", + "NextState": "Online" + } + ] + }, + "StateName": "Offline" + } + ] + }, + "RoleArn": { + "Fn::GetAtt": [ + "MyDetectorModelDetectorModelRoleF2FB4D88", + "Arn" + ] + }, + "Key": "payload.deviceId" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/manifest.json new file mode 100644 index 0000000000000..e8f8b1d56f962 --- /dev/null +++ b/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/manifest.json @@ -0,0 +1,49 @@ +{ + "version": "20.0.0", + "artifacts": { + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + }, + "iotevents-timer-actions-test-stack": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "iotevents-timer-actions-test-stack.template.json", + "validateOnSynth": false + }, + "metadata": { + "/iotevents-timer-actions-test-stack/MyInput/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyInput08947B23" + } + ], + "/iotevents-timer-actions-test-stack/MyDetectorModel/DetectorModelRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyDetectorModelDetectorModelRoleF2FB4D88" + } + ], + "/iotevents-timer-actions-test-stack/MyDetectorModel/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyDetectorModel559C0B0E" + } + ] + }, + "displayName": "iotevents-timer-actions-test-stack" + }, + "TimerActionsDefaultTestDeployAssert89D9000B": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "TimerActionsDefaultTestDeployAssert89D9000B.template.json", + "validateOnSynth": false + }, + "displayName": "TimerActions/DefaultTest/DeployAssert" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/tree.json b/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/tree.json new file mode 100644 index 0000000000000..f60b628102a08 --- /dev/null +++ b/packages/@aws-cdk/aws-iotevents-actions/test/iot/timer-actions.integ.snapshot/tree.json @@ -0,0 +1,268 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.58" + } + }, + "iotevents-timer-actions-test-stack": { + "id": "iotevents-timer-actions-test-stack", + "path": "iotevents-timer-actions-test-stack", + "children": { + "MyInput": { + "id": "MyInput", + "path": "iotevents-timer-actions-test-stack/MyInput", + "children": { + "Resource": { + "id": "Resource", + "path": "iotevents-timer-actions-test-stack/MyInput/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IoTEvents::Input", + "aws:cdk:cloudformation:props": { + "inputDefinition": { + "attributes": [ + { + "jsonPath": "payload.deviceId" + } + ] + }, + "inputName": "test_input" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iotevents.CfnInput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iotevents.Input", + "version": "0.0.0" + } + }, + "MyDetectorModel": { + "id": "MyDetectorModel", + "path": "iotevents-timer-actions-test-stack/MyDetectorModel", + "children": { + "DetectorModelRole": { + "id": "DetectorModelRole", + "path": "iotevents-timer-actions-test-stack/MyDetectorModel/DetectorModelRole", + "children": { + "Resource": { + "id": "Resource", + "path": "iotevents-timer-actions-test-stack/MyDetectorModel/DetectorModelRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "iotevents.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "iotevents-timer-actions-test-stack/MyDetectorModel/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IoTEvents::DetectorModel", + "aws:cdk:cloudformation:props": { + "detectorModelDefinition": { + "initialStateName": "Online", + "states": [ + { + "stateName": "Online", + "onEnter": { + "events": [ + { + "eventName": "enter-event", + "condition": { + "Fn::Join": [ + "", + [ + "currentInput(\"", + { + "Ref": "MyInput08947B23" + }, + "\")" + ] + ] + }, + "actions": [ + { + "setTimer": { + "timerName": "MyTimer", + "durationExpression": "60" + } + } + ] + } + ] + }, + "onInput": { + "events": [ + { + "eventName": "input-event", + "condition": { + "Fn::Join": [ + "", + [ + "currentInput(\"", + { + "Ref": "MyInput08947B23" + }, + "\")" + ] + ] + }, + "actions": [ + { + "resetTimer": { + "timerName": "MyTimer" + } + } + ] + } + ], + "transitionEvents": [ + { + "eventName": "Online_to_Offline", + "condition": "timeout(\"MyTimer\")", + "nextState": "Offline" + } + ] + }, + "onExit": { + "events": [ + { + "eventName": "exit-event", + "actions": [ + { + "clearTimer": { + "timerName": "MyTimer" + } + } + ] + } + ] + } + }, + { + "stateName": "Offline", + "onInput": { + "transitionEvents": [ + { + "eventName": "Offline_to_Online", + "condition": { + "Fn::Join": [ + "", + [ + "currentInput(\"", + { + "Ref": "MyInput08947B23" + }, + "\")" + ] + ] + }, + "nextState": "Online" + } + ] + } + } + ] + }, + "roleArn": { + "Fn::GetAtt": [ + "MyDetectorModelDetectorModelRoleF2FB4D88", + "Arn" + ] + }, + "key": "payload.deviceId" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iotevents.CfnDetectorModel", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iotevents.DetectorModel", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + }, + "TimerActions": { + "id": "TimerActions", + "path": "TimerActions", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "TimerActions/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "TimerActions/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.58" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "TimerActions/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-iotevents/lib/action.ts b/packages/@aws-cdk/aws-iotevents/lib/action.ts index f43c6b6c91626..0f5a1c1fac105 100644 --- a/packages/@aws-cdk/aws-iotevents/lib/action.ts +++ b/packages/@aws-cdk/aws-iotevents/lib/action.ts @@ -18,8 +18,9 @@ export interface ActionBindOptions { export interface IAction { /** * Returns the AWS IoT Events action specification. + * @internal */ - bind(scope: Construct, options: ActionBindOptions): ActionConfig; + _bind(scope: Construct, options: ActionBindOptions): ActionConfig; } /** diff --git a/packages/@aws-cdk/aws-iotevents/lib/expression.ts b/packages/@aws-cdk/aws-iotevents/lib/expression.ts index 8ad98de5d5496..925fd6a7201f5 100644 --- a/packages/@aws-cdk/aws-iotevents/lib/expression.ts +++ b/packages/@aws-cdk/aws-iotevents/lib/expression.ts @@ -20,6 +20,15 @@ export abstract class Expression { return this.fromString(`currentInput("${input.inputName}")`); } + /** + * Create a expression for function `timeout("timer-name")`. + * It is evaluated to true if the specified timer has elapsed. + * You can define a timer only using the `setTimer` action. + */ + public static timeout(timerName: string): Expression { + return this.fromString(`timeout("${timerName}")`); + } + /** * Create a expression for get an input attribute as `$input.TemperatureInput.temperatures[2]`. */ diff --git a/packages/@aws-cdk/aws-iotevents/lib/state.ts b/packages/@aws-cdk/aws-iotevents/lib/state.ts index ef8ce689fec47..221a2cf032bb9 100644 --- a/packages/@aws-cdk/aws-iotevents/lib/state.ts +++ b/packages/@aws-cdk/aws-iotevents/lib/state.ts @@ -182,7 +182,7 @@ function toEventsJson( return events?.map(event => ({ eventName: event.eventName, condition: event.condition?.evaluate(), - actions: event.actions?.map(action => action.bind(scope, actionBindOptions).configuration), + actions: event.actions?.map(action => action._bind(scope, actionBindOptions).configuration), })); } @@ -198,7 +198,7 @@ function toTransitionEventsJson( return transitionEvents.map(transitionEvent => ({ eventName: transitionEvent.eventName, condition: transitionEvent.condition.evaluate(), - actions: transitionEvent.actions?.map(action => action.bind(scope, actionBindOptions).configuration), + actions: transitionEvent.actions?.map(action => action._bind(scope, actionBindOptions).configuration), nextState: transitionEvent.nextState.stateName, })); } diff --git a/packages/@aws-cdk/aws-iotevents/package.json b/packages/@aws-cdk/aws-iotevents/package.json index ad246d85bc882..35327daf2534c 100644 --- a/packages/@aws-cdk/aws-iotevents/package.json +++ b/packages/@aws-cdk/aws-iotevents/package.json @@ -103,6 +103,12 @@ "engines": { "node": ">= 14.15.0" }, + "awslint": { + "exclude": [ + "no-unused-type:@aws-cdk/aws-iotevents.ActionBindOptions", + "no-unused-type:@aws-cdk/aws-iotevents.ActionConfig" + ] + }, "stability": "experimental", "maturity": "experimental", "awscdkio": { diff --git a/packages/@aws-cdk/aws-iotevents/test/detector-model.test.ts b/packages/@aws-cdk/aws-iotevents/test/detector-model.test.ts index 2b485648059bd..dcfdc7e8f15d6 100644 --- a/packages/@aws-cdk/aws-iotevents/test/detector-model.test.ts +++ b/packages/@aws-cdk/aws-iotevents/test/detector-model.test.ts @@ -148,7 +148,7 @@ test('can set actions to events', () => { eventName: 'test-eventName1', condition: iotevents.Expression.currentInput(input), actions: [{ - bind: () => ({ + _bind: () => ({ configuration: { lambda: { functionArn: 'arn:aws:lambda:us-east-1:123456789012:function:MyFn', @@ -200,7 +200,7 @@ test.each([ test('can set an action to multiple detector models', () => { // GIVEN an action const action: iotevents.IAction = { - bind: (_, { role }) => { + _bind: (_, { role }) => { role.addToPrincipalPolicy(new iam.PolicyStatement({ actions: ['lambda:InvokeFunction'], resources: ['arn:aws:lambda:us-east-1:123456789012:function:MyFn'], @@ -393,7 +393,7 @@ test('can set actions to transitions', () => { iotevents.Expression.inputAttribute(input, 'payload.temperature'), iotevents.Expression.fromString('12'), ), - executing: [{ bind: () => ({ configuration: { setTimer: { timerName: 'test-timer' } } }) }], + executing: [{ _bind: () => ({ configuration: { setTimer: { timerName: 'test-timer' } } }) }], }); new iotevents.DetectorModel(stack, 'MyDetectorModel', { @@ -501,6 +501,7 @@ describe('Expression', () => { const E = iotevents.Expression; test.each([ ['currentInput', (testInput: iotevents.IInput) => E.currentInput(testInput), 'currentInput("test-input")'], + ['timeout', () => E.timeout('test-timer'), 'timeout("test-timer")'], ['inputAttribute', (testInput: iotevents.IInput) => E.inputAttribute(testInput, 'json.path'), '$input.test-input.json.path'], ['add', () => E.add(E.fromString('5'), E.fromString('2')), '5 + 2'], ['subtract', () => E.subtract(E.fromString('5'), E.fromString('2')), '5 - 2'], diff --git a/packages/@aws-cdk/aws-lambda-nodejs/package.json b/packages/@aws-cdk/aws-lambda-nodejs/package.json index e7ae81028fd47..265fce21bf6fe 100644 --- a/packages/@aws-cdk/aws-lambda-nodejs/package.json +++ b/packages/@aws-cdk/aws-lambda-nodejs/package.json @@ -79,7 +79,7 @@ "@aws-cdk/pkglint": "0.0.0", "@types/jest": "^27.5.2", "delay": "5.0.0", - "esbuild": "^0.14.51" + "esbuild": "^0.14.53" }, "dependencies": { "@aws-cdk/aws-lambda": "0.0.0", diff --git a/packages/@aws-cdk/aws-lambda/README.md b/packages/@aws-cdk/aws-lambda/README.md index dc40e77e1363d..f12afc0c3d809 100644 --- a/packages/@aws-cdk/aws-lambda/README.md +++ b/packages/@aws-cdk/aws-lambda/README.md @@ -81,6 +81,16 @@ new lambda.DockerImageFunction(this, 'ECRFunction', { The props for these docker image resources allow overriding the image's `CMD`, `ENTRYPOINT`, and `WORKDIR` configurations as well as choosing a specific tag or digest. See their docs for more information. +To deploy a `DockerImageFunction` on Lambda `arm64` architecture, specify `Architecture.ARM_64` in `architecture`. +This will bundle docker image assets for `arm64` architecture with `--platform linux/arm64` even if build within an `x86_64` host. + +```ts +new DockerImageFunction(this, 'AssetFunction', { + code: DockerImageCode.fromImageAsset(path.join(__dirname, 'docker-arm64-handler')), + architecture: Architecture.ARM_64, +}); +``` + ## Execution Role Lambda functions assume an IAM role during execution. In CDK by default, Lambda diff --git a/packages/@aws-cdk/aws-lambda/lib/function.ts b/packages/@aws-cdk/aws-lambda/lib/function.ts index 9c142eb4da0c8..2f14b31b3b9d2 100644 --- a/packages/@aws-cdk/aws-lambda/lib/function.ts +++ b/packages/@aws-cdk/aws-lambda/lib/function.ts @@ -1094,7 +1094,12 @@ Environment variables can be marked for removal when used in Lambda@Edge by sett throw new Error('Cannot configure \'securityGroup\' or \'allowAllOutbound\' without configuring a VPC'); } - if (!props.vpc) { return undefined; } + if (!props.vpc) { + if (props.vpcSubnets) { + throw new Error('Cannot configure \'vpcSubnets\' without configuring a VPC'); + } + return undefined; + } if (props.securityGroup && props.allowAllOutbound !== undefined) { throw new Error('Configure \'allowAllOutbound\' directly on the supplied SecurityGroup.'); diff --git a/packages/@aws-cdk/aws-lambda/lib/image-function.ts b/packages/@aws-cdk/aws-lambda/lib/image-function.ts index a53f303c88b78..5000bae85e2c2 100644 --- a/packages/@aws-cdk/aws-lambda/lib/image-function.ts +++ b/packages/@aws-cdk/aws-lambda/lib/image-function.ts @@ -1,5 +1,7 @@ import * as ecr from '@aws-cdk/aws-ecr'; +import { Platform } from '@aws-cdk/aws-ecr-assets'; import { Construct } from 'constructs'; +import { Architecture } from './architecture'; import { AssetImageCode, AssetImageCodeProps, EcrImageCode, EcrImageCodeProps, Code } from './code'; import { Function, FunctionOptions } from './function'; import { Handler } from './handler'; @@ -41,8 +43,12 @@ export abstract class DockerImageCode { */ public static fromImageAsset(directory: string, props: AssetImageCodeProps = {}): DockerImageCode { return { - _bind() { - return new AssetImageCode(directory, props); + _bind(architecture?: Architecture) { + return new AssetImageCode(directory, { + // determine the platform from `architecture`. + ...architecture?.dockerPlatform ? { platform: Platform.custom(architecture.dockerPlatform) } : {}, + ...props, + }); }, }; } @@ -51,7 +57,7 @@ export abstract class DockerImageCode { * Produce a `Code` instance from this `DockerImageCode`. * @internal */ - public abstract _bind(): Code; + public abstract _bind(architecture?: Architecture): Code; } /** @@ -63,7 +69,7 @@ export class DockerImageFunction extends Function { ...props, handler: Handler.FROM_IMAGE, runtime: Runtime.FROM_IMAGE, - code: props.code._bind(), + code: props.code._bind(props.architecture), }); } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/docker-arm64-handler/Dockerfile b/packages/@aws-cdk/aws-lambda/test/docker-arm64-handler/Dockerfile new file mode 100644 index 0000000000000..3da16ef980217 --- /dev/null +++ b/packages/@aws-cdk/aws-lambda/test/docker-arm64-handler/Dockerfile @@ -0,0 +1,6 @@ +FROM public.ecr.aws/lambda/python:latest + +ARG FUNCTION_DIR="/var/task" +COPY index.py ${FUNCTION_DIR} + +CMD [ "index.handler" ] \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/docker-arm64-handler/index.py b/packages/@aws-cdk/aws-lambda/test/docker-arm64-handler/index.py new file mode 100644 index 0000000000000..fe4f05995f6bd --- /dev/null +++ b/packages/@aws-cdk/aws-lambda/test/docker-arm64-handler/index.py @@ -0,0 +1,6 @@ +import json, platform +def handler(event, context): + return { + 'statusCode': 200, + 'body': json.dumps( f'Hello CDK from Lambda({platform.platform()})!') + } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.ts b/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.ts new file mode 100644 index 0000000000000..b567e9b5733fc --- /dev/null +++ b/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.ts @@ -0,0 +1,19 @@ +import * as path from 'path'; +import { App, Stack } from '@aws-cdk/core'; +import * as integ from '@aws-cdk/integ-tests'; +import { Architecture, DockerImageCode, DockerImageFunction } from '../lib'; + +const app = new App(); + +const stack = new Stack(app, 'lambda-ecr-docker-arm64'); + +new DockerImageFunction(stack, 'MyLambda', { + code: DockerImageCode.fromImageAsset(path.join(__dirname, 'docker-arm64-handler')), + architecture: Architecture.ARM_64, +}); + +new integ.IntegTest(app, 'lambda-docker-arm64', { + testCases: [stack], +}); + +app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/lambda-platform.test.ts b/packages/@aws-cdk/aws-lambda/test/lambda-platform.test.ts new file mode 100644 index 0000000000000..1b38bd7ea2c8a --- /dev/null +++ b/packages/@aws-cdk/aws-lambda/test/lambda-platform.test.ts @@ -0,0 +1,44 @@ +import * as path from 'path'; +import { Template } from '@aws-cdk/assertions'; +import * as cdk from '@aws-cdk/core'; +import { Architecture, DockerImageCode, DockerImageFunction } from '../lib'; + +describe('lambda platform', () => { + test('can choose lambda architecture arm64', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'stack'); + + // WHEN + new DockerImageFunction(stack, 'Lambda', { + code: DockerImageCode.fromImageAsset(path.join(__dirname, 'docker-arm64-handler')), + architecture: Architecture.ARM_64, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Architectures: [ + 'arm64', + ], + }); + }); + + test('can choose lambda architecture x86_64', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'stack'); + + // WHEN + new DockerImageFunction(stack, 'Lambda', { + code: DockerImageCode.fromImageAsset(path.join(__dirname, 'docker-arm64-handler')), + architecture: Architecture.X86_64, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Architectures: [ + 'x86_64', + ], + }); + }); +}); diff --git a/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/cdk.out new file mode 100644 index 0000000000000..588d7b269d34f --- /dev/null +++ b/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/integ.json b/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/integ.json new file mode 100644 index 0000000000000..73b08e0ca0c6f --- /dev/null +++ b/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/integ.json @@ -0,0 +1,11 @@ +{ + "version": "20.0.0", + "testCases": { + "lambda-docker-arm64/DefaultTest": { + "stacks": [ + "lambda-ecr-docker-arm64" + ], + "assertionStack": "lambdadockerarm64DefaultTestDeployAssert07D408EF" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/integ.lambda.docker-arm64.expected.json b/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/integ.lambda.docker-arm64.expected.json new file mode 100644 index 0000000000000..448d6b6011df9 --- /dev/null +++ b/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/integ.lambda.docker-arm64.expected.json @@ -0,0 +1,74 @@ +{ + "Resources": { + "MyLambdaServiceRole4539ECB6": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "MyLambdaCCE802FB": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ImageUri": { + "Fn::Join": [ + "", + [ + { + "Ref": "AWS::AccountId" + }, + ".dkr.ecr.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/aws-cdk/assets:166017f6f6f219800dee266c149e208fe18dea1788d822b1783afbc008c25db7" + ] + ] + } + }, + "Role": { + "Fn::GetAtt": [ + "MyLambdaServiceRole4539ECB6", + "Arn" + ] + }, + "Architectures": [ + "arm64" + ], + "PackageType": "Image" + }, + "DependsOn": [ + "MyLambdaServiceRole4539ECB6" + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/lambda-ecr-docker-arm64.assets.json b/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/lambda-ecr-docker-arm64.assets.json new file mode 100644 index 0000000000000..723719a1247a6 --- /dev/null +++ b/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/lambda-ecr-docker-arm64.assets.json @@ -0,0 +1,33 @@ +{ + "version": "20.0.0", + "files": { + "e57a612d901fd500f4eae1beabe146b3d7a4f81dd10a81199b9c884d1e227a1e": { + "source": { + "path": "lambda-ecr-docker-arm64.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "e57a612d901fd500f4eae1beabe146b3d7a4f81dd10a81199b9c884d1e227a1e.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": { + "027b9b499ce9e488d4c3cfa41abdbdc6afe203989a5bd77258f471da03f3f040": { + "source": { + "directory": "asset.027b9b499ce9e488d4c3cfa41abdbdc6afe203989a5bd77258f471da03f3f040", + "platform": "linux/arm64" + }, + "destinations": { + "current_account-current_region": { + "repositoryName": "cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}", + "imageTag": "027b9b499ce9e488d4c3cfa41abdbdc6afe203989a5bd77258f471da03f3f040", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-image-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/lambda-ecr-docker-arm64.template.json b/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/lambda-ecr-docker-arm64.template.json new file mode 100644 index 0000000000000..20f5a2745bf18 --- /dev/null +++ b/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/lambda-ecr-docker-arm64.template.json @@ -0,0 +1,74 @@ +{ + "Resources": { + "MyLambdaServiceRole4539ECB6": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "MyLambdaCCE802FB": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ImageUri": { + "Fn::Join": [ + "", + [ + { + "Ref": "AWS::AccountId" + }, + ".dkr.ecr.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/aws-cdk/assets:027b9b499ce9e488d4c3cfa41abdbdc6afe203989a5bd77258f471da03f3f040" + ] + ] + } + }, + "Role": { + "Fn::GetAtt": [ + "MyLambdaServiceRole4539ECB6", + "Arn" + ] + }, + "Architectures": [ + "arm64" + ], + "PackageType": "Image" + }, + "DependsOn": [ + "MyLambdaServiceRole4539ECB6" + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/lambdadockerarm64DefaultTestDeployAssert07D408EF.template.json b/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/lambdadockerarm64DefaultTestDeployAssert07D408EF.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/lambdadockerarm64DefaultTestDeployAssert07D408EF.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/manifest.json new file mode 100644 index 0000000000000..a910ee19ed94c --- /dev/null +++ b/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/manifest.json @@ -0,0 +1,57 @@ +{ + "version": "20.0.0", + "artifacts": { + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + }, + "lambda-ecr-docker-arm64": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "lambda-ecr-docker-arm64.template.json", + "validateOnSynth": false + }, + "metadata": { + "/lambda-ecr-docker-arm64": [ + { + "type": "aws:cdk:asset", + "data": { + "repositoryName": "aws-cdk/assets", + "imageTag": "027b9b499ce9e488d4c3cfa41abdbdc6afe203989a5bd77258f471da03f3f040", + "id": "027b9b499ce9e488d4c3cfa41abdbdc6afe203989a5bd77258f471da03f3f040", + "packaging": "container-image", + "path": "asset.027b9b499ce9e488d4c3cfa41abdbdc6afe203989a5bd77258f471da03f3f040", + "sourceHash": "027b9b499ce9e488d4c3cfa41abdbdc6afe203989a5bd77258f471da03f3f040", + "platform": "linux/arm64" + } + } + ], + "/lambda-ecr-docker-arm64/MyLambda/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyLambdaServiceRole4539ECB6" + } + ], + "/lambda-ecr-docker-arm64/MyLambda/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyLambdaCCE802FB" + } + ] + }, + "displayName": "lambda-ecr-docker-arm64" + }, + "lambdadockerarm64DefaultTestDeployAssert07D408EF": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "lambdadockerarm64DefaultTestDeployAssert07D408EF.template.json", + "validateOnSynth": false + }, + "displayName": "lambda-docker-arm64/DefaultTest/DeployAssert" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/tree.json b/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/tree.json new file mode 100644 index 0000000000000..a01ab92a26150 --- /dev/null +++ b/packages/@aws-cdk/aws-lambda/test/lambda.docker-arm64.integ.snapshot/tree.json @@ -0,0 +1,196 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.58" + } + }, + "lambda-ecr-docker-arm64": { + "id": "lambda-ecr-docker-arm64", + "path": "lambda-ecr-docker-arm64", + "children": { + "MyLambda": { + "id": "MyLambda", + "path": "lambda-ecr-docker-arm64/MyLambda", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "lambda-ecr-docker-arm64/MyLambda/ServiceRole", + "children": { + "Resource": { + "id": "Resource", + "path": "lambda-ecr-docker-arm64/MyLambda/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Role", + "version": "0.0.0" + } + }, + "AssetImage": { + "id": "AssetImage", + "path": "lambda-ecr-docker-arm64/MyLambda/AssetImage", + "children": { + "Staging": { + "id": "Staging", + "path": "lambda-ecr-docker-arm64/MyLambda/AssetImage/Staging", + "constructInfo": { + "fqn": "@aws-cdk/core.AssetStaging", + "version": "0.0.0" + } + }, + "Repository": { + "id": "Repository", + "path": "lambda-ecr-docker-arm64/MyLambda/AssetImage/Repository", + "constructInfo": { + "fqn": "@aws-cdk/aws-ecr.RepositoryBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ecr-assets.DockerImageAsset", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "lambda-ecr-docker-arm64/MyLambda/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "imageUri": { + "Fn::Join": [ + "", + [ + { + "Ref": "AWS::AccountId" + }, + ".dkr.ecr.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/aws-cdk/assets:027b9b499ce9e488d4c3cfa41abdbdc6afe203989a5bd77258f471da03f3f040" + ] + ] + } + }, + "role": { + "Fn::GetAtt": [ + "MyLambdaServiceRole4539ECB6", + "Arn" + ] + }, + "architectures": [ + "arm64" + ], + "packageType": "Image" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.CfnFunction", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.DockerImageFunction", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + }, + "lambda-docker-arm64": { + "id": "lambda-docker-arm64", + "path": "lambda-docker-arm64", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "lambda-docker-arm64/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "lambda-docker-arm64/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.58" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "lambda-docker-arm64/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-lambda/test/vpc-lambda.test.ts b/packages/@aws-cdk/aws-lambda/test/vpc-lambda.test.ts index f1811b59e8f03..bdb742462194c 100644 --- a/packages/@aws-cdk/aws-lambda/test/vpc-lambda.test.ts +++ b/packages/@aws-cdk/aws-lambda/test/vpc-lambda.test.ts @@ -323,6 +323,21 @@ describe('lambda + vpc', () => { }); }).toThrow(/Lambda Functions in a public subnet/); }); + + test('specifying vpcSubnets without a vpc throws an Error', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + expect(() => { + new lambda.Function(stack, 'Function', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE }, + }); + }).toThrow('Cannot configure \'vpcSubnets\' without configuring a VPC'); + }); }); class SomethingConnectable implements ec2.IConnectable { diff --git a/packages/@aws-cdk/aws-opensearchservice/README.md b/packages/@aws-cdk/aws-opensearchservice/README.md index 65cf275025354..04153b1fc7a48 100644 --- a/packages/@aws-cdk/aws-opensearchservice/README.md +++ b/packages/@aws-cdk/aws-opensearchservice/README.md @@ -31,16 +31,16 @@ See [Migrating to OpenSearch](https://docs.aws.amazon.com/cdk/api/latest/docs/aw Create a development cluster by simply specifying the version: ```ts -const devDomain = new opensearch.Domain(this, 'Domain', { - version: opensearch.EngineVersion.OPENSEARCH_1_0, +const devDomain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, }); ``` To perform version upgrades without replacing the entire domain, specify the `enableVersionUpgrade` property. ```ts -const devDomain = new opensearch.Domain(this, 'Domain', { - version: opensearch.EngineVersion.OPENSEARCH_1_0, +const devDomain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, enableVersionUpgrade: true, // defaults to false }); ``` @@ -48,8 +48,8 @@ const devDomain = new opensearch.Domain(this, 'Domain', { Create a production grade cluster by also specifying things like capacity and az distribution ```ts -const prodDomain = new opensearch.Domain(this, 'Domain', { - version: opensearch.EngineVersion.OPENSEARCH_1_0, +const prodDomain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, capacity: { masterNodes: 5, dataNodes: 20, @@ -104,7 +104,7 @@ This method accepts a domain endpoint of an already existing domain: ```ts const domainEndpoint = 'https://my-domain-jcjotrt6f7otem4sqcwbch3c4u.us-east-1.es.amazonaws.com'; -const domain = opensearch.Domain.fromDomainEndpoint(this, 'ImportedDomain', domainEndpoint); +const domain = Domain.fromDomainEndpoint(this, 'ImportedDomain', domainEndpoint); ``` ### Using the output of another CloudFormation stack @@ -129,7 +129,7 @@ Helper methods also exist for managing access to the domain. ```ts declare const fn: lambda.Function; -declare const domain: opensearch.Domain; +declare const domain: Domain; // Grant write access to the app-search index domain.grantIndexWrite('app-search', fn); @@ -143,8 +143,8 @@ domain.grantPathRead('app-search/_search', fn); The domain can also be created with encryption enabled: ```ts -const domain = new opensearch.Domain(this, 'Domain', { - version: opensearch.EngineVersion.OPENSEARCH_1_0, +const domain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, ebs: { volumeSize: 100, volumeType: ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD, @@ -168,8 +168,8 @@ Domains can be placed inside a VPC, providing a secure communication between Ama ```ts const vpc = new ec2.Vpc(this, 'Vpc'); -const domainProps: opensearch.DomainProps = { - version: opensearch.EngineVersion.OPENSEARCH_1_0, +const domainProps: DomainProps = { + version: EngineVersion.OPENSEARCH_1_0, removalPolicy: RemovalPolicy.DESTROY, vpc, // must be enabled since our VPC contains multiple private subnets. @@ -181,7 +181,7 @@ const domainProps: opensearch.DomainProps = { dataNodes: 2, }, }; -new opensearch.Domain(this, 'Domain', domainProps); +new Domain(this, 'Domain', domainProps); ``` In addition, you can use the `vpcSubnets` property to control which specific subnets will be used, and the `securityGroups` property to control @@ -192,7 +192,7 @@ which security groups will be attached to the domain. By default, CDK will selec Helper methods exist to access common domain metrics for example: ```ts -declare const domain: opensearch.Domain; +declare const domain: Domain; const freeStorageSpace = domain.metricFreeStorageSpace(); const masterSysMemoryUtilization = domain.metric('MasterSysMemoryUtilization'); ``` @@ -205,8 +205,8 @@ The domain can also be created with a master user configured. The password can be supplied or dynamically created if not supplied. ```ts -const domain = new opensearch.Domain(this, 'Domain', { - version: opensearch.EngineVersion.OPENSEARCH_1_0, +const domain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, enforceHttps: true, nodeToNodeEncryption: true, encryptionAtRest: { @@ -243,8 +243,8 @@ stored in the AWS Secrets Manager as secret. The secret has the prefix `MasterUser`. ```ts -const domain = new opensearch.Domain(this, 'Domain', { - version: opensearch.EngineVersion.OPENSEARCH_1_0, +const domain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, useUnsignedBasicAuth: true, }); @@ -259,8 +259,8 @@ constructor property, or later by means of a helper method. For simple permissions the `accessPolicies` constructor may be sufficient: ```ts -const domain = new opensearch.Domain(this, 'Domain', { - version: opensearch.EngineVersion.OPENSEARCH_1_0, +const domain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, accessPolicies: [ new iam.PolicyStatement({ actions: ['es:*ESHttpPost', 'es:ESHttpPut*'], @@ -277,8 +277,8 @@ For more complex use-cases, for example, to set the domain up to receive data fr allows for policies that include the explicit domain ARN. ```ts -const domain = new opensearch.Domain(this, 'Domain', { - version: opensearch.EngineVersion.OPENSEARCH_1_0, +const domain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, }); domain.addAccessPolicies( new iam.PolicyStatement({ @@ -313,8 +313,8 @@ domain.addAccessPolicies( Audit logs can be enabled for a domain, but only when fine grained access control is enabled. ```ts -const domain = new opensearch.Domain(this, 'Domain', { - version: opensearch.EngineVersion.OPENSEARCH_1_0, +const domain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, enforceHttps: true, nodeToNodeEncryption: true, encryptionAtRest: { @@ -337,8 +337,8 @@ const domain = new opensearch.Domain(this, 'Domain', { UltraWarm nodes can be enabled to provide a cost-effective way to store large amounts of read-only data. ```ts -const domain = new opensearch.Domain(this, 'Domain', { - version: opensearch.EngineVersion.OPENSEARCH_1_0, +const domain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, capacity: { masterNodes: 2, warmNodes: 2, @@ -352,8 +352,8 @@ const domain = new opensearch.Domain(this, 'Domain', { Custom endpoints can be configured to reach the domain under a custom domain name. ```ts -new opensearch.Domain(this, 'Domain', { - version: opensearch.EngineVersion.OPENSEARCH_1_0, +new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, customEndpoint: { domainName: 'search.example.com', }, @@ -369,8 +369,8 @@ Additionally, an automatic CNAME-Record is created if a hosted zone is provided [Advanced options](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/createupdatedomains.html#createdomain-configure-advanced-options) can used to configure additional options. ```ts -new opensearch.Domain(this, 'Domain', { - version: opensearch.EngineVersion.OPENSEARCH_1_0, +new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, advancedOptions: { 'rest.action.multi.allow_explicit_index': 'false', 'indices.fielddata.cache.size': '25', @@ -378,3 +378,22 @@ new opensearch.Domain(this, 'Domain', { }, }); ``` + +## Amazon Cognito authentication for OpenSearch Dashboards + +The domain can be configured to use Amazon Cognito authentication for OpenSearch Dashboards. + +> Visit [Configuring Amazon Cognito authentication for OpenSearch Dashboards](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/cognito-auth.html) for more details. + +```ts +declare const cognitoConfigurationRole: iam.Role; + +const domain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, + cognitoDashboardsAuth: { + role: cognitoConfigurationRole, + identityPoolId: 'example-identity-pool-id', + userPoolId: 'example-user-pool-id', + }, +}); +``` diff --git a/packages/@aws-cdk/aws-opensearchservice/lib/domain.ts b/packages/@aws-cdk/aws-opensearchservice/lib/domain.ts index 960b9b626f8c7..4d51c6c176c6e 100644 --- a/packages/@aws-cdk/aws-opensearchservice/lib/domain.ts +++ b/packages/@aws-cdk/aws-opensearchservice/lib/domain.ts @@ -1583,12 +1583,12 @@ export class Domain extends DomainBase implements IDomain, ec2.IConnectable { }, nodeToNodeEncryptionOptions: { enabled: nodeToNodeEncryptionEnabled }, logPublishingOptions: logPublishing, - cognitoOptions: { - enabled: props.cognitoDashboardsAuth != null, + cognitoOptions: props.cognitoDashboardsAuth ? { + enabled: true, identityPoolId: props.cognitoDashboardsAuth?.identityPoolId, roleArn: props.cognitoDashboardsAuth?.role.roleArn, userPoolId: props.cognitoDashboardsAuth?.userPoolId, - }, + }: undefined, vpcOptions: cfnVpcOptions, snapshotOptions: props.automatedSnapshotStartHour ? { automatedSnapshotStartHour: props.automatedSnapshotStartHour } diff --git a/packages/@aws-cdk/aws-opensearchservice/lib/version.ts b/packages/@aws-cdk/aws-opensearchservice/lib/version.ts index b989ac4867b72..0347159408023 100644 --- a/packages/@aws-cdk/aws-opensearchservice/lib/version.ts +++ b/packages/@aws-cdk/aws-opensearchservice/lib/version.ts @@ -68,6 +68,9 @@ export class EngineVersion { /** AWS OpenSearch 1.2 */ public static readonly OPENSEARCH_1_2 = EngineVersion.openSearch('1.2'); + /** AWS OpenSearch 1.3 */ + public static readonly OPENSEARCH_1_3 = EngineVersion.openSearch('1.3'); + /** * Custom ElasticSearch version * @param version custom version number diff --git a/packages/@aws-cdk/aws-opensearchservice/package.json b/packages/@aws-cdk/aws-opensearchservice/package.json index 0d7ab91e184a5..a18f45d1c3b65 100644 --- a/packages/@aws-cdk/aws-opensearchservice/package.json +++ b/packages/@aws-cdk/aws-opensearchservice/package.json @@ -89,6 +89,8 @@ "@aws-cdk/integ-runner": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/pkglint": "0.0.0", + "@aws-cdk/integ-tests": "0.0.0", + "@aws-cdk/aws-cognito": "0.0.0", "@types/jest": "^27.5.2" }, "dependencies": { diff --git a/packages/@aws-cdk/aws-opensearchservice/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-opensearchservice/rosetta/default.ts-fixture index 625996f43fb30..0bf08b6ca9abd 100644 --- a/packages/@aws-cdk/aws-opensearchservice/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-opensearchservice/rosetta/default.ts-fixture @@ -1,12 +1,12 @@ // Fixture with packages imported, but nothing else import { Construct } from 'constructs'; -import { RemovalPolicy, Stack } from '@aws-cdk/core'; -import * as opensearch from '@aws-cdk/aws-opensearchservice'; +import { RemovalPolicy, Stack, Fn } from '@aws-cdk/core'; +import { Domain, DomainProps, EngineVersion } from '@aws-cdk/aws-opensearchservice'; import * as lambda from '@aws-cdk/aws-lambda'; import * as ec2 from '@aws-cdk/aws-ec2'; import * as iam from '@aws-cdk/aws-iam'; -class Fixture extends Stack { +class Fixture extends Stack { constructor(scope: Construct, id: string) { super(scope, id); diff --git a/packages/@aws-cdk/aws-opensearchservice/test/domain.test.ts b/packages/@aws-cdk/aws-opensearchservice/test/domain.test.ts index 07094a348e52b..6260678513600 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/domain.test.ts +++ b/packages/@aws-cdk/aws-opensearchservice/test/domain.test.ts @@ -187,9 +187,6 @@ test('minimal example renders correctly', () => { new Domain(stack, 'Domain', { version: defaultVersion }); Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - CognitoOptions: { - Enabled: false, - }, EBSOptions: { EBSEnabled: true, VolumeSize: 10, @@ -1852,6 +1849,46 @@ describe('advanced options', () => { }); }); +describe('cognito dashboards auth', () => { + test('cognito dashboards auth is not configured by default', () => { + new Domain(stack, 'Domain', { version: defaultVersion }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + CognitoOptions: Match.absent(), + }); + }); + + test('cognito dashboards auth can be configured', () => { + const identityPoolId = 'test-identity-pool-id'; + const userPoolId = 'test-user-pool-id'; + const user = new iam.User(stack, 'testuser'); + const role = new iam.Role(stack, 'testrole', { assumedBy: user }); + + new Domain(stack, 'Domain', { + version: defaultVersion, + cognitoDashboardsAuth: { + role, + identityPoolId, + userPoolId, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + CognitoOptions: { + Enabled: true, + IdentityPoolId: identityPoolId, + RoleArn: { + 'Fn::GetAtt': [ + 'testroleFAA56B58', + 'Arn', + ], + }, + UserPoolId: userPoolId, + }, + }); + }); +}); + function testGrant( expectedActions: string[], invocation: (user: iam.IPrincipal, domain: Domain) => void, diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.ts b/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.ts new file mode 100644 index 0000000000000..42642148dcff7 --- /dev/null +++ b/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.ts @@ -0,0 +1,54 @@ +/// !cdk-integ pragma:ignore-assets +import * as cognito from '@aws-cdk/aws-cognito'; +import * as iam from '@aws-cdk/aws-iam'; +import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; +import { Construct } from 'constructs'; +import * as opensearch from '../lib'; + +class TestStack extends Stack { + constructor(scope: Construct, id: string, props?: StackProps) { + super(scope, id, props); + + // Adding required resources per https://docs.aws.amazon.com/opensearch-service/latest/developerguide/cognito-auth.html#cognito-auth-config + const identityPool = new cognito.CfnIdentityPool(this, 'IdentityPool', { + allowUnauthenticatedIdentities: true, + }); + + const userPool = new cognito.UserPool(this, 'UserPool', { + removalPolicy: RemovalPolicy.DESTROY, + }); + userPool.addDomain('UserPoolDomain', { + cognitoDomain: { + domainPrefix: 'integ-test-domain-prefix', + }, + }); + + const role = new iam.Role(this, 'Role', { + assumedBy: new iam.ServicePrincipal('opensearchservice.amazonaws.com'), + managedPolicies: [ + iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonOpenSearchServiceCognitoAccess'), + ], + }); + + // Adding a domain with cognito dashboards auth configured + new opensearch.Domain(this, 'Domain', { + removalPolicy: RemovalPolicy.DESTROY, + version: opensearch.EngineVersion.OPENSEARCH_1_0, + cognitoDashboardsAuth: { + role, + identityPoolId: identityPool.ref, + userPoolId: userPool.userPoolId, + }, + }); + } +} + +const app = new App(); +const stack = new TestStack(app, 'cdk-integ-opensearch-cognitodashboardsauth'); + +new IntegTest(app, 'CognitoAuthForOpenSearchDashboards', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.advancedsecurity.integ.snapshot/cdk-integ-opensearch-advancedsecurity.template.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.advancedsecurity.integ.snapshot/cdk-integ-opensearch-advancedsecurity.template.json index 7b59058b5673c..6d5410432e9f8 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.advancedsecurity.integ.snapshot/cdk-integ-opensearch-advancedsecurity.template.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.advancedsecurity.integ.snapshot/cdk-integ-opensearch-advancedsecurity.template.json @@ -24,9 +24,6 @@ "InstanceType": "r5.large.search", "ZoneAwarenessEnabled": false }, - "CognitoOptions": { - "Enabled": false - }, "DomainEndpointOptions": { "EnforceHTTPS": true, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.advancedsecurity.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.advancedsecurity.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.advancedsecurity.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.advancedsecurity.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-opensearchservice/test/opensearch.advancedsecurity.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.advancedsecurity.integ.snapshot/manifest.json index ffe19a2034a60..d21141bf55b77 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.advancedsecurity.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.advancedsecurity.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-opensearchservice/test/opensearch.advancedsecurity.integ.snapshot/tree.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.advancedsecurity.integ.snapshot/tree.json index b11e66f2e05c0..0b7486944e4ce 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.advancedsecurity.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.advancedsecurity.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.58" } }, "cdk-integ-opensearch-advancedsecurity": { @@ -66,9 +66,6 @@ "instanceType": "r5.large.search", "zoneAwarenessEnabled": false }, - "cognitoOptions": { - "enabled": false - }, "domainEndpointOptions": { "enforceHttps": true, "tlsSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.cognitodashboardsauth.integ.snapshot/CognitoAuthForOpenSearchDashboardsDefaultTestDeployAssert4CCFA971.template.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.cognitodashboardsauth.integ.snapshot/CognitoAuthForOpenSearchDashboardsDefaultTestDeployAssert4CCFA971.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.cognitodashboardsauth.integ.snapshot/CognitoAuthForOpenSearchDashboardsDefaultTestDeployAssert4CCFA971.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.cognitodashboardsauth.integ.snapshot/cdk-integ-opensearch-cognitodashboardsauth.template.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.cognitodashboardsauth.integ.snapshot/cdk-integ-opensearch-cognitodashboardsauth.template.json new file mode 100644 index 0000000000000..98fbe17c6246f --- /dev/null +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.cognitodashboardsauth.integ.snapshot/cdk-integ-opensearch-cognitodashboardsauth.template.json @@ -0,0 +1,126 @@ +{ + "Resources": { + "IdentityPool": { + "Type": "AWS::Cognito::IdentityPool", + "Properties": { + "AllowUnauthenticatedIdentities": true + } + }, + "UserPool6BA7E5F2": { + "Type": "AWS::Cognito::UserPool", + "Properties": { + "AccountRecoverySetting": { + "RecoveryMechanisms": [ + { + "Name": "verified_phone_number", + "Priority": 1 + }, + { + "Name": "verified_email", + "Priority": 2 + } + ] + }, + "AdminCreateUserConfig": { + "AllowAdminCreateUserOnly": true + }, + "EmailVerificationMessage": "The verification code to your new account is {####}", + "EmailVerificationSubject": "Verify your new account", + "SmsVerificationMessage": "The verification code to your new account is {####}", + "VerificationMessageTemplate": { + "DefaultEmailOption": "CONFIRM_WITH_CODE", + "EmailMessage": "The verification code to your new account is {####}", + "EmailSubject": "Verify your new account", + "SmsMessage": "The verification code to your new account is {####}" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "UserPoolUserPoolDomain9F01E991": { + "Type": "AWS::Cognito::UserPoolDomain", + "Properties": { + "Domain": "integ-test-domain-prefix", + "UserPoolId": { + "Ref": "UserPool6BA7E5F2" + } + } + }, + "Role1ABCC5F0": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "opensearchservice.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/AmazonOpenSearchServiceCognitoAccess" + ] + ] + } + ] + } + }, + "Domain66AC69E0": { + "Type": "AWS::OpenSearchService::Domain", + "Properties": { + "ClusterConfig": { + "DedicatedMasterEnabled": false, + "InstanceCount": 1, + "InstanceType": "r5.large.search", + "ZoneAwarenessEnabled": false + }, + "CognitoOptions": { + "Enabled": true, + "IdentityPoolId": { + "Ref": "IdentityPool" + }, + "RoleArn": { + "Fn::GetAtt": [ + "Role1ABCC5F0", + "Arn" + ] + }, + "UserPoolId": { + "Ref": "UserPool6BA7E5F2" + } + }, + "DomainEndpointOptions": { + "EnforceHTTPS": false, + "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" + }, + "EBSOptions": { + "EBSEnabled": true, + "VolumeSize": 10, + "VolumeType": "gp2" + }, + "EncryptionAtRestOptions": { + "Enabled": false + }, + "EngineVersion": "OpenSearch_1.0", + "LogPublishingOptions": {}, + "NodeToNodeEncryptionOptions": { + "Enabled": false + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.cognitodashboardsauth.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.cognitodashboardsauth.integ.snapshot/cdk.out new file mode 100644 index 0000000000000..588d7b269d34f --- /dev/null +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.cognitodashboardsauth.integ.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.cognitodashboardsauth.integ.snapshot/integ.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.cognitodashboardsauth.integ.snapshot/integ.json new file mode 100644 index 0000000000000..30a553b18aed8 --- /dev/null +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.cognitodashboardsauth.integ.snapshot/integ.json @@ -0,0 +1,11 @@ +{ + "version": "20.0.0", + "testCases": { + "CognitoAuthForOpenSearchDashboards/DefaultTest": { + "stacks": [ + "cdk-integ-opensearch-cognitodashboardsauth" + ], + "assertionStack": "CognitoAuthForOpenSearchDashboardsDefaultTestDeployAssert4CCFA971" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.cognitodashboardsauth.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.cognitodashboardsauth.integ.snapshot/manifest.json new file mode 100644 index 0000000000000..1af8818405456 --- /dev/null +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.cognitodashboardsauth.integ.snapshot/manifest.json @@ -0,0 +1,61 @@ +{ + "version": "20.0.0", + "artifacts": { + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + }, + "cdk-integ-opensearch-cognitodashboardsauth": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "cdk-integ-opensearch-cognitodashboardsauth.template.json", + "validateOnSynth": false + }, + "metadata": { + "/cdk-integ-opensearch-cognitodashboardsauth/IdentityPool": [ + { + "type": "aws:cdk:logicalId", + "data": "IdentityPool" + } + ], + "/cdk-integ-opensearch-cognitodashboardsauth/UserPool/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "UserPool6BA7E5F2" + } + ], + "/cdk-integ-opensearch-cognitodashboardsauth/UserPool/UserPoolDomain/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "UserPoolUserPoolDomain9F01E991" + } + ], + "/cdk-integ-opensearch-cognitodashboardsauth/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Role1ABCC5F0" + } + ], + "/cdk-integ-opensearch-cognitodashboardsauth/Domain/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Domain66AC69E0" + } + ] + }, + "displayName": "cdk-integ-opensearch-cognitodashboardsauth" + }, + "CognitoAuthForOpenSearchDashboardsDefaultTestDeployAssert4CCFA971": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "CognitoAuthForOpenSearchDashboardsDefaultTestDeployAssert4CCFA971.template.json", + "validateOnSynth": false + }, + "displayName": "CognitoAuthForOpenSearchDashboards/DefaultTest/DeployAssert" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.cognitodashboardsauth.integ.snapshot/tree.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.cognitodashboardsauth.integ.snapshot/tree.json new file mode 100644 index 0000000000000..45b4ec90cb407 --- /dev/null +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.cognitodashboardsauth.integ.snapshot/tree.json @@ -0,0 +1,265 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.58" + } + }, + "cdk-integ-opensearch-cognitodashboardsauth": { + "id": "cdk-integ-opensearch-cognitodashboardsauth", + "path": "cdk-integ-opensearch-cognitodashboardsauth", + "children": { + "IdentityPool": { + "id": "IdentityPool", + "path": "cdk-integ-opensearch-cognitodashboardsauth/IdentityPool", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Cognito::IdentityPool", + "aws:cdk:cloudformation:props": { + "allowUnauthenticatedIdentities": true + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-cognito.CfnIdentityPool", + "version": "0.0.0" + } + }, + "UserPool": { + "id": "UserPool", + "path": "cdk-integ-opensearch-cognitodashboardsauth/UserPool", + "children": { + "Resource": { + "id": "Resource", + "path": "cdk-integ-opensearch-cognitodashboardsauth/UserPool/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Cognito::UserPool", + "aws:cdk:cloudformation:props": { + "accountRecoverySetting": { + "recoveryMechanisms": [ + { + "name": "verified_phone_number", + "priority": 1 + }, + { + "name": "verified_email", + "priority": 2 + } + ] + }, + "adminCreateUserConfig": { + "allowAdminCreateUserOnly": true + }, + "emailVerificationMessage": "The verification code to your new account is {####}", + "emailVerificationSubject": "Verify your new account", + "smsVerificationMessage": "The verification code to your new account is {####}", + "verificationMessageTemplate": { + "defaultEmailOption": "CONFIRM_WITH_CODE", + "emailMessage": "The verification code to your new account is {####}", + "emailSubject": "Verify your new account", + "smsMessage": "The verification code to your new account is {####}" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-cognito.CfnUserPool", + "version": "0.0.0" + } + }, + "UserPoolDomain": { + "id": "UserPoolDomain", + "path": "cdk-integ-opensearch-cognitodashboardsauth/UserPool/UserPoolDomain", + "children": { + "Resource": { + "id": "Resource", + "path": "cdk-integ-opensearch-cognitodashboardsauth/UserPool/UserPoolDomain/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Cognito::UserPoolDomain", + "aws:cdk:cloudformation:props": { + "domain": "integ-test-domain-prefix", + "userPoolId": { + "Ref": "UserPool6BA7E5F2" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-cognito.CfnUserPoolDomain", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-cognito.UserPoolDomain", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-cognito.UserPool", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "cdk-integ-opensearch-cognitodashboardsauth/Role", + "children": { + "Resource": { + "id": "Resource", + "path": "cdk-integ-opensearch-cognitodashboardsauth/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "opensearchservice.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/AmazonOpenSearchServiceCognitoAccess" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Role", + "version": "0.0.0" + } + }, + "Domain": { + "id": "Domain", + "path": "cdk-integ-opensearch-cognitodashboardsauth/Domain", + "children": { + "Resource": { + "id": "Resource", + "path": "cdk-integ-opensearch-cognitodashboardsauth/Domain/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::OpenSearchService::Domain", + "aws:cdk:cloudformation:props": { + "clusterConfig": { + "dedicatedMasterEnabled": false, + "instanceCount": 1, + "instanceType": "r5.large.search", + "zoneAwarenessEnabled": false + }, + "cognitoOptions": { + "enabled": true, + "identityPoolId": { + "Ref": "IdentityPool" + }, + "roleArn": { + "Fn::GetAtt": [ + "Role1ABCC5F0", + "Arn" + ] + }, + "userPoolId": { + "Ref": "UserPool6BA7E5F2" + } + }, + "domainEndpointOptions": { + "enforceHttps": false, + "tlsSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" + }, + "ebsOptions": { + "ebsEnabled": true, + "volumeSize": 10, + "volumeType": "gp2" + }, + "encryptionAtRestOptions": { + "enabled": false + }, + "engineVersion": "OpenSearch_1.0", + "logPublishingOptions": {}, + "nodeToNodeEncryptionOptions": { + "enabled": false + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-opensearchservice.CfnDomain", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-opensearchservice.Domain", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + }, + "CognitoAuthForOpenSearchDashboards": { + "id": "CognitoAuthForOpenSearchDashboards", + "path": "CognitoAuthForOpenSearchDashboards", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "CognitoAuthForOpenSearchDashboards/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "CognitoAuthForOpenSearchDashboards/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.58" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "CognitoAuthForOpenSearchDashboards/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-opensearchservice/test/opensearch.custom-kms-key.integ.snapshot/cdk-integ-opensearch-custom-kms-key.template.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.custom-kms-key.integ.snapshot/cdk-integ-opensearch-custom-kms-key.template.json index 2b33df14043ca..712fc8e981a0d 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.custom-kms-key.integ.snapshot/cdk-integ-opensearch-custom-kms-key.template.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.custom-kms-key.integ.snapshot/cdk-integ-opensearch-custom-kms-key.template.json @@ -44,9 +44,6 @@ "InstanceType": "r5.large.search", "ZoneAwarenessEnabled": false }, - "CognitoOptions": { - "Enabled": false - }, "DomainEndpointOptions": { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" @@ -228,7 +225,7 @@ "Properties": { "Code": { "S3Bucket": { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F" + "Ref": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3BucketC526447A" }, "S3Key": { "Fn::Join": [ @@ -241,7 +238,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" + "Ref": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5" } ] } @@ -254,7 +251,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" + "Ref": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5" } ] } @@ -281,17 +278,17 @@ } }, "Parameters": { - "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F": { + "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3BucketC526447A": { "Type": "String", - "Description": "S3 bucket for asset \"9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90\"" + "Description": "S3 bucket for asset \"105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286\"" }, - "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058": { + "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5": { "Type": "String", - "Description": "S3 key for asset version \"9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90\"" + "Description": "S3 key for asset version \"105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286\"" }, - "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90ArtifactHashC00C7285": { + "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286ArtifactHashC17A8FEC": { "Type": "String", - "Description": "Artifact hash for asset \"9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90\"" + "Description": "Artifact hash for asset \"105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286\"" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.custom-kms-key.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.custom-kms-key.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.custom-kms-key.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.custom-kms-key.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-opensearchservice/test/opensearch.custom-kms-key.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.custom-kms-key.integ.snapshot/manifest.json index b40eb5029b9f1..117ba4863ee90 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.custom-kms-key.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.custom-kms-key.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -19,13 +19,13 @@ { "type": "aws:cdk:asset", "data": { - "path": "asset.9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", - "id": "9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", + "path": "asset.105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286", + "id": "105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286", "packaging": "zip", - "sourceHash": "9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", - "s3BucketParameter": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F", - "s3KeyParameter": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058", - "artifactHashParameter": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90ArtifactHashC00C7285" + "sourceHash": "105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286", + "s3BucketParameter": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3BucketC526447A", + "s3KeyParameter": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5", + "artifactHashParameter": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286ArtifactHashC17A8FEC" } } ], @@ -71,22 +71,22 @@ "data": "AWS679f53fac002430cb0da5b7982bd22872D164C4C" } ], - "/cdk-integ-opensearch-custom-kms-key/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/S3Bucket": [ + "/cdk-integ-opensearch-custom-kms-key/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286/S3Bucket": [ { "type": "aws:cdk:logicalId", - "data": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F" + "data": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3BucketC526447A" } ], - "/cdk-integ-opensearch-custom-kms-key/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/S3VersionKey": [ + "/cdk-integ-opensearch-custom-kms-key/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286/S3VersionKey": [ { "type": "aws:cdk:logicalId", - "data": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" + "data": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5" } ], - "/cdk-integ-opensearch-custom-kms-key/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/ArtifactHash": [ + "/cdk-integ-opensearch-custom-kms-key/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286/ArtifactHash": [ { "type": "aws:cdk:logicalId", - "data": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90ArtifactHashC00C7285" + "data": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286ArtifactHashC17A8FEC" } ] }, diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.custom-kms-key.integ.snapshot/tree.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.custom-kms-key.integ.snapshot/tree.json index ee137350369d2..d6232912c89d3 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.custom-kms-key.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.custom-kms-key.integ.snapshot/tree.json @@ -9,7 +9,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.58" } }, "cdk-integ-opensearch-custom-kms-key": { @@ -83,9 +83,6 @@ "instanceType": "r5.large.search", "zoneAwarenessEnabled": false }, - "cognitoOptions": { - "enabled": false - }, "domainEndpointOptions": { "enforceHttps": false, "tlsSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" @@ -334,7 +331,7 @@ "aws:cdk:cloudformation:props": { "code": { "s3Bucket": { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F" + "Ref": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3BucketC526447A" }, "s3Key": { "Fn::Join": [ @@ -347,7 +344,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" + "Ref": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5" } ] } @@ -360,7 +357,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" + "Ref": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5" } ] } @@ -377,7 +374,7 @@ ] }, "handler": "index.handler", - "runtime": "nodejs12.x", + "runtime": "nodejs14.x", "timeout": 120 } }, @@ -396,13 +393,13 @@ "id": "AssetParameters", "path": "cdk-integ-opensearch-custom-kms-key/AssetParameters", "children": { - "9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90": { - "id": "9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", - "path": "cdk-integ-opensearch-custom-kms-key/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", + "105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286": { + "id": "105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286", + "path": "cdk-integ-opensearch-custom-kms-key/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286", "children": { "S3Bucket": { "id": "S3Bucket", - "path": "cdk-integ-opensearch-custom-kms-key/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/S3Bucket", + "path": "cdk-integ-opensearch-custom-kms-key/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286/S3Bucket", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -410,7 +407,7 @@ }, "S3VersionKey": { "id": "S3VersionKey", - "path": "cdk-integ-opensearch-custom-kms-key/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/S3VersionKey", + "path": "cdk-integ-opensearch-custom-kms-key/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286/S3VersionKey", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -418,7 +415,7 @@ }, "ArtifactHash": { "id": "ArtifactHash", - "path": "cdk-integ-opensearch-custom-kms-key/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/ArtifactHash", + "path": "cdk-integ-opensearch-custom-kms-key/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286/ArtifactHash", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -427,13 +424,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.58" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.58" } } }, diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.integ.snapshot/cdk-integ-opensearch.template.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.integ.snapshot/cdk-integ-opensearch.template.json index c92ea5ebf3939..2341834355603 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.integ.snapshot/cdk-integ-opensearch.template.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.integ.snapshot/cdk-integ-opensearch.template.json @@ -116,9 +116,6 @@ "InstanceType": "r5.large.search", "ZoneAwarenessEnabled": false }, - "CognitoOptions": { - "Enabled": false - }, "DomainEndpointOptions": { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" @@ -290,7 +287,7 @@ "Properties": { "Code": { "S3Bucket": { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F" + "Ref": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3BucketC526447A" }, "S3Key": { "Fn::Join": [ @@ -303,7 +300,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" + "Ref": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5" } ] } @@ -316,7 +313,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" + "Ref": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5" } ] } @@ -456,9 +453,6 @@ "InstanceType": "r5.large.search", "ZoneAwarenessEnabled": false }, - "CognitoOptions": { - "Enabled": false - }, "DomainEndpointOptions": { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" @@ -596,17 +590,17 @@ } }, "Parameters": { - "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F": { + "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3BucketC526447A": { "Type": "String", - "Description": "S3 bucket for asset \"9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90\"" + "Description": "S3 bucket for asset \"105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286\"" }, - "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058": { + "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5": { "Type": "String", - "Description": "S3 key for asset version \"9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90\"" + "Description": "S3 key for asset version \"105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286\"" }, - "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90ArtifactHashC00C7285": { + "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286ArtifactHashC17A8FEC": { "Type": "String", - "Description": "Artifact hash for asset \"9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90\"" + "Description": "Artifact hash for asset \"105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286\"" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.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-opensearchservice/test/opensearch.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.integ.snapshot/manifest.json index 70e033a8594e9..fca6b84f2b386 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -19,13 +19,13 @@ { "type": "aws:cdk:asset", "data": { - "path": "asset.9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", - "id": "9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", + "path": "asset.105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286", + "id": "105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286", "packaging": "zip", - "sourceHash": "9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", - "s3BucketParameter": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F", - "s3KeyParameter": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058", - "artifactHashParameter": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90ArtifactHashC00C7285" + "sourceHash": "105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286", + "s3BucketParameter": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3BucketC526447A", + "s3KeyParameter": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5", + "artifactHashParameter": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286ArtifactHashC17A8FEC" } } ], @@ -83,22 +83,22 @@ "data": "AWS679f53fac002430cb0da5b7982bd22872D164C4C" } ], - "/cdk-integ-opensearch/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/S3Bucket": [ + "/cdk-integ-opensearch/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286/S3Bucket": [ { "type": "aws:cdk:logicalId", - "data": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F" + "data": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3BucketC526447A" } ], - "/cdk-integ-opensearch/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/S3VersionKey": [ + "/cdk-integ-opensearch/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286/S3VersionKey": [ { "type": "aws:cdk:logicalId", - "data": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" + "data": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5" } ], - "/cdk-integ-opensearch/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/ArtifactHash": [ + "/cdk-integ-opensearch/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286/ArtifactHash": [ { "type": "aws:cdk:logicalId", - "data": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90ArtifactHashC00C7285" + "data": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286ArtifactHashC17A8FEC" } ], "/cdk-integ-opensearch/Domain2/SlowSearchLogs/Resource": [ diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.integ.snapshot/tree.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.integ.snapshot/tree.json index 023b8f817182d..6ece69ad106a1 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.integ.snapshot/tree.json @@ -9,7 +9,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.58" } }, "cdk-integ-opensearch": { @@ -163,9 +163,6 @@ "instanceType": "r5.large.search", "zoneAwarenessEnabled": false }, - "cognitoOptions": { - "enabled": false - }, "domainEndpointOptions": { "enforceHttps": false, "tlsSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" @@ -382,7 +379,7 @@ "aws:cdk:cloudformation:props": { "code": { "s3Bucket": { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F" + "Ref": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3BucketC526447A" }, "s3Key": { "Fn::Join": [ @@ -395,7 +392,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" + "Ref": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5" } ] } @@ -408,7 +405,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" + "Ref": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5" } ] } @@ -425,7 +422,7 @@ ] }, "handler": "index.handler", - "runtime": "nodejs12.x", + "runtime": "nodejs14.x", "timeout": 120 } }, @@ -444,13 +441,13 @@ "id": "AssetParameters", "path": "cdk-integ-opensearch/AssetParameters", "children": { - "9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90": { - "id": "9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", - "path": "cdk-integ-opensearch/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", + "105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286": { + "id": "105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286", + "path": "cdk-integ-opensearch/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286", "children": { "S3Bucket": { "id": "S3Bucket", - "path": "cdk-integ-opensearch/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/S3Bucket", + "path": "cdk-integ-opensearch/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286/S3Bucket", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -458,7 +455,7 @@ }, "S3VersionKey": { "id": "S3VersionKey", - "path": "cdk-integ-opensearch/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/S3VersionKey", + "path": "cdk-integ-opensearch/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286/S3VersionKey", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -466,7 +463,7 @@ }, "ArtifactHash": { "id": "ArtifactHash", - "path": "cdk-integ-opensearch/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/ArtifactHash", + "path": "cdk-integ-opensearch/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286/ArtifactHash", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -475,13 +472,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.58" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.58" } }, "Domain2": { @@ -631,9 +628,6 @@ "instanceType": "r5.large.search", "zoneAwarenessEnabled": false }, - "cognitoOptions": { - "enabled": false - }, "domainEndpointOptions": { "enforceHttps": false, "tlsSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.ultrawarm.integ.snapshot/cdk-integ-opensearch-ultrawarm.template.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.ultrawarm.integ.snapshot/cdk-integ-opensearch-ultrawarm.template.json index 8bbe484db5eb1..f7cff4e18d0ad 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.ultrawarm.integ.snapshot/cdk-integ-opensearch-ultrawarm.template.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.ultrawarm.integ.snapshot/cdk-integ-opensearch-ultrawarm.template.json @@ -14,9 +14,6 @@ "WarmType": "ultrawarm1.medium.search", "ZoneAwarenessEnabled": false }, - "CognitoOptions": { - "Enabled": false - }, "DomainEndpointOptions": { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.ultrawarm.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.ultrawarm.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.ultrawarm.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.ultrawarm.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-opensearchservice/test/opensearch.ultrawarm.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.ultrawarm.integ.snapshot/manifest.json index 236babe96d8bc..6be0e451acd67 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.ultrawarm.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.ultrawarm.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-opensearchservice/test/opensearch.ultrawarm.integ.snapshot/tree.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.ultrawarm.integ.snapshot/tree.json index c2a46081544cf..9e11c3c61aa60 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.ultrawarm.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.ultrawarm.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.58" } }, "cdk-integ-opensearch-ultrawarm": { @@ -37,9 +37,6 @@ "warmType": "ultrawarm1.medium.search", "zoneAwarenessEnabled": false }, - "cognitoOptions": { - "enabled": false - }, "domainEndpointOptions": { "enforceHttps": false, "tlsSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.unsignedbasicauth.integ.snapshot/cdk-integ-opensearch-unsignedbasicauth.template.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.unsignedbasicauth.integ.snapshot/cdk-integ-opensearch-unsignedbasicauth.template.json index ea296db686ba3..1c93dd64f4282 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.unsignedbasicauth.integ.snapshot/cdk-integ-opensearch-unsignedbasicauth.template.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.unsignedbasicauth.integ.snapshot/cdk-integ-opensearch-unsignedbasicauth.template.json @@ -40,9 +40,6 @@ "InstanceType": "r5.large.search", "ZoneAwarenessEnabled": false }, - "CognitoOptions": { - "Enabled": false - }, "DomainEndpointOptions": { "EnforceHTTPS": true, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" @@ -189,7 +186,7 @@ "Properties": { "Code": { "S3Bucket": { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F" + "Ref": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3BucketC526447A" }, "S3Key": { "Fn::Join": [ @@ -202,7 +199,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" + "Ref": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5" } ] } @@ -215,7 +212,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" + "Ref": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5" } ] } @@ -241,17 +238,17 @@ } }, "Parameters": { - "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F": { + "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3BucketC526447A": { "Type": "String", - "Description": "S3 bucket for asset \"9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90\"" + "Description": "S3 bucket for asset \"105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286\"" }, - "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058": { + "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5": { "Type": "String", - "Description": "S3 key for asset version \"9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90\"" + "Description": "S3 key for asset version \"105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286\"" }, - "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90ArtifactHashC00C7285": { + "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286ArtifactHashC17A8FEC": { "Type": "String", - "Description": "Artifact hash for asset \"9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90\"" + "Description": "Artifact hash for asset \"105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286\"" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.unsignedbasicauth.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.unsignedbasicauth.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.unsignedbasicauth.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.unsignedbasicauth.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-opensearchservice/test/opensearch.unsignedbasicauth.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.unsignedbasicauth.integ.snapshot/manifest.json index ffeed3ea79ef7..a8e93cbb58d78 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.unsignedbasicauth.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.unsignedbasicauth.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -19,13 +19,13 @@ { "type": "aws:cdk:asset", "data": { - "path": "asset.9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", - "id": "9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", + "path": "asset.105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286", + "id": "105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286", "packaging": "zip", - "sourceHash": "9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", - "s3BucketParameter": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F", - "s3KeyParameter": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058", - "artifactHashParameter": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90ArtifactHashC00C7285" + "sourceHash": "105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286", + "s3BucketParameter": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3BucketC526447A", + "s3KeyParameter": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5", + "artifactHashParameter": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286ArtifactHashC17A8FEC" } } ], @@ -65,22 +65,22 @@ "data": "AWS679f53fac002430cb0da5b7982bd22872D164C4C" } ], - "/cdk-integ-opensearch-unsignedbasicauth/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/S3Bucket": [ + "/cdk-integ-opensearch-unsignedbasicauth/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286/S3Bucket": [ { "type": "aws:cdk:logicalId", - "data": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F" + "data": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3BucketC526447A" } ], - "/cdk-integ-opensearch-unsignedbasicauth/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/S3VersionKey": [ + "/cdk-integ-opensearch-unsignedbasicauth/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286/S3VersionKey": [ { "type": "aws:cdk:logicalId", - "data": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" + "data": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5" } ], - "/cdk-integ-opensearch-unsignedbasicauth/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/ArtifactHash": [ + "/cdk-integ-opensearch-unsignedbasicauth/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286/ArtifactHash": [ { "type": "aws:cdk:logicalId", - "data": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90ArtifactHashC00C7285" + "data": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286ArtifactHashC17A8FEC" } ] }, diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.unsignedbasicauth.integ.snapshot/tree.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.unsignedbasicauth.integ.snapshot/tree.json index 988fda54fcc91..333619059d1d4 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.unsignedbasicauth.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.unsignedbasicauth.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.58" } }, "cdk-integ-opensearch-unsignedbasicauth": { @@ -79,9 +79,6 @@ "instanceType": "r5.large.search", "zoneAwarenessEnabled": false }, - "cognitoOptions": { - "enabled": false - }, "domainEndpointOptions": { "enforceHttps": true, "tlsSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" @@ -279,7 +276,7 @@ "aws:cdk:cloudformation:props": { "code": { "s3Bucket": { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F" + "Ref": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3BucketC526447A" }, "s3Key": { "Fn::Join": [ @@ -292,7 +289,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" + "Ref": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5" } ] } @@ -305,7 +302,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" + "Ref": "AssetParameters105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286S3VersionKey237620B5" } ] } @@ -322,7 +319,7 @@ ] }, "handler": "index.handler", - "runtime": "nodejs12.x", + "runtime": "nodejs14.x", "timeout": 120 } }, @@ -341,13 +338,13 @@ "id": "AssetParameters", "path": "cdk-integ-opensearch-unsignedbasicauth/AssetParameters", "children": { - "9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90": { - "id": "9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", - "path": "cdk-integ-opensearch-unsignedbasicauth/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", + "105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286": { + "id": "105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286", + "path": "cdk-integ-opensearch-unsignedbasicauth/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286", "children": { "S3Bucket": { "id": "S3Bucket", - "path": "cdk-integ-opensearch-unsignedbasicauth/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/S3Bucket", + "path": "cdk-integ-opensearch-unsignedbasicauth/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286/S3Bucket", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -355,7 +352,7 @@ }, "S3VersionKey": { "id": "S3VersionKey", - "path": "cdk-integ-opensearch-unsignedbasicauth/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/S3VersionKey", + "path": "cdk-integ-opensearch-unsignedbasicauth/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286/S3VersionKey", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -363,7 +360,7 @@ }, "ArtifactHash": { "id": "ArtifactHash", - "path": "cdk-integ-opensearch-unsignedbasicauth/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/ArtifactHash", + "path": "cdk-integ-opensearch-unsignedbasicauth/AssetParameters/105b4f39ae68785e705640aa91919e412fcba2dd454aca53412747be8d955286/ArtifactHash", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -371,14 +368,14 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.58" } } }, "constructInfo": { - "fqn": "@aws-cdk/core.Construct", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.1.58" } } }, diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/cdk-integ-opensearch-vpc.template.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/cdk-integ-opensearch-vpc.template.json index 9283e90ab7003..cfb61b56e1d9c 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/cdk-integ-opensearch-vpc.template.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/cdk-integ-opensearch-vpc.template.json @@ -411,9 +411,6 @@ }, "ZoneAwarenessEnabled": true }, - "CognitoOptions": { - "Enabled": false - }, "DomainEndpointOptions": { "EnforceHTTPS": false, "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.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-opensearchservice/test/opensearch.vpc.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/manifest.json index 8eedc53e2f14b..7984c610349ba 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.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-opensearchservice/test/opensearch.vpc.integ.snapshot/tree.json b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/tree.json index a4d9ed29f17e1..d56fce1ae57b9 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-opensearchservice/test/opensearch.vpc.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.58" } }, "cdk-integ-opensearch-vpc": { @@ -712,9 +712,6 @@ "availabilityZoneCount": 2 } }, - "cognitoOptions": { - "enabled": false - }, "domainEndpointOptions": { "enforceHttps": false, "tlsSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" diff --git a/packages/@aws-cdk/aws-rds/lib/instance-engine.ts b/packages/@aws-cdk/aws-rds/lib/instance-engine.ts index 1dcba69bcfc16..ff8544b330684 100644 --- a/packages/@aws-cdk/aws-rds/lib/instance-engine.ts +++ b/packages/@aws-cdk/aws-rds/lib/instance-engine.ts @@ -238,25 +238,55 @@ export class MariaDbEngineVersion { */ public static readonly VER_10_1_34 = MariaDbEngineVersion.of('10.1.34', '10.1'); - /** Version "10.2" (only a major version, without a specific minor version). */ + /** + * Version "10.2" (only a major version, without a specific minor version) + * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + */ public static readonly VER_10_2 = MariaDbEngineVersion.of('10.2', '10.2'); - /** Version "10.2.11". */ + /** + * Version "10.2.11". + * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + */ public static readonly VER_10_2_11 = MariaDbEngineVersion.of('10.2.11', '10.2'); - /** Version "10.2.12". */ + /** + * Version "10.2.12". + * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + */ public static readonly VER_10_2_12 = MariaDbEngineVersion.of('10.2.12', '10.2'); - /** Version "10.2.15". */ + /** + * Version "10.2.15". + * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + */ public static readonly VER_10_2_15 = MariaDbEngineVersion.of('10.2.15', '10.2'); - /** Version "10.2.21". */ + /** + * Version "10.2.21". + * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + */ public static readonly VER_10_2_21 = MariaDbEngineVersion.of('10.2.21', '10.2'); - /** Version "10.2.32". */ + /** + * Version "10.2.32". + * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + */ public static readonly VER_10_2_32 = MariaDbEngineVersion.of('10.2.32', '10.2'); - /** Version "10.2.37". */ + /** + * Version "10.2.37". + * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + */ public static readonly VER_10_2_37 = MariaDbEngineVersion.of('10.2.37', '10.2'); - /** Version "10.2.39". */ + /** + * Version "10.2.39". + * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + */ public static readonly VER_10_2_39 = MariaDbEngineVersion.of('10.2.39', '10.2'); - /** Version "10.2.40". */ + /** + * Version "10.2.40". + * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + */ public static readonly VER_10_2_40 = MariaDbEngineVersion.of('10.2.40', '10.2'); - /** Version "10.2.41". */ + /** + * Version "10.2.41". + * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + */ public static readonly VER_10_2_41 = MariaDbEngineVersion.of('10.2.41', '10.2'); /** Version "10.3" (only a major version, without a specific minor version). */ @@ -275,6 +305,10 @@ export class MariaDbEngineVersion { public static readonly VER_10_3_31 = MariaDbEngineVersion.of('10.3.31', '10.3'); /** Version "10.3.32". */ public static readonly VER_10_3_32 = MariaDbEngineVersion.of('10.3.32', '10.3'); + /** Version "10.3.34". */ + public static readonly VER_10_3_34 = MariaDbEngineVersion.of('10.3.34', '10.3'); + /** Version "10.3.35". */ + public static readonly VER_10_3_35 = MariaDbEngineVersion.of('10.3.35', '10.3'); /** Version "10.4" (only a major version, without a specific minor version). */ public static readonly VER_10_4 = MariaDbEngineVersion.of('10.4', '10.4'); @@ -288,6 +322,10 @@ export class MariaDbEngineVersion { public static readonly VER_10_4_21 = MariaDbEngineVersion.of('10.4.21', '10.4'); /** Version "10.4.22". */ public static readonly VER_10_4_22 = MariaDbEngineVersion.of('10.4.22', '10.4'); + /** Version "10.4.24". */ + public static readonly VER_10_4_24 = MariaDbEngineVersion.of('10.4.24', '10.4'); + /** Version "10.4.25". */ + public static readonly VER_10_4_25 = MariaDbEngineVersion.of('10.4.25', '10.4'); /** Version "10.5" (only a major version, without a specific minor version). */ public static readonly VER_10_5 = MariaDbEngineVersion.of('10.5', '10.5'); @@ -299,6 +337,19 @@ export class MariaDbEngineVersion { public static readonly VER_10_5_12 = MariaDbEngineVersion.of('10.5.12', '10.5'); /** Version "10.5.13". */ public static readonly VER_10_5_13 = MariaDbEngineVersion.of('10.5.13', '10.5'); + /** Version "10.5.15". */ + public static readonly VER_10_5_15 = MariaDbEngineVersion.of('10.5.15', '10.5'); + /** Version "10.5.16". */ + public static readonly VER_10_5_16 = MariaDbEngineVersion.of('10.5.16', '10.5'); + + /** Version "10.6" (only a major version, without a specific minor version). */ + public static readonly VER_10_6 = MariaDbEngineVersion.of('10.6', '10.6'); + /** Version "10.6.5". */ + public static readonly VER_10_6_5 = MariaDbEngineVersion.of('10.6.5', '10.6'); + /** Version "10.6.7". */ + public static readonly VER_10_6_7 = MariaDbEngineVersion.of('10.6.7', '10.6'); + /** Version "10.6.8". */ + public static readonly VER_10_6_8 = MariaDbEngineVersion.of('10.6.8', '10.6'); /** * Create a new MariaDbEngineVersion with an arbitrary version. @@ -902,6 +953,8 @@ export class PostgresEngineVersion { public static readonly VER_12_9 = PostgresEngineVersion.of('12.9', '12', { s3Import: true, s3Export: true }); /** Version "12.10". */ public static readonly VER_12_10 = PostgresEngineVersion.of('12.10', '12', { s3Import: true, s3Export: true }); + /** Version "12.11". */ + public static readonly VER_12_11 = PostgresEngineVersion.of('12.11', '12', { s3Import: true, s3Export: true }); /** Version "13" (only a major version, without a specific minor version). */ public static readonly VER_13 = PostgresEngineVersion.of('13', '13', { s3Import: true, s3Export: true }); @@ -917,6 +970,8 @@ export class PostgresEngineVersion { public static readonly VER_13_5 = PostgresEngineVersion.of('13.5', '13', { s3Import: true, s3Export: true }); /** Version "13.6". */ public static readonly VER_13_6 = PostgresEngineVersion.of('13.6', '13', { s3Import: true, s3Export: true }); + /** Version "13.7". */ + public static readonly VER_13_7 = PostgresEngineVersion.of('13.7', '13', { s3Import: true, s3Export: true }); /** Version "14" (only a major version, without a specific minor version). */ public static readonly VER_14 = PostgresEngineVersion.of('14', '14', { s3Import: true, s3Export: true }); @@ -924,6 +979,8 @@ export class PostgresEngineVersion { public static readonly VER_14_1 = PostgresEngineVersion.of('14.1', '14', { s3Import: true, s3Export: true }); /** Version "14.2". */ public static readonly VER_14_2 = PostgresEngineVersion.of('14.2', '14', { s3Import: true, s3Export: true }); + /** Version "14.3". */ + public static readonly VER_14_3 = PostgresEngineVersion.of('14.3', '14', { s3Import: true, s3Export: true }); /** * Create a new PostgresEngineVersion with an arbitrary version. diff --git a/packages/@aws-cdk/aws-rds/test/mariadb/mariadb.instance-engine.test.ts b/packages/@aws-cdk/aws-rds/test/mariadb/mariadb.instance-engine.test.ts new file mode 100644 index 0000000000000..f2aa303812dfd --- /dev/null +++ b/packages/@aws-cdk/aws-rds/test/mariadb/mariadb.instance-engine.test.ts @@ -0,0 +1,91 @@ +import { Template } from '@aws-cdk/assertions'; +import * as core from '@aws-cdk/core'; +import * as rds from '../../lib'; + +describe('MariaDB server instance engine', () => { + describe('MariaDB instance engine versions', () => { + test("has MajorEngineVersion ending in '10.3' for major version 10.3", () => { + const stack = new core.Stack(); + new rds.OptionGroup(stack, 'OptionGroup', { + engine: rds.DatabaseInstanceEngine.mariaDb({ + version: rds.MariaDbEngineVersion.VER_10_3, + }), + configurations: [ + { + name: 'MARIADB_BACKUP_RESTORE', + settings: { + IAM_ROLE_ARN: 'some-role-arn', + }, + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::OptionGroup', { + MajorEngineVersion: '10.3', + }); + }); + + test("has MajorEngineVersion ending in '10.4' for major version 10.4", () => { + const stack = new core.Stack(); + new rds.OptionGroup(stack, 'OptionGroup', { + engine: rds.DatabaseInstanceEngine.mariaDb({ + version: rds.MariaDbEngineVersion.VER_10_4, + }), + configurations: [ + { + name: 'MARIADB_BACKUP_RESTORE', + settings: { + IAM_ROLE_ARN: 'some-role-arn', + }, + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::OptionGroup', { + MajorEngineVersion: '10.4', + }); + }); + + test("has MajorEngineVersion ending in '10.5' for major version 10.5", () => { + const stack = new core.Stack(); + new rds.OptionGroup(stack, 'OptionGroup', { + engine: rds.DatabaseInstanceEngine.mariaDb({ + version: rds.MariaDbEngineVersion.VER_10_5, + }), + configurations: [ + { + name: 'MARIADB_BACKUP_RESTORE', + settings: { + IAM_ROLE_ARN: 'some-role-arn', + }, + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::OptionGroup', { + MajorEngineVersion: '10.5', + }); + }); + + test("has MajorEngineVersion ending in '10.6' for major version 10.6", () => { + const stack = new core.Stack(); + new rds.OptionGroup(stack, 'OptionGroup', { + engine: rds.DatabaseInstanceEngine.mariaDb({ + version: rds.MariaDbEngineVersion.VER_10_6, + }), + configurations: [ + { + name: 'MARIADB_BACKUP_RESTORE', + settings: { + IAM_ROLE_ARN: 'some-role-arn', + }, + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::OptionGroup', { + MajorEngineVersion: '10.6', + }); + }); + }); +}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts b/packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts index 49785c5093b33..abaf1e2be63ee 100644 --- a/packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts +++ b/packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts @@ -299,7 +299,7 @@ export class BucketDeployment extends Construct { uuid: this.renderSingletonUuid(props.memoryLimit, props.ephemeralStorageSize, props.vpc), code: lambda.Code.fromAsset(path.join(__dirname, 'lambda')), layers: [new AwsCliLayer(this, 'AwsCliLayer')], - runtime: lambda.Runtime.PYTHON_3_7, + runtime: lambda.Runtime.PYTHON_3_9, environment: props.useEfs ? { MOUNT_PATH: mountPath, } : undefined, diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js new file mode 100644 index 0000000000000..9df94382cc74e --- /dev/null +++ b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js @@ -0,0 +1,118 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.handler = exports.external = void 0; +const https = require("https"); +const url = require("url"); +// for unit tests +exports.external = { + sendHttpRequest: defaultSendHttpRequest, + log: defaultLog, + includeStackTraces: true, + userHandlerIndex: './index', +}; +const CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; +const MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; +async function handler(event, context) { + const sanitizedEvent = { ...event, ResponseURL: '...' }; + exports.external.log(JSON.stringify(sanitizedEvent, undefined, 2)); + // ignore DELETE event when the physical resource ID is the marker that + // indicates that this DELETE is a subsequent DELETE to a failed CREATE + // operation. + if (event.RequestType === 'Delete' && event.PhysicalResourceId === CREATE_FAILED_PHYSICAL_ID_MARKER) { + exports.external.log('ignoring DELETE event caused by a failed CREATE event'); + await submitResponse('SUCCESS', event); + return; + } + try { + // invoke the user handler. this is intentionally inside the try-catch to + // ensure that if there is an error it's reported as a failure to + // cloudformation (otherwise cfn waits). + // eslint-disable-next-line @typescript-eslint/no-require-imports + const userHandler = require(exports.external.userHandlerIndex).handler; + const result = await userHandler(sanitizedEvent, context); + // validate user response and create the combined event + const responseEvent = renderResponse(event, result); + // submit to cfn as success + await submitResponse('SUCCESS', responseEvent); + } + catch (e) { + const resp = { + ...event, + Reason: exports.external.includeStackTraces ? e.stack : e.message, + }; + if (!resp.PhysicalResourceId) { + // special case: if CREATE fails, which usually implies, we usually don't + // have a physical resource id. in this case, the subsequent DELETE + // operation does not have any meaning, and will likely fail as well. to + // address this, we use a marker so the provider framework can simply + // ignore the subsequent DELETE. + if (event.RequestType === 'Create') { + exports.external.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); + resp.PhysicalResourceId = CREATE_FAILED_PHYSICAL_ID_MARKER; + } + else { + // otherwise, if PhysicalResourceId is not specified, something is + // terribly wrong because all other events should have an ID. + exports.external.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`); + } + } + // this is an actual error, fail the activity altogether and exist. + await submitResponse('FAILED', resp); + } +} +exports.handler = handler; +function renderResponse(cfnRequest, handlerResponse = {}) { + // if physical ID is not returned, we have some defaults for you based + // on the request type. + const physicalResourceId = handlerResponse.PhysicalResourceId ?? cfnRequest.PhysicalResourceId ?? cfnRequest.RequestId; + // if we are in DELETE and physical ID was changed, it's an error. + if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { + throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${handlerResponse.PhysicalResourceId}" during deletion`); + } + // merge request event and result event (result prevails). + return { + ...cfnRequest, + ...handlerResponse, + PhysicalResourceId: physicalResourceId, + }; +} +async function submitResponse(status, event) { + const json = { + Status: status, + Reason: event.Reason ?? status, + StackId: event.StackId, + RequestId: event.RequestId, + PhysicalResourceId: event.PhysicalResourceId || MISSING_PHYSICAL_ID_MARKER, + LogicalResourceId: event.LogicalResourceId, + NoEcho: event.NoEcho, + Data: event.Data, + }; + exports.external.log('submit response to cloudformation', json); + const responseBody = JSON.stringify(json); + const parsedUrl = url.parse(event.ResponseURL); + const req = { + hostname: parsedUrl.hostname, + path: parsedUrl.path, + method: 'PUT', + headers: { 'content-type': '', 'content-length': responseBody.length }, + }; + await exports.external.sendHttpRequest(req, responseBody); +} +async function defaultSendHttpRequest(options, responseBody) { + return new Promise((resolve, reject) => { + try { + const request = https.request(options, _ => resolve()); + request.on('error', reject); + request.write(responseBody); + request.end(); + } + catch (e) { + reject(e); + } + }); +} +function defaultLog(fmt, ...params) { + // eslint-disable-next-line no-console + console.log(fmt, ...params); +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZWpzLWVudHJ5cG9pbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJub2RlanMtZW50cnlwb2ludC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBK0I7QUFDL0IsMkJBQTJCO0FBRTNCLGlCQUFpQjtBQUNKLFFBQUEsUUFBUSxHQUFHO0lBQ3RCLGVBQWUsRUFBRSxzQkFBc0I7SUFDdkMsR0FBRyxFQUFFLFVBQVU7SUFDZixrQkFBa0IsRUFBRSxJQUFJO0lBQ3hCLGdCQUFn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c29sZVxuICBjb25zb2xlLmxvZyhmbXQsIC4uLnBhcmFtcyk7XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/index.d.ts b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/index.d.ts rename to packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/index.js b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.js similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/index.js rename to packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.js diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/index.ts b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/index.ts rename to packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476.zip b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262.zip similarity index 69% rename from packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476.zip rename to packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262.zip index e478968fa8400..0e782f0e80200 100644 Binary files a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476.zip and b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262.zip differ diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/__entrypoint__.js b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/__entrypoint__.js deleted file mode 100644 index 3475719002c73..0000000000000 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/__entrypoint__.js +++ /dev/null @@ -1,119 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = exports.external = void 0; -const https = require("https"); -const url = require("url"); -// for unit tests -exports.external = { - sendHttpRequest: defaultSendHttpRequest, - log: defaultLog, - includeStackTraces: true, - userHandlerIndex: './index', -}; -const CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; -const MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; -async function handler(event, context) { - exports.external.log(JSON.stringify(event, undefined, 2)); - // ignore DELETE event when the physical resource ID is the marker that - // indicates that this DELETE is a subsequent DELETE to a failed CREATE - // operation. - if (event.RequestType === 'Delete' && event.PhysicalResourceId === CREATE_FAILED_PHYSICAL_ID_MARKER) { - exports.external.log('ignoring DELETE event caused by a failed CREATE event'); - await submitResponse('SUCCESS', event); - return; - } - try { - // invoke the user handler. this is intentionally inside the try-catch to - // ensure that if there is an error it's reported as a failure to - // cloudformation (otherwise cfn waits). - // eslint-disable-next-line @typescript-eslint/no-require-imports - const userHandler = require(exports.external.userHandlerIndex).handler; - const result = await userHandler(event, context); - // validate user response and create the combined event - const responseEvent = renderResponse(event, result); - // submit to cfn as success - await submitResponse('SUCCESS', responseEvent); - } - catch (e) { - const resp = { - ...event, - Reason: exports.external.includeStackTraces ? e.stack : e.message, - }; - if (!resp.PhysicalResourceId) { - // special case: if CREATE fails, which usually implies, we usually don't - // have a physical resource id. in this case, the subsequent DELETE - // operation does not have any meaning, and will likely fail as well. to - // address this, we use a marker so the provider framework can simply - // ignore the subsequent DELETE. - if (event.RequestType === 'Create') { - exports.external.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); - resp.PhysicalResourceId = CREATE_FAILED_PHYSICAL_ID_MARKER; - } - else { - // otherwise, if PhysicalResourceId is not specified, something is - // terribly wrong because all other events should have an ID. - exports.external.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`); - } - } - // this is an actual error, fail the activity altogether and exist. - await submitResponse('FAILED', resp); - } -} -exports.handler = handler; -function renderResponse(cfnRequest, handlerResponse = {}) { - var _a, _b; - // if physical ID is not returned, we have some defaults for you based - // on the request type. - const physicalResourceId = (_b = (_a = handlerResponse.PhysicalResourceId) !== null && _a !== void 0 ? _a : cfnRequest.PhysicalResourceId) !== null && _b !== void 0 ? _b : cfnRequest.RequestId; - // if we are in DELETE and physical ID was changed, it's an error. - if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { - throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${handlerResponse.PhysicalResourceId}" during deletion`); - } - // merge request event and result event (result prevails). - return { - ...cfnRequest, - ...handlerResponse, - PhysicalResourceId: physicalResourceId, - }; -} -async function submitResponse(status, event) { - var _a; - const json = { - Status: status, - Reason: (_a = event.Reason) !== null && _a !== void 0 ? _a : status, - StackId: event.StackId, - RequestId: event.RequestId, - PhysicalResourceId: event.PhysicalResourceId || MISSING_PHYSICAL_ID_MARKER, - LogicalResourceId: event.LogicalResourceId, - NoEcho: event.NoEcho, - Data: event.Data, - }; - exports.external.log('submit response to cloudformation', json); - const responseBody = JSON.stringify(json); - const parsedUrl = url.parse(event.ResponseURL); - const req = { - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: 'PUT', - headers: { 'content-type': '', 'content-length': responseBody.length }, - }; - await exports.external.sendHttpRequest(req, responseBody); -} -async function defaultSendHttpRequest(options, responseBody) { - return new Promise((resolve, reject) => { - try { - const request = https.request(options, _ => resolve()); - request.on('error', reject); - request.write(responseBody); - request.end(); - } - catch (e) { - reject(e); - } - }); -} -function defaultLog(fmt, ...params) { - // eslint-disable-next-line no-console - console.log(fmt, ...params); -} -//# sour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HtcbiAgICAgIHJlamVjdChlKTtcbiAgICB9XG4gIH0pO1xufVxuXG5mdW5jdGlvbiBkZWZhdWx0TG9nKGZtdDogc3RyaW5nLCAuLi5wYXJhbXM6IGFueVtdKSB7XG4gIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1jb25zb2xlXG4gIGNvbnNvbGUubG9nKGZtdCwgLi4ucGFyYW1zKTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.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-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/manifest.json index dd18b232b6944..3542fe30bdbf7 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -19,25 +19,25 @@ { "type": "aws:cdk:asset", "data": { - "path": "asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824", - "id": "be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824", + "path": "asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26", + "id": "60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26", "packaging": "zip", - "sourceHash": "be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824", - "s3BucketParameter": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3Bucket09A62232", - "s3KeyParameter": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3VersionKeyA28118BE", - "artifactHashParameter": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824ArtifactHash76F8FCF2" + "sourceHash": "60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26", + "s3BucketParameter": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3Bucket180EC6B2", + "s3KeyParameter": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3VersionKeyF1ADAF48", + "artifactHashParameter": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26ArtifactHashF709D3CB" } }, { "type": "aws:cdk:asset", "data": { - "path": "asset.01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476.zip", - "id": "01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476", + "path": "asset.672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262.zip", + "id": "672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262", "packaging": "file", - "sourceHash": "01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476", - "s3BucketParameter": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4", - "s3KeyParameter": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0", - "artifactHashParameter": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476ArtifactHash0FB7E57C" + "sourceHash": "672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262", + "s3BucketParameter": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4", + "s3KeyParameter": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764", + "artifactHashParameter": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262ArtifactHash9E8C5685" } }, { @@ -95,40 +95,40 @@ "data": "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F" } ], - "/test-bucket-deployments-1/AssetParameters/be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/S3Bucket": [ + "/test-bucket-deployments-1/AssetParameters/60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/S3Bucket": [ { "type": "aws:cdk:logicalId", - "data": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3Bucket09A62232" + "data": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3Bucket180EC6B2" } ], - "/test-bucket-deployments-1/AssetParameters/be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/S3VersionKey": [ + "/test-bucket-deployments-1/AssetParameters/60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/S3VersionKey": [ { "type": "aws:cdk:logicalId", - "data": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3VersionKeyA28118BE" + "data": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3VersionKeyF1ADAF48" } ], - "/test-bucket-deployments-1/AssetParameters/be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/ArtifactHash": [ + "/test-bucket-deployments-1/AssetParameters/60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/ArtifactHash": [ { "type": "aws:cdk:logicalId", - "data": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824ArtifactHash76F8FCF2" + "data": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26ArtifactHashF709D3CB" } ], - "/test-bucket-deployments-1/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476/S3Bucket": [ + "/test-bucket-deployments-1/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262/S3Bucket": [ { "type": "aws:cdk:logicalId", - "data": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "data": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" } ], - "/test-bucket-deployments-1/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476/S3VersionKey": [ + "/test-bucket-deployments-1/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262/S3VersionKey": [ { "type": "aws:cdk:logicalId", - "data": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "data": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ], - "/test-bucket-deployments-1/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476/ArtifactHash": [ + "/test-bucket-deployments-1/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262/ArtifactHash": [ { "type": "aws:cdk:logicalId", - "data": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476ArtifactHash0FB7E57C" + "data": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262ArtifactHash9E8C5685" } ], "/test-bucket-deployments-1/AssetParameters/f98b78092dcdd31f5e6d47489beb5f804d4835ef86a8085d0a2053cb9ae711da/S3Bucket": [ diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/test-bucket-deployments-1.assets.json b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/test-bucket-deployments-1.assets.json index cea6e6c783143..51fe8eb558b3a 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/test-bucket-deployments-1.assets.json +++ b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/test-bucket-deployments-1.assets.json @@ -1,28 +1,28 @@ { - "version": "17.0.0", + "version": "20.0.0", "files": { - "be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824": { + "60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26": { "source": { - "path": "asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824", + "path": "asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824.zip", + "objectKey": "60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476": { + "672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262": { "source": { - "path": "asset.01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476.zip", + "path": "asset.672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262.zip", "packaging": "file" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476.zip", + "objectKey": "672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } @@ -53,7 +53,7 @@ } } }, - "39a0b3ad336e3252b0c27b4a31a6e35e09d6de50d368545a5b8ec4abf560b90c": { + "4ede274a48c7a8a8140dd2d5dab420cc87a7fc5544ed203fc4399eb8b396ce9d": { "source": { "path": "test-bucket-deployments-1.template.json", "packaging": "file" @@ -61,7 +61,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "39a0b3ad336e3252b0c27b4a31a6e35e09d6de50d368545a5b8ec4abf560b90c.json", + "objectKey": "4ede274a48c7a8a8140dd2d5dab420cc87a7fc5544ed203fc4399eb8b396ce9d.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-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/test-bucket-deployments-1.template.json b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/test-bucket-deployments-1.template.json index 64f79d32009bb..34de7f9a03ba5 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/test-bucket-deployments-1.template.json +++ b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/test-bucket-deployments-1.template.json @@ -114,7 +114,7 @@ "Properties": { "Code": { "S3Bucket": { - "Ref": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3Bucket09A62232" + "Ref": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3Bucket180EC6B2" }, "S3Key": { "Fn::Join": [ @@ -127,7 +127,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3VersionKeyA28118BE" + "Ref": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3VersionKeyF1ADAF48" } ] } @@ -140,7 +140,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3VersionKeyA28118BE" + "Ref": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3VersionKeyF1ADAF48" } ] } @@ -230,7 +230,7 @@ "Properties": { "Content": { "S3Bucket": { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" }, "S3Key": { "Fn::Join": [ @@ -243,7 +243,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -256,7 +256,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -519,7 +519,7 @@ "Ref": "DeployWithInvalidationAwsCliLayerDEDD5787" } ], - "Runtime": "python3.7", + "Runtime": "python3.9", "Timeout": 900 }, "DependsOn": [ @@ -529,29 +529,29 @@ } }, "Parameters": { - "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3Bucket09A62232": { + "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3Bucket180EC6B2": { "Type": "String", - "Description": "S3 bucket for asset \"be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824\"" + "Description": "S3 bucket for asset \"60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26\"" }, - "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3VersionKeyA28118BE": { + "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3VersionKeyF1ADAF48": { "Type": "String", - "Description": "S3 key for asset version \"be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824\"" + "Description": "S3 key for asset version \"60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26\"" }, - "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824ArtifactHash76F8FCF2": { + "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26ArtifactHashF709D3CB": { "Type": "String", - "Description": "Artifact hash for asset \"be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824\"" + "Description": "Artifact hash for asset \"60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26\"" }, - "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4": { + "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4": { "Type": "String", - "Description": "S3 bucket for asset \"01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476\"" + "Description": "S3 bucket for asset \"672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262\"" }, - "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0": { + "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764": { "Type": "String", - "Description": "S3 key for asset version \"01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476\"" + "Description": "S3 key for asset version \"672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262\"" }, - "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476ArtifactHash0FB7E57C": { + "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262ArtifactHash9E8C5685": { "Type": "String", - "Description": "Artifact hash for asset \"01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476\"" + "Description": "Artifact hash for asset \"672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262\"" }, "AssetParametersf98b78092dcdd31f5e6d47489beb5f804d4835ef86a8085d0a2053cb9ae711daS3BucketF23C0DE7": { "Type": "String", diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/tree.json b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/tree.json index 10b4184a4dbc1..b0c465d283022 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-cloudfront.integ.snapshot/tree.json @@ -9,7 +9,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } }, "test-bucket-deployments-1": { @@ -174,13 +174,13 @@ "id": "AssetParameters", "path": "test-bucket-deployments-1/AssetParameters", "children": { - "be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824": { - "id": "be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824", - "path": "test-bucket-deployments-1/AssetParameters/be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824", + "60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26": { + "id": "60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26", + "path": "test-bucket-deployments-1/AssetParameters/60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26", "children": { "S3Bucket": { "id": "S3Bucket", - "path": "test-bucket-deployments-1/AssetParameters/be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/S3Bucket", + "path": "test-bucket-deployments-1/AssetParameters/60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/S3Bucket", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -188,7 +188,7 @@ }, "S3VersionKey": { "id": "S3VersionKey", - "path": "test-bucket-deployments-1/AssetParameters/be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/S3VersionKey", + "path": "test-bucket-deployments-1/AssetParameters/60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/S3VersionKey", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -196,7 +196,7 @@ }, "ArtifactHash": { "id": "ArtifactHash", - "path": "test-bucket-deployments-1/AssetParameters/be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/ArtifactHash", + "path": "test-bucket-deployments-1/AssetParameters/60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/ArtifactHash", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -205,16 +205,16 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } }, - "01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476": { - "id": "01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476", - "path": "test-bucket-deployments-1/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476", + "672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262": { + "id": "672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262", + "path": "test-bucket-deployments-1/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262", "children": { "S3Bucket": { "id": "S3Bucket", - "path": "test-bucket-deployments-1/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476/S3Bucket", + "path": "test-bucket-deployments-1/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262/S3Bucket", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -222,7 +222,7 @@ }, "S3VersionKey": { "id": "S3VersionKey", - "path": "test-bucket-deployments-1/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476/S3VersionKey", + "path": "test-bucket-deployments-1/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262/S3VersionKey", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -230,7 +230,7 @@ }, "ArtifactHash": { "id": "ArtifactHash", - "path": "test-bucket-deployments-1/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476/ArtifactHash", + "path": "test-bucket-deployments-1/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262/ArtifactHash", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -239,7 +239,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } }, "f98b78092dcdd31f5e6d47489beb5f804d4835ef86a8085d0a2053cb9ae711da": { @@ -273,7 +273,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } }, "fc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222e": { @@ -307,13 +307,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } }, "Distribution": { @@ -424,7 +424,7 @@ "aws:cdk:cloudformation:props": { "content": { "s3Bucket": { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" }, "s3Key": { "Fn::Join": [ @@ -437,7 +437,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -450,7 +450,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -787,7 +787,7 @@ "Ref": "DeployWithInvalidationAwsCliLayerDEDD5787" } ], - "runtime": "python3.7", + "runtime": "python3.9", "timeout": 900 } }, diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/TestBucketDeploymentContent.assets.json b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/TestBucketDeploymentContent.assets.json index 0a331d73a886e..27b342637d131 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/TestBucketDeploymentContent.assets.json +++ b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/TestBucketDeploymentContent.assets.json @@ -1,15 +1,15 @@ { - "version": "17.0.0", + "version": "20.0.0", "files": { - "01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476": { + "672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262": { "source": { - "path": "asset.01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476.zip", + "path": "asset.672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262.zip", "packaging": "file" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476.zip", + "objectKey": "672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } @@ -66,7 +66,7 @@ } } }, - "a2502ee64d52a7e96ba5c899754aa37ed7c1254348a03fe90a51e6b9175b2300": { + "3ed0eab4bbbed28428c86b436726f701c9ddf664e0069753d3a5ebc00f0edcd9": { "source": { "path": "TestBucketDeploymentContent.template.json", "packaging": "file" @@ -74,7 +74,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "a2502ee64d52a7e96ba5c899754aa37ed7c1254348a03fe90a51e6b9175b2300.json", + "objectKey": "3ed0eab4bbbed28428c86b436726f701c9ddf664e0069753d3a5ebc00f0edcd9.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-s3-deployment/test/bucket-deployment-data.integ.snapshot/TestBucketDeploymentContent.template.json b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/TestBucketDeploymentContent.template.json index 446bf4c05c8a3..c4c6e0603aeb3 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/TestBucketDeploymentContent.template.json +++ b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/TestBucketDeploymentContent.template.json @@ -18,7 +18,7 @@ "Properties": { "Content": { "S3Bucket": { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" }, "S3Key": { "Fn::Join": [ @@ -31,7 +31,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -44,7 +44,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -443,7 +443,7 @@ "Ref": "DeployMeAwsCliLayer5F9219E9" } ], - "Runtime": "python3.7", + "Runtime": "python3.9", "Timeout": 900 }, "DependsOn": [ @@ -453,17 +453,17 @@ } }, "Parameters": { - "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4": { + "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4": { "Type": "String", - "Description": "S3 bucket for asset \"01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476\"" + "Description": "S3 bucket for asset \"672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262\"" }, - "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0": { + "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764": { "Type": "String", - "Description": "S3 key for asset version \"01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476\"" + "Description": "S3 key for asset version \"672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262\"" }, - "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476ArtifactHash0FB7E57C": { + "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262ArtifactHash9E8C5685": { "Type": "String", - "Description": "Artifact hash for asset \"01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476\"" + "Description": "Artifact hash for asset \"672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262\"" }, "AssetParametersf98b78092dcdd31f5e6d47489beb5f804d4835ef86a8085d0a2053cb9ae711daS3BucketF23C0DE7": { "Type": "String", diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/asset.01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476.zip b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/asset.672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262.zip similarity index 69% rename from packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/asset.01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476.zip rename to packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/asset.672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262.zip index e478968fa8400..0e782f0e80200 100644 Binary files a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/asset.01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476.zip and b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/asset.672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262.zip differ diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.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-s3-deployment/test/bucket-deployment-data.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/manifest.json index 83d1462428de2..c1683f5aaebdc 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -19,13 +19,13 @@ { "type": "aws:cdk:asset", "data": { - "path": "asset.01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476.zip", - "id": "01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476", + "path": "asset.672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262.zip", + "id": "672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262", "packaging": "file", - "sourceHash": "01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476", - "s3BucketParameter": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4", - "s3KeyParameter": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0", - "artifactHashParameter": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476ArtifactHash0FB7E57C" + "sourceHash": "672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262", + "s3BucketParameter": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4", + "s3KeyParameter": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764", + "artifactHashParameter": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262ArtifactHash9E8C5685" } }, { @@ -95,22 +95,22 @@ "data": "DeployMeCustomResource4455EE35" } ], - "/TestBucketDeploymentContent/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476/S3Bucket": [ + "/TestBucketDeploymentContent/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262/S3Bucket": [ { "type": "aws:cdk:logicalId", - "data": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "data": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" } ], - "/TestBucketDeploymentContent/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476/S3VersionKey": [ + "/TestBucketDeploymentContent/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262/S3VersionKey": [ { "type": "aws:cdk:logicalId", - "data": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "data": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ], - "/TestBucketDeploymentContent/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476/ArtifactHash": [ + "/TestBucketDeploymentContent/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262/ArtifactHash": [ { "type": "aws:cdk:logicalId", - "data": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476ArtifactHash0FB7E57C" + "data": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262ArtifactHash9E8C5685" } ], "/TestBucketDeploymentContent/AssetParameters/f98b78092dcdd31f5e6d47489beb5f804d4835ef86a8085d0a2053cb9ae711da/S3Bucket": [ diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/tree.json b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/tree.json index e6dd6e531dbbd..c6d3babc7d412 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment-data.integ.snapshot/tree.json @@ -9,7 +9,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } }, "TestBucketDeploymentContent": { @@ -87,7 +87,7 @@ "aws:cdk:cloudformation:props": { "content": { "s3Bucket": { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" }, "s3Key": { "Fn::Join": [ @@ -100,7 +100,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -113,7 +113,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -251,13 +251,13 @@ "id": "AssetParameters", "path": "TestBucketDeploymentContent/AssetParameters", "children": { - "01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476": { - "id": "01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476", - "path": "TestBucketDeploymentContent/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476", + "672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262": { + "id": "672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262", + "path": "TestBucketDeploymentContent/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262", "children": { "S3Bucket": { "id": "S3Bucket", - "path": "TestBucketDeploymentContent/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476/S3Bucket", + "path": "TestBucketDeploymentContent/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262/S3Bucket", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -265,7 +265,7 @@ }, "S3VersionKey": { "id": "S3VersionKey", - "path": "TestBucketDeploymentContent/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476/S3VersionKey", + "path": "TestBucketDeploymentContent/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262/S3VersionKey", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -273,7 +273,7 @@ }, "ArtifactHash": { "id": "ArtifactHash", - "path": "TestBucketDeploymentContent/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476/ArtifactHash", + "path": "TestBucketDeploymentContent/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262/ArtifactHash", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -282,7 +282,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } }, "f98b78092dcdd31f5e6d47489beb5f804d4835ef86a8085d0a2053cb9ae711da": { @@ -316,7 +316,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } }, "d09271be89b6cb0398f793b40c1531fd9b076aa92ba80b5e436914b1808fe18d": { @@ -350,7 +350,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } }, "0f14dedeaf4386031c978375cbda0f65d7b52b29452cabb8873eb8f0d0fa936b": { @@ -384,7 +384,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } }, "0d7be86c2a7d62be64fcbe2cbaa36c912a72d445022cc17c37af4f99f1b97a5a": { @@ -418,13 +418,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } }, "Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C": { @@ -736,7 +736,7 @@ "Ref": "DeployMeAwsCliLayer5F9219E9" } ], - "runtime": "python3.7", + "runtime": "python3.9", "timeout": 900 } }, diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js new file mode 100644 index 0000000000000..9df94382cc74e --- /dev/null +++ b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js @@ -0,0 +1,118 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.handler = exports.external = void 0; +const https = require("https"); +const url = require("url"); +// for unit tests +exports.external = { + sendHttpRequest: defaultSendHttpRequest, + log: defaultLog, + includeStackTraces: true, + userHandlerIndex: './index', +}; +const CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; +const MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; +async function handler(event, context) { + const sanitizedEvent = { ...event, ResponseURL: '...' }; + exports.external.log(JSON.stringify(sanitizedEvent, undefined, 2)); + // ignore DELETE event when the physical resource ID is the marker that + // indicates that this DELETE is a subsequent DELETE to a failed CREATE + // operation. + if (event.RequestType === 'Delete' && event.PhysicalResourceId === CREATE_FAILED_PHYSICAL_ID_MARKER) { + exports.external.log('ignoring DELETE event caused by a failed CREATE event'); + await submitResponse('SUCCESS', event); + return; + } + try { + // invoke the user handler. this is intentionally inside the try-catch to + // ensure that if there is an error it's reported as a failure to + // cloudformation (otherwise cfn waits). + // eslint-disable-next-line @typescript-eslint/no-require-imports + const userHandler = require(exports.external.userHandlerIndex).handler; + const result = await userHandler(sanitizedEvent, context); + // validate user response and create the combined event + const responseEvent = renderResponse(event, result); + // submit to cfn as success + await submitResponse('SUCCESS', responseEvent); + } + catch (e) { + const resp = { + ...event, + Reason: exports.external.includeStackTraces ? e.stack : e.message, + }; + if (!resp.PhysicalResourceId) { + // special case: if CREATE fails, which usually implies, we usually don't + // have a physical resource id. in this case, the subsequent DELETE + // operation does not have any meaning, and will likely fail as well. to + // address this, we use a marker so the provider framework can simply + // ignore the subsequent DELETE. + if (event.RequestType === 'Create') { + exports.external.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); + resp.PhysicalResourceId = CREATE_FAILED_PHYSICAL_ID_MARKER; + } + else { + // otherwise, if PhysicalResourceId is not specified, something is + // terribly wrong because all other events should have an ID. + exports.external.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`); + } + } + // this is an actual error, fail the activity altogether and exist. + await submitResponse('FAILED', resp); + } +} +exports.handler = handler; +function renderResponse(cfnRequest, handlerResponse = {}) { + // if physical ID is not returned, we have some defaults for you based + // on the request type. + const physicalResourceId = handlerResponse.PhysicalResourceId ?? cfnRequest.PhysicalResourceId ?? cfnRequest.RequestId; + // if we are in DELETE and physical ID was changed, it's an error. + if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { + throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${handlerResponse.PhysicalResourceId}" during deletion`); + } + // merge request event and result event (result prevails). + return { + ...cfnRequest, + ...handlerResponse, + PhysicalResourceId: physicalResourceId, + }; +} +async function submitResponse(status, event) { + const json = { + Status: status, + Reason: event.Reason ?? status, + StackId: event.StackId, + RequestId: event.RequestId, + PhysicalResourceId: event.PhysicalResourceId || MISSING_PHYSICAL_ID_MARKER, + LogicalResourceId: event.LogicalResourceId, + NoEcho: event.NoEcho, + Data: event.Data, + }; + exports.external.log('submit response to cloudformation', json); + const responseBody = JSON.stringify(json); + const parsedUrl = url.parse(event.ResponseURL); + const req = { + hostname: parsedUrl.hostname, + path: parsedUrl.path, + method: 'PUT', + headers: { 'content-type': '', 'content-length': responseBody.length }, + }; + await exports.external.sendHttpRequest(req, responseBody); +} +async function defaultSendHttpRequest(options, responseBody) { + return new Promise((resolve, reject) => { + try { + const request = https.request(options, _ => resolve()); + request.on('error', reject); + request.write(responseBody); + request.end(); + } + catch (e) { + reject(e); + } + }); +} +function defaultLog(fmt, ...params) { + // eslint-disable-next-line no-console + console.log(fmt, ...params); +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZWpzLWVudHJ5cG9pbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJub2RlanMtZW50cnlwb2ludC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBK0I7QUFDL0IsMkJBQTJCO0FBRTNCLGlCQUFpQjtBQUNKLFFBQUEsUUFBUSxHQUFHO0lBQ3RCLGVBQWUsRUFBRSxzQkFBc0I7SUFDdkMsR0FBRyxFQUFFLFVBQVU7SUFDZ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c2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbm8tY29uc29sZVxuICBjb25zb2xlLmxvZyhmbXQsIC4uLnBhcmFtcyk7XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/index.d.ts b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/index.d.ts rename to packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/index.js b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.js similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/index.js rename to packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.js diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/index.ts b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/index.ts rename to packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476.zip b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262.zip similarity index 69% rename from packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476.zip rename to packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262.zip index e478968fa8400..0e782f0e80200 100644 Binary files a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476.zip and b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262.zip differ diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/__entrypoint__.js b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/__entrypoint__.js deleted file mode 100644 index 3475719002c73..0000000000000 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/__entrypoint__.js +++ /dev/null @@ -1,119 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = exports.external = void 0; -const https = require("https"); -const url = require("url"); -// for unit tests -exports.external = { - sendHttpRequest: defaultSendHttpRequest, - log: defaultLog, - includeStackTraces: true, - userHandlerIndex: './index', -}; -const CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; -const MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; -async function handler(event, context) { - exports.external.log(JSON.stringify(event, undefined, 2)); - // ignore DELETE event when the physical resource ID is the marker that - // indicates that this DELETE is a subsequent DELETE to a failed CREATE - // operation. - if (event.RequestType === 'Delete' && event.PhysicalResourceId === CREATE_FAILED_PHYSICAL_ID_MARKER) { - exports.external.log('ignoring DELETE event caused by a failed CREATE event'); - await submitResponse('SUCCESS', event); - return; - } - try { - // invoke the user handler. this is intentionally inside the try-catch to - // ensure that if there is an error it's reported as a failure to - // cloudformation (otherwise cfn waits). - // eslint-disable-next-line @typescript-eslint/no-require-imports - const userHandler = require(exports.external.userHandlerIndex).handler; - const result = await userHandler(event, context); - // validate user response and create the combined event - const responseEvent = renderResponse(event, result); - // submit to cfn as success - await submitResponse('SUCCESS', responseEvent); - } - catch (e) { - const resp = { - ...event, - Reason: exports.external.includeStackTraces ? e.stack : e.message, - }; - if (!resp.PhysicalResourceId) { - // special case: if CREATE fails, which usually implies, we usually don't - // have a physical resource id. in this case, the subsequent DELETE - // operation does not have any meaning, and will likely fail as well. to - // address this, we use a marker so the provider framework can simply - // ignore the subsequent DELETE. - if (event.RequestType === 'Create') { - exports.external.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); - resp.PhysicalResourceId = CREATE_FAILED_PHYSICAL_ID_MARKER; - } - else { - // otherwise, if PhysicalResourceId is not specified, something is - // terribly wrong because all other events should have an ID. - exports.external.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`); - } - } - // this is an actual error, fail the activity altogether and exist. - await submitResponse('FAILED', resp); - } -} -exports.handler = handler; -function renderResponse(cfnRequest, handlerResponse = {}) { - var _a, _b; - // if physical ID is not returned, we have some defaults for you based - // on the request type. - const physicalResourceId = (_b = (_a = handlerResponse.PhysicalResourceId) !== null && _a !== void 0 ? _a : cfnRequest.PhysicalResourceId) !== null && _b !== void 0 ? _b : cfnRequest.RequestId; - // if we are in DELETE and physical ID was changed, it's an error. - if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { - throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${handlerResponse.PhysicalResourceId}" during deletion`); - } - // merge request event and result event (result prevails). - return { - ...cfnRequest, - ...handlerResponse, - PhysicalResourceId: physicalResourceId, - }; -} -async function submitResponse(status, event) { - var _a; - const json = { - Status: status, - Reason: (_a = event.Reason) !== null && _a !== void 0 ? _a : status, - StackId: event.StackId, - RequestId: event.RequestId, - PhysicalResourceId: event.PhysicalResourceId || MISSING_PHYSICAL_ID_MARKER, - LogicalResourceId: event.LogicalResourceId, - NoEcho: event.NoEcho, - Data: event.Data, - }; - exports.external.log('submit response to cloudformation', json); - const responseBody = JSON.stringify(json); - const parsedUrl = url.parse(event.ResponseURL); - const req = { - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: 'PUT', - headers: { 'content-type': '', 'content-length': responseBody.length }, - }; - await exports.external.sendHttpRequest(req, responseBody); -} -async function defaultSendHttpRequest(options, responseBody) { - return new Promise((resolve, reject) => { - try { - const request = https.request(options, _ => resolve()); - request.on('error', reject); - request.write(responseBody); - request.end(); - } - catch (e) { - reject(e); - } - }); -} -function defaultLog(fmt, ...params) { - // eslint-disable-next-line no-console - console.log(fmt, ...params); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZWpzLWVudHJ5cG9pbnQuanMiLCJzb3VyY2VSb290Ij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5nLCAuLi5wYXJhbXM6IGFueVtdKSB7XG4gIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1jb25zb2xlXG4gIGNvbnNvbGUubG9nKGZtdCwgLi4ucGFyYW1zKTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/cdk.out index 90bef2e09ad39..588d7b269d34f 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.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-s3-deployment/test/bucket-deployment.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/manifest.json index 6ee81885a425c..3c1bdb7b9eee9 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "17.0.0", + "version": "20.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -19,25 +19,25 @@ { "type": "aws:cdk:asset", "data": { - "path": "asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824", - "id": "be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824", + "path": "asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26", + "id": "60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26", "packaging": "zip", - "sourceHash": "be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824", - "s3BucketParameter": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3Bucket09A62232", - "s3KeyParameter": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3VersionKeyA28118BE", - "artifactHashParameter": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824ArtifactHash76F8FCF2" + "sourceHash": "60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26", + "s3BucketParameter": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3Bucket180EC6B2", + "s3KeyParameter": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3VersionKeyF1ADAF48", + "artifactHashParameter": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26ArtifactHashF709D3CB" } }, { "type": "aws:cdk:asset", "data": { - "path": "asset.01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476.zip", - "id": "01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476", + "path": "asset.672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262.zip", + "id": "672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262", "packaging": "file", - "sourceHash": "01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476", - "s3BucketParameter": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4", - "s3KeyParameter": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0", - "artifactHashParameter": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476ArtifactHash0FB7E57C" + "sourceHash": "672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262", + "s3BucketParameter": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4", + "s3KeyParameter": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764", + "artifactHashParameter": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262ArtifactHash9E8C5685" } }, { @@ -95,40 +95,40 @@ "data": "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F" } ], - "/test-bucket-deployments-2/AssetParameters/be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/S3Bucket": [ + "/test-bucket-deployments-2/AssetParameters/60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/S3Bucket": [ { "type": "aws:cdk:logicalId", - "data": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3Bucket09A62232" + "data": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3Bucket180EC6B2" } ], - "/test-bucket-deployments-2/AssetParameters/be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/S3VersionKey": [ + "/test-bucket-deployments-2/AssetParameters/60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/S3VersionKey": [ { "type": "aws:cdk:logicalId", - "data": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3VersionKeyA28118BE" + "data": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3VersionKeyF1ADAF48" } ], - "/test-bucket-deployments-2/AssetParameters/be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/ArtifactHash": [ + "/test-bucket-deployments-2/AssetParameters/60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/ArtifactHash": [ { "type": "aws:cdk:logicalId", - "data": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824ArtifactHash76F8FCF2" + "data": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26ArtifactHashF709D3CB" } ], - "/test-bucket-deployments-2/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476/S3Bucket": [ + "/test-bucket-deployments-2/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262/S3Bucket": [ { "type": "aws:cdk:logicalId", - "data": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "data": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" } ], - "/test-bucket-deployments-2/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476/S3VersionKey": [ + "/test-bucket-deployments-2/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262/S3VersionKey": [ { "type": "aws:cdk:logicalId", - "data": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "data": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ], - "/test-bucket-deployments-2/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476/ArtifactHash": [ + "/test-bucket-deployments-2/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262/ArtifactHash": [ { "type": "aws:cdk:logicalId", - "data": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476ArtifactHash0FB7E57C" + "data": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262ArtifactHash9E8C5685" } ], "/test-bucket-deployments-2/AssetParameters/f98b78092dcdd31f5e6d47489beb5f804d4835ef86a8085d0a2053cb9ae711da/S3Bucket": [ @@ -350,10 +350,7 @@ "/test-bucket-deployments-2/BucketDeploymentEFS-VPC-c8e45d2d82aec23f89c7172e7e6f994ff3d9c444fa/Resource": [ { "type": "aws:cdk:logicalId", - "data": "BucketDeploymentEFSVPCc8e45d2d82aec23f89c7172e7e6f994ff3d9c444faDE9EC34B", - "trace": [ - "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" - ] + "data": "BucketDeploymentEFSVPCc8e45d2d82aec23f89c7172e7e6f994ff3d9c444faDE9EC34B" } ], "/test-bucket-deployments-2/BucketDeploymentEFS-VPC-c8e45d2d82aec23f89c7172e7e6f994ff3d9c444fa/EfsSecurityGroup/Resource": [ @@ -371,28 +368,19 @@ "/test-bucket-deployments-2/BucketDeploymentEFS-VPC-c8e45d2d82aec23f89c7172e7e6f994ff3d9c444fa/EfsMountTarget1": [ { "type": "aws:cdk:logicalId", - "data": "BucketDeploymentEFSVPCc8e45d2d82aec23f89c7172e7e6f994ff3d9c444faEfsMountTarget140913EA1", - "trace": [ - "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" - ] + "data": "BucketDeploymentEFSVPCc8e45d2d82aec23f89c7172e7e6f994ff3d9c444faEfsMountTarget140913EA1" } ], "/test-bucket-deployments-2/BucketDeploymentEFS-VPC-c8e45d2d82aec23f89c7172e7e6f994ff3d9c444fa/EfsMountTarget2": [ { "type": "aws:cdk:logicalId", - "data": "BucketDeploymentEFSVPCc8e45d2d82aec23f89c7172e7e6f994ff3d9c444faEfsMountTarget215F1A11A", - "trace": [ - "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" - ] + "data": "BucketDeploymentEFSVPCc8e45d2d82aec23f89c7172e7e6f994ff3d9c444faEfsMountTarget215F1A11A" } ], "/test-bucket-deployments-2/BucketDeploymentEFS-VPC-c8e45d2d82aec23f89c7172e7e6f994ff3d9c444fa/AccessPoint/Resource": [ { "type": "aws:cdk:logicalId", - "data": "BucketDeploymentEFSVPCc8e45d2d82aec23f89c7172e7e6f994ff3d9c444faAccessPoint657AFA25", - "trace": [ - "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" - ] + "data": "BucketDeploymentEFSVPCc8e45d2d82aec23f89c7172e7e6f994ff3d9c444faAccessPoint657AFA25" } ], "/test-bucket-deployments-2/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756Cc8e45d2d82aec23f89c7172e7e6f994ff3d9c444fa/ServiceRole/Resource": [ diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/test-bucket-deployments-2.assets.json b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/test-bucket-deployments-2.assets.json index de4d05914f4cb..9c7d0a0a1f975 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/test-bucket-deployments-2.assets.json +++ b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/test-bucket-deployments-2.assets.json @@ -1,28 +1,28 @@ { - "version": "17.0.0", + "version": "20.0.0", "files": { - "be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824": { + "60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26": { "source": { - "path": "asset.be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824", + "path": "asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824.zip", + "objectKey": "60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476": { + "672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262": { "source": { - "path": "asset.01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476.zip", + "path": "asset.672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262.zip", "packaging": "file" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476.zip", + "objectKey": "672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } @@ -53,7 +53,7 @@ } } }, - "f6506bf1bfd1e40d9a60935c1dbe4a74a017e7e403997c180c2e21e64216b781": { + "46faa5409c447e4540630ddb084f9f472119a53e65a106e997e36f8793275f73": { "source": { "path": "test-bucket-deployments-2.template.json", "packaging": "file" @@ -61,7 +61,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "f6506bf1bfd1e40d9a60935c1dbe4a74a017e7e403997c180c2e21e64216b781.json", + "objectKey": "46faa5409c447e4540630ddb084f9f472119a53e65a106e997e36f8793275f73.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-s3-deployment/test/bucket-deployment.integ.snapshot/test-bucket-deployments-2.template.json b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/test-bucket-deployments-2.template.json index 591c155e21c80..853f5494c33a7 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/test-bucket-deployments-2.template.json +++ b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/test-bucket-deployments-2.template.json @@ -129,7 +129,7 @@ "Properties": { "Code": { "S3Bucket": { - "Ref": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3Bucket09A62232" + "Ref": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3Bucket180EC6B2" }, "S3Key": { "Fn::Join": [ @@ -142,7 +142,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3VersionKeyA28118BE" + "Ref": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3VersionKeyF1ADAF48" } ] } @@ -155,7 +155,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3VersionKeyA28118BE" + "Ref": "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3VersionKeyF1ADAF48" } ] } @@ -197,7 +197,7 @@ "Properties": { "Content": { "S3Bucket": { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" }, "S3Key": { "Fn::Join": [ @@ -210,7 +210,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -223,7 +223,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -512,7 +512,7 @@ "Ref": "DeployMeAwsCliLayer5F9219E9" } ], - "Runtime": "python3.7", + "Runtime": "python3.9", "Timeout": 900 }, "DependsOn": [ @@ -908,7 +908,7 @@ "Properties": { "Content": { "S3Bucket": { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" }, "S3Key": { "Fn::Join": [ @@ -921,7 +921,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -934,7 +934,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -1485,7 +1485,7 @@ "Ref": "DeployMeWithEfsStorageAwsCliLayer1619A3EE" } ], - "Runtime": "python3.7", + "Runtime": "python3.9", "Timeout": 900, "VpcConfig": { "SecurityGroupIds": [ @@ -1606,7 +1606,7 @@ "Properties": { "Content": { "S3Bucket": { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" }, "S3Key": { "Fn::Join": [ @@ -1619,7 +1619,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -1632,7 +1632,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -1796,7 +1796,7 @@ "Properties": { "Content": { "S3Bucket": { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" }, "S3Key": { "Fn::Join": [ @@ -1809,7 +1809,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -1822,7 +1822,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -1907,7 +1907,7 @@ "Properties": { "Content": { "S3Bucket": { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" }, "S3Key": { "Fn::Join": [ @@ -1920,7 +1920,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -1933,7 +1933,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -2009,7 +2009,7 @@ "Properties": { "Content": { "S3Bucket": { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" }, "S3Key": { "Fn::Join": [ @@ -2022,7 +2022,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -2035,7 +2035,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -2111,29 +2111,29 @@ } }, "Parameters": { - "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3Bucket09A62232": { + "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3Bucket180EC6B2": { "Type": "String", - "Description": "S3 bucket for asset \"be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824\"" + "Description": "S3 bucket for asset \"60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26\"" }, - "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824S3VersionKeyA28118BE": { + "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26S3VersionKeyF1ADAF48": { "Type": "String", - "Description": "S3 key for asset version \"be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824\"" + "Description": "S3 key for asset version \"60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26\"" }, - "AssetParametersbe270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824ArtifactHash76F8FCF2": { + "AssetParameters60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26ArtifactHashF709D3CB": { "Type": "String", - "Description": "Artifact hash for asset \"be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824\"" + "Description": "Artifact hash for asset \"60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26\"" }, - "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4": { + "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4": { "Type": "String", - "Description": "S3 bucket for asset \"01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476\"" + "Description": "S3 bucket for asset \"672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262\"" }, - "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0": { + "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764": { "Type": "String", - "Description": "S3 key for asset version \"01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476\"" + "Description": "S3 key for asset version \"672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262\"" }, - "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476ArtifactHash0FB7E57C": { + "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262ArtifactHash9E8C5685": { "Type": "String", - "Description": "Artifact hash for asset \"01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476\"" + "Description": "Artifact hash for asset \"672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262\"" }, "AssetParametersf98b78092dcdd31f5e6d47489beb5f804d4835ef86a8085d0a2053cb9ae711daS3BucketF23C0DE7": { "Type": "String", diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/tree.json b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/tree.json index 596e9c91ff960..3c93181523f9e 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.integ.snapshot/tree.json @@ -9,7 +9,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } }, "test-bucket-deployments-2": { @@ -189,13 +189,13 @@ "id": "AssetParameters", "path": "test-bucket-deployments-2/AssetParameters", "children": { - "be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824": { - "id": "be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824", - "path": "test-bucket-deployments-2/AssetParameters/be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824", + "60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26": { + "id": "60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26", + "path": "test-bucket-deployments-2/AssetParameters/60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26", "children": { "S3Bucket": { "id": "S3Bucket", - "path": "test-bucket-deployments-2/AssetParameters/be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/S3Bucket", + "path": "test-bucket-deployments-2/AssetParameters/60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/S3Bucket", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -203,7 +203,7 @@ }, "S3VersionKey": { "id": "S3VersionKey", - "path": "test-bucket-deployments-2/AssetParameters/be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/S3VersionKey", + "path": "test-bucket-deployments-2/AssetParameters/60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/S3VersionKey", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -211,7 +211,7 @@ }, "ArtifactHash": { "id": "ArtifactHash", - "path": "test-bucket-deployments-2/AssetParameters/be270bbdebe0851c887569796e3997437cca54ce86893ed94788500448e92824/ArtifactHash", + "path": "test-bucket-deployments-2/AssetParameters/60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/ArtifactHash", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -220,16 +220,16 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } }, - "01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476": { - "id": "01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476", - "path": "test-bucket-deployments-2/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476", + "672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262": { + "id": "672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262", + "path": "test-bucket-deployments-2/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262", "children": { "S3Bucket": { "id": "S3Bucket", - "path": "test-bucket-deployments-2/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476/S3Bucket", + "path": "test-bucket-deployments-2/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262/S3Bucket", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -237,7 +237,7 @@ }, "S3VersionKey": { "id": "S3VersionKey", - "path": "test-bucket-deployments-2/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476/S3VersionKey", + "path": "test-bucket-deployments-2/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262/S3VersionKey", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -245,7 +245,7 @@ }, "ArtifactHash": { "id": "ArtifactHash", - "path": "test-bucket-deployments-2/AssetParameters/01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476/ArtifactHash", + "path": "test-bucket-deployments-2/AssetParameters/672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262/ArtifactHash", "constructInfo": { "fqn": "@aws-cdk/core.CfnParameter", "version": "0.0.0" @@ -254,7 +254,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } }, "f98b78092dcdd31f5e6d47489beb5f804d4835ef86a8085d0a2053cb9ae711da": { @@ -288,7 +288,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } }, "fc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222e": { @@ -322,13 +322,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.0.9" + "version": "10.1.33" } }, "DeployMe": { @@ -373,7 +373,7 @@ "aws:cdk:cloudformation:props": { "content": { "s3Bucket": { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" }, "s3Key": { "Fn::Join": [ @@ -386,7 +386,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -399,7 +399,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -768,7 +768,7 @@ "Ref": "DeployMeAwsCliLayer5F9219E9" } ], - "runtime": "python3.7", + "runtime": "python3.9", "timeout": 900 } }, @@ -1468,7 +1468,7 @@ "aws:cdk:cloudformation:props": { "content": { "s3Bucket": { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" }, "s3Key": { "Fn::Join": [ @@ -1481,7 +1481,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -1494,7 +1494,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -2152,7 +2152,7 @@ "Ref": "DeployMeWithEfsStorageAwsCliLayer1619A3EE" } ], - "runtime": "python3.7", + "runtime": "python3.9", "timeout": 900, "vpcConfig": { "subnetIds": [ @@ -2347,7 +2347,7 @@ "aws:cdk:cloudformation:props": { "content": { "s3Bucket": { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" }, "s3Key": { "Fn::Join": [ @@ -2360,7 +2360,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -2373,7 +2373,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -2617,7 +2617,7 @@ "aws:cdk:cloudformation:props": { "content": { "s3Bucket": { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" }, "s3Key": { "Fn::Join": [ @@ -2630,7 +2630,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -2643,7 +2643,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -2767,7 +2767,7 @@ "aws:cdk:cloudformation:props": { "content": { "s3Bucket": { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" }, "s3Key": { "Fn::Join": [ @@ -2780,7 +2780,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -2793,7 +2793,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -2917,7 +2917,7 @@ "aws:cdk:cloudformation:props": { "content": { "s3Bucket": { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3BucketC0D91AC4" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3Bucket2B5B33F4" }, "s3Key": { "Fn::Join": [ @@ -2930,7 +2930,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } @@ -2943,7 +2943,7 @@ "Fn::Split": [ "||", { - "Ref": "AssetParameters01e9cf93416a1f67b17dad851459445bdaaafcc2f3ab4390c03984fd57b2f476S3VersionKey26CFD1B0" + "Ref": "AssetParameters672cee2a3bc0f6f95dc287bbbcfca917f657efdac3d5cea83e0ceec6f1cdc262S3VersionKeyAD46A764" } ] } diff --git a/packages/@aws-cdk/aws-secretsmanager/README.md b/packages/@aws-cdk/aws-secretsmanager/README.md index 3b99e340cf970..0a86cc2ee2082 100644 --- a/packages/@aws-cdk/aws-secretsmanager/README.md +++ b/packages/@aws-cdk/aws-secretsmanager/README.md @@ -18,27 +18,35 @@ import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; ## Create a new Secret in a Stack -In order to have SecretsManager generate a new secret value automatically, -you can get started with the following: +To have SecretsManager generate a new secret value automatically, +follow this example: ```ts -// Default secret +declare const vpc: ec2.Vpc; + +// Simple secret const secret = new secretsmanager.Secret(this, 'Secret'); -// Using the default secret -new iam.User(this, 'User', { - password: secret.secretValue, +// Using the secret +const instance1 = new rds.DatabaseInstance(this, "PostgresInstance1", { + engine: rds.DatabaseInstanceEngine.POSTGRES, + credentials: rds.Credentials.fromSecret(secret), + vpc }); -// Templated secret +// Templated secret with username and password fields const templatedSecret = new secretsmanager.Secret(this, 'TemplatedSecret', { generateSecretString: { - secretStringTemplate: JSON.stringify({ username: 'user' }), + secretStringTemplate: JSON.stringify({ username: 'postgres' }), generateStringKey: 'password', }, }); -// Using the templated secret -new iam.User(this, 'OtherUser', { - userName: templatedSecret.secretValueFromJson('username').toString(), - password: templatedSecret.secretValueFromJson('password'), +// Using the templated secret as credentials +const instance2 = new rds.DatabaseInstance(this, "PostgresInstance2", { + engine: rds.DatabaseInstanceEngine.POSTGRES, + credentials: { + username: templatedSecret.secretValueFromJson('username').toString(), + password: templatedSecret.secretValueFromJson('password') + }, + vpc }); ``` @@ -58,7 +66,7 @@ const secret = secretsmanager.Secret.fromSecretAttributes(this, 'ImportedSecret' SecretsManager secret values can only be used in select set of properties. For the list of properties, see [the CloudFormation Dynamic References documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html). -A secret can set `RemovalPolicy`. If it set to `RETAIN`, that removing a secret will fail. +A secret can set `RemovalPolicy`. If it set to `RETAIN`, removing that secret will fail. ## Grant permission to use the secret to a role diff --git a/packages/@aws-cdk/aws-secretsmanager/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-secretsmanager/rosetta/default.ts-fixture index 64fc649d2d1c2..4e66468a44ec6 100644 --- a/packages/@aws-cdk/aws-secretsmanager/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-secretsmanager/rosetta/default.ts-fixture @@ -5,6 +5,7 @@ import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; import * as kms from '@aws-cdk/aws-kms'; import * as iam from '@aws-cdk/aws-iam'; import * as ec2 from '@aws-cdk/aws-ec2'; +import * as rds from '@aws-cdk/aws-rds'; class Fixture extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk/core/README.md b/packages/@aws-cdk/core/README.md index 35785221ce946..2d0e0b9928b98 100644 --- a/packages/@aws-cdk/core/README.md +++ b/packages/@aws-cdk/core/README.md @@ -345,13 +345,13 @@ relationship between all resources in the scope of `constructA` and all resources in the scope of `constructB`. If you want a single object to represent a set of constructs that are not -necessarily in the same scope, you can use a `ConcreteDependable`. The +necessarily in the same scope, you can use a `DependencyGroup`. The following creates a single object that represents a dependency on two constructs, `constructB` and `constructC`: ```ts // Declare the dependable object -const bAndC = new ConcreteDependable(); +const bAndC = new DependencyGroup(); bAndC.add(constructB); bAndC.add(constructC); diff --git a/packages/@aws-cdk/core/lib/environment.ts b/packages/@aws-cdk/core/lib/environment.ts index 837d7546c46fb..a43ec37f3472c 100644 --- a/packages/@aws-cdk/core/lib/environment.ts +++ b/packages/@aws-cdk/core/lib/environment.ts @@ -5,28 +5,28 @@ export interface Environment { /** * The AWS account ID for this environment. * - * This can be either a concrete value such as `585191031104` or `Aws.accountId` which + * This can be either a concrete value such as `585191031104` or `Aws.ACCOUNT_ID` which * indicates that account ID will only be determined during deployment (it * will resolve to the CloudFormation intrinsic `{"Ref":"AWS::AccountId"}`). * Note that certain features, such as cross-stack references and * environmental context providers require concerete region information and * will cause this stack to emit synthesis errors. * - * @default Aws.accountId which means that the stack will be account-agnostic. + * @default Aws.ACCOUNT_ID which means that the stack will be account-agnostic. */ readonly account?: string; /** * The AWS region for this environment. * - * This can be either a concrete value such as `eu-west-2` or `Aws.region` + * This can be either a concrete value such as `eu-west-2` or `Aws.REGION` * which indicates that account ID will only be determined during deployment * (it will resolve to the CloudFormation intrinsic `{"Ref":"AWS::Region"}`). * Note that certain features, such as cross-stack references and - * environmental context providers require concerete region information and + * environmental context providers require concrete region information and * will cause this stack to emit synthesis errors. * - * @default Aws.region which means that the stack will be region-agnostic. + * @default Aws.REGION which means that the stack will be region-agnostic. */ readonly region?: string; } diff --git a/packages/@aws-cdk/core/lib/stack.ts b/packages/@aws-cdk/core/lib/stack.ts index 376e41ac1ddc2..debb99cc22f64 100644 --- a/packages/@aws-cdk/core/lib/stack.ts +++ b/packages/@aws-cdk/core/lib/stack.ts @@ -207,9 +207,9 @@ export class Stack extends Construct implements ITaggable { * This value is resolved according to the following rules: * * 1. The value provided to `env.region` when the stack is defined. This can - * either be a concerete region (e.g. `us-west-2`) or the `Aws.region` + * either be a concerete region (e.g. `us-west-2`) or the `Aws.REGION` * token. - * 3. `Aws.region`, which is represents the CloudFormation intrinsic reference + * 3. `Aws.REGION`, which is represents the CloudFormation intrinsic reference * `{ "Ref": "AWS::Region" }` encoded as a string token. * * Preferably, you should use the return value as an opaque string and not @@ -229,9 +229,9 @@ export class Stack extends Construct implements ITaggable { * This value is resolved according to the following rules: * * 1. The value provided to `env.account` when the stack is defined. This can - * either be a concerete account (e.g. `585695031111`) or the - * `Aws.accountId` token. - * 3. `Aws.accountId`, which represents the CloudFormation intrinsic reference + * either be a concrete account (e.g. `585695031111`) or the + * `Aws.ACCOUNT_ID` token. + * 3. `Aws.ACCOUNT_ID`, which represents the CloudFormation intrinsic reference * `{ "Ref": "AWS::AccountId" }` encoded as a string token. * * Preferably, you should use the return value as an opaque string and not @@ -254,7 +254,7 @@ export class Stack extends Construct implements ITaggable { * environment. * * If either `stack.account` or `stack.region` are not concrete values (e.g. - * `Aws.account` or `Aws.region`) the special strings `unknown-account` and/or + * `Aws.ACCOUNT_ID` or `Aws.REGION`) the special strings `unknown-account` and/or * `unknown-region` will be used respectively to indicate this stack is * region/account-agnostic. */ @@ -501,7 +501,7 @@ export class Stack extends Construct implements ITaggable { * scheme based on the construct path to ensure uniqueness. * * If you wish to obtain the deploy-time AWS::StackName intrinsic, - * you can use `Aws.stackName` directly. + * you can use `Aws.STACK_NAME` directly. */ public get stackName(): string { return this._stackName; diff --git a/packages/@aws-cdk/core/rosetta/default.ts-fixture b/packages/@aws-cdk/core/rosetta/default.ts-fixture index c1c9106b2fed7..23d992a8629a0 100644 --- a/packages/@aws-cdk/core/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/core/rosetta/default.ts-fixture @@ -18,8 +18,6 @@ import { CfnParameter, CfnResource, CfnResourceProps, - ConcreteDependable, - Construct, CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, @@ -36,6 +34,10 @@ import { Stage, Token, } from '@aws-cdk/core'; +import { + Construct, + DependencyGroup, +} from 'constructs'; declare const app: App; declare const arn: 'arn:partition:service:region:account-id:resource-id'; diff --git a/packages/@aws-cdk/integ-runner/THIRD_PARTY_LICENSES b/packages/@aws-cdk/integ-runner/THIRD_PARTY_LICENSES index 8dc1855b784c9..c00f4f83b62f7 100644 --- a/packages/@aws-cdk/integ-runner/THIRD_PARTY_LICENSES +++ b/packages/@aws-cdk/integ-runner/THIRD_PARTY_LICENSES @@ -156,7 +156,7 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH RE ---------------- -** aws-sdk@2.1185.0 - https://www.npmjs.com/package/aws-sdk/v/2.1185.0 | Apache-2.0 +** aws-sdk@2.1187.0 - https://www.npmjs.com/package/aws-sdk/v/2.1187.0 | Apache-2.0 AWS SDK for JavaScript Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/aws-cdk-lib/README.md b/packages/aws-cdk-lib/README.md index 1fc08f146a00f..aa61a3f87d603 100644 --- a/packages/aws-cdk-lib/README.md +++ b/packages/aws-cdk-lib/README.md @@ -376,13 +376,13 @@ relationship between all resources in the scope of `constructA` and all resources in the scope of `constructB`. If you want a single object to represent a set of constructs that are not -necessarily in the same scope, you can use a `ConcreteDependable`. The +necessarily in the same scope, you can use a `DependencyGroup`. The following creates a single object that represents a dependency on two constructs, `constructB` and `constructC`: ```ts // Declare the dependable object -const bAndC = new ConcreteDependable(); +const bAndC = new DependencyGroup(); bAndC.add(constructB); bAndC.add(constructC); diff --git a/packages/aws-cdk-lib/package.json b/packages/aws-cdk-lib/package.json index c2207b58b4218..0ca06d90e2539 100644 --- a/packages/aws-cdk-lib/package.json +++ b/packages/aws-cdk-lib/package.json @@ -361,7 +361,7 @@ "@types/fs-extra": "^8.1.2", "@types/node": "^14.18.23", "constructs": "^10.0.0", - "esbuild": "^0.14.51", + "esbuild": "^0.14.53", "fs-extra": "^9.1.0", "ts-node": "^9.1.1", "typescript": "~3.8.3" diff --git a/packages/aws-cdk/THIRD_PARTY_LICENSES b/packages/aws-cdk/THIRD_PARTY_LICENSES index d84e6e7f79d01..69a803d4f0d26 100644 --- a/packages/aws-cdk/THIRD_PARTY_LICENSES +++ b/packages/aws-cdk/THIRD_PARTY_LICENSES @@ -268,7 +268,7 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH RE ---------------- -** aws-sdk@2.1185.0 - https://www.npmjs.com/package/aws-sdk/v/2.1185.0 | Apache-2.0 +** aws-sdk@2.1187.0 - https://www.npmjs.com/package/aws-sdk/v/2.1187.0 | Apache-2.0 AWS SDK for JavaScript Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/aws-cdk/lib/api/hotswap-deployments.ts b/packages/aws-cdk/lib/api/hotswap-deployments.ts index f64e5c16eddfa..487d8a1dd2281 100644 --- a/packages/aws-cdk/lib/api/hotswap-deployments.ts +++ b/packages/aws-cdk/lib/api/hotswap-deployments.ts @@ -68,6 +68,11 @@ async function findAllHotswappableChanges( sdk: ISDK, nestedStackNames: { [nestedStackName: string]: NestedStackNames }, ): Promise { + // Skip hotswap if there is any change on stack outputs + if (stackChanges.outputs.differenceCount > 0) { + return undefined; + } + const resourceDifferences = getStackResourceDifferences(stackChanges); let foundNonHotswappableChange = false; diff --git a/packages/aws-cdk/test/api/hotswap/hotswap-deployments.test.ts b/packages/aws-cdk/test/api/hotswap/hotswap-deployments.test.ts index e7436e8d127ec..4c3bd67ee764c 100644 --- a/packages/aws-cdk/test/api/hotswap/hotswap-deployments.test.ts +++ b/packages/aws-cdk/test/api/hotswap/hotswap-deployments.test.ts @@ -356,3 +356,61 @@ test('changing the type of a deployed resource always results in a full deployme expect(mockUpdateMachineDefinition).not.toHaveBeenCalled(); expect(mockUpdateLambdaCode).not.toHaveBeenCalled(); }); + +test('A change to both a hotswappable resource and a stack output results in a full deployment', async () => { + // GIVEN + setup.setCurrentCfnStackTemplate({ + Resources: { + Func: { + Type: 'AWS::Lambda::Function', + Properties: { + Code: { + S3Bucket: 'current-bucket', + S3Key: 'current-key', + }, + FunctionName: 'my-function', + }, + Metadata: { + 'aws:asset:path': 'old-path', + }, + }, + }, + Outputs: { + SomeOutput: { + Value: 'old-value', + }, + }, + }); + const cdkStackArtifact = setup.cdkStackArtifactOf({ + template: { + Resources: { + Func: { + Type: 'AWS::Lambda::Function', + Properties: { + Code: { + S3Bucket: 'current-bucket', + S3Key: 'new-key', + }, + FunctionName: 'my-function', + }, + Metadata: { + 'aws:asset:path': 'new-path', + }, + }, + }, + Outputs: { + SomeOutput: { + Value: 'new-value', + }, + }, + }, + }); + + // WHEN + const deployStackResult = await hotswapMockSdkProvider.tryHotswapDeployment(cdkStackArtifact); + + // THEN + expect(deployStackResult).toBeUndefined(); + expect(mockUpdateMachineDefinition).not.toHaveBeenCalled(); + expect(mockUpdateLambdaCode).not.toHaveBeenCalled(); +}); diff --git a/packages/cdk-assets/package.json b/packages/cdk-assets/package.json index f14a50cf072c8..ecafa1959ef88 100644 --- a/packages/cdk-assets/package.json +++ b/packages/cdk-assets/package.json @@ -39,7 +39,7 @@ "@types/yargs": "^15.0.14", "@aws-cdk/cdk-build-tools": "0.0.0", "jest": "^27.5.1", - "jszip": "^3.10.0", + "jszip": "^3.10.1", "mock-fs": "^4.14.0", "@aws-cdk/pkglint": "0.0.0" }, diff --git a/tools/@aws-cdk/node-bundle/package.json b/tools/@aws-cdk/node-bundle/package.json index 36dbeecf4272d..9ff19321547c0 100644 --- a/tools/@aws-cdk/node-bundle/package.json +++ b/tools/@aws-cdk/node-bundle/package.json @@ -40,13 +40,13 @@ "jest-junit": "^13", "json-schema": "^0.4.0", "npm-check-updates": "^12", - "projen": "^0.60.10", + "projen": "^0.60.14", "standard-version": "^9", "ts-jest": "^27", "typescript": "^4.5.5" }, "dependencies": { - "esbuild": "^0.14.51", + "esbuild": "^0.14.53", "fs-extra": "^10.1.0", "license-checker": "^25.0.1", "madge": "^5.0.1", diff --git a/version.v2.json b/version.v2.json index 7756ec057f0cd..a4993e99d49d2 100644 --- a/version.v2.json +++ b/version.v2.json @@ -1,4 +1,4 @@ { - "version": "2.34.2", - "alphaVersion": "2.34.2-alpha.0" + "version": "2.35.0", + "alphaVersion": "2.35.0-alpha.0" } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 17c62c9d1a961..96d7c3e3a35fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -60,32 +60,32 @@ integrity sha512-HSmX4WZPPK3FUxYp7g2T6EyO8j96HlZJlxmKPSh6KAcqwyDrfx7hKjXpAW/0FhFfTJsR0Yt4lAjLI2coMptIHQ== "@babel/core@^7.1.0", "@babel/core@^7.12.3", "@babel/core@^7.7.2", "@babel/core@^7.7.5", "@babel/core@^7.8.0": - version "7.18.9" - resolved "https://registry.npmjs.org/@babel/core/-/core-7.18.9.tgz#805461f967c77ff46c74ca0460ccf4fe933ddd59" - integrity sha512-1LIb1eL8APMy91/IMW+31ckrfBM4yCoLaVzoDhZUKSM4cu1L1nIidyxkCgzPAgrC5WEz36IPEr/eSeSF9pIn+g== + version "7.18.10" + resolved "https://registry.npmjs.org/@babel/core/-/core-7.18.10.tgz#39ad504991d77f1f3da91be0b8b949a5bc466fb8" + integrity sha512-JQM6k6ENcBFKVtWvLavlvi/mPcpYZ3+R+2EySDEMSMbp7Mn4FexlbbJVrx2R7Ijhr01T8gyqrOaABWIOgxeUyw== dependencies: "@ampproject/remapping" "^2.1.0" "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.18.9" + "@babel/generator" "^7.18.10" "@babel/helper-compilation-targets" "^7.18.9" "@babel/helper-module-transforms" "^7.18.9" "@babel/helpers" "^7.18.9" - "@babel/parser" "^7.18.9" - "@babel/template" "^7.18.6" - "@babel/traverse" "^7.18.9" - "@babel/types" "^7.18.9" + "@babel/parser" "^7.18.10" + "@babel/template" "^7.18.10" + "@babel/traverse" "^7.18.10" + "@babel/types" "^7.18.10" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.1" semver "^6.3.0" -"@babel/generator@^7.18.9", "@babel/generator@^7.7.2": - version "7.18.9" - resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.18.9.tgz#68337e9ea8044d6ddc690fb29acae39359cca0a5" - integrity sha512-wt5Naw6lJrL1/SGkipMiFxJjtyczUWTP38deiP1PO60HsBjDeKk08CGC3S8iVuvf0FmTdgKwU1KIXzSKL1G0Ug== +"@babel/generator@^7.18.10", "@babel/generator@^7.7.2": + version "7.18.10" + resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.18.10.tgz#794f328bfabdcbaf0ebf9bf91b5b57b61fa77a2a" + integrity sha512-0+sW7e3HjQbiHbj1NeU/vN8ornohYlacAfZIaXhdoGweQqgcNy69COVciYYqEXJ/v+9OBA7Frxm4CVAuNqKeNA== dependencies: - "@babel/types" "^7.18.9" + "@babel/types" "^7.18.10" "@jridgewell/gen-mapping" "^0.3.2" jsesc "^2.5.1" @@ -159,6 +159,11 @@ dependencies: "@babel/types" "^7.18.6" +"@babel/helper-string-parser@^7.18.10": + version "7.18.10" + resolved "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz#181f22d28ebe1b3857fa575f5c290b1aaf659b56" + integrity sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw== + "@babel/helper-validator-identifier@^7.18.6": version "7.18.6" resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz#9c97e30d31b2b8c72a1d08984f2ca9b574d7a076" @@ -187,10 +192,10 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.18.6", "@babel/parser@^7.18.9": - version "7.18.9" - resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.18.9.tgz#f2dde0c682ccc264a9a8595efd030a5cc8fd2539" - integrity sha512-9uJveS9eY9DJ0t64YbIBZICtJy8a5QrDEVdiLCG97fVLpDTpGX7t8mMSb6OWw6Lrnjqj4O8zwjELX3dhoMgiBg== +"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.18.10": + version "7.18.10" + resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.18.10.tgz#94b5f8522356e69e8277276adf67ed280c90ecc1" + integrity sha512-TYk3OA0HKL6qNryUayb5UUEhM/rkOQozIBEA5ITXh5DWrSp0TlUQXMyZmnWxG/DizSWBeeQ0Zbc5z8UGaaqoeg== "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -283,36 +288,37 @@ dependencies: "@babel/helper-plugin-utils" "^7.18.6" -"@babel/template@^7.18.6", "@babel/template@^7.3.3": - version "7.18.6" - resolved "https://registry.npmjs.org/@babel/template/-/template-7.18.6.tgz#1283f4993e00b929d6e2d3c72fdc9168a2977a31" - integrity sha512-JoDWzPe+wgBsTTgdnIma3iHNFC7YVJoPssVBDjiHfNlyt4YcunDtcDOUmfVDfCK5MfdsaIoX9PkijPhjH3nYUw== +"@babel/template@^7.18.10", "@babel/template@^7.18.6", "@babel/template@^7.3.3": + version "7.18.10" + resolved "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz#6f9134835970d1dbf0835c0d100c9f38de0c5e71" + integrity sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA== dependencies: "@babel/code-frame" "^7.18.6" - "@babel/parser" "^7.18.6" - "@babel/types" "^7.18.6" + "@babel/parser" "^7.18.10" + "@babel/types" "^7.18.10" -"@babel/traverse@^7.18.9", "@babel/traverse@^7.7.2": - version "7.18.9" - resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.18.9.tgz#deeff3e8f1bad9786874cb2feda7a2d77a904f98" - integrity sha512-LcPAnujXGwBgv3/WHv01pHtb2tihcyW1XuL9wd7jqh1Z8AQkTd+QVjMrMijrln0T7ED3UXLIy36P9Ao7W75rYg== +"@babel/traverse@^7.18.10", "@babel/traverse@^7.18.9", "@babel/traverse@^7.7.2": + version "7.18.10" + resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.18.10.tgz#37ad97d1cb00efa869b91dd5d1950f8a6cf0cb08" + integrity sha512-J7ycxg0/K9XCtLyHf0cz2DqDihonJeIo+z+HEdRe9YuT8TY4A66i+Ab2/xZCEW7Ro60bPCBBfqqboHSamoV3+g== dependencies: "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.18.9" + "@babel/generator" "^7.18.10" "@babel/helper-environment-visitor" "^7.18.9" "@babel/helper-function-name" "^7.18.9" "@babel/helper-hoist-variables" "^7.18.6" "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/parser" "^7.18.9" - "@babel/types" "^7.18.9" + "@babel/parser" "^7.18.10" + "@babel/types" "^7.18.10" debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.3.0", "@babel/types@^7.3.3": - version "7.18.9" - resolved "https://registry.npmjs.org/@babel/types/-/types-7.18.9.tgz#7148d64ba133d8d73a41b3172ac4b83a1452205f" - integrity sha512-WwMLAg2MvJmt/rKEVQBBhIVffMmnilX4oe0sRe7iPOHIGsqpruFHHdrfj4O1CMMtgMtCU4oPafZjDPCRgO57Wg== +"@babel/types@^7.0.0", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.3.0", "@babel/types@^7.3.3": + version "7.18.10" + resolved "https://registry.npmjs.org/@babel/types/-/types-7.18.10.tgz#4908e81b6b339ca7c6b7a555a5fc29446f26dde6" + integrity sha512-MJvnbEiiNkpjo+LknnmRrqbY1GPUUggjv+wQVjetM/AONoupqRALB7I6jGqNUAZsKcRIEu2J6FRFvsczljjsaQ== dependencies: + "@babel/helper-string-parser" "^7.18.10" "@babel/helper-validator-identifier" "^7.18.6" to-fast-properties "^2.0.0" @@ -333,6 +339,11 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" +"@esbuild/linux-loong64@0.14.53": + version "0.14.53" + resolved "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.14.53.tgz#251b4cd6760fadb4d68a05815e6dc5e432d69cd6" + integrity sha512-W2dAL6Bnyn4xa/QRSU3ilIK4EzD5wgYXKXJiS1HDF5vU3675qc2bvFyLwbUcdmssDveyndy7FbitrCoiV/eMLg== + "@eslint/eslintrc@^0.4.3": version "0.4.3" resolved "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" @@ -658,7 +669,7 @@ chalk "^4.1.2" semver "^7.3.7" -"@jsii/spec@1.63.2", "@jsii/spec@^1.59.0", "@jsii/spec@^1.63.2": +"@jsii/spec@1.63.2", "@jsii/spec@^1.63.2": version "1.63.2" resolved "https://registry.npmjs.org/@jsii/spec/-/spec-1.63.2.tgz#36cdde3279ba8e1d212bbcba9b4766b1a3aaab95" integrity sha512-zIFZDG/qtQJWa2I7W1cUXExeshr4WSSuMNHWGkJzIn4hFtYv4eQG7cP3gF2ToqAwS2WgsX7fQ7dDrLg0Pzfc2A== @@ -1466,9 +1477,9 @@ read-package-json-fast "^2.0.1" "@npmcli/run-script@^4.1.0": - version "4.1.7" - resolved "https://registry.npmjs.org/@npmcli/run-script/-/run-script-4.1.7.tgz#b1a2f57568eb738e45e9ea3123fb054b400a86f7" - integrity sha512-WXr/MyM4tpKA4BotB81NccGAv8B48lNH0gRoILucbcAhTQXLCoi6HflMV3KdXubIqvP9SuLsFn68Z7r4jl+ppw== + version "4.2.0" + resolved "https://registry.npmjs.org/@npmcli/run-script/-/run-script-4.2.0.tgz#2c25758f80831ba138afe25225d456e89acedac3" + integrity sha512-e/QgLg7j2wSJp1/7JRl0GC8c7PMX+uYlA/1Tb+IDOLdSM4T7K1VQ9mm9IGU3WRtY5vEIObpqCLb3aCNCug18DA== dependencies: "@npmcli/node-gyp" "^2.0.0" "@npmcli/promise-spawn" "^3.0.0" @@ -2108,13 +2119,13 @@ tsutils "^3.21.0" "@typescript-eslint/eslint-plugin@^5": - version "5.31.0" - resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.31.0.tgz#cae1967b1e569e6171bbc6bec2afa4e0c8efccfe" - integrity sha512-VKW4JPHzG5yhYQrQ1AzXgVgX8ZAJEvCz0QI6mLRX4tf7rnFfh5D8SKm0Pq6w5PyNfAWJk6sv313+nEt3ohWMBQ== + version "5.32.0" + resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.32.0.tgz#e27e38cffa4a61226327c874a7be965e9a861624" + integrity sha512-CHLuz5Uz7bHP2WgVlvoZGhf0BvFakBJKAD/43Ty0emn4wXWv5k01ND0C0fHcl/Im8Td2y/7h44E9pca9qAu2ew== dependencies: - "@typescript-eslint/scope-manager" "5.31.0" - "@typescript-eslint/type-utils" "5.31.0" - "@typescript-eslint/utils" "5.31.0" + "@typescript-eslint/scope-manager" "5.32.0" + "@typescript-eslint/type-utils" "5.32.0" + "@typescript-eslint/utils" "5.32.0" debug "^4.3.4" functional-red-black-tree "^1.0.1" ignore "^5.2.0" @@ -2145,13 +2156,13 @@ debug "^4.3.1" "@typescript-eslint/parser@^5": - version "5.31.0" - resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.31.0.tgz#7f42d7dcc68a0a6d80a0f3d9a65063aee7bb8d2c" - integrity sha512-UStjQiZ9OFTFReTrN+iGrC6O/ko9LVDhreEK5S3edmXgR396JGq7CoX2TWIptqt/ESzU2iRKXAHfSF2WJFcWHw== + version "5.32.0" + resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.32.0.tgz#1de243443bc6186fb153b9e395b842e46877ca5d" + integrity sha512-IxRtsehdGV9GFQ35IGm5oKKR2OGcazUoiNBxhRV160iF9FoyuXxjY+rIqs1gfnd+4eL98OjeGnMpE7RF/NBb3A== dependencies: - "@typescript-eslint/scope-manager" "5.31.0" - "@typescript-eslint/types" "5.31.0" - "@typescript-eslint/typescript-estree" "5.31.0" + "@typescript-eslint/scope-manager" "5.32.0" + "@typescript-eslint/types" "5.32.0" + "@typescript-eslint/typescript-estree" "5.32.0" debug "^4.3.4" "@typescript-eslint/scope-manager@4.33.0": @@ -2162,20 +2173,20 @@ "@typescript-eslint/types" "4.33.0" "@typescript-eslint/visitor-keys" "4.33.0" -"@typescript-eslint/scope-manager@5.31.0": - version "5.31.0" - resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.31.0.tgz#f47a794ba84d9b818ab7f8f44fff55a61016c606" - integrity sha512-8jfEzBYDBG88rcXFxajdVavGxb5/XKXyvWgvD8Qix3EEJLCFIdVloJw+r9ww0wbyNLOTYyBsR+4ALNGdlalLLg== +"@typescript-eslint/scope-manager@5.32.0": + version "5.32.0" + resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.32.0.tgz#763386e963a8def470580cc36cf9228864190b95" + integrity sha512-KyAE+tUON0D7tNz92p1uetRqVJiiAkeluvwvZOqBmW9z2XApmk5WSMV9FrzOroAcVxJZB3GfUwVKr98Dr/OjOg== dependencies: - "@typescript-eslint/types" "5.31.0" - "@typescript-eslint/visitor-keys" "5.31.0" + "@typescript-eslint/types" "5.32.0" + "@typescript-eslint/visitor-keys" "5.32.0" -"@typescript-eslint/type-utils@5.31.0": - version "5.31.0" - resolved "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.31.0.tgz#70a0b7201360b5adbddb0c36080495aa08f6f3d9" - integrity sha512-7ZYqFbvEvYXFn9ax02GsPcEOmuWNg+14HIf4q+oUuLnMbpJ6eHAivCg7tZMVwzrIuzX3QCeAOqKoyMZCv5xe+w== +"@typescript-eslint/type-utils@5.32.0": + version "5.32.0" + resolved "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.32.0.tgz#45a14506fe3fb908600b4cef2f70778f7b5cdc79" + integrity sha512-0gSsIhFDduBz3QcHJIp3qRCvVYbqzHg8D6bHFsDMrm0rURYDj+skBK2zmYebdCp+4nrd9VWd13egvhYFJj/wZg== dependencies: - "@typescript-eslint/utils" "5.31.0" + "@typescript-eslint/utils" "5.32.0" debug "^4.3.4" tsutils "^3.21.0" @@ -2184,10 +2195,10 @@ resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.33.0.tgz#a1e59036a3b53ae8430ceebf2a919dc7f9af6d72" integrity sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ== -"@typescript-eslint/types@5.31.0": - version "5.31.0" - resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.31.0.tgz#7aa389122b64b18e473c1672fb3b8310e5f07a9a" - integrity sha512-/f/rMaEseux+I4wmR6mfpM2wvtNZb1p9hAV77hWfuKc3pmaANp5dLAZSiE3/8oXTYTt3uV9KW5yZKJsMievp6g== +"@typescript-eslint/types@5.32.0": + version "5.32.0" + resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.32.0.tgz#484273021eeeae87ddb288f39586ef5efeb6dcd8" + integrity sha512-EBUKs68DOcT/EjGfzywp+f8wG9Zw6gj6BjWu7KV/IYllqKJFPlZlLSYw/PTvVyiRw50t6wVbgv4p9uE2h6sZrQ== "@typescript-eslint/typescript-estree@4.33.0", "@typescript-eslint/typescript-estree@^4.33.0": version "4.33.0" @@ -2202,28 +2213,28 @@ semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/typescript-estree@5.31.0": - version "5.31.0" - resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.31.0.tgz#eb92970c9d6e3946690d50c346fb9b1d745ee882" - integrity sha512-3S625TMcARX71wBc2qubHaoUwMEn+l9TCsaIzYI/ET31Xm2c9YQ+zhGgpydjorwQO9pLfR/6peTzS/0G3J/hDw== +"@typescript-eslint/typescript-estree@5.32.0": + version "5.32.0" + resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.32.0.tgz#282943f34babf07a4afa7b0ff347a8e7b6030d12" + integrity sha512-ZVAUkvPk3ITGtCLU5J4atCw9RTxK+SRc6hXqLtllC2sGSeMFWN+YwbiJR9CFrSFJ3w4SJfcWtDwNb/DmUIHdhg== dependencies: - "@typescript-eslint/types" "5.31.0" - "@typescript-eslint/visitor-keys" "5.31.0" + "@typescript-eslint/types" "5.32.0" + "@typescript-eslint/visitor-keys" "5.32.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/utils@5.31.0": - version "5.31.0" - resolved "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.31.0.tgz#e146fa00dca948bfe547d665b2138a2dc1b79acd" - integrity sha512-kcVPdQS6VIpVTQ7QnGNKMFtdJdvnStkqS5LeALr4rcwx11G6OWb2HB17NMPnlRHvaZP38hL9iK8DdE9Fne7NYg== +"@typescript-eslint/utils@5.32.0": + version "5.32.0" + resolved "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.32.0.tgz#eccb6b672b94516f1afc6508d05173c45924840c" + integrity sha512-W7lYIAI5Zlc5K082dGR27Fczjb3Q57ECcXefKU/f0ajM5ToM0P+N9NmJWip8GmGu/g6QISNT+K6KYB+iSHjXCQ== dependencies: "@types/json-schema" "^7.0.9" - "@typescript-eslint/scope-manager" "5.31.0" - "@typescript-eslint/types" "5.31.0" - "@typescript-eslint/typescript-estree" "5.31.0" + "@typescript-eslint/scope-manager" "5.32.0" + "@typescript-eslint/types" "5.32.0" + "@typescript-eslint/typescript-estree" "5.32.0" eslint-scope "^5.1.1" eslint-utils "^3.0.0" @@ -2235,12 +2246,12 @@ "@typescript-eslint/types" "4.33.0" eslint-visitor-keys "^2.0.0" -"@typescript-eslint/visitor-keys@5.31.0": - version "5.31.0" - resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.31.0.tgz#b0eca264df01ce85dceb76aebff3784629258f54" - integrity sha512-ZK0jVxSjS4gnPirpVjXHz7mgdOsZUHzNYSfTw2yPa3agfbt9YfqaBiBZFSSxeBWnpWkzCxTfUpnzA3Vily/CSg== +"@typescript-eslint/visitor-keys@5.32.0": + version "5.32.0" + resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.32.0.tgz#b9715d0b11fdb5dd10fd0c42ff13987470525394" + integrity sha512-S54xOHZgfThiZ38/ZGTgB2rqx51CMJ5MCfVT2IplK4Q7hgzGfe0nLzLCcenDnc/cSjP568hdeKfeDcBgqNHD/g== dependencies: - "@typescript-eslint/types" "5.31.0" + "@typescript-eslint/types" "5.32.0" eslint-visitor-keys "^3.3.0" "@xmldom/xmldom@^0.8.2": @@ -2639,9 +2650,9 @@ aws-sdk-mock@5.6.0: traverse "^0.6.6" aws-sdk@^2.1093.0, aws-sdk@^2.596.0, aws-sdk@^2.848.0, aws-sdk@^2.928.0: - version "2.1185.0" - resolved "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1185.0.tgz#157c6a900a9449cb36b37493337cae418e01210d" - integrity sha512-viFlYC6RAKOqBRM4gIB4rE80KMFNVvEkQpNmpd3PqCOemGPETDxCVHS0oqZ26qM278sZVHt+oAjPy5HmZasskg== + version "2.1187.0" + resolved "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1187.0.tgz#eb928d64305630f53b8f6dad5c7b91fec8f04622" + integrity sha512-QcxQ3asIhH9QQnN/5JO3MaHRjwcy3/AsBzcAjPU+lHZGV0drnuDmg3ZkZuAa/mOgQ3MEi68G3gYD+481QJgnMg== dependencies: buffer "4.9.2" events "1.1.1" @@ -3023,16 +3034,16 @@ caseless@~0.12.0: resolved "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw== -cdk-generate-synthetic-examples@^0.1.12: - version "0.1.12" - resolved "https://registry.npmjs.org/cdk-generate-synthetic-examples/-/cdk-generate-synthetic-examples-0.1.12.tgz#2b617559b06ab8ab584a8f419188926a4ecae2de" - integrity sha512-2zE3jjiXHohn4y171o3Cr5opp+G0fpIyCUmbr5PeNLQqBFKC0jOA3WxZStj1pcIjP6q6h13T47WYTsPeyznVzw== +cdk-generate-synthetic-examples@^0.1.14: + version "0.1.14" + resolved "https://registry.npmjs.org/cdk-generate-synthetic-examples/-/cdk-generate-synthetic-examples-0.1.14.tgz#2591f1b889182df9923c6e5206eff3af57f8ff68" + integrity sha512-VveJpeYdfVbh4sw7/FzOtggeUfSzTiAoI7MO4M3ZEcIZDZwIm6yGnX544zgS1+iH1bSyqrGPN8DArcQLftYByg== dependencies: - "@jsii/spec" "^1.59.0" + "@jsii/spec" "^1.63.2" fs-extra "^10.1.0" - jsii "^1.59.0" - jsii-reflect "^1.59.0" - jsii-rosetta "^1.59.0" + jsii "^1.63.2" + jsii-reflect "^1.63.2" + jsii-rosetta "^1.63.2" yargs "^17.5.1" cdk8s-plus-21@^2.0.0-beta.12: @@ -3043,10 +3054,10 @@ cdk8s-plus-21@^2.0.0-beta.12: minimatch "^3.1.2" safe-stable-stringify "*" -cdk8s@^2.3.72: - version "2.3.72" - resolved "https://registry.npmjs.org/cdk8s/-/cdk8s-2.3.72.tgz#e33706b2b26632500611af676f6a5ccbbf1e8bc0" - integrity sha512-b/Tqkug6EmK5t/FMv7QMyXzq/cRnzszEHDS0wfl2E4q0Vbh4N0kwzAc+h22GlNeR/U0EormgrH9eT9kF4LXEIg== +cdk8s@^2.3.74: + version "2.3.74" + resolved "https://registry.npmjs.org/cdk8s/-/cdk8s-2.3.74.tgz#4166ccd5be22747f03e0960107d624aec2576f95" + integrity sha512-mlODV+rIIoxuywZYsxtPbpi8xzCEQ6v4nJkGIsSzMYiv0tXGuPCkzn309I8Q3vFH18VRxXPLrKkXcXnSe0+OEw== dependencies: fast-json-patch "^3.1.1" follow-redirects "^1.15.1" @@ -3390,9 +3401,9 @@ console-control-strings@^1.0.0, console-control-strings@^1.1.0, console-control- integrity sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ== constructs@^10.0.0: - version "10.1.63" - resolved "https://registry.npmjs.org/constructs/-/constructs-10.1.63.tgz#ee42fd4589cf23c9492e531542a140a1865577f0" - integrity sha512-3a05YsbP0ibitw66a0qcvw+uXZmXWWeE1Knhxb80dKEV8/FC4MOtD4Fe/3zb8NDH9FrLoMgUomhLQHeI5irpZA== + version "10.1.65" + resolved "https://registry.npmjs.org/constructs/-/constructs-10.1.65.tgz#383ca30b71e6f47d7f6c66ac1389498a93e16c72" + integrity sha512-GTb1xCN4CcUW4UxMvEGqVpmOZsEZYaE3kFN/KHAGTX2eCbMwrJaruEURyB7yttAdkOTwCkmPPDoWhRUMerKDfw== conventional-changelog-angular@^5.0.12: version "5.0.13" @@ -4105,9 +4116,9 @@ ecc-jsbn@~0.1.1: safer-buffer "^2.1.0" electron-to-chromium@^1.4.202: - version "1.4.206" - resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.206.tgz#580ff85b54d7ec0c05f20b1e37ea0becdd7b0ee4" - integrity sha512-h+Fadt1gIaQ06JaIiyqPsBjJ08fV5Q7md+V8bUvQW/9OvXfL2LRICTz2EcnnCP7QzrFTS6/27MRV6Bl9Yn97zA== + version "1.4.210" + resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.210.tgz#12611fe874b833a3bf3671438b5893aba7858980" + integrity sha512-kSiX4tuyZijV7Cz0MWVmGT8K2siqaOA4Z66K5dCttPPRh0HicOcOAEj1KlC8O8J1aOS/1M8rGofOzksLKaHWcQ== emittery@^0.8.1: version "0.8.1" @@ -4231,9 +4242,9 @@ es-to-primitive@^1.2.1: is-symbol "^1.0.2" es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@^0.10.53, es5-ext@^0.10.61, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.46: - version "0.10.61" - resolved "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.61.tgz#311de37949ef86b6b0dcea894d1ffedb909d3269" - integrity sha512-yFhIqQAzu2Ca2I4SE2Au3rxVfmohU9Y7wqGR+s7+H7krk26NXhIRAZDgqd6xqjCEFUomDEA3/Bo/7fKmIkW1kA== + version "0.10.62" + resolved "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz#5e6adc19a6da524bf3d1e02bbc8960e5eb49a9a5" + integrity sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA== dependencies: es6-iterator "^2.0.3" es6-symbol "^3.1.3" @@ -4271,131 +4282,132 @@ es6-weak-map@^2.0.3: es6-iterator "^2.0.3" es6-symbol "^3.1.1" -esbuild-android-64@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.51.tgz#414a087cb0de8db1e347ecca6c8320513de433db" - integrity sha512-6FOuKTHnC86dtrKDmdSj2CkcKF8PnqkaIXqvgydqfJmqBazCPdw+relrMlhGjkvVdiiGV70rpdnyFmA65ekBCQ== - -esbuild-android-arm64@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.51.tgz#55de3bce2aab72bcd2b606da4318ad00fb9c8151" - integrity sha512-vBtp//5VVkZWmYYvHsqBRCMMi1MzKuMIn5XDScmnykMTu9+TD9v0NMEDqQxvtFToeYmojdo5UCV2vzMQWJcJ4A== - -esbuild-darwin-64@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.51.tgz#4259f23ed6b4cea2ec8a28d87b7fb9801f093754" - integrity sha512-YFmXPIOvuagDcwCejMRtCDjgPfnDu+bNeh5FU2Ryi68ADDVlWEpbtpAbrtf/lvFTWPexbgyKgzppNgsmLPr8PA== - -esbuild-darwin-arm64@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.51.tgz#d77b4366a71d84e530ba019d540b538b295d494a" - integrity sha512-juYD0QnSKwAMfzwKdIF6YbueXzS6N7y4GXPDeDkApz/1RzlT42mvX9jgNmyOlWKN7YzQAYbcUEJmZJYQGdf2ow== - -esbuild-freebsd-64@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.51.tgz#27b6587b3639f10519c65e07219d249b01f2ad38" - integrity sha512-cLEI/aXjb6vo5O2Y8rvVSQ7smgLldwYY5xMxqh/dQGfWO+R1NJOFsiax3IS4Ng300SVp7Gz3czxT6d6qf2cw0g== - -esbuild-freebsd-arm64@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.51.tgz#63c435917e566808c71fafddc600aca4d78be1ec" - integrity sha512-TcWVw/rCL2F+jUgRkgLa3qltd5gzKjIMGhkVybkjk6PJadYInPtgtUBp1/hG+mxyigaT7ib+od1Xb84b+L+1Mg== - -esbuild-linux-32@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.51.tgz#c3da774143a37e7f11559b9369d98f11f997a5d9" - integrity sha512-RFqpyC5ChyWrjx8Xj2K0EC1aN0A37H6OJfmUXIASEqJoHcntuV3j2Efr9RNmUhMfNE6yEj2VpYuDteZLGDMr0w== - -esbuild-linux-64@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.51.tgz#5d92b67f674e02ae0b4a9de9a757ba482115c4ae" - integrity sha512-dxjhrqo5i7Rq6DXwz5v+MEHVs9VNFItJmHBe1CxROWNf4miOGoQhqSG8StStbDkQ1Mtobg6ng+4fwByOhoQoeA== - -esbuild-linux-arm64@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.51.tgz#dac84740516e859d8b14e1ecc478dd5241b10c93" - integrity sha512-D9rFxGutoqQX3xJPxqd6o+kvYKeIbM0ifW2y0bgKk5HPgQQOo2k9/2Vpto3ybGYaFPCE5qTGtqQta9PoP6ZEzw== - -esbuild-linux-arm@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.51.tgz#b3ae7000696cd53ed95b2b458554ff543a60e106" - integrity sha512-LsJynDxYF6Neg7ZC7748yweCDD+N8ByCv22/7IAZglIEniEkqdF4HCaa49JNDLw1UQGlYuhOB8ZT/MmcSWzcWg== - -esbuild-linux-mips64le@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.51.tgz#dad10770fac94efa092b5a0643821c955a9dd385" - integrity sha512-vS54wQjy4IinLSlb5EIlLoln8buh1yDgliP4CuEHumrPk4PvvP4kTRIG4SzMXm6t19N0rIfT4bNdAxzJLg2k6A== - -esbuild-linux-ppc64le@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.51.tgz#b68c2f8294d012a16a88073d67e976edd4850ae0" - integrity sha512-xcdd62Y3VfGoyphNP/aIV9LP+RzFw5M5Z7ja+zdpQHHvokJM7d0rlDRMN+iSSwvUymQkqZO+G/xjb4/75du8BQ== - -esbuild-linux-riscv64@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.51.tgz#608a318b8697123e44c1e185cdf6708e3df50b93" - integrity sha512-syXHGak9wkAnFz0gMmRBoy44JV0rp4kVCEA36P5MCeZcxFq8+fllBC2t6sKI23w3qd8Vwo9pTADCgjTSf3L3rA== - -esbuild-linux-s390x@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.51.tgz#c9e7791170a3295dba79b93aa452beb9838a8625" - integrity sha512-kFAJY3dv+Wq8o28K/C7xkZk/X34rgTwhknSsElIqoEo8armCOjMJ6NsMxm48KaWY2h2RUYGtQmr+RGuUPKBhyw== - -esbuild-netbsd-64@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.51.tgz#0abd40b8c2e37fda6f5cc41a04cb2b690823d891" - integrity sha512-ZZBI7qrR1FevdPBVHz/1GSk1x5GDL/iy42Zy8+neEm/HA7ma+hH/bwPEjeHXKWUDvM36CZpSL/fn1/y9/Hb+1A== - -esbuild-openbsd-64@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.51.tgz#4adba0b7ea7eb1428bb00d8e94c199a949b130e8" - integrity sha512-7R1/p39M+LSVQVgDVlcY1KKm6kFKjERSX1lipMG51NPcspJD1tmiZSmmBXoY5jhHIu6JL1QkFDTx94gMYK6vfA== - -esbuild-sunos-64@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.51.tgz#4b8a6d97dfedda30a6e39607393c5c90ebf63891" - integrity sha512-HoHaCswHxLEYN8eBTtyO0bFEWvA3Kdb++hSQ/lLG7TyKF69TeSG0RNoBRAs45x/oCeWaTDntEZlYwAfQlhEtJA== - -esbuild-windows-32@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.51.tgz#d31d8ca0c1d314fb1edea163685a423b62e9ac17" - integrity sha512-4rtwSAM35A07CBt1/X8RWieDj3ZUHQqUOaEo5ZBs69rt5WAFjP4aqCIobdqOy4FdhYw1yF8Z0xFBTyc9lgPtEg== - -esbuild-windows-64@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.51.tgz#7d3c09c8652d222925625637bdc7e6c223e0085d" - integrity sha512-HoN/5HGRXJpWODprGCgKbdMvrC3A2gqvzewu2eECRw2sYxOUoh2TV1tS+G7bHNapPGI79woQJGV6pFH7GH7qnA== - -esbuild-windows-arm64@0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.51.tgz#0220d2304bfdc11bc27e19b2aaf56edf183e4ae9" - integrity sha512-JQDqPjuOH7o+BsKMSddMfmVJXrnYZxXDHsoLHc0xgmAZkOOCflRmC43q31pk79F9xuyWY45jDBPolb5ZgGOf9g== - -esbuild@^0.14.51: - version "0.14.51" - resolved "https://registry.npmjs.org/esbuild/-/esbuild-0.14.51.tgz#1c8ecbc8db3710da03776211dc3ee3448f7aa51e" - integrity sha512-+CvnDitD7Q5sT7F+FM65sWkF8wJRf+j9fPcprxYV4j+ohmzVj2W7caUqH2s5kCaCJAfcAICjSlKhDCcvDpU7nw== +esbuild-android-64@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.53.tgz#259bc3ef1399a3cad8f4f67c40ee20779c4de675" + integrity sha512-fIL93sOTnEU+NrTAVMIKiAw0YH22HWCAgg4N4Z6zov2t0kY9RAJ50zY9ZMCQ+RT6bnOfDt8gCTnt/RaSNA2yRA== + +esbuild-android-arm64@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.53.tgz#2158253d4e8f9fdd2a081bbb4f73b8806178841e" + integrity sha512-PC7KaF1v0h/nWpvlU1UMN7dzB54cBH8qSsm7S9mkwFA1BXpaEOufCg8hdoEI1jep0KeO/rjZVWrsH8+q28T77A== + +esbuild-darwin-64@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.53.tgz#b4681831fd8f8d06feb5048acbe90d742074cc2a" + integrity sha512-gE7P5wlnkX4d4PKvLBUgmhZXvL7lzGRLri17/+CmmCzfncIgq8lOBvxGMiQ4xazplhxq+72TEohyFMZLFxuWvg== + +esbuild-darwin-arm64@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.53.tgz#d267d957852d121b261b3f76ead86e5b5463acc9" + integrity sha512-otJwDU3hnI15Q98PX4MJbknSZ/WSR1I45il7gcxcECXzfN4Mrpft5hBDHXNRnCh+5858uPXBXA1Vaz2jVWLaIA== + +esbuild-freebsd-64@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.53.tgz#aca2af6d72b537fe66a38eb8f374fb66d4c98ca0" + integrity sha512-WkdJa8iyrGHyKiPF4lk0MiOF87Q2SkE+i+8D4Cazq3/iqmGPJ6u49je300MFi5I2eUsQCkaOWhpCVQMTKGww2w== + +esbuild-freebsd-arm64@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.53.tgz#76282e19312d914c34343c8a7da6cc5f051580b9" + integrity sha512-9T7WwCuV30NAx0SyQpw8edbKvbKELnnm1FHg7gbSYaatH+c8WJW10g/OdM7JYnv7qkimw2ZTtSA+NokOLd2ydQ== + +esbuild-linux-32@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.53.tgz#1045d34cf7c5faaf2af3b29cc1573b06580c37e5" + integrity sha512-VGanLBg5en2LfGDgLEUxQko2lqsOS7MTEWUi8x91YmsHNyzJVT/WApbFFx3MQGhkf+XdimVhpyo5/G0PBY91zg== + +esbuild-linux-64@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.53.tgz#ab3f2ee2ebb5a6930c72d9539cb34b428808cbe4" + integrity sha512-pP/FA55j/fzAV7N9DF31meAyjOH6Bjuo3aSKPh26+RW85ZEtbJv9nhoxmGTd9FOqjx59Tc1ZbrJabuiXlMwuZQ== + +esbuild-linux-arm64@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.53.tgz#1f5530412f6690949e78297122350488d3266cfe" + integrity sha512-GDmWITT+PMsjCA6/lByYk7NyFssW4Q6in32iPkpjZ/ytSyH+xeEx8q7HG3AhWH6heemEYEWpTll/eui3jwlSnw== + +esbuild-linux-arm@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.53.tgz#a44ec9b5b42007ab6c0d65a224ccc6bbd97c54cf" + integrity sha512-/u81NGAVZMopbmzd21Nu/wvnKQK3pT4CrvQ8BTje1STXcQAGnfyKgQlj3m0j2BzYbvQxSy+TMck4TNV2onvoPA== + +esbuild-linux-mips64le@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.53.tgz#a4d0b6b17cfdeea4e41b0b085a5f73d99311be9f" + integrity sha512-d6/XHIQW714gSSp6tOOX2UscedVobELvQlPMkInhx1NPz4ThZI9uNLQ4qQJHGBGKGfu+rtJsxM4NVHLhnNRdWQ== + +esbuild-linux-ppc64le@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.53.tgz#8c331822c85465434e086e3e6065863770c38139" + integrity sha512-ndnJmniKPCB52m+r6BtHHLAOXw+xBCWIxNnedbIpuREOcbSU/AlyM/2dA3BmUQhsHdb4w3amD5U2s91TJ3MzzA== + +esbuild-linux-riscv64@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.53.tgz#36fd75543401304bea8a2d63bf8ea18aaa508e00" + integrity sha512-yG2sVH+QSix6ct4lIzJj329iJF3MhloLE6/vKMQAAd26UVPVkhMFqFopY+9kCgYsdeWvXdPgmyOuKa48Y7+/EQ== + +esbuild-linux-s390x@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.53.tgz#1622677ab6824123f48f75d3afc031cd41936129" + integrity sha512-OCJlgdkB+XPYndHmw6uZT7jcYgzmx9K+28PVdOa/eLjdoYkeAFvH5hTwX4AXGLZLH09tpl4bVsEtvuyUldaNCg== + +esbuild-netbsd-64@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.53.tgz#e86d0efd0116658be335492ed12e66b26b4baf52" + integrity sha512-gp2SB+Efc7MhMdWV2+pmIs/Ja/Mi5rjw+wlDmmbIn68VGXBleNgiEZG+eV2SRS0kJEUyHNedDtwRIMzaohWedQ== + +esbuild-openbsd-64@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.53.tgz#9bcbbe6f86304872c6e91f64c8eb73fc29c3588b" + integrity sha512-eKQ30ZWe+WTZmteDYg8S+YjHV5s4iTxeSGhJKJajFfQx9TLZJvsJX0/paqwP51GicOUruFpSUAs2NCc0a4ivQQ== + +esbuild-sunos-64@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.53.tgz#f7a872f7460bfb7b131f7188a95fbce3d1c577e8" + integrity sha512-OWLpS7a2FrIRukQqcgQqR1XKn0jSJoOdT+RlhAxUoEQM/IpytS3FXzCJM6xjUYtpO5GMY0EdZJp+ur2pYdm39g== + +esbuild-windows-32@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.53.tgz#c5e3ca50e2d1439cc2c9fe4defa63bcd474ce709" + integrity sha512-m14XyWQP5rwGW0tbEfp95U6A0wY0DYPInWBB7D69FAXUpBpBObRoGTKRv36lf2RWOdE4YO3TNvj37zhXjVL5xg== + +esbuild-windows-64@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.53.tgz#ec2ab4a60c5215f092ffe1eab6d01319e88238af" + integrity sha512-s9skQFF0I7zqnQ2K8S1xdLSfZFsPLuOGmSx57h2btSEswv0N0YodYvqLcJMrNMXh6EynOmWD7rz+0rWWbFpIHQ== + +esbuild-windows-arm64@0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.53.tgz#f71d403806bdf9f4a1f9d097db9aec949bd675c8" + integrity sha512-E+5Gvb+ZWts+00T9II6wp2L3KG2r3iGxByqd/a1RmLmYWVsSVUjkvIxZuJ3hYTIbhLkH5PRwpldGTKYqVz0nzQ== + +esbuild@^0.14.53: + version "0.14.53" + resolved "https://registry.npmjs.org/esbuild/-/esbuild-0.14.53.tgz#20b1007f686e8584f2a01a1bec5a37aac9498ce4" + integrity sha512-ohO33pUBQ64q6mmheX1mZ8mIXj8ivQY/L4oVuAshr+aJI+zLl+amrp3EodrUNDNYVrKJXGPfIHFGhO8slGRjuw== optionalDependencies: - esbuild-android-64 "0.14.51" - esbuild-android-arm64 "0.14.51" - esbuild-darwin-64 "0.14.51" - esbuild-darwin-arm64 "0.14.51" - esbuild-freebsd-64 "0.14.51" - esbuild-freebsd-arm64 "0.14.51" - esbuild-linux-32 "0.14.51" - esbuild-linux-64 "0.14.51" - esbuild-linux-arm "0.14.51" - esbuild-linux-arm64 "0.14.51" - esbuild-linux-mips64le "0.14.51" - esbuild-linux-ppc64le "0.14.51" - esbuild-linux-riscv64 "0.14.51" - esbuild-linux-s390x "0.14.51" - esbuild-netbsd-64 "0.14.51" - esbuild-openbsd-64 "0.14.51" - esbuild-sunos-64 "0.14.51" - esbuild-windows-32 "0.14.51" - esbuild-windows-64 "0.14.51" - esbuild-windows-arm64 "0.14.51" + "@esbuild/linux-loong64" "0.14.53" + esbuild-android-64 "0.14.53" + esbuild-android-arm64 "0.14.53" + esbuild-darwin-64 "0.14.53" + esbuild-darwin-arm64 "0.14.53" + esbuild-freebsd-64 "0.14.53" + esbuild-freebsd-arm64 "0.14.53" + esbuild-linux-32 "0.14.53" + esbuild-linux-64 "0.14.53" + esbuild-linux-arm "0.14.53" + esbuild-linux-arm64 "0.14.53" + esbuild-linux-mips64le "0.14.53" + esbuild-linux-ppc64le "0.14.53" + esbuild-linux-riscv64 "0.14.53" + esbuild-linux-s390x "0.14.53" + esbuild-netbsd-64 "0.14.53" + esbuild-openbsd-64 "0.14.53" + esbuild-sunos-64 "0.14.53" + esbuild-windows-32 "0.14.53" + esbuild-windows-64 "0.14.53" + esbuild-windows-arm64 "0.14.53" escalade@^3.1.1: version "3.1.1" @@ -6799,7 +6811,7 @@ jsii-pacmak@^1.63.2: xmlbuilder "^15.1.1" yargs "^16.2.0" -jsii-reflect@^1.59.0, jsii-reflect@^1.63.2: +jsii-reflect@^1.63.2: version "1.63.2" resolved "https://registry.npmjs.org/jsii-reflect/-/jsii-reflect-1.63.2.tgz#1f8d130a1cb5a03b30651543dd52c77eb9f620fe" integrity sha512-eawNN/ySYVznYY2ZJYe5FNcSly12KgC8/MBDl4qln3daag3Ts/d7ocfbS9sjFayn4AhBojq1h1DDs8sjoG38Kg== @@ -6811,7 +6823,7 @@ jsii-reflect@^1.59.0, jsii-reflect@^1.63.2: oo-ascii-tree "^1.63.2" yargs "^16.2.0" -jsii-rosetta@^1.59.0, jsii-rosetta@^1.63.2: +jsii-rosetta@^1.63.2: version "1.63.2" resolved "https://registry.npmjs.org/jsii-rosetta/-/jsii-rosetta-1.63.2.tgz#42c1ee7a418392f0dcee8fa89277559871b76117" integrity sha512-cBl8uAtNYuWqrwGue2Sr7cdgPhWx/QiAAE70lDec0OtBSNdGq0MUA04GD1/peQw4LPhE+1ikdeyspJYJaTtQgg== @@ -6830,7 +6842,7 @@ jsii-rosetta@^1.59.0, jsii-rosetta@^1.63.2: workerpool "^6.2.1" yargs "^16.2.0" -jsii@1.63.2, jsii@^1.59.0, jsii@^1.63.2: +jsii@1.63.2, jsii@^1.63.2: version "1.63.2" resolved "https://registry.npmjs.org/jsii/-/jsii-1.63.2.tgz#6042f7d1239f939ef0df28c41e090a3c221ac8f6" integrity sha512-KHnsuTm4ErLiB4JNvPi/TzJuIXeqkMim95Qs9KG5M8tfDd/GHlsotwxNx9qfG2R7DdAWrH0MG+kd1wKIAl+GFw== @@ -6963,10 +6975,10 @@ jsprim@^1.2.2: json-schema "0.4.0" verror "1.10.0" -jszip@^3.10.0: - version "3.10.0" - resolved "https://registry.npmjs.org/jszip/-/jszip-3.10.0.tgz#faf3db2b4b8515425e34effcdbb086750a346061" - integrity sha512-LDfVtOLtOxb9RXkYOwPyNBTQDL4eUbqahtoY6x07GiDJHwSYvn8sHHIw8wINImV3MqbMNve2gSuM1DDqEKk09Q== +jszip@^3.10.1: + version "3.10.1" + resolved "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz#34aee70eb18ea1faec2f589208a157d1feb091c2" + integrity sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g== dependencies: lie "~3.3.0" pako "~1.0.2" @@ -7333,9 +7345,9 @@ lru-cache@^6.0.0: yallist "^4.0.0" lru-cache@^7.4.4, lru-cache@^7.5.1, lru-cache@^7.7.1: - version "7.13.1" - resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-7.13.1.tgz#267a81fbd0881327c46a81c5922606a2cfe336c4" - integrity sha512-CHqbAq7NFlW3RSnoWXLJBxCWaZVBrfa9UEHId2M3AW8iEBurbqduNexEUCGc3SHc6iCYXNJCDi903LajSVAEPQ== + version "7.13.2" + resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-7.13.2.tgz#bb5d3f1deea3f3a7a35c1c44345566a612e09cd0" + integrity sha512-VJL3nIpA79TodY/ctmZEfhASgqekbT574/c4j3jn4bKXbSCnTTCH/KltZyvL2GlV+tGSMtsWyem8DCX7qKTMBA== lru-queue@^0.1.0: version "0.1.0" @@ -8946,10 +8958,10 @@ progress@^2.0.0, progress@^2.0.3: resolved "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== -projen@^0.60.10: - version "0.60.10" - resolved "https://registry.npmjs.org/projen/-/projen-0.60.10.tgz#9659672a8374c3d386b0655523e6d47919cb6a38" - integrity sha512-c4vRC5U/Q59U6rzIK+Oy0/iRYt3419OP1WyiBjP7X6QXuCcNcehstmMcc2QS5uM1zMi4v/Hi82wwTG7juBGHYA== +projen@^0.60.14: + version "0.60.14" + resolved "https://registry.npmjs.org/projen/-/projen-0.60.14.tgz#bc51ad43161745d928884b2ff68025c3ca3d1d9b" + integrity sha512-BrY9AgcUafK304wSinVUFr6mJ3cqGvRm2V/hZMUoFUka2bEgJXJNnY6VZEoLj5KRUarJZVvcoh8X6ckaFn44eA== dependencies: "@iarna/toml" "^2.2.5" case "^1.6.3"