From 6d1dc5befd4b76d8799417185d862e81da0a6796 Mon Sep 17 00:00:00 2001 From: Kaizen Conroy <36202692+kaizencc@users.noreply.github.com> Date: Tue, 22 Aug 2023 20:30:25 -0400 Subject: [PATCH] feat(synthetics): enable auto delete lambdas via custom resource (#26580) Synthetics [used](https://aws.amazon.com/about-aws/whats-new/2022/05/amazon-cloudwatch-synthetics-support-canary-resources-deletion/) to have a property `deleteLambdaResourceOnCanaryDeletion` that has since been deprecated and erased from cloudformation docs. Although this property still works today synthetics makes no promises that this is supported in the future. Here in CDK land, this PR serves as a replacement to the `deleteLambdaResourceOnCanaryDeletion` property (called `enableAutoDeleteLambdas` on the L2 Canary) by implementing a custom resource similar to what we have in S3 and ECR. **This PR deprecates `enableAutoDeleteLambdas` in favor of `cleanup: cleanup.LAMBDA`, an enum that achieves the same thing but via custom resource** Closes #18448 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../@aws-cdk/aws-synthetics-alpha/README.md | 26 +- .../aws-synthetics-alpha/lib/canary.ts | 82 +- .../aws-synthetics-alpha/package.json | 6 +- .../airlift-custom-resource-handlers.sh | 23 + .../aws-synthetics-alpha/test/canary.test.ts | 65 +- .../aws-synthetics-alpha/test/code.test.ts | 7 +- ...-synthetics-canary-auto-delete.assets.json | 45 + ...ynthetics-canary-auto-delete.template.json | 679 +++++ .../cdk.out | 1 + ...efaultTestDeployAssert94B79CED.assets.json | 19 + ...aultTestDeployAssert94B79CED.template.json | 36 + .../integ.json | 14 + .../manifest.json | 201 ++ .../tree.json | 923 +++++++ .../test/integ.canary-auto-delete-lambda.ts | 61 + ...efaultTestDeployAssert3AD5A094.assets.json | 10 +- ...aultTestDeployAssert3AD5A094.template.json | 20 +- .../index.js | 1 + .../index.js | 2184 ++++++++--------- .../nodejs/node_modules/canary.js | 0 .../nodejs/node_modules/folder/canary.js | 0 .../python/canary.py | 0 .../canary-one.assets.json | 23 +- .../canary-one.template.json | 281 ++- .../integ.canary.js.snapshot/manifest.json | 58 +- .../test/integ.canary.js.snapshot/tree.json | 230 +- .../aws-synthetics-alpha/test/integ.canary.ts | 9 +- .../aws-synthetics-alpha/test/metric.test.ts | 5 +- .../custom-resource-handlers/README.md | 1 + .../index.ts | 95 + .../custom-resource-handlers/package.json | 2 + ...elete-underlying-resources-handler.test.ts | 264 ++ yarn.lock | 170 ++ 33 files changed, 4270 insertions(+), 1271 deletions(-) create mode 100755 packages/@aws-cdk/aws-synthetics-alpha/scripts/airlift-custom-resource-handlers.sh create mode 100644 packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdk-synthetics-canary-auto-delete.assets.json create mode 100644 packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdk-synthetics-canary-auto-delete.template.json create mode 100644 packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdk.out create mode 100644 packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdkintegsyntheticscanaryautodeleteDefaultTestDeployAssert94B79CED.assets.json create mode 100644 packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdkintegsyntheticscanaryautodeleteDefaultTestDeployAssert94B79CED.template.json create mode 100644 packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/integ.json create mode 100644 packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/manifest.json create mode 100644 packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/tree.json create mode 100644 packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.ts create mode 100644 packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.40129686bd15b9964212325144aa0db37ac362e1e290ab678d8679880f705e83/index.js rename packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/{asset.d5b88712f80b7d8c96ddbffc883a569f5e5681cf14a985d4d0933ca3712f5110.bundle => asset.54ed1902ad5ad220444041937ce65cb63c7fbccd0c11fdfd9ecbec43770cdaa5.bundle}/index.js (97%) rename packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/{asset.4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9 => asset.d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8}/nodejs/node_modules/canary.js (100%) rename packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/{asset.4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9 => asset.d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8}/nodejs/node_modules/folder/canary.js (100%) rename packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/{asset.4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9 => asset.d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8}/python/canary.py (100%) create mode 100644 packages/@aws-cdk/custom-resource-handlers/lib/aws-synthetics-alpha/auto-delete-underlying-resources-handler/index.ts create mode 100644 packages/@aws-cdk/custom-resource-handlers/test/aws-synthetics-alpha/auto-delete-underlying-resources-handler.test.ts diff --git a/packages/@aws-cdk/aws-synthetics-alpha/README.md b/packages/@aws-cdk/aws-synthetics-alpha/README.md index 0c64ba10df1c8..bcb5ff96a3671 100644 --- a/packages/@aws-cdk/aws-synthetics-alpha/README.md +++ b/packages/@aws-cdk/aws-synthetics-alpha/README.md @@ -102,27 +102,35 @@ const schedule = synthetics.Schedule.cron({ If you want the canary to run just once upon deployment, you can use `Schedule.once()`. -### Canary DeleteLambdaResourcesOnCanaryDeletion +### Deleting underlying resources on canary deletion -You can specify whether the AWS CloudFormation is to also delete the Lambda functions and layers used by this canary, when the canary is deleted. +When you delete a lambda, the following underlying resources are isolated in your AWS account: -This can be provisioned by setting the `enableAutoDeleteLambdas` property to `true` when we define the canary. + - Lambda Function that runs your canary script + - S3 Bucket for artifact storage + - IAM roles and policies + - Log Groups in CloudWatch Logs. -```ts -const stack = new Stack(); +To learn more about these underlying resources, see +[Synthetics Canaries Deletion](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/synthetics_canaries_deletion.html). + +In the CDK, you can configure your canary to delete the underlying lambda function when the canary is deleted. +This can be provisioned by setting `cleanup: Cleanup.LAMBDA`. Note that this +will create a custom resource under the hood that takes care of the lambda deletion for you. -const canary = new synthetics.Canary(stack, 'Canary', { +```ts +const canary = new synthetics.Canary(this, 'Canary', { test: synthetics.Test.custom({ handler: 'index.handler', code: synthetics.Code.fromInline('/* Synthetics handler code'), }), - enableAutoDeleteLambdas: true, + cleanup: synthetics.Cleanup.LAMBDA, runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0, }); ``` -Synthetic Canaries create additional resources under the hood beyond Lambda functions. Setting `enableAutoDeleteLambdas: true` will take care of -cleaning up Lambda functions on deletion, but you still have to manually delete other resources like S3 buckets and CloudWatch logs. +> Note: To properly clean up your canary on deletion, you still have to manually delete other resources +> like S3 buckets and CloudWatch logs. ### Configuring the Canary Script diff --git a/packages/@aws-cdk/aws-synthetics-alpha/lib/canary.ts b/packages/@aws-cdk/aws-synthetics-alpha/lib/canary.ts index d36f8172484a3..c144d464a8bb6 100644 --- a/packages/@aws-cdk/aws-synthetics-alpha/lib/canary.ts +++ b/packages/@aws-cdk/aws-synthetics-alpha/lib/canary.ts @@ -10,6 +10,11 @@ import { Runtime } from './runtime'; import { Schedule } from './schedule'; import { CloudWatchSyntheticsMetrics } from 'aws-cdk-lib/aws-synthetics/lib/synthetics-canned-metrics.generated'; import { CfnCanary } from 'aws-cdk-lib/aws-synthetics'; +import { CustomResource, CustomResourceProvider, CustomResourceProviderRuntime } from 'aws-cdk-lib/core'; +import * as path from 'path'; + +const AUTO_DELETE_UNDERLYING_RESOURCES_RESOURCE_TYPE = 'Custom::SyntheticsAutoDeleteUnderlyingResources'; +const AUTO_DELETE_UNDERLYING_RESOURCES_TAG = 'aws-cdk:auto-delete-underlying-resources'; /** * Specify a test that the canary should run @@ -50,6 +55,25 @@ export interface CustomTestOptions { readonly handler: string, } +/** + * Different ways to clean up underlying Canary resources + * when the Canary is deleted. + */ +export enum Cleanup { + /** + * Clean up nothing. The user is responsible for cleaning up + * all resources left behind by the Canary. + */ + NOTHING = 'nothing', + + /** + * Clean up the underlying Lambda function only. The user is + * responsible for cleaning up all other resources left behind + * by the Canary. + */ + LAMBDA = 'lambda', +} + /** * Options for specifying the s3 location that stores the data of each canary run. The artifacts bucket location **cannot** * be updated once the canary is created. @@ -195,9 +219,18 @@ export interface CanaryProps { * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-synthetics-canary.html#cfn-synthetics-canary-deletelambdaresourcesoncanarydeletion * * @default false + * @deprecated this feature has been deprecated by the service team, use `cleanup: Cleanup.LAMBDA` instead which will use a Custom Resource to achieve the same effect. */ readonly enableAutoDeleteLambdas?: boolean; + /** + * Specify the underlying resources to be cleaned up when the canary is deleted. + * Using `Cleanup.LAMBDA` will create a Custom Resource to achieve this. + * + * @default Cleanup.NOTHING + */ + readonly cleanup?: Cleanup; + /** * Lifecycle rules for the generated canary artifact bucket. Has no effect * if a bucket is passed to `artifactsBucketLocation`. If you pass a bucket @@ -248,6 +281,7 @@ export class Canary extends cdk.Resource implements ec2.IConnectable { * @internal */ private readonly _connections?: ec2.Connections; + private readonly _resource: CfnCanary; public constructor(scope: Construct, id: string, props: CanaryProps) { if (props.canaryName && !cdk.Token.isUnresolved(props.canaryName)) { @@ -285,12 +319,49 @@ export class Canary extends cdk.Resource implements ec2.IConnectable { code: this.createCode(props), runConfig: this.createRunConfig(props), vpcConfig: this.createVpcConfig(props), - deleteLambdaResourcesOnCanaryDeletion: props.enableAutoDeleteLambdas, }); + this._resource = resource; this.canaryId = resource.attrId; this.canaryState = resource.attrState; this.canaryName = this.getResourceNameAttribute(resource.ref); + + if (props.cleanup === Cleanup.LAMBDA ?? props.enableAutoDeleteLambdas) { + this.cleanupUnderlyingResources(); + } + } + + private cleanupUnderlyingResources() { + const provider = CustomResourceProvider.getOrCreateProvider(this, AUTO_DELETE_UNDERLYING_RESOURCES_RESOURCE_TYPE, { + codeDirectory: path.join(__dirname, '..', 'custom-resource-handlers', 'dist', 'aws-synthetics-alpha', 'auto-delete-underlying-resources-handler'), + useCfnResponseWrapper: false, + runtime: CustomResourceProviderRuntime.NODEJS_18_X, + description: `Lambda function for auto-deleting underlying resources created by ${this.canaryName}.`, + policyStatements: [{ + Effect: 'Allow', + Action: ['lambda:DeleteFunction'], + Resource: this.lambdaArn(), + }, { + Effect: 'Allow', + Action: ['synthetics:GetCanary'], + Resource: '*', + }], + }); + + new CustomResource(this, 'AutoDeleteUnderlyingResourcesCustomResource', { + resourceType: AUTO_DELETE_UNDERLYING_RESOURCES_RESOURCE_TYPE, + serviceToken: provider.serviceToken, + properties: { + CanaryName: this.canaryName, + }, + }); + + // We also tag the canary to record the fact that we want it autodeleted. + // The custom resource will check this tag before actually doing the delete. + // Because tagging and untagging will ALWAYS happen before the CR is deleted, + // we can set `autoDeleteLambda: false` without the removal of the CR emptying + // the lambda as a side effect. + cdk.Tags.of(this._resource).add(AUTO_DELETE_UNDERLYING_RESOURCES_TAG, 'true'); } /** @@ -402,6 +473,15 @@ export class Canary extends cdk.Resource implements ec2.IConnectable { }); } + private lambdaArn() { + return cdk.Stack.of(this).formatArn({ + service: 'lambda', + resource: 'function', + arnFormat: cdk.ArnFormat.COLON_RESOURCE_NAME, + resourceName: 'cwsyn-*', + }); + } + /** * Returns the code object taken in by the canary resource. */ diff --git a/packages/@aws-cdk/aws-synthetics-alpha/package.json b/packages/@aws-cdk/aws-synthetics-alpha/package.json index 186bf703a95a7..ab93636420494 100644 --- a/packages/@aws-cdk/aws-synthetics-alpha/package.json +++ b/packages/@aws-cdk/aws-synthetics-alpha/package.json @@ -67,7 +67,10 @@ "cdk-build": { "env": { "AWSLINT_BASE_CONSTRUCT": true - } + }, + "pre": [ + "./scripts/airlift-custom-resource-handlers.sh" + ] }, "keywords": [ "aws", @@ -84,6 +87,7 @@ "license": "Apache-2.0", "devDependencies": { "@aws-cdk/cdk-build-tools": "0.0.0", + "@aws-cdk/custom-resource-handlers": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", "@aws-cdk/pkglint": "0.0.0", "@aws-cdk/integ-tests-alpha": "0.0.0", diff --git a/packages/@aws-cdk/aws-synthetics-alpha/scripts/airlift-custom-resource-handlers.sh b/packages/@aws-cdk/aws-synthetics-alpha/scripts/airlift-custom-resource-handlers.sh new file mode 100755 index 0000000000000..5a5038ddd63d3 --- /dev/null +++ b/packages/@aws-cdk/aws-synthetics-alpha/scripts/airlift-custom-resource-handlers.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +scriptdir=$(cd $(dirname $0) && pwd) +customresourcedir=$(node -p "path.dirname(require.resolve('@aws-cdk/custom-resource-handlers/package.json'))") +awscdklibdir=${scriptdir}/.. + +list_custom_resources() { + for file in $customresourcedir/dist/aws-synthetics-alpha/*/index.js; do + echo $file | rev | cut -d "/" -f 2-4 | rev + done +} + +customresources=$(list_custom_resources) + +echo $customresources + +cd $awscdklibdir +mkdir -p $awscdklibdir/custom-resource-handlers + +for cr in $customresources; do + mkdir -p $awscdklibdir/custom-resource-handlers/$cr + cp $customresourcedir/$cr/index.js $awscdklibdir/custom-resource-handlers/$cr +done diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/canary.test.ts b/packages/@aws-cdk/aws-synthetics-alpha/test/canary.test.ts index 5ca9f25d74b1c..d4460351dcc61 100644 --- a/packages/@aws-cdk/aws-synthetics-alpha/test/canary.test.ts +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/canary.test.ts @@ -1,5 +1,4 @@ import * as path from 'path'; -import { testDeprecated } from '@aws-cdk/cdk-build-tools'; import { Match, Template } from 'aws-cdk-lib/assertions'; import * as ec2 from 'aws-cdk-lib/aws-ec2'; import * as iam from 'aws-cdk-lib/aws-iam'; @@ -7,7 +6,7 @@ import * as s3 from 'aws-cdk-lib/aws-s3'; import { Duration, Lazy, Stack } from 'aws-cdk-lib'; import * as synthetics from '../lib'; -testDeprecated('Basic canary properties work', () => { +test('Basic canary properties work', () => { // GIVEN const stack = new Stack(); @@ -36,7 +35,7 @@ testDeprecated('Basic canary properties work', () => { }); }); -testDeprecated('Can set `DeleteLambdaResourceOnCanaryDeletion`', () => { +test('cleanup.LAMBDA introduces custom resource to delete lambda', () => { // GIVEN const stack = new Stack(); @@ -46,17 +45,15 @@ testDeprecated('Can set `DeleteLambdaResourceOnCanaryDeletion`', () => { handler: 'index.handler', code: synthetics.Code.fromInline('/* Synthetics handler code'), }), - enableAutoDeleteLambdas: true, + cleanup: synthetics.Cleanup.LAMBDA, runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_8, }); // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Synthetics::Canary', { - DeleteLambdaResourcesOnCanaryDeletion: true, - }); + Template.fromStack(stack).resourceCountIs('Custom::SyntheticsAutoDeleteUnderlyingResources', 1); }); -testDeprecated('Canary can have generated name', () => { +test('Canary can have generated name', () => { // GIVEN const stack = new Stack(); @@ -75,7 +72,7 @@ testDeprecated('Canary can have generated name', () => { }); }); -testDeprecated('Name validation does not fail when using Tokens', () => { +test('Name validation does not fail when using Tokens', () => { // GIVEN const stack = new Stack(); @@ -93,7 +90,7 @@ testDeprecated('Name validation does not fail when using Tokens', () => { Template.fromStack(stack).resourceCountIs('AWS::Synthetics::Canary', 1); }); -testDeprecated('Throws when name is specified incorrectly', () => { +test('Throws when name is specified incorrectly', () => { // GIVEN const stack = new Stack(); @@ -109,7 +106,7 @@ testDeprecated('Throws when name is specified incorrectly', () => { .toThrowError('Canary name must be lowercase, numbers, hyphens, or underscores (got "My Canary")'); }); -testDeprecated('Throws when name has more than 21 characters', () => { +test('Throws when name has more than 21 characters', () => { // GIVEN const stack = new Stack(); @@ -125,7 +122,7 @@ testDeprecated('Throws when name has more than 21 characters', () => { .toThrowError(`Canary name is too large, must be between 1 and 21 characters, but is 22 (got "${'a'.repeat(22)}")`); }); -testDeprecated('An existing role can be specified instead of auto-created', () => { +test('An existing role can be specified instead of auto-created', () => { // GIVEN const stack = new Stack(); @@ -151,7 +148,7 @@ testDeprecated('An existing role can be specified instead of auto-created', () = }); }); -testDeprecated('An auto-generated bucket can have lifecycle rules', () => { +test('An auto-generated bucket can have lifecycle rules', () => { // GIVEN const stack = new Stack(); const lifecycleRules = [{ @@ -180,7 +177,7 @@ testDeprecated('An auto-generated bucket can have lifecycle rules', () => { }); }); -testDeprecated('An existing bucket and prefix can be specified instead of auto-created', () => { +test('An existing bucket and prefix can be specified instead of auto-created', () => { // GIVEN const stack = new Stack(); const bucket = new s3.Bucket(stack, 'mytestbucket'); @@ -202,7 +199,7 @@ testDeprecated('An existing bucket and prefix can be specified instead of auto-c }); }); -testDeprecated('Runtime can be specified', () => { +test('Runtime can be specified', () => { // GIVEN const stack = new Stack(); @@ -221,7 +218,7 @@ testDeprecated('Runtime can be specified', () => { }); }); -testDeprecated('Python runtime can be specified', () => { +test('Python runtime can be specified', () => { // GIVEN const stack = new Stack(); @@ -240,7 +237,7 @@ testDeprecated('Python runtime can be specified', () => { }); }); -testDeprecated('environment variables can be specified', () => { +test('environment variables can be specified', () => { // GIVEN const stack = new Stack(); const environmentVariables = { @@ -266,7 +263,7 @@ testDeprecated('environment variables can be specified', () => { }); }); -testDeprecated('environment variables are skipped if not provided', () => { +test('environment variables are skipped if not provided', () => { // GIVEN const stack = new Stack(); @@ -285,7 +282,7 @@ testDeprecated('environment variables are skipped if not provided', () => { }); }); -testDeprecated('Runtime can be customized', () => { +test('Runtime can be customized', () => { // GIVEN const stack = new Stack(); @@ -304,7 +301,7 @@ testDeprecated('Runtime can be customized', () => { }); }); -testDeprecated('Schedule can be set with Rate', () => { +test('Schedule can be set with Rate', () => { // GIVEN const stack = new Stack(); @@ -324,7 +321,7 @@ testDeprecated('Schedule can be set with Rate', () => { }); }); -testDeprecated('Schedule can be set to 1 minute', () => { +test('Schedule can be set to 1 minute', () => { // GIVEN const stack = new Stack(); @@ -344,7 +341,7 @@ testDeprecated('Schedule can be set to 1 minute', () => { }); }); -testDeprecated('Schedule can be set with Cron', () => { +test('Schedule can be set with Cron', () => { // GIVEN const stack = new Stack(); @@ -364,7 +361,7 @@ testDeprecated('Schedule can be set with Cron', () => { }); }); -testDeprecated('Schedule can be set with Expression', () => { +test('Schedule can be set with Expression', () => { // GIVEN const stack = new Stack(); @@ -384,7 +381,7 @@ testDeprecated('Schedule can be set with Expression', () => { }); }); -testDeprecated('Schedule can be set to run once', () => { +test('Schedule can be set to run once', () => { // GIVEN const stack = new Stack(); @@ -436,7 +433,7 @@ test('Throws when rate above is not a whole number of minutes', () => { .toThrowError('\'59 seconds\' cannot be converted into a whole number of minutes.'); }); -testDeprecated('Can share artifacts bucket between canaries', () => { +test('Can share artifacts bucket between canaries', () => { // GIVEN const stack = new Stack(); @@ -464,7 +461,7 @@ testDeprecated('Can share artifacts bucket between canaries', () => { expect(canary1.artifactsBucket).toEqual(canary2.artifactsBucket); }); -testDeprecated('can specify custom test', () => { +test('can specify custom test', () => { // GIVEN const stack = new Stack(); @@ -493,7 +490,7 @@ testDeprecated('can specify custom test', () => { }); describe('canary in a vpc', () => { - testDeprecated('can specify vpc', () => { + test('can specify vpc', () => { // GIVEN const stack = new Stack(); const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2 }); @@ -528,7 +525,7 @@ describe('canary in a vpc', () => { }); }); - testDeprecated('default security group and subnets', () => { + test('default security group and subnets', () => { // GIVEN const stack = new Stack(); const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2 }); @@ -565,7 +562,7 @@ describe('canary in a vpc', () => { }); }); - testDeprecated('provided security group', () => { + test('provided security group', () => { // GIVEN const stack = new Stack(); const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2 }); @@ -610,7 +607,7 @@ describe('canary in a vpc', () => { }); }); -testDeprecated('Role policy generated as expected', () => { +test('Role policy generated as expected', () => { // GIVEN const stack = new Stack(); @@ -705,7 +702,7 @@ testDeprecated('Role policy generated as expected', () => { }); }); -testDeprecated('Should create handler with path for recent runtimes', () => { +test('Should create handler with path for recent runtimes', () => { // GIVEN const stack = new Stack(); @@ -730,7 +727,7 @@ testDeprecated('Should create handler with path for recent runtimes', () => { }); describe('handler validation', () => { - testDeprecated('legacy runtimes', () => { + test('legacy runtimes', () => { const stack = new Stack(); expect(() => { new synthetics.Canary(stack, 'Canary', { @@ -743,7 +740,7 @@ describe('handler validation', () => { }).toThrow(/Canary Handler must be specified as 'fileName.handler' for legacy runtimes/); }); - testDeprecated('recent runtimes', () => { + test('recent runtimes', () => { const stack = new Stack(); expect(() => { @@ -777,7 +774,7 @@ describe('handler validation', () => { }).not.toThrow(); }); - testDeprecated('handler length', () => { + test('handler length', () => { const stack = new Stack(); expect(() => { new synthetics.Canary(stack, 'Canary1', { diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/code.test.ts b/packages/@aws-cdk/aws-synthetics-alpha/test/code.test.ts index fe974a38fa0bf..396d245d2bd98 100644 --- a/packages/@aws-cdk/aws-synthetics-alpha/test/code.test.ts +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/code.test.ts @@ -1,6 +1,5 @@ import * as fs from 'fs'; import * as path from 'path'; -import { testDeprecated } from '@aws-cdk/cdk-build-tools'; import { Template } from 'aws-cdk-lib/assertions'; import * as s3 from 'aws-cdk-lib/aws-s3'; import { App, Stack, DockerImage } from 'aws-cdk-lib'; @@ -42,7 +41,7 @@ describe(synthetics.Code.fromInline, () => { }); describe(synthetics.Code.fromAsset, () => { - testDeprecated('fromAsset works for node runtimes', () => { + test('fromAsset works for node runtimes', () => { // GIVEN const stack = new Stack(new App(), 'canaries'); @@ -66,7 +65,7 @@ describe(synthetics.Code.fromAsset, () => { }); }); - testDeprecated('fromAsset works for python runtimes', () => { + test('fromAsset works for python runtimes', () => { // GIVEN const stack = new Stack(new App(), 'canaries'); @@ -90,7 +89,7 @@ describe(synthetics.Code.fromAsset, () => { }); }); - testDeprecated('only one Asset object gets created even if multiple canaries use the same AssetCode', () => { + test('only one Asset object gets created even if multiple canaries use the same AssetCode', () => { // GIVEN const app = new App({ context: { diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdk-synthetics-canary-auto-delete.assets.json b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdk-synthetics-canary-auto-delete.assets.json new file mode 100644 index 0000000000000..fdfeb046b719e --- /dev/null +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdk-synthetics-canary-auto-delete.assets.json @@ -0,0 +1,45 @@ +{ + "version": "33.0.0", + "files": { + "086fe534b1e7545fbc662251685b8a7d91ab2061bbfe98d857b27478442487cb": { + "source": { + "path": "asset.086fe534b1e7545fbc662251685b8a7d91ab2061bbfe98d857b27478442487cb", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "086fe534b1e7545fbc662251685b8a7d91ab2061bbfe98d857b27478442487cb.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "66db480cb40e7e6208f01c9d9e882f4c416110a2c66dd0c6d12844e8ca9129b6": { + "source": { + "path": "asset.66db480cb40e7e6208f01c9d9e882f4c416110a2c66dd0c6d12844e8ca9129b6", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "66db480cb40e7e6208f01c9d9e882f4c416110a2c66dd0c6d12844e8ca9129b6.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "b9110200a7df43e8d36405bba4dfa22124052374428d331231631a12975d93db": { + "source": { + "path": "cdk-synthetics-canary-auto-delete.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "b9110200a7df43e8d36405bba4dfa22124052374428d331231631a12975d93db.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-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdk-synthetics-canary-auto-delete.template.json b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdk-synthetics-canary-auto-delete.template.json new file mode 100644 index 0000000000000..ce4b0bb08b1f8 --- /dev/null +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdk-synthetics-canary-auto-delete.template.json @@ -0,0 +1,679 @@ +{ + "Resources": { + "CanaryArtifactsBucket4A60D32B": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "aws:kms" + } + } + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "CanaryArtifactsBucketPolicy63096C41": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "CanaryArtifactsBucket4A60D32B" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "CanaryArtifactsBucket4A60D32B", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "CanaryArtifactsBucket4A60D32B", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "CanaryServiceRoleD132250E": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:ListAllMyBuckets", + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": "s3:GetBucketLocation", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "CanaryArtifactsBucket4A60D32B", + "Arn" + ] + } + }, + { + "Action": "s3:PutObject", + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "CanaryArtifactsBucket4A60D32B", + "Arn" + ] + }, + "/*" + ] + ] + } + }, + { + "Action": "cloudwatch:PutMetricData", + "Condition": { + "StringEquals": { + "cloudwatch:namespace": "CloudWatchSynthetics" + } + }, + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/lambda/cwsyn-*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "canaryPolicy" + } + ] + } + }, + "Canary11957FE2": { + "Type": "AWS::Synthetics::Canary", + "Properties": { + "ArtifactS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "CanaryArtifactsBucket4A60D32B" + } + ] + ] + }, + "Code": { + "Handler": "index.handler", + "Script": "\n exports.handler = async () => {\n console.log('hello world');\n };" + }, + "ExecutionRoleArn": { + "Fn::GetAtt": [ + "CanaryServiceRoleD132250E", + "Arn" + ] + }, + "Name": "next", + "RuntimeVersion": "syn-nodejs-puppeteer-4.0", + "Schedule": { + "DurationInSeconds": "0", + "Expression": "rate(5 minutes)" + }, + "StartCanaryAfterCreation": true, + "Tags": [ + { + "Key": "aws-cdk:auto-delete-underlying-resources", + "Value": "true" + } + ] + } + }, + "CanaryAutoDeleteUnderlyingResourcesCustomResource76464216": { + "Type": "Custom::SyntheticsAutoDeleteUnderlyingResources", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderHandler26776D4E", + "Arn" + ] + }, + "CanaryName": { + "Ref": "Canary11957FE2" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderRole2D11A112": { + "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": [ + { + "Effect": "Allow", + "Action": [ + "lambda:DeleteFunction" + ], + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:cwsyn-*" + ] + ] + } + }, + { + "Effect": "Allow", + "Action": [ + "synthetics:GetCanary" + ], + "Resource": "*" + } + ] + } + } + ] + } + }, + "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderHandler26776D4E": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "086fe534b1e7545fbc662251685b8a7d91ab2061bbfe98d857b27478442487cb.zip" + }, + "Timeout": 900, + "MemorySize": 128, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderRole2D11A112", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Description": { + "Fn::Join": [ + "", + [ + "Lambda function for auto-deleting underlying resources created by ", + { + "Ref": "Canary11957FE2" + }, + "." + ] + ] + } + }, + "DependsOn": [ + "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderRole2D11A112" + ] + }, + "CanaryRemovedArtifactsBucket37DF7242": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "aws:kms" + } + } + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "CanaryRemovedArtifactsBucketPolicy29BB2D96": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "CanaryRemovedArtifactsBucket37DF7242" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "CanaryRemovedArtifactsBucket37DF7242", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "CanaryRemovedArtifactsBucket37DF7242", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "CanaryRemovedServiceRole11BAE4E9": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:ListAllMyBuckets", + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": "s3:GetBucketLocation", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "CanaryRemovedArtifactsBucket37DF7242", + "Arn" + ] + } + }, + { + "Action": "s3:PutObject", + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "CanaryRemovedArtifactsBucket37DF7242", + "Arn" + ] + }, + "/*" + ] + ] + } + }, + { + "Action": "cloudwatch:PutMetricData", + "Condition": { + "StringEquals": { + "cloudwatch:namespace": "CloudWatchSynthetics" + } + }, + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/lambda/cwsyn-*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "canaryPolicy" + } + ] + } + }, + "CanaryRemoved24AD6309": { + "Type": "AWS::Synthetics::Canary", + "Properties": { + "ArtifactS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "CanaryRemovedArtifactsBucket37DF7242" + } + ] + ] + }, + "Code": { + "Handler": "index.handler", + "Script": "\n exports.handler = async () => {\n console.log('hello world');\n };" + }, + "ExecutionRoleArn": { + "Fn::GetAtt": [ + "CanaryRemovedServiceRole11BAE4E9", + "Arn" + ] + }, + "Name": "cdksyntheticscaeae9a3", + "RuntimeVersion": "syn-nodejs-puppeteer-4.0", + "Schedule": { + "DurationInSeconds": "0", + "Expression": "rate(5 minutes)" + }, + "StartCanaryAfterCreation": false, + "Tags": [ + { + "Key": "aws-cdk:auto-delete-underlying-resources", + "Value": "true" + } + ] + } + }, + "CanaryRemovedAutoDeleteUnderlyingResourcesCustomResource697450B4": { + "Type": "Custom::SyntheticsAutoDeleteUnderlyingResources", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderHandler26776D4E", + "Arn" + ] + }, + "CanaryName": { + "Ref": "CanaryRemoved24AD6309" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "DeleteCanary6ED313B0": { + "Type": "Custom::AWS", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "AWS679f53fac002430cb0da5b7982bd22872D164C4C", + "Arn" + ] + }, + "Create": { + "Fn::Join": [ + "", + [ + "{\"physicalResourceId\":{\"id\":\"", + { + "Ref": "CanaryRemoved24AD6309" + }, + "\"},\"service\":\"Synthetics\",\"action\":\"deleteCanary\",\"parameters\":{\"Name\":\"", + { + "Ref": "CanaryRemoved24AD6309" + }, + "\"}}" + ] + ] + }, + "InstallLatestAwsSdk": false + }, + "DependsOn": [ + "DeleteCanaryCustomResourcePolicy98D0C78F" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "DeleteCanaryCustomResourcePolicy98D0C78F": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "synthetics:DeleteCanary", + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "DeleteCanaryCustomResourcePolicy98D0C78F", + "Roles": [ + { + "Ref": "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2" + } + ] + } + }, + "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2": { + "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" + ] + ] + } + ] + } + }, + "AWS679f53fac002430cb0da5b7982bd22872D164C4C": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "66db480cb40e7e6208f01c9d9e882f4c416110a2c66dd0c6d12844e8ca9129b6.zip" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Timeout": 120 + }, + "DependsOn": [ + "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2" + ] + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdk.out b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdk.out new file mode 100644 index 0000000000000..560dae10d018f --- /dev/null +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"33.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdkintegsyntheticscanaryautodeleteDefaultTestDeployAssert94B79CED.assets.json b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdkintegsyntheticscanaryautodeleteDefaultTestDeployAssert94B79CED.assets.json new file mode 100644 index 0000000000000..7e1322c5ea23d --- /dev/null +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdkintegsyntheticscanaryautodeleteDefaultTestDeployAssert94B79CED.assets.json @@ -0,0 +1,19 @@ +{ + "version": "33.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "cdkintegsyntheticscanaryautodeleteDefaultTestDeployAssert94B79CED.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdkintegsyntheticscanaryautodeleteDefaultTestDeployAssert94B79CED.template.json b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdkintegsyntheticscanaryautodeleteDefaultTestDeployAssert94B79CED.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/cdkintegsyntheticscanaryautodeleteDefaultTestDeployAssert94B79CED.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/integ.json b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/integ.json new file mode 100644 index 0000000000000..446438683f9c3 --- /dev/null +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/integ.json @@ -0,0 +1,14 @@ +{ + "version": "33.0.0", + "testCases": { + "cdk-integ-synthetics-canary-auto-delete/DefaultTest": { + "stacks": [ + "cdk-synthetics-canary-auto-delete" + ], + "diffAssets": true, + "stackUpdateWorkflow": false, + "assertionStack": "cdk-integ-synthetics-canary-auto-delete/DefaultTest/DeployAssert", + "assertionStackName": "cdkintegsyntheticscanaryautodeleteDefaultTestDeployAssert94B79CED" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/manifest.json b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/manifest.json new file mode 100644 index 0000000000000..677d7e9f04854 --- /dev/null +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/manifest.json @@ -0,0 +1,201 @@ +{ + "version": "33.0.0", + "artifacts": { + "cdk-synthetics-canary-auto-delete.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "cdk-synthetics-canary-auto-delete.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "cdk-synthetics-canary-auto-delete": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "cdk-synthetics-canary-auto-delete.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/b9110200a7df43e8d36405bba4dfa22124052374428d331231631a12975d93db.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "cdk-synthetics-canary-auto-delete.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "cdk-synthetics-canary-auto-delete.assets" + ], + "metadata": { + "/cdk-synthetics-canary-auto-delete/Canary/ArtifactsBucket/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "CanaryArtifactsBucket4A60D32B" + } + ], + "/cdk-synthetics-canary-auto-delete/Canary/ArtifactsBucket/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "CanaryArtifactsBucketPolicy63096C41" + } + ], + "/cdk-synthetics-canary-auto-delete/Canary/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "CanaryServiceRoleD132250E" + } + ], + "/cdk-synthetics-canary-auto-delete/Canary/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Canary11957FE2" + } + ], + "/cdk-synthetics-canary-auto-delete/Canary/AutoDeleteUnderlyingResourcesCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "CanaryAutoDeleteUnderlyingResourcesCustomResource76464216" + } + ], + "/cdk-synthetics-canary-auto-delete/Custom::SyntheticsAutoDeleteUnderlyingResourcesCustomResourceProvider/Role": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderRole2D11A112" + } + ], + "/cdk-synthetics-canary-auto-delete/Custom::SyntheticsAutoDeleteUnderlyingResourcesCustomResourceProvider/Handler": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderHandler26776D4E" + } + ], + "/cdk-synthetics-canary-auto-delete/CanaryRemoved/ArtifactsBucket/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "CanaryRemovedArtifactsBucket37DF7242" + } + ], + "/cdk-synthetics-canary-auto-delete/CanaryRemoved/ArtifactsBucket/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "CanaryRemovedArtifactsBucketPolicy29BB2D96" + } + ], + "/cdk-synthetics-canary-auto-delete/CanaryRemoved/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "CanaryRemovedServiceRole11BAE4E9" + } + ], + "/cdk-synthetics-canary-auto-delete/CanaryRemoved/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "CanaryRemoved24AD6309" + } + ], + "/cdk-synthetics-canary-auto-delete/CanaryRemoved/AutoDeleteUnderlyingResourcesCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "CanaryRemovedAutoDeleteUnderlyingResourcesCustomResource697450B4" + } + ], + "/cdk-synthetics-canary-auto-delete/DeleteCanary/Resource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "DeleteCanary6ED313B0" + } + ], + "/cdk-synthetics-canary-auto-delete/DeleteCanary/CustomResourcePolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "DeleteCanaryCustomResourcePolicy98D0C78F" + } + ], + "/cdk-synthetics-canary-auto-delete/AWS679f53fac002430cb0da5b7982bd2287/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2" + } + ], + "/cdk-synthetics-canary-auto-delete/AWS679f53fac002430cb0da5b7982bd2287/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "AWS679f53fac002430cb0da5b7982bd22872D164C4C" + } + ], + "/cdk-synthetics-canary-auto-delete/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/cdk-synthetics-canary-auto-delete/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "cdk-synthetics-canary-auto-delete" + }, + "cdkintegsyntheticscanaryautodeleteDefaultTestDeployAssert94B79CED.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "cdkintegsyntheticscanaryautodeleteDefaultTestDeployAssert94B79CED.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "cdkintegsyntheticscanaryautodeleteDefaultTestDeployAssert94B79CED": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "cdkintegsyntheticscanaryautodeleteDefaultTestDeployAssert94B79CED.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "cdkintegsyntheticscanaryautodeleteDefaultTestDeployAssert94B79CED.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "cdkintegsyntheticscanaryautodeleteDefaultTestDeployAssert94B79CED.assets" + ], + "metadata": { + "/cdk-integ-synthetics-canary-auto-delete/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/cdk-integ-synthetics-canary-auto-delete/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "cdk-integ-synthetics-canary-auto-delete/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/tree.json b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/tree.json new file mode 100644 index 0000000000000..e051cea00eec5 --- /dev/null +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.js.snapshot/tree.json @@ -0,0 +1,923 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "cdk-synthetics-canary-auto-delete": { + "id": "cdk-synthetics-canary-auto-delete", + "path": "cdk-synthetics-canary-auto-delete", + "children": { + "Canary": { + "id": "Canary", + "path": "cdk-synthetics-canary-auto-delete/Canary", + "children": { + "ArtifactsBucket": { + "id": "ArtifactsBucket", + "path": "cdk-synthetics-canary-auto-delete/Canary/ArtifactsBucket", + "children": { + "Resource": { + "id": "Resource", + "path": "cdk-synthetics-canary-auto-delete/Canary/ArtifactsBucket/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::Bucket", + "aws:cdk:cloudformation:props": { + "bucketEncryption": { + "serverSideEncryptionConfiguration": [ + { + "serverSideEncryptionByDefault": { + "sseAlgorithm": "aws:kms" + } + } + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucket", + "version": "0.0.0" + } + }, + "Policy": { + "id": "Policy", + "path": "cdk-synthetics-canary-auto-delete/Canary/ArtifactsBucket/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "cdk-synthetics-canary-auto-delete/Canary/ArtifactsBucket/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", + "aws:cdk:cloudformation:props": { + "bucket": { + "Ref": "CanaryArtifactsBucket4A60D32B" + }, + "policyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "CanaryArtifactsBucket4A60D32B", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "CanaryArtifactsBucket4A60D32B", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.Bucket", + "version": "0.0.0" + } + }, + "ServiceRole": { + "id": "ServiceRole", + "path": "cdk-synthetics-canary-auto-delete/Canary/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "cdk-synthetics-canary-auto-delete/Canary/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "cdk-synthetics-canary-auto-delete/Canary/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" + }, + "policies": [ + { + "policyName": "canaryPolicy", + "policyDocument": { + "Statement": [ + { + "Action": "s3:ListAllMyBuckets", + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": "s3:GetBucketLocation", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "CanaryArtifactsBucket4A60D32B", + "Arn" + ] + } + }, + { + "Action": "s3:PutObject", + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "CanaryArtifactsBucket4A60D32B", + "Arn" + ] + }, + "/*" + ] + ] + } + }, + { + "Action": "cloudwatch:PutMetricData", + "Condition": { + "StringEquals": { + "cloudwatch:namespace": "CloudWatchSynthetics" + } + }, + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/lambda/cwsyn-*" + ] + ] + } + } + ], + "Version": "2012-10-17" + } + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "cdk-synthetics-canary-auto-delete/Canary/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Synthetics::Canary", + "aws:cdk:cloudformation:props": { + "artifactS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "CanaryArtifactsBucket4A60D32B" + } + ] + ] + }, + "code": { + "handler": "index.handler", + "script": "\n exports.handler = async () => {\n console.log('hello world');\n };" + }, + "executionRoleArn": { + "Fn::GetAtt": [ + "CanaryServiceRoleD132250E", + "Arn" + ] + }, + "name": "next", + "runtimeVersion": "syn-nodejs-puppeteer-4.0", + "schedule": { + "durationInSeconds": "0", + "expression": "rate(5 minutes)" + }, + "startCanaryAfterCreation": true, + "tags": [ + { + "key": "aws-cdk:auto-delete-underlying-resources", + "value": "true" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_synthetics.CfnCanary", + "version": "0.0.0" + } + }, + "AutoDeleteUnderlyingResourcesCustomResource": { + "id": "AutoDeleteUnderlyingResourcesCustomResource", + "path": "cdk-synthetics-canary-auto-delete/Canary/AutoDeleteUnderlyingResourcesCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "cdk-synthetics-canary-auto-delete/Canary/AutoDeleteUnderlyingResourcesCustomResource/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-synthetics-alpha.Canary", + "version": "0.0.0" + } + }, + "Custom::SyntheticsAutoDeleteUnderlyingResourcesCustomResourceProvider": { + "id": "Custom::SyntheticsAutoDeleteUnderlyingResourcesCustomResourceProvider", + "path": "cdk-synthetics-canary-auto-delete/Custom::SyntheticsAutoDeleteUnderlyingResourcesCustomResourceProvider", + "children": { + "Staging": { + "id": "Staging", + "path": "cdk-synthetics-canary-auto-delete/Custom::SyntheticsAutoDeleteUnderlyingResourcesCustomResourceProvider/Staging", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "cdk-synthetics-canary-auto-delete/Custom::SyntheticsAutoDeleteUnderlyingResourcesCustomResourceProvider/Role", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + }, + "Handler": { + "id": "Handler", + "path": "cdk-synthetics-canary-auto-delete/Custom::SyntheticsAutoDeleteUnderlyingResourcesCustomResourceProvider/Handler", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResourceProvider", + "version": "0.0.0" + } + }, + "CanaryRemoved": { + "id": "CanaryRemoved", + "path": "cdk-synthetics-canary-auto-delete/CanaryRemoved", + "children": { + "ArtifactsBucket": { + "id": "ArtifactsBucket", + "path": "cdk-synthetics-canary-auto-delete/CanaryRemoved/ArtifactsBucket", + "children": { + "Resource": { + "id": "Resource", + "path": "cdk-synthetics-canary-auto-delete/CanaryRemoved/ArtifactsBucket/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::Bucket", + "aws:cdk:cloudformation:props": { + "bucketEncryption": { + "serverSideEncryptionConfiguration": [ + { + "serverSideEncryptionByDefault": { + "sseAlgorithm": "aws:kms" + } + } + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucket", + "version": "0.0.0" + } + }, + "Policy": { + "id": "Policy", + "path": "cdk-synthetics-canary-auto-delete/CanaryRemoved/ArtifactsBucket/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "cdk-synthetics-canary-auto-delete/CanaryRemoved/ArtifactsBucket/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", + "aws:cdk:cloudformation:props": { + "bucket": { + "Ref": "CanaryRemovedArtifactsBucket37DF7242" + }, + "policyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "CanaryRemovedArtifactsBucket37DF7242", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "CanaryRemovedArtifactsBucket37DF7242", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.Bucket", + "version": "0.0.0" + } + }, + "ServiceRole": { + "id": "ServiceRole", + "path": "cdk-synthetics-canary-auto-delete/CanaryRemoved/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "cdk-synthetics-canary-auto-delete/CanaryRemoved/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "cdk-synthetics-canary-auto-delete/CanaryRemoved/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" + }, + "policies": [ + { + "policyName": "canaryPolicy", + "policyDocument": { + "Statement": [ + { + "Action": "s3:ListAllMyBuckets", + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": "s3:GetBucketLocation", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "CanaryRemovedArtifactsBucket37DF7242", + "Arn" + ] + } + }, + { + "Action": "s3:PutObject", + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "CanaryRemovedArtifactsBucket37DF7242", + "Arn" + ] + }, + "/*" + ] + ] + } + }, + { + "Action": "cloudwatch:PutMetricData", + "Condition": { + "StringEquals": { + "cloudwatch:namespace": "CloudWatchSynthetics" + } + }, + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/lambda/cwsyn-*" + ] + ] + } + } + ], + "Version": "2012-10-17" + } + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "cdk-synthetics-canary-auto-delete/CanaryRemoved/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Synthetics::Canary", + "aws:cdk:cloudformation:props": { + "artifactS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "CanaryRemovedArtifactsBucket37DF7242" + } + ] + ] + }, + "code": { + "handler": "index.handler", + "script": "\n exports.handler = async () => {\n console.log('hello world');\n };" + }, + "executionRoleArn": { + "Fn::GetAtt": [ + "CanaryRemovedServiceRole11BAE4E9", + "Arn" + ] + }, + "name": "cdksyntheticscaeae9a3", + "runtimeVersion": "syn-nodejs-puppeteer-4.0", + "schedule": { + "durationInSeconds": "0", + "expression": "rate(5 minutes)" + }, + "startCanaryAfterCreation": false, + "tags": [ + { + "key": "aws-cdk:auto-delete-underlying-resources", + "value": "true" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_synthetics.CfnCanary", + "version": "0.0.0" + } + }, + "AutoDeleteUnderlyingResourcesCustomResource": { + "id": "AutoDeleteUnderlyingResourcesCustomResource", + "path": "cdk-synthetics-canary-auto-delete/CanaryRemoved/AutoDeleteUnderlyingResourcesCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "cdk-synthetics-canary-auto-delete/CanaryRemoved/AutoDeleteUnderlyingResourcesCustomResource/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-synthetics-alpha.Canary", + "version": "0.0.0" + } + }, + "DeleteCanary": { + "id": "DeleteCanary", + "path": "cdk-synthetics-canary-auto-delete/DeleteCanary", + "children": { + "Provider": { + "id": "Provider", + "path": "cdk-synthetics-canary-auto-delete/DeleteCanary/Provider", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.SingletonFunction", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "cdk-synthetics-canary-auto-delete/DeleteCanary/Resource", + "children": { + "Default": { + "id": "Default", + "path": "cdk-synthetics-canary-auto-delete/DeleteCanary/Resource/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "0.0.0" + } + }, + "CustomResourcePolicy": { + "id": "CustomResourcePolicy", + "path": "cdk-synthetics-canary-auto-delete/DeleteCanary/CustomResourcePolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "cdk-synthetics-canary-auto-delete/DeleteCanary/CustomResourcePolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "synthetics:DeleteCanary", + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "DeleteCanaryCustomResourcePolicy98D0C78F", + "roles": [ + { + "Ref": "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.custom_resources.AwsCustomResource", + "version": "0.0.0" + } + }, + "AWS679f53fac002430cb0da5b7982bd2287": { + "id": "AWS679f53fac002430cb0da5b7982bd2287", + "path": "cdk-synthetics-canary-auto-delete/AWS679f53fac002430cb0da5b7982bd2287", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "cdk-synthetics-canary-auto-delete/AWS679f53fac002430cb0da5b7982bd2287/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "cdk-synthetics-canary-auto-delete/AWS679f53fac002430cb0da5b7982bd2287/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "cdk-synthetics-canary-auto-delete/AWS679f53fac002430cb0da5b7982bd2287/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-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Code": { + "id": "Code", + "path": "cdk-synthetics-canary-auto-delete/AWS679f53fac002430cb0da5b7982bd2287/Code", + "children": { + "Stage": { + "id": "Stage", + "path": "cdk-synthetics-canary-auto-delete/AWS679f53fac002430cb0da5b7982bd2287/Code/Stage", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "cdk-synthetics-canary-auto-delete/AWS679f53fac002430cb0da5b7982bd2287/Code/AssetBucket", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3_assets.Asset", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "cdk-synthetics-canary-auto-delete/AWS679f53fac002430cb0da5b7982bd2287/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "s3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "s3Key": "66db480cb40e7e6208f01c9d9e882f4c416110a2c66dd0c6d12844e8ca9129b6.zip" + }, + "handler": "index.handler", + "role": { + "Fn::GetAtt": [ + "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2", + "Arn" + ] + }, + "runtime": "nodejs18.x", + "timeout": 120 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "cdk-synthetics-canary-auto-delete/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "cdk-synthetics-canary-auto-delete/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "cdk-integ-synthetics-canary-auto-delete": { + "id": "cdk-integ-synthetics-canary-auto-delete", + "path": "cdk-integ-synthetics-canary-auto-delete", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "cdk-integ-synthetics-canary-auto-delete/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "cdk-integ-synthetics-canary-auto-delete/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.2.69" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "cdk-integ-synthetics-canary-auto-delete/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "cdk-integ-synthetics-canary-auto-delete/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "cdk-integ-synthetics-canary-auto-delete/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.2.69" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.ts b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.ts new file mode 100644 index 0000000000000..78281a1638d44 --- /dev/null +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary-auto-delete-lambda.ts @@ -0,0 +1,61 @@ +import { App, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Construct } from 'constructs'; +import * as synthetics from '../lib'; +import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId } from 'aws-cdk-lib/custom-resources'; + +class TestStack extends Stack { + constructor(scope: Construct, id: string, props?: StackProps) { + super(scope, id, props); + + new synthetics.Canary(this, 'Canary', { + canaryName: 'next', + runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0, + test: synthetics.Test.custom({ + handler: 'index.handler', + code: synthetics.Code.fromInline(` + exports.handler = async () => { + console.log(\'hello world\'); + };`), + }), + cleanup: synthetics.Cleanup.LAMBDA, + }); + + const canaryThatWillBeRemoved = new synthetics.Canary(this, 'CanaryRemoved', { + runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0, + test: synthetics.Test.custom({ + handler: 'index.handler', + code: synthetics.Code.fromInline(` + exports.handler = async () => { + console.log(\'hello world\'); + };`), + }), + cleanup: synthetics.Cleanup.LAMBDA, + startAfterCreation: false, // otherwise we get error: canary is in a state that can't be deleted: RUNNING + }); + + // Remove this canary immediately + // so we can test that a non-existing canary will not fail the auto-delete-lambda Custom Resource + new AwsCustomResource(this, 'DeleteCanary', { + onCreate: { + physicalResourceId: PhysicalResourceId.of(canaryThatWillBeRemoved.canaryName), + service: 'Synthetics', + action: 'deleteCanary', + parameters: { + Name: canaryThatWillBeRemoved.canaryName, + }, + }, + policy: AwsCustomResourcePolicy.fromSdkCalls({ + resources: AwsCustomResourcePolicy.ANY_RESOURCE, + }), + }); + } +} + +const app = new App(); + +new IntegTest(app, 'cdk-integ-synthetics-canary-auto-delete', { + testCases: [new TestStack(app, 'cdk-synthetics-canary-auto-delete')], + diffAssets: true, + stackUpdateWorkflow: false, // will error because this stack has a cr that deletes its own resources +}); diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/IntegCanaryTestDefaultTestDeployAssert3AD5A094.assets.json b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/IntegCanaryTestDefaultTestDeployAssert3AD5A094.assets.json index afe07bedc6ac2..e93cc5ec6743a 100644 --- a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/IntegCanaryTestDefaultTestDeployAssert3AD5A094.assets.json +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/IntegCanaryTestDefaultTestDeployAssert3AD5A094.assets.json @@ -1,20 +1,20 @@ { "version": "33.0.0", "files": { - "d5b88712f80b7d8c96ddbffc883a569f5e5681cf14a985d4d0933ca3712f5110": { + "54ed1902ad5ad220444041937ce65cb63c7fbccd0c11fdfd9ecbec43770cdaa5": { "source": { - "path": "asset.d5b88712f80b7d8c96ddbffc883a569f5e5681cf14a985d4d0933ca3712f5110.bundle", + "path": "asset.54ed1902ad5ad220444041937ce65cb63c7fbccd0c11fdfd9ecbec43770cdaa5.bundle", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "d5b88712f80b7d8c96ddbffc883a569f5e5681cf14a985d4d0933ca3712f5110.zip", + "objectKey": "54ed1902ad5ad220444041937ce65cb63c7fbccd0c11fdfd9ecbec43770cdaa5.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "df5ea21aeb8a2b4d703bce966a4cf197c3a558b9b1bd275879fa58d12447002e": { + "8c08730d94137e65bc12948174518428ecc7274c82e0ac14815338b53bb23df8": { "source": { "path": "IntegCanaryTestDefaultTestDeployAssert3AD5A094.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "df5ea21aeb8a2b4d703bce966a4cf197c3a558b9b1bd275879fa58d12447002e.json", + "objectKey": "8c08730d94137e65bc12948174518428ecc7274c82e0ac14815338b53bb23df8.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-synthetics-alpha/test/integ.canary.js.snapshot/IntegCanaryTestDefaultTestDeployAssert3AD5A094.template.json b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/IntegCanaryTestDefaultTestDeployAssert3AD5A094.template.json index 48a134cc4587f..dbca1cef09871 100644 --- a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/IntegCanaryTestDefaultTestDeployAssert3AD5A094.template.json +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/IntegCanaryTestDefaultTestDeployAssert3AD5A094.template.json @@ -34,7 +34,7 @@ "outputPaths": [ "CanaryRuns.0.Status.State" ], - "salt": "1690980132317" + "salt": "1692725521150" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -322,7 +322,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "d5b88712f80b7d8c96ddbffc883a569f5e5681cf14a985d4d0933ca3712f5110.zip" + "S3Key": "54ed1902ad5ad220444041937ce65cb63c7fbccd0c11fdfd9ecbec43770cdaa5.zip" }, "Timeout": 120, "Handler": "index.handler", @@ -437,7 +437,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "d5b88712f80b7d8c96ddbffc883a569f5e5681cf14a985d4d0933ca3712f5110.zip" + "S3Key": "54ed1902ad5ad220444041937ce65cb63c7fbccd0c11fdfd9ecbec43770cdaa5.zip" }, "Timeout": 120, "Handler": "index.isComplete", @@ -479,7 +479,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "d5b88712f80b7d8c96ddbffc883a569f5e5681cf14a985d4d0933ca3712f5110.zip" + "S3Key": "54ed1902ad5ad220444041937ce65cb63c7fbccd0c11fdfd9ecbec43770cdaa5.zip" }, "Timeout": 120, "Handler": "index.onTimeout", @@ -525,7 +525,7 @@ "outputPaths": [ "CanaryRuns.0.Status.State" ], - "salt": "1690980132318" + "salt": "1692725521151" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -681,7 +681,7 @@ "outputPaths": [ "CanaryRuns.0.Status.State" ], - "salt": "1690980132318" + "salt": "1692725521151" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -837,7 +837,7 @@ "outputPaths": [ "CanaryRuns.0.Status.State" ], - "salt": "1690980132318" + "salt": "1692725521151" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -993,7 +993,7 @@ "outputPaths": [ "CanaryRuns.0.Status.State" ], - "salt": "1690980132319" + "salt": "1692725521152" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -1149,7 +1149,7 @@ "outputPaths": [ "CanaryRuns.0.Status.State" ], - "salt": "1690980132319" + "salt": "1692725521152" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -1305,7 +1305,7 @@ "outputPaths": [ "CanaryRuns.0.Status.State" ], - "salt": "1690980132319" + "salt": "1692725521152" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.40129686bd15b9964212325144aa0db37ac362e1e290ab678d8679880f705e83/index.js b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.40129686bd15b9964212325144aa0db37ac362e1e290ab678d8679880f705e83/index.js new file mode 100644 index 0000000000000..ac1fce791194d --- /dev/null +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.40129686bd15b9964212325144aa0db37ac362e1e290ab678d8679880f705e83/index.js @@ -0,0 +1 @@ +"use strict";var f=Object.create;var i=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var w=(o,e)=>{for(var t in e)i(o,t,{get:e[t],enumerable:!0})},l=(o,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of g(e))!S.call(o,n)&&n!==t&&i(o,n,{get:()=>e[n],enumerable:!(s=I(e,n))||s.enumerable});return o};var m=(o,e,t)=>(t=o!=null?f(A(o)):{},l(e||!o||!o.__esModule?i(t,"default",{value:o,enumerable:!0}):t,o)),P=o=>l(i({},"__esModule",{value:!0}),o);var O={};w(O,{autoDeleteHandler:()=>E,handler:()=>_});module.exports=P(O);var c=require("@aws-sdk/client-lambda"),u=require("@aws-sdk/client-synthetics");var y=m(require("https")),R=m(require("url")),a={sendHttpRequest:D,log:F,includeStackTraces:!0,userHandlerIndex:"./index"},p="AWSCDK::CustomResourceProviderFramework::CREATE_FAILED",L="AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID";function C(o){return async(e,t)=>{let s={...e,ResponseURL:"..."};if(a.log(JSON.stringify(s,void 0,2)),e.RequestType==="Delete"&&e.PhysicalResourceId===p){a.log("ignoring DELETE event caused by a failed CREATE event"),await d("SUCCESS",e);return}try{let n=await o(s,t),r=b(e,n);await d("SUCCESS",r)}catch(n){let r={...e,Reason:a.includeStackTraces?n.stack:n.message};r.PhysicalResourceId||(e.RequestType==="Create"?(a.log("CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored"),r.PhysicalResourceId=p):a.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(e)}`)),await d("FAILED",r)}}}function b(o,e={}){let t=e.PhysicalResourceId??o.PhysicalResourceId??o.RequestId;if(o.RequestType==="Delete"&&t!==o.PhysicalResourceId)throw new Error(`DELETE: cannot change the physical resource ID from "${o.PhysicalResourceId}" to "${e.PhysicalResourceId}" during deletion`);return{...o,...e,PhysicalResourceId:t}}async function d(o,e){let t={Status:o,Reason:e.Reason??o,StackId:e.StackId,RequestId:e.RequestId,PhysicalResourceId:e.PhysicalResourceId||L,LogicalResourceId:e.LogicalResourceId,NoEcho:e.NoEcho,Data:e.Data};a.log("submit response to cloudformation",t);let s=JSON.stringify(t),n=R.parse(e.ResponseURL),r={hostname:n.hostname,path:n.path,method:"PUT",headers:{"content-type":"","content-length":Buffer.byteLength(s,"utf8")}};await T({attempts:5,sleep:1e3},a.sendHttpRequest)(r,s)}async function D(o,e){return new Promise((t,s)=>{try{let n=y.request(o,r=>t());n.on("error",s),n.write(e),n.end()}catch(n){s(n)}})}function F(o,...e){console.log(o,...e)}function T(o,e){return async(...t)=>{let s=o.attempts,n=o.sleep;for(;;)try{return await e(...t)}catch(r){if(s--<=0)throw r;await x(Math.floor(Math.random()*n)),n*=2}}}async function x(o){return new Promise(e=>setTimeout(e,o))}var h="aws-cdk:auto-delete-lambda",H=new c.LambdaClient({}),N=new u.SyntheticsClient({}),_=C(E);async function E(o){switch(o.RequestType){case"Create":return{PhyscialResourceId:o.ResourceProperties?.CanaryName};case"Update":return{PhysicalResourceId:(await k(o)).PhysicalResourceId};case"Delete":return q(o.ResourceProperties?.CanaryName)}}async function k(o){return{PhysicalResourceId:o.ResourceProperties?.CanaryName}}async function q(o){if(console.log(`Deleting lambda function associated with ${o}`),!o)throw new Error("No CanaryName was provided.");try{let e=await N.send(new u.GetCanaryCommand({Name:o}));if(e.Canary===void 0||e.Canary.Id===void 0)return;if(e.Canary.EngineArn===void 0)return;if(!W(e.Canary.Tags)){console.log(`Canary does not have '${h}' tag, skipping deletion.`);return}let t=e.Canary.EngineArn.split(":");t.at(-1)?.includes(e.Canary.Id)||t.pop();let s=t.join(":");console.log(`Deleting lambda ${s}`),await H.send(new c.DeleteFunctionCommand({FunctionName:s}))}catch(e){if(e.name!=="ResourceNotFoundException")throw e}}function W(o){return o?Object.keys(o).some(e=>e===h&&o[e]==="true"):!1}0&&(module.exports={autoDeleteHandler,handler}); diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.d5b88712f80b7d8c96ddbffc883a569f5e5681cf14a985d4d0933ca3712f5110.bundle/index.js b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.54ed1902ad5ad220444041937ce65cb63c7fbccd0c11fdfd9ecbec43770cdaa5.bundle/index.js similarity index 97% rename from packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.d5b88712f80b7d8c96ddbffc883a569f5e5681cf14a985d4d0933ca3712f5110.bundle/index.js rename to packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.54ed1902ad5ad220444041937ce65cb63c7fbccd0c11fdfd9ecbec43770cdaa5.bundle/index.js index 33762d0416ca1..88c13ce7441ab 100644 --- a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.d5b88712f80b7d8c96ddbffc883a569f5e5681cf14a985d4d0933ca3712f5110.bundle/index.js +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.54ed1902ad5ad220444041937ce65cb63c7fbccd0c11fdfd9ecbec43770cdaa5.bundle/index.js @@ -1,4 +1,3 @@ -"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; @@ -1539,6 +1538,88 @@ var require_eventStream = __commonJS({ } }); +// ../../../node_modules/@smithy/types/dist-cjs/extensions/checksum.js +var require_checksum2 = __commonJS({ + "../../../node_modules/@smithy/types/dist-cjs/extensions/checksum.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.resolveChecksumRuntimeConfig = exports.getChecksumConfiguration = exports.AlgorithmId = void 0; + var AlgorithmId; + (function(AlgorithmId2) { + AlgorithmId2["MD5"] = "md5"; + AlgorithmId2["CRC32"] = "crc32"; + AlgorithmId2["CRC32C"] = "crc32c"; + AlgorithmId2["SHA1"] = "sha1"; + AlgorithmId2["SHA256"] = "sha256"; + })(AlgorithmId = exports.AlgorithmId || (exports.AlgorithmId = {})); + var getChecksumConfiguration = (runtimeConfig) => { + const checksumAlgorithms = []; + if (runtimeConfig.sha256 !== void 0) { + checksumAlgorithms.push({ + algorithmId: () => AlgorithmId.SHA256, + checksumConstructor: () => runtimeConfig.sha256 + }); + } + if (runtimeConfig.md5 != void 0) { + checksumAlgorithms.push({ + algorithmId: () => AlgorithmId.MD5, + checksumConstructor: () => runtimeConfig.md5 + }); + } + return { + _checksumAlgorithms: checksumAlgorithms, + addChecksumAlgorithm(algo) { + this._checksumAlgorithms.push(algo); + }, + checksumAlgorithms() { + return this._checksumAlgorithms; + } + }; + }; + exports.getChecksumConfiguration = getChecksumConfiguration; + var resolveChecksumRuntimeConfig = (clientConfig) => { + const runtimeConfig = {}; + clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => { + runtimeConfig[checksumAlgorithm.algorithmId()] = checksumAlgorithm.checksumConstructor(); + }); + return runtimeConfig; + }; + exports.resolveChecksumRuntimeConfig = resolveChecksumRuntimeConfig; + } +}); + +// ../../../node_modules/@smithy/types/dist-cjs/extensions/defaultClientConfiguration.js +var require_defaultClientConfiguration = __commonJS({ + "../../../node_modules/@smithy/types/dist-cjs/extensions/defaultClientConfiguration.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.resolveDefaultRuntimeConfig = exports.getDefaultClientConfiguration = void 0; + var checksum_1 = require_checksum2(); + var getDefaultClientConfiguration = (runtimeConfig) => { + return { + ...(0, checksum_1.getChecksumConfiguration)(runtimeConfig) + }; + }; + exports.getDefaultClientConfiguration = getDefaultClientConfiguration; + var resolveDefaultRuntimeConfig = (config) => { + return { + ...(0, checksum_1.resolveChecksumRuntimeConfig)(config) + }; + }; + exports.resolveDefaultRuntimeConfig = resolveDefaultRuntimeConfig; + } +}); + +// ../../../node_modules/@smithy/types/dist-cjs/extensions/index.js +var require_extensions = __commonJS({ + "../../../node_modules/@smithy/types/dist-cjs/extensions/index.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); + tslib_1.__exportStar(require_defaultClientConfiguration(), exports); + } +}); + // ../../../node_modules/@smithy/types/dist-cjs/http.js var require_http = __commonJS({ "../../../node_modules/@smithy/types/dist-cjs/http.js"(exports) { @@ -1757,6 +1838,7 @@ var require_dist_cjs = __commonJS({ tslib_1.__exportStar(require_endpoint(), exports); tslib_1.__exportStar(require_endpoints(), exports); tslib_1.__exportStar(require_eventStream(), exports); + tslib_1.__exportStar(require_extensions(), exports); tslib_1.__exportStar(require_http(), exports); tslib_1.__exportStar(require_identity2(), exports); tslib_1.__exportStar(require_logger(), exports); @@ -3997,7 +4079,7 @@ var require_getCanonicalQuery = __commonJS({ if (typeof value === "string") { serialized[key] = `${(0, util_uri_escape_1.escapeUri)(key)}=${(0, util_uri_escape_1.escapeUri)(value)}`; } else if (Array.isArray(value)) { - serialized[key] = value.slice(0).sort().reduce((encoded, value2) => encoded.concat([`${(0, util_uri_escape_1.escapeUri)(key)}=${(0, util_uri_escape_1.escapeUri)(value2)}`]), []).join("&"); + serialized[key] = value.slice(0).reduce((encoded, value2) => encoded.concat([`${(0, util_uri_escape_1.escapeUri)(key)}=${(0, util_uri_escape_1.escapeUri)(value2)}`]), []).sort().join("&"); } } return keys.map((key) => serialized[key]).filter((serialized2) => serialized2).join("&"); @@ -4634,7 +4716,7 @@ var require_partitions = __commonJS({ supportsDualStack: true, supportsFIPS: true }, - regionRegex: "^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$", + regionRegex: "^(us|eu|ap|sa|ca|me|af|il)\\-\\w+\\-\\d+$", regions: { "af-south-1": { description: "Africa (Cape Town)" @@ -4699,6 +4781,9 @@ var require_partitions = __commonJS({ "eu-west-3": { description: "Europe (Paris)" }, + "il-central-1": { + description: "Israel (Tel Aviv)" + }, "me-central-1": { description: "Middle East (UAE)" }, @@ -5222,7 +5307,7 @@ var require_blob_types = __commonJS({ }); // ../../../node_modules/@aws-sdk/types/dist-cjs/checksum.js -var require_checksum2 = __commonJS({ +var require_checksum3 = __commonJS({ "../../../node_modules/@aws-sdk/types/dist-cjs/checksum.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -5516,7 +5601,7 @@ var require_dist_cjs17 = __commonJS({ tslib_1.__exportStar(require_abort2(), exports); tslib_1.__exportStar(require_auth2(), exports); tslib_1.__exportStar(require_blob_types(), exports); - tslib_1.__exportStar(require_checksum2(), exports); + tslib_1.__exportStar(require_checksum3(), exports); tslib_1.__exportStar(require_client2(), exports); tslib_1.__exportStar(require_command2(), exports); tslib_1.__exportStar(require_connection2(), exports); @@ -10394,7 +10479,7 @@ var require_package = __commonJS({ module2.exports = { name: "@aws-sdk/client-sfn", description: "AWS SDK for JavaScript Sfn Client for Node.js, Browser and React Native", - version: "3.378.0", + version: "3.391.0", scripts: { build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", "build:cjs": "tsc -p tsconfig.cjs.json", @@ -10414,37 +10499,37 @@ var require_package = __commonJS({ dependencies: { "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/client-sts": "3.378.0", - "@aws-sdk/credential-provider-node": "3.378.0", - "@aws-sdk/middleware-host-header": "3.378.0", - "@aws-sdk/middleware-logger": "3.378.0", - "@aws-sdk/middleware-recursion-detection": "3.378.0", - "@aws-sdk/middleware-signing": "3.378.0", - "@aws-sdk/middleware-user-agent": "3.378.0", - "@aws-sdk/types": "3.378.0", - "@aws-sdk/util-endpoints": "3.378.0", - "@aws-sdk/util-user-agent-browser": "3.378.0", - "@aws-sdk/util-user-agent-node": "3.378.0", - "@smithy/config-resolver": "^2.0.1", - "@smithy/fetch-http-handler": "^2.0.1", - "@smithy/hash-node": "^2.0.1", - "@smithy/invalid-dependency": "^2.0.1", - "@smithy/middleware-content-length": "^2.0.1", - "@smithy/middleware-endpoint": "^2.0.1", - "@smithy/middleware-retry": "^2.0.1", - "@smithy/middleware-serde": "^2.0.1", + "@aws-sdk/client-sts": "3.391.0", + "@aws-sdk/credential-provider-node": "3.391.0", + "@aws-sdk/middleware-host-header": "3.391.0", + "@aws-sdk/middleware-logger": "3.391.0", + "@aws-sdk/middleware-recursion-detection": "3.391.0", + "@aws-sdk/middleware-signing": "3.391.0", + "@aws-sdk/middleware-user-agent": "3.391.0", + "@aws-sdk/types": "3.391.0", + "@aws-sdk/util-endpoints": "3.391.0", + "@aws-sdk/util-user-agent-browser": "3.391.0", + "@aws-sdk/util-user-agent-node": "3.391.0", + "@smithy/config-resolver": "^2.0.3", + "@smithy/fetch-http-handler": "^2.0.3", + "@smithy/hash-node": "^2.0.3", + "@smithy/invalid-dependency": "^2.0.3", + "@smithy/middleware-content-length": "^2.0.3", + "@smithy/middleware-endpoint": "^2.0.3", + "@smithy/middleware-retry": "^2.0.3", + "@smithy/middleware-serde": "^2.0.3", "@smithy/middleware-stack": "^2.0.0", - "@smithy/node-config-provider": "^2.0.1", - "@smithy/node-http-handler": "^2.0.1", - "@smithy/protocol-http": "^2.0.1", - "@smithy/smithy-client": "^2.0.1", - "@smithy/types": "^2.0.2", - "@smithy/url-parser": "^2.0.1", + "@smithy/node-config-provider": "^2.0.3", + "@smithy/node-http-handler": "^2.0.3", + "@smithy/protocol-http": "^2.0.3", + "@smithy/smithy-client": "^2.0.3", + "@smithy/types": "^2.2.0", + "@smithy/url-parser": "^2.0.3", "@smithy/util-base64": "^2.0.0", "@smithy/util-body-length-browser": "^2.0.0", "@smithy/util-body-length-node": "^2.0.0", - "@smithy/util-defaults-mode-browser": "^2.0.1", - "@smithy/util-defaults-mode-node": "^2.0.1", + "@smithy/util-defaults-mode-browser": "^2.0.3", + "@smithy/util-defaults-mode-node": "^2.0.3", "@smithy/util-retry": "^2.0.0", "@smithy/util-utf8": "^2.0.0", tslib: "^2.5.0" @@ -10533,7 +10618,7 @@ var require_package2 = __commonJS({ module2.exports = { name: "@aws-sdk/client-sts", description: "AWS SDK for JavaScript Sts Client for Node.js, Browser and React Native", - version: "3.378.0", + version: "3.391.0", scripts: { build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", "build:cjs": "tsc -p tsconfig.cjs.json", @@ -10555,37 +10640,37 @@ var require_package2 = __commonJS({ dependencies: { "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/credential-provider-node": "3.378.0", - "@aws-sdk/middleware-host-header": "3.378.0", - "@aws-sdk/middleware-logger": "3.378.0", - "@aws-sdk/middleware-recursion-detection": "3.378.0", - "@aws-sdk/middleware-sdk-sts": "3.378.0", - "@aws-sdk/middleware-signing": "3.378.0", - "@aws-sdk/middleware-user-agent": "3.378.0", - "@aws-sdk/types": "3.378.0", - "@aws-sdk/util-endpoints": "3.378.0", - "@aws-sdk/util-user-agent-browser": "3.378.0", - "@aws-sdk/util-user-agent-node": "3.378.0", - "@smithy/config-resolver": "^2.0.1", - "@smithy/fetch-http-handler": "^2.0.1", - "@smithy/hash-node": "^2.0.1", - "@smithy/invalid-dependency": "^2.0.1", - "@smithy/middleware-content-length": "^2.0.1", - "@smithy/middleware-endpoint": "^2.0.1", - "@smithy/middleware-retry": "^2.0.1", - "@smithy/middleware-serde": "^2.0.1", + "@aws-sdk/credential-provider-node": "3.391.0", + "@aws-sdk/middleware-host-header": "3.391.0", + "@aws-sdk/middleware-logger": "3.391.0", + "@aws-sdk/middleware-recursion-detection": "3.391.0", + "@aws-sdk/middleware-sdk-sts": "3.391.0", + "@aws-sdk/middleware-signing": "3.391.0", + "@aws-sdk/middleware-user-agent": "3.391.0", + "@aws-sdk/types": "3.391.0", + "@aws-sdk/util-endpoints": "3.391.0", + "@aws-sdk/util-user-agent-browser": "3.391.0", + "@aws-sdk/util-user-agent-node": "3.391.0", + "@smithy/config-resolver": "^2.0.3", + "@smithy/fetch-http-handler": "^2.0.3", + "@smithy/hash-node": "^2.0.3", + "@smithy/invalid-dependency": "^2.0.3", + "@smithy/middleware-content-length": "^2.0.3", + "@smithy/middleware-endpoint": "^2.0.3", + "@smithy/middleware-retry": "^2.0.3", + "@smithy/middleware-serde": "^2.0.3", "@smithy/middleware-stack": "^2.0.0", - "@smithy/node-config-provider": "^2.0.1", - "@smithy/node-http-handler": "^2.0.1", - "@smithy/protocol-http": "^2.0.1", - "@smithy/smithy-client": "^2.0.1", - "@smithy/types": "^2.0.2", - "@smithy/url-parser": "^2.0.1", + "@smithy/node-config-provider": "^2.0.3", + "@smithy/node-http-handler": "^2.0.3", + "@smithy/protocol-http": "^2.0.3", + "@smithy/smithy-client": "^2.0.3", + "@smithy/types": "^2.2.0", + "@smithy/url-parser": "^2.0.3", "@smithy/util-base64": "^2.0.0", "@smithy/util-body-length-browser": "^2.0.0", "@smithy/util-body-length-node": "^2.0.0", - "@smithy/util-defaults-mode-browser": "^2.0.1", - "@smithy/util-defaults-mode-node": "^2.0.1", + "@smithy/util-defaults-mode-browser": "^2.0.3", + "@smithy/util-defaults-mode-node": "^2.0.3", "@smithy/util-retry": "^2.0.0", "@smithy/util-utf8": "^2.0.0", "fast-xml-parser": "4.2.5", @@ -14804,7 +14889,7 @@ var require_package3 = __commonJS({ module2.exports = { name: "@aws-sdk/client-sso", description: "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native", - version: "3.378.0", + version: "3.391.0", scripts: { build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", "build:cjs": "tsc -p tsconfig.cjs.json", @@ -14824,34 +14909,34 @@ var require_package3 = __commonJS({ dependencies: { "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/middleware-host-header": "3.378.0", - "@aws-sdk/middleware-logger": "3.378.0", - "@aws-sdk/middleware-recursion-detection": "3.378.0", - "@aws-sdk/middleware-user-agent": "3.378.0", - "@aws-sdk/types": "3.378.0", - "@aws-sdk/util-endpoints": "3.378.0", - "@aws-sdk/util-user-agent-browser": "3.378.0", - "@aws-sdk/util-user-agent-node": "3.378.0", - "@smithy/config-resolver": "^2.0.1", - "@smithy/fetch-http-handler": "^2.0.1", - "@smithy/hash-node": "^2.0.1", - "@smithy/invalid-dependency": "^2.0.1", - "@smithy/middleware-content-length": "^2.0.1", - "@smithy/middleware-endpoint": "^2.0.1", - "@smithy/middleware-retry": "^2.0.1", - "@smithy/middleware-serde": "^2.0.1", + "@aws-sdk/middleware-host-header": "3.391.0", + "@aws-sdk/middleware-logger": "3.391.0", + "@aws-sdk/middleware-recursion-detection": "3.391.0", + "@aws-sdk/middleware-user-agent": "3.391.0", + "@aws-sdk/types": "3.391.0", + "@aws-sdk/util-endpoints": "3.391.0", + "@aws-sdk/util-user-agent-browser": "3.391.0", + "@aws-sdk/util-user-agent-node": "3.391.0", + "@smithy/config-resolver": "^2.0.3", + "@smithy/fetch-http-handler": "^2.0.3", + "@smithy/hash-node": "^2.0.3", + "@smithy/invalid-dependency": "^2.0.3", + "@smithy/middleware-content-length": "^2.0.3", + "@smithy/middleware-endpoint": "^2.0.3", + "@smithy/middleware-retry": "^2.0.3", + "@smithy/middleware-serde": "^2.0.3", "@smithy/middleware-stack": "^2.0.0", - "@smithy/node-config-provider": "^2.0.1", - "@smithy/node-http-handler": "^2.0.1", - "@smithy/protocol-http": "^2.0.1", - "@smithy/smithy-client": "^2.0.1", - "@smithy/types": "^2.0.2", - "@smithy/url-parser": "^2.0.1", + "@smithy/node-config-provider": "^2.0.3", + "@smithy/node-http-handler": "^2.0.3", + "@smithy/protocol-http": "^2.0.3", + "@smithy/smithy-client": "^2.0.3", + "@smithy/types": "^2.2.0", + "@smithy/url-parser": "^2.0.3", "@smithy/util-base64": "^2.0.0", "@smithy/util-body-length-browser": "^2.0.0", "@smithy/util-body-length-node": "^2.0.0", - "@smithy/util-defaults-mode-browser": "^2.0.1", - "@smithy/util-defaults-mode-node": "^2.0.1", + "@smithy/util-defaults-mode-browser": "^2.0.3", + "@smithy/util-defaults-mode-node": "^2.0.3", "@smithy/util-retry": "^2.0.0", "@smithy/util-utf8": "^2.0.0", tslib: "^2.5.0" @@ -15299,8 +15384,8 @@ var require_SSOClient = __commonJS({ var EndpointParameters_1 = require_EndpointParameters3(); var runtimeConfig_1 = require_runtimeConfig(); var SSOClient = class extends smithy_client_1.Client { - constructor(configuration) { - const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration); + constructor(...[configuration]) { + const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration || {}); const _config_1 = (0, EndpointParameters_1.resolveClientEndpointParameters)(_config_0); const _config_2 = (0, config_resolver_1.resolveRegionConfig)(_config_1); const _config_3 = (0, middleware_endpoint_1.resolveEndpointConfig)(_config_2); @@ -16182,143 +16267,44 @@ var require_dist_cjs46 = __commonJS({ } }); -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/constants.js -var require_constants8 = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/constants.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.REFRESH_MESSAGE = exports.EXPIRE_WINDOW_MS = void 0; - exports.EXPIRE_WINDOW_MS = 5 * 60 * 1e3; - exports.REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/EndpointParameters.js -var require_EndpointParameters4 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/EndpointParameters.js"(exports) { +// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/bundle/client-sso-oidc-node.js +var require_client_sso_oidc_node = __commonJS({ + "../../../node_modules/@aws-sdk/token-providers/dist-cjs/bundle/client-sso-oidc-node.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - exports.resolveClientEndpointParameters = void 0; + exports.UnsupportedGrantTypeException = exports.UnauthorizedClientException = exports.SlowDownException = exports.SSOOIDCClient = exports.InvalidScopeException = exports.InvalidRequestException = exports.InvalidClientException = exports.InternalServerException = exports.ExpiredTokenException = exports.CreateTokenCommand = exports.AuthorizationPendingException = exports.AccessDeniedException = void 0; + var middleware_host_header_1 = require_dist_cjs3(); + var middleware_logger_1 = require_dist_cjs4(); + var middleware_recursion_detection_1 = require_dist_cjs5(); + var middleware_user_agent_1 = require_dist_cjs19(); + var config_resolver_1 = require_dist_cjs21(); + var middleware_content_length_1 = require_dist_cjs22(); + var middleware_endpoint_1 = require_dist_cjs26(); + var middleware_retry_1 = require_dist_cjs29(); + var smithy_client_1 = require_dist_cjs35(); var resolveClientEndpointParameters = (options) => { + var _a, _b; return { ...options, - useDualstackEndpoint: options.useDualstackEndpoint ?? false, - useFipsEndpoint: options.useFipsEndpoint ?? false, + useDualstackEndpoint: (_a = options.useDualstackEndpoint) !== null && _a !== void 0 ? _a : false, + useFipsEndpoint: (_b = options.useFipsEndpoint) !== null && _b !== void 0 ? _b : false, defaultSigningName: "awsssooidc" }; }; - exports.resolveClientEndpointParameters = resolveClientEndpointParameters; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso-oidc/package.json -var require_package4 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso-oidc/package.json"(exports, module2) { - module2.exports = { - name: "@aws-sdk/client-sso-oidc", - description: "AWS SDK for JavaScript Sso Oidc Client for Node.js, Browser and React Native", - version: "3.378.0", - scripts: { - build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", - "build:docs": "typedoc", - "build:es": "tsc -p tsconfig.es.json", - "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", - "build:types": "tsc -p tsconfig.types.json", - "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", - clean: "rimraf ./dist-* && rimraf *.tsbuildinfo", - "extract:docs": "api-extractor run --local", - "generate:client": "node ../../scripts/generate-clients/single-service --solo sso-oidc" - }, - main: "./dist-cjs/index.js", - types: "./dist-types/index.d.ts", - module: "./dist-es/index.js", - sideEffects: false, - dependencies: { - "@aws-crypto/sha256-browser": "3.0.0", - "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/middleware-host-header": "3.378.0", - "@aws-sdk/middleware-logger": "3.378.0", - "@aws-sdk/middleware-recursion-detection": "3.378.0", - "@aws-sdk/middleware-user-agent": "3.378.0", - "@aws-sdk/types": "3.378.0", - "@aws-sdk/util-endpoints": "3.378.0", - "@aws-sdk/util-user-agent-browser": "3.378.0", - "@aws-sdk/util-user-agent-node": "3.378.0", - "@smithy/config-resolver": "^2.0.1", - "@smithy/fetch-http-handler": "^2.0.1", - "@smithy/hash-node": "^2.0.1", - "@smithy/invalid-dependency": "^2.0.1", - "@smithy/middleware-content-length": "^2.0.1", - "@smithy/middleware-endpoint": "^2.0.1", - "@smithy/middleware-retry": "^2.0.1", - "@smithy/middleware-serde": "^2.0.1", - "@smithy/middleware-stack": "^2.0.0", - "@smithy/node-config-provider": "^2.0.1", - "@smithy/node-http-handler": "^2.0.1", - "@smithy/protocol-http": "^2.0.1", - "@smithy/smithy-client": "^2.0.1", - "@smithy/types": "^2.0.2", - "@smithy/url-parser": "^2.0.1", - "@smithy/util-base64": "^2.0.0", - "@smithy/util-body-length-browser": "^2.0.0", - "@smithy/util-body-length-node": "^2.0.0", - "@smithy/util-defaults-mode-browser": "^2.0.1", - "@smithy/util-defaults-mode-node": "^2.0.1", - "@smithy/util-retry": "^2.0.0", - "@smithy/util-utf8": "^2.0.0", - tslib: "^2.5.0" - }, - devDependencies: { - "@smithy/service-client-documentation-generator": "^2.0.0", - "@tsconfig/node14": "1.0.3", - "@types/node": "^14.14.31", - concurrently: "7.0.0", - "downlevel-dts": "0.10.1", - rimraf: "3.0.2", - typedoc: "0.23.23", - typescript: "~4.9.5" - }, - engines: { - node: ">=14.0.0" - }, - typesVersions: { - "<4.0": { - "dist-types/*": [ - "dist-types/ts3.4/*" - ] - } - }, - files: [ - "dist-*/**" - ], - author: { - name: "AWS SDK for JavaScript Team", - url: "https://aws.amazon.com/javascript/" - }, - license: "Apache-2.0", - browser: { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" - }, - "react-native": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" - }, - homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sso-oidc", - repository: { - type: "git", - url: "https://github.com/aws/aws-sdk-js-v3.git", - directory: "clients/client-sso-oidc" - } - }; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js -var require_ruleset2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ruleSet = void 0; + var package_default = { version: "3.387.0" }; + var util_user_agent_node_1 = require_dist_cjs42(); + var config_resolver_2 = require_dist_cjs21(); + var hash_node_1 = require_dist_cjs43(); + var middleware_retry_2 = require_dist_cjs29(); + var node_config_provider_1 = require_dist_cjs39(); + var node_http_handler_1 = require_dist_cjs33(); + var util_body_length_node_1 = require_dist_cjs44(); + var util_retry_1 = require_dist_cjs28(); + var smithy_client_2 = require_dist_cjs35(); + var url_parser_1 = require_dist_cjs24(); + var util_base64_1 = require_dist_cjs31(); + var util_utf8_1 = require_dist_cjs13(); + var util_endpoints_1 = require_dist_cjs18(); var p = "required"; var q = "fn"; var r = "argv"; @@ -16339,128 +16325,61 @@ var require_ruleset2 = __commonJS({ var n = [h]; var o = [i]; var _data = { version: "1.0", parameters: { Region: e, UseDualStack: f, UseFIPS: f, Endpoint: e }, rules: [{ conditions: [{ [q]: "aws.partition", [r]: [{ [s]: "Region" }], assign: a }], type: b, rules: [{ conditions: [{ [q]: "isSet", [r]: m }, { [q]: "parseURL", [r]: m, assign: "url" }], type: b, rules: [{ conditions: n, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: c }, { type: b, rules: [{ conditions: o, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: c }, { endpoint: { url: g, properties: j, headers: j }, type: d }] }] }, { conditions: [h, i], type: b, rules: [{ conditions: [k, l], type: b, rules: [{ endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: j, headers: j }, type: d }] }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: c }] }, { conditions: n, type: b, rules: [{ conditions: [k], type: b, rules: [{ type: b, rules: [{ endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}", properties: j, headers: j }, type: d }] }] }, { error: "FIPS is enabled but this partition does not support FIPS", type: c }] }, { conditions: o, type: b, rules: [{ conditions: [l], type: b, rules: [{ endpoint: { url: "https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: j, headers: j }, type: d }] }, { error: "DualStack is enabled but this partition does not support DualStack", type: c }] }, { endpoint: { url: "https://oidc.{Region}.{PartitionResult#dnsSuffix}", properties: j, headers: j }, type: d }] }] }; - exports.ruleSet = _data; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js -var require_endpointResolver2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.defaultEndpointResolver = void 0; - var util_endpoints_1 = require_dist_cjs18(); - var ruleset_1 = require_ruleset2(); + var ruleSet = _data; var defaultEndpointResolver = (endpointParams, context = {}) => { - return (0, util_endpoints_1.resolveEndpoint)(ruleset_1.ruleSet, { + return (0, util_endpoints_1.resolveEndpoint)(ruleSet, { endpointParams, logger: context.logger }); }; - exports.defaultEndpointResolver = defaultEndpointResolver; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js -var require_runtimeConfig_shared2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.getRuntimeConfig = void 0; - var smithy_client_1 = require_dist_cjs35(); - var url_parser_1 = require_dist_cjs24(); - var util_base64_1 = require_dist_cjs31(); - var util_utf8_1 = require_dist_cjs13(); - var endpointResolver_1 = require_endpointResolver2(); - var getRuntimeConfig = (config) => ({ - apiVersion: "2019-06-10", - base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64, - base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64, - disableHostPrefix: config?.disableHostPrefix ?? false, - endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver, - logger: config?.logger ?? new smithy_client_1.NoOpLogger(), - serviceId: config?.serviceId ?? "SSO OIDC", - urlParser: config?.urlParser ?? url_parser_1.parseUrl, - utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8, - utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8 - }); - exports.getRuntimeConfig = getRuntimeConfig; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js -var require_runtimeConfig2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.getRuntimeConfig = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - var package_json_1 = tslib_1.__importDefault(require_package4()); - var util_user_agent_node_1 = require_dist_cjs42(); - var config_resolver_1 = require_dist_cjs21(); - var hash_node_1 = require_dist_cjs43(); - var middleware_retry_1 = require_dist_cjs29(); - var node_config_provider_1 = require_dist_cjs39(); - var node_http_handler_1 = require_dist_cjs33(); - var util_body_length_node_1 = require_dist_cjs44(); - var util_retry_1 = require_dist_cjs28(); - var runtimeConfig_shared_1 = require_runtimeConfig_shared2(); - var smithy_client_1 = require_dist_cjs35(); - var util_defaults_mode_node_1 = require_dist_cjs45(); - var smithy_client_2 = require_dist_cjs35(); var getRuntimeConfig = (config) => { - (0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version); + var _a, _b, _c, _d, _e, _f, _g, _h, _j; + return { + apiVersion: "2019-06-10", + base64Decoder: (_a = config === null || config === void 0 ? void 0 : config.base64Decoder) !== null && _a !== void 0 ? _a : util_base64_1.fromBase64, + base64Encoder: (_b = config === null || config === void 0 ? void 0 : config.base64Encoder) !== null && _b !== void 0 ? _b : util_base64_1.toBase64, + disableHostPrefix: (_c = config === null || config === void 0 ? void 0 : config.disableHostPrefix) !== null && _c !== void 0 ? _c : false, + endpointProvider: (_d = config === null || config === void 0 ? void 0 : config.endpointProvider) !== null && _d !== void 0 ? _d : defaultEndpointResolver, + logger: (_e = config === null || config === void 0 ? void 0 : config.logger) !== null && _e !== void 0 ? _e : new smithy_client_2.NoOpLogger(), + serviceId: (_f = config === null || config === void 0 ? void 0 : config.serviceId) !== null && _f !== void 0 ? _f : "SSO OIDC", + urlParser: (_g = config === null || config === void 0 ? void 0 : config.urlParser) !== null && _g !== void 0 ? _g : url_parser_1.parseUrl, + utf8Decoder: (_h = config === null || config === void 0 ? void 0 : config.utf8Decoder) !== null && _h !== void 0 ? _h : util_utf8_1.fromUtf8, + utf8Encoder: (_j = config === null || config === void 0 ? void 0 : config.utf8Encoder) !== null && _j !== void 0 ? _j : util_utf8_1.toUtf8 + }; + }; + var smithy_client_3 = require_dist_cjs35(); + var util_defaults_mode_node_1 = require_dist_cjs45(); + var smithy_client_4 = require_dist_cjs35(); + var getRuntimeConfig2 = (config) => { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; + (0, smithy_client_4.emitWarningIfUnsupportedVersion)(process.version); const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config); - const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode); - const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config); + const defaultConfigProvider = () => defaultsMode().then(smithy_client_3.loadConfigsForDefaultMode); + const clientSharedValues = getRuntimeConfig(config); return { ...clientSharedValues, ...config, runtime: "node", defaultsMode, - bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength, - defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }), - maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: config?.requestHandler ?? new node_http_handler_1.NodeHttpHandler(defaultConfigProvider), - retryMode: config?.retryMode ?? (0, node_config_provider_1.loadConfig)({ - ...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS, + bodyLengthChecker: (_a = config === null || config === void 0 ? void 0 : config.bodyLengthChecker) !== null && _a !== void 0 ? _a : util_body_length_node_1.calculateBodyLength, + defaultUserAgentProvider: (_b = config === null || config === void 0 ? void 0 : config.defaultUserAgentProvider) !== null && _b !== void 0 ? _b : (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_default.version }), + maxAttempts: (_c = config === null || config === void 0 ? void 0 : config.maxAttempts) !== null && _c !== void 0 ? _c : (0, node_config_provider_1.loadConfig)(middleware_retry_2.NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: (_d = config === null || config === void 0 ? void 0 : config.region) !== null && _d !== void 0 ? _d : (0, node_config_provider_1.loadConfig)(config_resolver_2.NODE_REGION_CONFIG_OPTIONS, config_resolver_2.NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: (_e = config === null || config === void 0 ? void 0 : config.requestHandler) !== null && _e !== void 0 ? _e : new node_http_handler_1.NodeHttpHandler(defaultConfigProvider), + retryMode: (_f = config === null || config === void 0 ? void 0 : config.retryMode) !== null && _f !== void 0 ? _f : (0, node_config_provider_1.loadConfig)({ + ...middleware_retry_2.NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE }), - sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"), - streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector, - useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), - useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS) + sha256: (_g = config === null || config === void 0 ? void 0 : config.sha256) !== null && _g !== void 0 ? _g : hash_node_1.Hash.bind(null, "sha256"), + streamCollector: (_h = config === null || config === void 0 ? void 0 : config.streamCollector) !== null && _h !== void 0 ? _h : node_http_handler_1.streamCollector, + useDualstackEndpoint: (_j = config === null || config === void 0 ? void 0 : config.useDualstackEndpoint) !== null && _j !== void 0 ? _j : (0, node_config_provider_1.loadConfig)(config_resolver_2.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), + useFipsEndpoint: (_k = config === null || config === void 0 ? void 0 : config.useFipsEndpoint) !== null && _k !== void 0 ? _k : (0, node_config_provider_1.loadConfig)(config_resolver_2.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS) }; }; - exports.getRuntimeConfig = getRuntimeConfig; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/SSOOIDCClient.js -var require_SSOOIDCClient = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/SSOOIDCClient.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.SSOOIDCClient = exports.__Client = void 0; - var middleware_host_header_1 = require_dist_cjs3(); - var middleware_logger_1 = require_dist_cjs4(); - var middleware_recursion_detection_1 = require_dist_cjs5(); - var middleware_user_agent_1 = require_dist_cjs19(); - var config_resolver_1 = require_dist_cjs21(); - var middleware_content_length_1 = require_dist_cjs22(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_retry_1 = require_dist_cjs29(); - var smithy_client_1 = require_dist_cjs35(); - Object.defineProperty(exports, "__Client", { enumerable: true, get: function() { - return smithy_client_1.Client; - } }); - var EndpointParameters_1 = require_EndpointParameters4(); - var runtimeConfig_1 = require_runtimeConfig2(); var SSOOIDCClient = class extends smithy_client_1.Client { - constructor(configuration) { - const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration); - const _config_1 = (0, EndpointParameters_1.resolveClientEndpointParameters)(_config_0); + constructor(...[configuration]) { + const _config_0 = getRuntimeConfig2(configuration || {}); + const _config_1 = resolveClientEndpointParameters(_config_0); const _config_2 = (0, config_resolver_1.resolveRegionConfig)(_config_1); const _config_3 = (0, middleware_endpoint_1.resolveEndpointConfig)(_config_2); const _config_4 = (0, middleware_retry_1.resolveRetryConfig)(_config_3); @@ -16480,37 +16399,20 @@ var require_SSOOIDCClient = __commonJS({ } }; exports.SSOOIDCClient = SSOOIDCClient; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/models/SSOOIDCServiceException.js -var require_SSOOIDCServiceException = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/models/SSOOIDCServiceException.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.SSOOIDCServiceException = exports.__ServiceException = void 0; - var smithy_client_1 = require_dist_cjs35(); - Object.defineProperty(exports, "__ServiceException", { enumerable: true, get: function() { - return smithy_client_1.ServiceException; - } }); - var SSOOIDCServiceException = class _SSOOIDCServiceException extends smithy_client_1.ServiceException { + var smithy_client_5 = require_dist_cjs35(); + var middleware_endpoint_2 = require_dist_cjs26(); + var middleware_serde_1 = require_dist_cjs25(); + var smithy_client_6 = require_dist_cjs35(); + var protocol_http_1 = require_dist_cjs2(); + var smithy_client_7 = require_dist_cjs35(); + var smithy_client_8 = require_dist_cjs35(); + var SSOOIDCServiceException = class _SSOOIDCServiceException extends smithy_client_8.ServiceException { constructor(options) { super(options); Object.setPrototypeOf(this, _SSOOIDCServiceException.prototype); } }; - exports.SSOOIDCServiceException = SSOOIDCServiceException; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/models/models_0.js -var require_models_03 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/models/models_0.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.InvalidClientMetadataException = exports.UnsupportedGrantTypeException = exports.UnauthorizedClientException = exports.SlowDownException = exports.InvalidScopeException = exports.InvalidRequestException = exports.InvalidGrantException = exports.InvalidClientException = exports.InternalServerException = exports.ExpiredTokenException = exports.AuthorizationPendingException = exports.AccessDeniedException = void 0; - var SSOOIDCServiceException_1 = require_SSOOIDCServiceException(); - var AccessDeniedException = class _AccessDeniedException extends SSOOIDCServiceException_1.SSOOIDCServiceException { + var AccessDeniedException = class _AccessDeniedException extends SSOOIDCServiceException { constructor(opts) { super({ name: "AccessDeniedException", @@ -16525,7 +16427,7 @@ var require_models_03 = __commonJS({ } }; exports.AccessDeniedException = AccessDeniedException; - var AuthorizationPendingException = class _AuthorizationPendingException extends SSOOIDCServiceException_1.SSOOIDCServiceException { + var AuthorizationPendingException = class _AuthorizationPendingException extends SSOOIDCServiceException { constructor(opts) { super({ name: "AuthorizationPendingException", @@ -16540,7 +16442,7 @@ var require_models_03 = __commonJS({ } }; exports.AuthorizationPendingException = AuthorizationPendingException; - var ExpiredTokenException = class _ExpiredTokenException extends SSOOIDCServiceException_1.SSOOIDCServiceException { + var ExpiredTokenException = class _ExpiredTokenException extends SSOOIDCServiceException { constructor(opts) { super({ name: "ExpiredTokenException", @@ -16555,7 +16457,7 @@ var require_models_03 = __commonJS({ } }; exports.ExpiredTokenException = ExpiredTokenException; - var InternalServerException = class _InternalServerException extends SSOOIDCServiceException_1.SSOOIDCServiceException { + var InternalServerException = class _InternalServerException extends SSOOIDCServiceException { constructor(opts) { super({ name: "InternalServerException", @@ -16570,7 +16472,7 @@ var require_models_03 = __commonJS({ } }; exports.InternalServerException = InternalServerException; - var InvalidClientException = class _InvalidClientException extends SSOOIDCServiceException_1.SSOOIDCServiceException { + var InvalidClientException = class _InvalidClientException extends SSOOIDCServiceException { constructor(opts) { super({ name: "InvalidClientException", @@ -16585,7 +16487,7 @@ var require_models_03 = __commonJS({ } }; exports.InvalidClientException = InvalidClientException; - var InvalidGrantException = class _InvalidGrantException extends SSOOIDCServiceException_1.SSOOIDCServiceException { + var InvalidGrantException = class _InvalidGrantException extends SSOOIDCServiceException { constructor(opts) { super({ name: "InvalidGrantException", @@ -16599,8 +16501,7 @@ var require_models_03 = __commonJS({ this.error_description = opts.error_description; } }; - exports.InvalidGrantException = InvalidGrantException; - var InvalidRequestException = class _InvalidRequestException extends SSOOIDCServiceException_1.SSOOIDCServiceException { + var InvalidRequestException = class _InvalidRequestException extends SSOOIDCServiceException { constructor(opts) { super({ name: "InvalidRequestException", @@ -16615,7 +16516,7 @@ var require_models_03 = __commonJS({ } }; exports.InvalidRequestException = InvalidRequestException; - var InvalidScopeException = class _InvalidScopeException extends SSOOIDCServiceException_1.SSOOIDCServiceException { + var InvalidScopeException = class _InvalidScopeException extends SSOOIDCServiceException { constructor(opts) { super({ name: "InvalidScopeException", @@ -16630,7 +16531,7 @@ var require_models_03 = __commonJS({ } }; exports.InvalidScopeException = InvalidScopeException; - var SlowDownException = class _SlowDownException extends SSOOIDCServiceException_1.SSOOIDCServiceException { + var SlowDownException = class _SlowDownException extends SSOOIDCServiceException { constructor(opts) { super({ name: "SlowDownException", @@ -16645,7 +16546,7 @@ var require_models_03 = __commonJS({ } }; exports.SlowDownException = SlowDownException; - var UnauthorizedClientException = class _UnauthorizedClientException extends SSOOIDCServiceException_1.SSOOIDCServiceException { + var UnauthorizedClientException = class _UnauthorizedClientException extends SSOOIDCServiceException { constructor(opts) { super({ name: "UnauthorizedClientException", @@ -16660,7 +16561,7 @@ var require_models_03 = __commonJS({ } }; exports.UnauthorizedClientException = UnauthorizedClientException; - var UnsupportedGrantTypeException = class _UnsupportedGrantTypeException extends SSOOIDCServiceException_1.SSOOIDCServiceException { + var UnsupportedGrantTypeException = class _UnsupportedGrantTypeException extends SSOOIDCServiceException { constructor(opts) { super({ name: "UnsupportedGrantTypeException", @@ -16675,7 +16576,7 @@ var require_models_03 = __commonJS({ } }; exports.UnsupportedGrantTypeException = UnsupportedGrantTypeException; - var InvalidClientMetadataException = class _InvalidClientMetadataException extends SSOOIDCServiceException_1.SSOOIDCServiceException { + var InvalidClientMetadataException = class _InvalidClientMetadataException extends SSOOIDCServiceException { constructor(opts) { super({ name: "InvalidClientMetadataException", @@ -16689,28 +16590,14 @@ var require_models_03 = __commonJS({ this.error_description = opts.error_description; } }; - exports.InvalidClientMetadataException = InvalidClientMetadataException; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/protocols/Aws_restJson1.js -var require_Aws_restJson12 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/protocols/Aws_restJson1.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.de_StartDeviceAuthorizationCommand = exports.de_RegisterClientCommand = exports.de_CreateTokenCommand = exports.se_StartDeviceAuthorizationCommand = exports.se_RegisterClientCommand = exports.se_CreateTokenCommand = void 0; - var protocol_http_1 = require_dist_cjs2(); - var smithy_client_1 = require_dist_cjs35(); - var models_0_1 = require_models_03(); - var SSOOIDCServiceException_1 = require_SSOOIDCServiceException(); var se_CreateTokenCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { "content-type": "application/json" }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}/token`; + const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}/token`; let body; - body = JSON.stringify((0, smithy_client_1.take)(input, { + body = JSON.stringify((0, smithy_client_7.take)(input, { clientId: [], clientSecret: [], code: [], @@ -16718,7 +16605,7 @@ var require_Aws_restJson12 = __commonJS({ grantType: [], redirectUri: [], refreshToken: [], - scope: (_) => (0, smithy_client_1._json)(_) + scope: (_) => (0, smithy_client_7._json)(_) })); return new protocol_http_1.HttpRequest({ protocol, @@ -16730,18 +16617,17 @@ var require_Aws_restJson12 = __commonJS({ body }); }; - exports.se_CreateTokenCommand = se_CreateTokenCommand; var se_RegisterClientCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { "content-type": "application/json" }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}/client/register`; + const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}/client/register`; let body; - body = JSON.stringify((0, smithy_client_1.take)(input, { + body = JSON.stringify((0, smithy_client_7.take)(input, { clientName: [], clientType: [], - scopes: (_) => (0, smithy_client_1._json)(_) + scopes: (_) => (0, smithy_client_7._json)(_) })); return new protocol_http_1.HttpRequest({ protocol, @@ -16753,15 +16639,14 @@ var require_Aws_restJson12 = __commonJS({ body }); }; - exports.se_RegisterClientCommand = se_RegisterClientCommand; var se_StartDeviceAuthorizationCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = { "content-type": "application/json" }; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}/device_authorization`; + const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}/device_authorization`; let body; - body = JSON.stringify((0, smithy_client_1.take)(input, { + body = JSON.stringify((0, smithy_client_7.take)(input, { clientId: [], clientSecret: [], startUrl: [] @@ -16776,26 +16661,24 @@ var require_Aws_restJson12 = __commonJS({ body }); }; - exports.se_StartDeviceAuthorizationCommand = se_StartDeviceAuthorizationCommand; var de_CreateTokenCommand = async (output, context) => { if (output.statusCode !== 200 && output.statusCode >= 300) { return de_CreateTokenCommandError(output, context); } - const contents = (0, smithy_client_1.map)({ + const contents = (0, smithy_client_7.map)({ $metadata: deserializeMetadata(output) }); - const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body"); - const doc = (0, smithy_client_1.take)(data, { - accessToken: smithy_client_1.expectString, - expiresIn: smithy_client_1.expectInt32, - idToken: smithy_client_1.expectString, - refreshToken: smithy_client_1.expectString, - tokenType: smithy_client_1.expectString + const data = (0, smithy_client_7.expectNonNull)((0, smithy_client_7.expectObject)(await parseBody(output.body, context)), "body"); + const doc = (0, smithy_client_7.take)(data, { + accessToken: smithy_client_7.expectString, + expiresIn: smithy_client_7.expectInt32, + idToken: smithy_client_7.expectString, + refreshToken: smithy_client_7.expectString, + tokenType: smithy_client_7.expectString }); Object.assign(contents, doc); return contents; }; - exports.de_CreateTokenCommand = de_CreateTokenCommand; var de_CreateTokenCommandError = async (output, context) => { const parsedOutput = { ...output, @@ -16849,22 +16732,21 @@ var require_Aws_restJson12 = __commonJS({ if (output.statusCode !== 200 && output.statusCode >= 300) { return de_RegisterClientCommandError(output, context); } - const contents = (0, smithy_client_1.map)({ + const contents = (0, smithy_client_7.map)({ $metadata: deserializeMetadata(output) }); - const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body"); - const doc = (0, smithy_client_1.take)(data, { - authorizationEndpoint: smithy_client_1.expectString, - clientId: smithy_client_1.expectString, - clientIdIssuedAt: smithy_client_1.expectLong, - clientSecret: smithy_client_1.expectString, - clientSecretExpiresAt: smithy_client_1.expectLong, - tokenEndpoint: smithy_client_1.expectString + const data = (0, smithy_client_7.expectNonNull)((0, smithy_client_7.expectObject)(await parseBody(output.body, context)), "body"); + const doc = (0, smithy_client_7.take)(data, { + authorizationEndpoint: smithy_client_7.expectString, + clientId: smithy_client_7.expectString, + clientIdIssuedAt: smithy_client_7.expectLong, + clientSecret: smithy_client_7.expectString, + clientSecretExpiresAt: smithy_client_7.expectLong, + tokenEndpoint: smithy_client_7.expectString }); Object.assign(contents, doc); return contents; }; - exports.de_RegisterClientCommand = de_RegisterClientCommand; var de_RegisterClientCommandError = async (output, context) => { const parsedOutput = { ...output, @@ -16897,22 +16779,21 @@ var require_Aws_restJson12 = __commonJS({ if (output.statusCode !== 200 && output.statusCode >= 300) { return de_StartDeviceAuthorizationCommandError(output, context); } - const contents = (0, smithy_client_1.map)({ + const contents = (0, smithy_client_7.map)({ $metadata: deserializeMetadata(output) }); - const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body"); - const doc = (0, smithy_client_1.take)(data, { - deviceCode: smithy_client_1.expectString, - expiresIn: smithy_client_1.expectInt32, - interval: smithy_client_1.expectInt32, - userCode: smithy_client_1.expectString, - verificationUri: smithy_client_1.expectString, - verificationUriComplete: smithy_client_1.expectString + const data = (0, smithy_client_7.expectNonNull)((0, smithy_client_7.expectObject)(await parseBody(output.body, context)), "body"); + const doc = (0, smithy_client_7.take)(data, { + deviceCode: smithy_client_7.expectString, + expiresIn: smithy_client_7.expectInt32, + interval: smithy_client_7.expectInt32, + userCode: smithy_client_7.expectString, + verificationUri: smithy_client_7.expectString, + verificationUriComplete: smithy_client_7.expectString }); Object.assign(contents, doc); return contents; }; - exports.de_StartDeviceAuthorizationCommand = de_StartDeviceAuthorizationCommand; var de_StartDeviceAuthorizationCommandError = async (output, context) => { const parsedOutput = { ...output, @@ -16944,182 +16825,185 @@ var require_Aws_restJson12 = __commonJS({ }); } }; - var throwDefaultError = (0, smithy_client_1.withBaseException)(SSOOIDCServiceException_1.SSOOIDCServiceException); + var throwDefaultError = (0, smithy_client_7.withBaseException)(SSOOIDCServiceException); var de_AccessDeniedExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_1.map)({}); + const contents = (0, smithy_client_7.map)({}); const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - error: smithy_client_1.expectString, - error_description: smithy_client_1.expectString + const doc = (0, smithy_client_7.take)(data, { + error: smithy_client_7.expectString, + error_description: smithy_client_7.expectString }); Object.assign(contents, doc); - const exception = new models_0_1.AccessDeniedException({ + const exception = new AccessDeniedException({ $metadata: deserializeMetadata(parsedOutput), ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); + return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); }; var de_AuthorizationPendingExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_1.map)({}); + const contents = (0, smithy_client_7.map)({}); const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - error: smithy_client_1.expectString, - error_description: smithy_client_1.expectString + const doc = (0, smithy_client_7.take)(data, { + error: smithy_client_7.expectString, + error_description: smithy_client_7.expectString }); Object.assign(contents, doc); - const exception = new models_0_1.AuthorizationPendingException({ + const exception = new AuthorizationPendingException({ $metadata: deserializeMetadata(parsedOutput), ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); + return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); }; var de_ExpiredTokenExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_1.map)({}); + const contents = (0, smithy_client_7.map)({}); const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - error: smithy_client_1.expectString, - error_description: smithy_client_1.expectString + const doc = (0, smithy_client_7.take)(data, { + error: smithy_client_7.expectString, + error_description: smithy_client_7.expectString }); Object.assign(contents, doc); - const exception = new models_0_1.ExpiredTokenException({ + const exception = new ExpiredTokenException({ $metadata: deserializeMetadata(parsedOutput), ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); + return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); }; var de_InternalServerExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_1.map)({}); + const contents = (0, smithy_client_7.map)({}); const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - error: smithy_client_1.expectString, - error_description: smithy_client_1.expectString + const doc = (0, smithy_client_7.take)(data, { + error: smithy_client_7.expectString, + error_description: smithy_client_7.expectString }); Object.assign(contents, doc); - const exception = new models_0_1.InternalServerException({ + const exception = new InternalServerException({ $metadata: deserializeMetadata(parsedOutput), ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); + return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); }; var de_InvalidClientExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_1.map)({}); + const contents = (0, smithy_client_7.map)({}); const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - error: smithy_client_1.expectString, - error_description: smithy_client_1.expectString + const doc = (0, smithy_client_7.take)(data, { + error: smithy_client_7.expectString, + error_description: smithy_client_7.expectString }); Object.assign(contents, doc); - const exception = new models_0_1.InvalidClientException({ + const exception = new InvalidClientException({ $metadata: deserializeMetadata(parsedOutput), ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); + return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); }; var de_InvalidClientMetadataExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_1.map)({}); + const contents = (0, smithy_client_7.map)({}); const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - error: smithy_client_1.expectString, - error_description: smithy_client_1.expectString + const doc = (0, smithy_client_7.take)(data, { + error: smithy_client_7.expectString, + error_description: smithy_client_7.expectString }); Object.assign(contents, doc); - const exception = new models_0_1.InvalidClientMetadataException({ + const exception = new InvalidClientMetadataException({ $metadata: deserializeMetadata(parsedOutput), ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); + return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); }; var de_InvalidGrantExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_1.map)({}); + const contents = (0, smithy_client_7.map)({}); const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - error: smithy_client_1.expectString, - error_description: smithy_client_1.expectString + const doc = (0, smithy_client_7.take)(data, { + error: smithy_client_7.expectString, + error_description: smithy_client_7.expectString }); Object.assign(contents, doc); - const exception = new models_0_1.InvalidGrantException({ + const exception = new InvalidGrantException({ $metadata: deserializeMetadata(parsedOutput), ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); + return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); }; var de_InvalidRequestExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_1.map)({}); + const contents = (0, smithy_client_7.map)({}); const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - error: smithy_client_1.expectString, - error_description: smithy_client_1.expectString + const doc = (0, smithy_client_7.take)(data, { + error: smithy_client_7.expectString, + error_description: smithy_client_7.expectString }); Object.assign(contents, doc); - const exception = new models_0_1.InvalidRequestException({ + const exception = new InvalidRequestException({ $metadata: deserializeMetadata(parsedOutput), ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); + return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); }; var de_InvalidScopeExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_1.map)({}); + const contents = (0, smithy_client_7.map)({}); const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - error: smithy_client_1.expectString, - error_description: smithy_client_1.expectString + const doc = (0, smithy_client_7.take)(data, { + error: smithy_client_7.expectString, + error_description: smithy_client_7.expectString }); Object.assign(contents, doc); - const exception = new models_0_1.InvalidScopeException({ + const exception = new InvalidScopeException({ $metadata: deserializeMetadata(parsedOutput), ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); + return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); }; var de_SlowDownExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_1.map)({}); + const contents = (0, smithy_client_7.map)({}); const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - error: smithy_client_1.expectString, - error_description: smithy_client_1.expectString + const doc = (0, smithy_client_7.take)(data, { + error: smithy_client_7.expectString, + error_description: smithy_client_7.expectString }); Object.assign(contents, doc); - const exception = new models_0_1.SlowDownException({ + const exception = new SlowDownException({ $metadata: deserializeMetadata(parsedOutput), ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); + return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); }; var de_UnauthorizedClientExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_1.map)({}); + const contents = (0, smithy_client_7.map)({}); const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - error: smithy_client_1.expectString, - error_description: smithy_client_1.expectString + const doc = (0, smithy_client_7.take)(data, { + error: smithy_client_7.expectString, + error_description: smithy_client_7.expectString }); Object.assign(contents, doc); - const exception = new models_0_1.UnauthorizedClientException({ + const exception = new UnauthorizedClientException({ $metadata: deserializeMetadata(parsedOutput), ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); + return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); }; var de_UnsupportedGrantTypeExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_1.map)({}); + const contents = (0, smithy_client_7.map)({}); const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - error: smithy_client_1.expectString, - error_description: smithy_client_1.expectString + const doc = (0, smithy_client_7.take)(data, { + error: smithy_client_7.expectString, + error_description: smithy_client_7.expectString }); Object.assign(contents, doc); - const exception = new models_0_1.UnsupportedGrantTypeException({ + const exception = new UnsupportedGrantTypeException({ $metadata: deserializeMetadata(parsedOutput), ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); + return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); }; - var deserializeMetadata = (output) => ({ - httpStatusCode: output.statusCode, - requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"], - extendedRequestId: output.headers["x-amz-id-2"], - cfId: output.headers["x-amz-cf-id"] - }); - var collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)); + var deserializeMetadata = (output) => { + var _a, _b; + return { + httpStatusCode: output.statusCode, + requestId: (_b = (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"]) !== null && _b !== void 0 ? _b : output.headers["x-amz-request-id"], + extendedRequestId: output.headers["x-amz-id-2"], + cfId: output.headers["x-amz-cf-id"] + }; + }; + var collectBodyString = (streamBody, context) => (0, smithy_client_7.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)); var parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { return JSON.parse(encoded); @@ -17127,12 +17011,13 @@ var require_Aws_restJson12 = __commonJS({ return {}; }); var parseErrorBody = async (errorBody, context) => { + var _a; const value = await parseBody(errorBody, context); - value.message = value.message ?? value.Message; + value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message; return value; }; var loadRestJsonErrorCode = (output, data) => { - const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()); + const findKey = (object, key) => Object.keys(object).find((k2) => k2.toLowerCase() === key.toLowerCase()); const sanitizeErrorCode = (rawValue) => { let cleanValue = rawValue; if (typeof cleanValue === "number") { @@ -17160,23 +17045,11 @@ var require_Aws_restJson12 = __commonJS({ return sanitizeErrorCode(data["__type"]); } }; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/commands/CreateTokenCommand.js -var require_CreateTokenCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/commands/CreateTokenCommand.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.CreateTokenCommand = exports.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs35(); - Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var Aws_restJson1_1 = require_Aws_restJson12(); - var CreateTokenCommand = class _CreateTokenCommand extends smithy_client_1.Command { + var CreateTokenCommand = class _CreateTokenCommand extends smithy_client_6.Command { + constructor(input) { + super(); + this.input = input; + } static getEndpointParameterInstructions() { return { UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, @@ -17185,13 +17058,9 @@ var require_CreateTokenCommand = __commonJS({ UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } }; } - constructor(input) { - super(); - this.input = input; - } resolveMiddleware(clientStack, configuration, options) { this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _CreateTokenCommand.getEndpointParameterInstructions())); + this.middlewareStack.use((0, middleware_endpoint_2.getEndpointPlugin)(configuration, _CreateTokenCommand.getEndpointParameterInstructions())); const stack = clientStack.concat(this.middlewareStack); const { logger } = configuration; const clientName = "SSOOIDCClient"; @@ -17207,30 +17076,21 @@ var require_CreateTokenCommand = __commonJS({ return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); } serialize(input, context) { - return (0, Aws_restJson1_1.se_CreateTokenCommand)(input, context); + return se_CreateTokenCommand(input, context); } deserialize(output, context) { - return (0, Aws_restJson1_1.de_CreateTokenCommand)(output, context); + return de_CreateTokenCommand(output, context); } }; exports.CreateTokenCommand = CreateTokenCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/commands/RegisterClientCommand.js -var require_RegisterClientCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/commands/RegisterClientCommand.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.RegisterClientCommand = exports.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs35(); - Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var Aws_restJson1_1 = require_Aws_restJson12(); - var RegisterClientCommand = class _RegisterClientCommand extends smithy_client_1.Command { + var middleware_endpoint_3 = require_dist_cjs26(); + var middleware_serde_2 = require_dist_cjs25(); + var smithy_client_9 = require_dist_cjs35(); + var RegisterClientCommand = class _RegisterClientCommand extends smithy_client_9.Command { + constructor(input) { + super(); + this.input = input; + } static getEndpointParameterInstructions() { return { UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, @@ -17239,13 +17099,9 @@ var require_RegisterClientCommand = __commonJS({ UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } }; } - constructor(input) { - super(); - this.input = input; - } resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _RegisterClientCommand.getEndpointParameterInstructions())); + this.middlewareStack.use((0, middleware_serde_2.getSerdePlugin)(configuration, this.serialize, this.deserialize)); + this.middlewareStack.use((0, middleware_endpoint_3.getEndpointPlugin)(configuration, _RegisterClientCommand.getEndpointParameterInstructions())); const stack = clientStack.concat(this.middlewareStack); const { logger } = configuration; const clientName = "SSOOIDCClient"; @@ -17261,30 +17117,20 @@ var require_RegisterClientCommand = __commonJS({ return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); } serialize(input, context) { - return (0, Aws_restJson1_1.se_RegisterClientCommand)(input, context); + return se_RegisterClientCommand(input, context); } deserialize(output, context) { - return (0, Aws_restJson1_1.de_RegisterClientCommand)(output, context); + return de_RegisterClientCommand(output, context); } }; - exports.RegisterClientCommand = RegisterClientCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/commands/StartDeviceAuthorizationCommand.js -var require_StartDeviceAuthorizationCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/commands/StartDeviceAuthorizationCommand.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.StartDeviceAuthorizationCommand = exports.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs35(); - Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var Aws_restJson1_1 = require_Aws_restJson12(); - var StartDeviceAuthorizationCommand = class _StartDeviceAuthorizationCommand extends smithy_client_1.Command { + var middleware_endpoint_4 = require_dist_cjs26(); + var middleware_serde_3 = require_dist_cjs25(); + var smithy_client_10 = require_dist_cjs35(); + var StartDeviceAuthorizationCommand = class _StartDeviceAuthorizationCommand extends smithy_client_10.Command { + constructor(input) { + super(); + this.input = input; + } static getEndpointParameterInstructions() { return { UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, @@ -17293,13 +17139,9 @@ var require_StartDeviceAuthorizationCommand = __commonJS({ UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } }; } - constructor(input) { - super(); - this.input = input; - } resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _StartDeviceAuthorizationCommand.getEndpointParameterInstructions())); + this.middlewareStack.use((0, middleware_serde_3.getSerdePlugin)(configuration, this.serialize, this.deserialize)); + this.middlewareStack.use((0, middleware_endpoint_4.getEndpointPlugin)(configuration, _StartDeviceAuthorizationCommand.getEndpointParameterInstructions())); const stack = clientStack.concat(this.middlewareStack); const { logger } = configuration; const clientName = "SSOOIDCClient"; @@ -17315,76 +17157,31 @@ var require_StartDeviceAuthorizationCommand = __commonJS({ return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); } serialize(input, context) { - return (0, Aws_restJson1_1.se_StartDeviceAuthorizationCommand)(input, context); + return se_StartDeviceAuthorizationCommand(input, context); } deserialize(output, context) { - return (0, Aws_restJson1_1.de_StartDeviceAuthorizationCommand)(output, context); + return de_StartDeviceAuthorizationCommand(output, context); } }; - exports.StartDeviceAuthorizationCommand = StartDeviceAuthorizationCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/SSOOIDC.js -var require_SSOOIDC = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/SSOOIDC.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.SSOOIDC = void 0; - var smithy_client_1 = require_dist_cjs35(); - var CreateTokenCommand_1 = require_CreateTokenCommand(); - var RegisterClientCommand_1 = require_RegisterClientCommand(); - var StartDeviceAuthorizationCommand_1 = require_StartDeviceAuthorizationCommand(); - var SSOOIDCClient_1 = require_SSOOIDCClient(); var commands = { - CreateTokenCommand: CreateTokenCommand_1.CreateTokenCommand, - RegisterClientCommand: RegisterClientCommand_1.RegisterClientCommand, - StartDeviceAuthorizationCommand: StartDeviceAuthorizationCommand_1.StartDeviceAuthorizationCommand + CreateTokenCommand, + RegisterClientCommand, + StartDeviceAuthorizationCommand }; - var SSOOIDC = class extends SSOOIDCClient_1.SSOOIDCClient { + var SSOOIDC = class extends SSOOIDCClient { }; - exports.SSOOIDC = SSOOIDC; - (0, smithy_client_1.createAggregatedClient)(commands, SSOOIDC); - } -}); - -// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/commands/index.js -var require_commands2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/commands/index.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_CreateTokenCommand(), exports); - tslib_1.__exportStar(require_RegisterClientCommand(), exports); - tslib_1.__exportStar(require_StartDeviceAuthorizationCommand(), exports); - } -}); - -// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/models/index.js -var require_models2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/models/index.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_models_03(), exports); + (0, smithy_client_5.createAggregatedClient)(commands, SSOOIDC); } }); -// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js -var require_dist_cjs47 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js"(exports) { +// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/constants.js +var require_constants8 = __commonJS({ + "../../../node_modules/@aws-sdk/token-providers/dist-cjs/constants.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - exports.SSOOIDCServiceException = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_SSOOIDCClient(), exports); - tslib_1.__exportStar(require_SSOOIDC(), exports); - tslib_1.__exportStar(require_commands2(), exports); - tslib_1.__exportStar(require_models2(), exports); - var SSOOIDCServiceException_1 = require_SSOOIDCServiceException(); - Object.defineProperty(exports, "SSOOIDCServiceException", { enumerable: true, get: function() { - return SSOOIDCServiceException_1.SSOOIDCServiceException; - } }); + exports.REFRESH_MESSAGE = exports.EXPIRE_WINDOW_MS = void 0; + exports.EXPIRE_WINDOW_MS = 5 * 60 * 1e3; + exports.REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`; } }); @@ -17394,13 +17191,13 @@ var require_getSsoOidcClient = __commonJS({ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getSsoOidcClient = void 0; - var client_sso_oidc_1 = require_dist_cjs47(); + var client_sso_oidc_node_1 = require_client_sso_oidc_node(); var ssoOidcClientsHash = {}; var getSsoOidcClient = (ssoRegion) => { if (ssoOidcClientsHash[ssoRegion]) { return ssoOidcClientsHash[ssoRegion]; } - const ssoOidcClient = new client_sso_oidc_1.SSOOIDCClient({ region: ssoRegion }); + const ssoOidcClient = new client_sso_oidc_node_1.SSOOIDCClient({ region: ssoRegion }); ssoOidcClientsHash[ssoRegion] = ssoOidcClient; return ssoOidcClient; }; @@ -17414,11 +17211,11 @@ var require_getNewSsoOidcToken = __commonJS({ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getNewSsoOidcToken = void 0; - var client_sso_oidc_1 = require_dist_cjs47(); + var client_sso_oidc_node_1 = require_client_sso_oidc_node(); var getSsoOidcClient_1 = require_getSsoOidcClient(); var getNewSsoOidcToken = (ssoToken, ssoRegion) => { const ssoOidcClient = (0, getSsoOidcClient_1.getSsoOidcClient)(ssoRegion); - return ssoOidcClient.send(new client_sso_oidc_1.CreateTokenCommand({ + return ssoOidcClient.send(new client_sso_oidc_node_1.CreateTokenCommand({ clientId: ssoToken.clientId, clientSecret: ssoToken.clientSecret, refreshToken: ssoToken.refreshToken, @@ -17598,11 +17395,12 @@ var require_nodeProvider = __commonJS({ }); // ../../../node_modules/@aws-sdk/token-providers/dist-cjs/index.js -var require_dist_cjs48 = __commonJS({ +var require_dist_cjs47 = __commonJS({ "../../../node_modules/@aws-sdk/token-providers/dist-cjs/index.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); + tslib_1.__exportStar(require_client_sso_oidc_node(), exports); tslib_1.__exportStar(require_fromSso(), exports); tslib_1.__exportStar(require_fromStatic3(), exports); tslib_1.__exportStar(require_nodeProvider(), exports); @@ -17616,7 +17414,7 @@ var require_resolveSSOCredentials = __commonJS({ Object.defineProperty(exports, "__esModule", { value: true }); exports.resolveSSOCredentials = void 0; var client_sso_1 = require_dist_cjs46(); - var token_providers_1 = require_dist_cjs48(); + var token_providers_1 = require_dist_cjs47(); var property_provider_1 = require_dist_cjs6(); var shared_ini_file_loader_1 = require_dist_cjs38(); var EXPIRE_WINDOW_MS = 15 * 60 * 1e3; @@ -17758,7 +17556,7 @@ var require_types7 = __commonJS({ }); // ../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js -var require_dist_cjs49 = __commonJS({ +var require_dist_cjs48 = __commonJS({ "../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -17776,8 +17574,8 @@ var require_resolveSsoCredentials = __commonJS({ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.resolveSsoCredentials = exports.isSsoProfile = void 0; - var credential_provider_sso_1 = require_dist_cjs49(); - var credential_provider_sso_2 = require_dist_cjs49(); + var credential_provider_sso_1 = require_dist_cjs48(); + var credential_provider_sso_2 = require_dist_cjs48(); Object.defineProperty(exports, "isSsoProfile", { enumerable: true, get: function() { return credential_provider_sso_2.isSsoProfile; } }); @@ -17870,7 +17668,7 @@ var require_fromTokenFile = __commonJS({ }); // ../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js -var require_dist_cjs50 = __commonJS({ +var require_dist_cjs49 = __commonJS({ "../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -17886,7 +17684,7 @@ var require_resolveWebIdentityCredentials = __commonJS({ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.resolveWebIdentityCredentials = exports.isWebIdentityProfile = void 0; - var credential_provider_web_identity_1 = require_dist_cjs50(); + var credential_provider_web_identity_1 = require_dist_cjs49(); var isWebIdentityProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.web_identity_token_file === "string" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1; exports.isWebIdentityProfile = isWebIdentityProfile; var resolveWebIdentityCredentials = async (profile, options) => (0, credential_provider_web_identity_1.fromTokenFile)({ @@ -17954,7 +17752,7 @@ var require_fromIni = __commonJS({ }); // ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js -var require_dist_cjs51 = __commonJS({ +var require_dist_cjs50 = __commonJS({ "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -17994,10 +17792,10 @@ var require_defaultProvider = __commonJS({ Object.defineProperty(exports, "__esModule", { value: true }); exports.defaultProvider = void 0; var credential_provider_env_1 = require_dist_cjs37(); - var credential_provider_ini_1 = require_dist_cjs51(); + var credential_provider_ini_1 = require_dist_cjs50(); var credential_provider_process_1 = require_dist_cjs41(); - var credential_provider_sso_1 = require_dist_cjs49(); - var credential_provider_web_identity_1 = require_dist_cjs50(); + var credential_provider_sso_1 = require_dist_cjs48(); + var credential_provider_web_identity_1 = require_dist_cjs49(); var property_provider_1 = require_dist_cjs6(); var shared_ini_file_loader_1 = require_dist_cjs38(); var remoteProvider_1 = require_remoteProvider(); @@ -18009,7 +17807,7 @@ var require_defaultProvider = __commonJS({ }); // ../../../node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js -var require_dist_cjs52 = __commonJS({ +var require_dist_cjs51 = __commonJS({ "../../../node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -18019,7 +17817,7 @@ var require_dist_cjs52 = __commonJS({ }); // ../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js -var require_ruleset3 = __commonJS({ +var require_ruleset2 = __commonJS({ "../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -18066,13 +17864,13 @@ var require_ruleset3 = __commonJS({ }); // ../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js -var require_endpointResolver3 = __commonJS({ +var require_endpointResolver2 = __commonJS({ "../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.defaultEndpointResolver = void 0; var util_endpoints_1 = require_dist_cjs18(); - var ruleset_1 = require_ruleset3(); + var ruleset_1 = require_ruleset2(); var defaultEndpointResolver = (endpointParams, context = {}) => { return (0, util_endpoints_1.resolveEndpoint)(ruleset_1.ruleSet, { endpointParams, @@ -18084,7 +17882,7 @@ var require_endpointResolver3 = __commonJS({ }); // ../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js -var require_runtimeConfig_shared3 = __commonJS({ +var require_runtimeConfig_shared2 = __commonJS({ "../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -18093,7 +17891,7 @@ var require_runtimeConfig_shared3 = __commonJS({ var url_parser_1 = require_dist_cjs24(); var util_base64_1 = require_dist_cjs31(); var util_utf8_1 = require_dist_cjs13(); - var endpointResolver_1 = require_endpointResolver3(); + var endpointResolver_1 = require_endpointResolver2(); var getRuntimeConfig = (config) => ({ apiVersion: "2011-06-15", base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64, @@ -18111,7 +17909,7 @@ var require_runtimeConfig_shared3 = __commonJS({ }); // ../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js -var require_runtimeConfig3 = __commonJS({ +var require_runtimeConfig2 = __commonJS({ "../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -18119,7 +17917,7 @@ var require_runtimeConfig3 = __commonJS({ var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); var package_json_1 = tslib_1.__importDefault(require_package2()); var defaultStsRoleAssumers_1 = require_defaultStsRoleAssumers(); - var credential_provider_node_1 = require_dist_cjs52(); + var credential_provider_node_1 = require_dist_cjs51(); var util_user_agent_node_1 = require_dist_cjs42(); var config_resolver_1 = require_dist_cjs21(); var hash_node_1 = require_dist_cjs43(); @@ -18128,7 +17926,7 @@ var require_runtimeConfig3 = __commonJS({ var node_http_handler_1 = require_dist_cjs33(); var util_body_length_node_1 = require_dist_cjs44(); var util_retry_1 = require_dist_cjs28(); - var runtimeConfig_shared_1 = require_runtimeConfig_shared3(); + var runtimeConfig_shared_1 = require_runtimeConfig_shared2(); var smithy_client_1 = require_dist_cjs35(); var util_defaults_mode_node_1 = require_dist_cjs45(); var smithy_client_2 = require_dist_cjs35(); @@ -18182,10 +17980,10 @@ var require_STSClient = __commonJS({ return smithy_client_1.Client; } }); var EndpointParameters_1 = require_EndpointParameters2(); - var runtimeConfig_1 = require_runtimeConfig3(); + var runtimeConfig_1 = require_runtimeConfig2(); var STSClient = class _STSClient extends smithy_client_1.Client { - constructor(configuration) { - const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration); + constructor(...[configuration]) { + const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration || {}); const _config_1 = (0, EndpointParameters_1.resolveClientEndpointParameters)(_config_0); const _config_2 = (0, config_resolver_1.resolveRegionConfig)(_config_1); const _config_3 = (0, middleware_endpoint_1.resolveEndpointConfig)(_config_2); @@ -18587,7 +18385,7 @@ var require_STS = __commonJS({ }); // ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/index.js -var require_commands3 = __commonJS({ +var require_commands2 = __commonJS({ "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/index.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -18604,7 +18402,7 @@ var require_commands3 = __commonJS({ }); // ../../../node_modules/@aws-sdk/client-sts/dist-cjs/models/index.js -var require_models3 = __commonJS({ +var require_models2 = __commonJS({ "../../../node_modules/@aws-sdk/client-sts/dist-cjs/models/index.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -18648,7 +18446,7 @@ var require_defaultRoleAssumers = __commonJS({ }); // ../../../node_modules/@aws-sdk/client-sts/dist-cjs/index.js -var require_dist_cjs53 = __commonJS({ +var require_dist_cjs52 = __commonJS({ "../../../node_modules/@aws-sdk/client-sts/dist-cjs/index.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -18656,8 +18454,8 @@ var require_dist_cjs53 = __commonJS({ var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); tslib_1.__exportStar(require_STSClient(), exports); tslib_1.__exportStar(require_STS(), exports); - tslib_1.__exportStar(require_commands3(), exports); - tslib_1.__exportStar(require_models3(), exports); + tslib_1.__exportStar(require_commands2(), exports); + tslib_1.__exportStar(require_models2(), exports); tslib_1.__exportStar(require_defaultRoleAssumers(), exports); var STSServiceException_1 = require_STSServiceException(); Object.defineProperty(exports, "STSServiceException", { enumerable: true, get: function() { @@ -18667,7 +18465,7 @@ var require_dist_cjs53 = __commonJS({ }); // ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/ruleset.js -var require_ruleset4 = __commonJS({ +var require_ruleset3 = __commonJS({ "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/ruleset.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -18699,13 +18497,13 @@ var require_ruleset4 = __commonJS({ }); // ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/endpointResolver.js -var require_endpointResolver4 = __commonJS({ +var require_endpointResolver3 = __commonJS({ "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/endpointResolver.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.defaultEndpointResolver = void 0; var util_endpoints_1 = require_dist_cjs18(); - var ruleset_1 = require_ruleset4(); + var ruleset_1 = require_ruleset3(); var defaultEndpointResolver = (endpointParams, context = {}) => { return (0, util_endpoints_1.resolveEndpoint)(ruleset_1.ruleSet, { endpointParams, @@ -18717,7 +18515,7 @@ var require_endpointResolver4 = __commonJS({ }); // ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.shared.js -var require_runtimeConfig_shared4 = __commonJS({ +var require_runtimeConfig_shared3 = __commonJS({ "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.shared.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -18726,7 +18524,7 @@ var require_runtimeConfig_shared4 = __commonJS({ var url_parser_1 = require_dist_cjs24(); var util_base64_1 = require_dist_cjs31(); var util_utf8_1 = require_dist_cjs13(); - var endpointResolver_1 = require_endpointResolver4(); + var endpointResolver_1 = require_endpointResolver3(); var getRuntimeConfig = (config) => ({ apiVersion: "2016-11-23", base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64, @@ -18744,15 +18542,15 @@ var require_runtimeConfig_shared4 = __commonJS({ }); // ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.js -var require_runtimeConfig4 = __commonJS({ +var require_runtimeConfig3 = __commonJS({ "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRuntimeConfig = void 0; var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); var package_json_1 = tslib_1.__importDefault(require_package()); - var client_sts_1 = require_dist_cjs53(); - var credential_provider_node_1 = require_dist_cjs52(); + var client_sts_1 = require_dist_cjs52(); + var credential_provider_node_1 = require_dist_cjs51(); var util_user_agent_node_1 = require_dist_cjs42(); var config_resolver_1 = require_dist_cjs21(); var hash_node_1 = require_dist_cjs43(); @@ -18761,7 +18559,7 @@ var require_runtimeConfig4 = __commonJS({ var node_http_handler_1 = require_dist_cjs33(); var util_body_length_node_1 = require_dist_cjs44(); var util_retry_1 = require_dist_cjs28(); - var runtimeConfig_shared_1 = require_runtimeConfig_shared4(); + var runtimeConfig_shared_1 = require_runtimeConfig_shared3(); var smithy_client_1 = require_dist_cjs35(); var util_defaults_mode_node_1 = require_dist_cjs45(); var smithy_client_2 = require_dist_cjs35(); @@ -18815,10 +18613,10 @@ var require_SFNClient = __commonJS({ return smithy_client_1.Client; } }); var EndpointParameters_1 = require_EndpointParameters(); - var runtimeConfig_1 = require_runtimeConfig4(); + var runtimeConfig_1 = require_runtimeConfig3(); var SFNClient = class extends smithy_client_1.Client { - constructor(configuration) { - const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration); + constructor(...[configuration]) { + const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration || {}); const _config_1 = (0, EndpointParameters_1.resolveClientEndpointParameters)(_config_0); const _config_2 = (0, config_resolver_1.resolveRegionConfig)(_config_1); const _config_3 = (0, middleware_endpoint_1.resolveEndpointConfig)(_config_2); @@ -18865,7 +18663,7 @@ var require_SFNServiceException = __commonJS({ }); // ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/models/models_0.js -var require_models_04 = __commonJS({ +var require_models_03 = __commonJS({ "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/models/models_0.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -19661,7 +19459,7 @@ var require_Aws_json1_0 = __commonJS({ exports.de_UpdateStateMachineAliasCommand = exports.de_UpdateStateMachineCommand = exports.de_UpdateMapRunCommand = exports.de_UntagResourceCommand = exports.de_TagResourceCommand = exports.de_StopExecutionCommand = exports.de_StartSyncExecutionCommand = exports.de_StartExecutionCommand = exports.de_SendTaskSuccessCommand = exports.de_SendTaskHeartbeatCommand = exports.de_SendTaskFailureCommand = exports.de_PublishStateMachineVersionCommand = exports.de_ListTagsForResourceCommand = exports.de_ListStateMachineVersionsCommand = exports.de_ListStateMachinesCommand = exports.de_ListStateMachineAliasesCommand = exports.de_ListMapRunsCommand = exports.de_ListExecutionsCommand = void 0; var protocol_http_1 = require_dist_cjs2(); var smithy_client_1 = require_dist_cjs35(); - var models_0_1 = require_models_04(); + var models_0_1 = require_models_03(); var SFNServiceException_1 = require_SFNServiceException(); var se_CreateActivityCommand = async (input, context) => { const headers = sharedHeaders("CreateActivity"); @@ -22024,7 +21822,7 @@ var require_CreateStateMachineAliasCommand = __commonJS({ Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { return smithy_client_1.Command; } }); - var models_0_1 = require_models_04(); + var models_0_1 = require_models_03(); var Aws_json1_0_1 = require_Aws_json1_0(); var CreateStateMachineAliasCommand = class _CreateStateMachineAliasCommand extends smithy_client_1.Command { static getEndpointParameterInstructions() { @@ -22079,7 +21877,7 @@ var require_CreateStateMachineCommand = __commonJS({ Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { return smithy_client_1.Command; } }); - var models_0_1 = require_models_04(); + var models_0_1 = require_models_03(); var Aws_json1_0_1 = require_Aws_json1_0(); var CreateStateMachineCommand = class _CreateStateMachineCommand extends smithy_client_1.Command { static getEndpointParameterInstructions() { @@ -22404,7 +22202,7 @@ var require_DescribeExecutionCommand = __commonJS({ Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { return smithy_client_1.Command; } }); - var models_0_1 = require_models_04(); + var models_0_1 = require_models_03(); var Aws_json1_0_1 = require_Aws_json1_0(); var DescribeExecutionCommand = class _DescribeExecutionCommand extends smithy_client_1.Command { static getEndpointParameterInstructions() { @@ -22513,7 +22311,7 @@ var require_DescribeStateMachineAliasCommand = __commonJS({ Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { return smithy_client_1.Command; } }); - var models_0_1 = require_models_04(); + var models_0_1 = require_models_03(); var Aws_json1_0_1 = require_Aws_json1_0(); var DescribeStateMachineAliasCommand = class _DescribeStateMachineAliasCommand extends smithy_client_1.Command { static getEndpointParameterInstructions() { @@ -22568,7 +22366,7 @@ var require_DescribeStateMachineCommand = __commonJS({ Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { return smithy_client_1.Command; } }); - var models_0_1 = require_models_04(); + var models_0_1 = require_models_03(); var Aws_json1_0_1 = require_Aws_json1_0(); var DescribeStateMachineCommand = class _DescribeStateMachineCommand extends smithy_client_1.Command { static getEndpointParameterInstructions() { @@ -22623,7 +22421,7 @@ var require_DescribeStateMachineForExecutionCommand = __commonJS({ Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { return smithy_client_1.Command; } }); - var models_0_1 = require_models_04(); + var models_0_1 = require_models_03(); var Aws_json1_0_1 = require_Aws_json1_0(); var DescribeStateMachineForExecutionCommand = class _DescribeStateMachineForExecutionCommand extends smithy_client_1.Command { static getEndpointParameterInstructions() { @@ -22678,7 +22476,7 @@ var require_GetActivityTaskCommand = __commonJS({ Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { return smithy_client_1.Command; } }); - var models_0_1 = require_models_04(); + var models_0_1 = require_models_03(); var Aws_json1_0_1 = require_Aws_json1_0(); var GetActivityTaskCommand = class _GetActivityTaskCommand extends smithy_client_1.Command { static getEndpointParameterInstructions() { @@ -22733,7 +22531,7 @@ var require_GetExecutionHistoryCommand = __commonJS({ Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { return smithy_client_1.Command; } }); - var models_0_1 = require_models_04(); + var models_0_1 = require_models_03(); var Aws_json1_0_1 = require_Aws_json1_0(); var GetExecutionHistoryCommand = class _GetExecutionHistoryCommand extends smithy_client_1.Command { static getEndpointParameterInstructions() { @@ -23166,7 +22964,7 @@ var require_PublishStateMachineVersionCommand = __commonJS({ Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { return smithy_client_1.Command; } }); - var models_0_1 = require_models_04(); + var models_0_1 = require_models_03(); var Aws_json1_0_1 = require_Aws_json1_0(); var PublishStateMachineVersionCommand = class _PublishStateMachineVersionCommand extends smithy_client_1.Command { static getEndpointParameterInstructions() { @@ -23221,7 +23019,7 @@ var require_SendTaskFailureCommand = __commonJS({ Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { return smithy_client_1.Command; } }); - var models_0_1 = require_models_04(); + var models_0_1 = require_models_03(); var Aws_json1_0_1 = require_Aws_json1_0(); var SendTaskFailureCommand = class _SendTaskFailureCommand extends smithy_client_1.Command { static getEndpointParameterInstructions() { @@ -23330,7 +23128,7 @@ var require_SendTaskSuccessCommand = __commonJS({ Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { return smithy_client_1.Command; } }); - var models_0_1 = require_models_04(); + var models_0_1 = require_models_03(); var Aws_json1_0_1 = require_Aws_json1_0(); var SendTaskSuccessCommand = class _SendTaskSuccessCommand extends smithy_client_1.Command { static getEndpointParameterInstructions() { @@ -23385,7 +23183,7 @@ var require_StartExecutionCommand = __commonJS({ Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { return smithy_client_1.Command; } }); - var models_0_1 = require_models_04(); + var models_0_1 = require_models_03(); var Aws_json1_0_1 = require_Aws_json1_0(); var StartExecutionCommand = class _StartExecutionCommand extends smithy_client_1.Command { static getEndpointParameterInstructions() { @@ -23440,7 +23238,7 @@ var require_StartSyncExecutionCommand = __commonJS({ Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { return smithy_client_1.Command; } }); - var models_0_1 = require_models_04(); + var models_0_1 = require_models_03(); var Aws_json1_0_1 = require_Aws_json1_0(); var StartSyncExecutionCommand = class _StartSyncExecutionCommand extends smithy_client_1.Command { static getEndpointParameterInstructions() { @@ -23495,7 +23293,7 @@ var require_StopExecutionCommand = __commonJS({ Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { return smithy_client_1.Command; } }); - var models_0_1 = require_models_04(); + var models_0_1 = require_models_03(); var Aws_json1_0_1 = require_Aws_json1_0(); var StopExecutionCommand = class _StopExecutionCommand extends smithy_client_1.Command { static getEndpointParameterInstructions() { @@ -23712,7 +23510,7 @@ var require_UpdateStateMachineAliasCommand = __commonJS({ Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { return smithy_client_1.Command; } }); - var models_0_1 = require_models_04(); + var models_0_1 = require_models_03(); var Aws_json1_0_1 = require_Aws_json1_0(); var UpdateStateMachineAliasCommand = class _UpdateStateMachineAliasCommand extends smithy_client_1.Command { static getEndpointParameterInstructions() { @@ -23767,7 +23565,7 @@ var require_UpdateStateMachineCommand = __commonJS({ Object.defineProperty(exports, "$Command", { enumerable: true, get: function() { return smithy_client_1.Command; } }); - var models_0_1 = require_models_04(); + var models_0_1 = require_models_03(); var Aws_json1_0_1 = require_Aws_json1_0(); var UpdateStateMachineCommand = class _UpdateStateMachineCommand extends smithy_client_1.Command { static getEndpointParameterInstructions() { @@ -23896,7 +23694,7 @@ var require_SFN = __commonJS({ }); // ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/index.js -var require_commands4 = __commonJS({ +var require_commands3 = __commonJS({ "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/index.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -24132,17 +23930,17 @@ var require_pagination4 = __commonJS({ }); // ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/models/index.js -var require_models4 = __commonJS({ +var require_models3 = __commonJS({ "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/models/index.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_models_04(), exports); + tslib_1.__exportStar(require_models_03(), exports); } }); // ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/index.js -var require_dist_cjs54 = __commonJS({ +var require_dist_cjs53 = __commonJS({ "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/index.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -24150,9 +23948,9 @@ var require_dist_cjs54 = __commonJS({ var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); tslib_1.__exportStar(require_SFNClient(), exports); tslib_1.__exportStar(require_SFN(), exports); - tslib_1.__exportStar(require_commands4(), exports); + tslib_1.__exportStar(require_commands3(), exports); tslib_1.__exportStar(require_pagination4(), exports); - tslib_1.__exportStar(require_models4(), exports); + tslib_1.__exportStar(require_models3(), exports); var SFNServiceException_1 = require_SFNServiceException(); Object.defineProperty(exports, "SFNServiceException", { enumerable: true, get: function() { return SFNServiceException_1.SFNServiceException; @@ -30892,6 +30690,523 @@ var require_lib4 = __commonJS({ } }); +// ../sdk-v2-to-v3-adapter/lib/client-names.ts +var CLIENT_NAMES; +var init_client_names = __esm({ + "../sdk-v2-to-v3-adapter/lib/client-names.ts"() { + "use strict"; + CLIENT_NAMES = [ + "ACM", + "ACMPCA", + "APIGateway", + "ARCZonalShift", + "AccessAnalyzer", + "Account", + "AlexaForBusiness", + "Amp", + "Amplify", + "AmplifyBackend", + "AmplifyUIBuilder", + "ApiGatewayManagementApi", + "ApiGatewayV2", + "AppConfig", + "AppConfigData", + "AppIntegrations", + "AppMesh", + "AppRunner", + "AppStream", + "AppSync", + "Appflow", + "ApplicationAutoScaling", + "ApplicationCostProfiler", + "ApplicationInsights", + "Athena", + "AuditManager", + "AugmentedAIRuntime", + "AutoScaling", + "AutoScalingPlans", + "Backup", + "BackupGateway", + "BackupStorage", + "Batch", + "Billingconductor", + "Braket", + "Budgets", + "CUR", + "Chime", + "ChimeSDKIdentity", + "ChimeSDKMediaPipelines", + "ChimeSDKMeetings", + "ChimeSDKMessaging", + "ChimeSDKVoice", + "Cloud9", + "CloudControl", + "CloudDirectory", + "CloudFormation", + "CloudFront", + "CloudHSM", + "CloudHSMV2", + "CloudSearch", + "CloudSearchDomain", + "CloudTrail", + "CloudWatch", + "CloudWatchEvents", + "CloudWatchLogs", + "CodeArtifact", + "CodeBuild", + "CodeCatalyst", + "CodeCommit", + "CodeDeploy", + "CodeGuruProfiler", + "CodeGuruReviewer", + "CodePipeline", + "CodeStar", + "CodeStarNotifications", + "CodeStarconnections", + "CognitoIdentity", + "CognitoIdentityServiceProvider", + "CognitoSync", + "Comprehend", + "ComprehendMedical", + "ComputeOptimizer", + "ConfigService", + "Connect", + "ConnectCampaigns", + "ConnectCases", + "ConnectContactLens", + "ConnectParticipant", + "ControlTower", + "CostExplorer", + "CustomerProfiles", + "DAX", + "DLM", + "DMS", + "DataBrew", + "DataExchange", + "DataPipeline", + "DataSync", + "Detective", + "DevOpsGuru", + "DeviceFarm", + "DirectConnect", + "DirectoryService", + "Discovery", + "DocDB", + "DocDBElastic", + "Drs", + "DynamoDB", + "DynamoDBStreams", + "EBS", + "EC2", + "EC2InstanceConnect", + "ECR", + "ECRPUBLIC", + "ECS", + "EFS", + "EKS", + "ELB", + "ELBv2", + "EMR", + "EMRServerless", + "EMRcontainers", + "ES", + "ElastiCache", + "ElasticBeanstalk", + "ElasticInference", + "ElasticTranscoder", + "EventBridge", + "Evidently", + "FMS", + "FSx", + "Finspace", + "Finspacedata", + "Firehose", + "Fis", + "ForecastQueryService", + "ForecastService", + "FraudDetector", + "GameLift", + "GameSparks", + "Glacier", + "GlobalAccelerator", + "Glue", + "Grafana", + "Greengrass", + "GreengrassV2", + "GroundStation", + "GuardDuty", + "Health", + "HealthLake", + "Honeycode", + "IAM", + "IVS", + "IdentityStore", + "Imagebuilder", + "Inspector", + "Inspector2", + "IoT1ClickDevicesService", + "IoT1ClickProjects", + "IoTAnalytics", + "IoTEvents", + "IoTEventsData", + "IoTFleetHub", + "IoTFleetWise", + "IoTJobsDataPlane", + "IoTRoboRunner", + "IoTSecureTunneling", + "IoTSiteWise", + "IoTThingsGraph", + "IoTTwinMaker", + "IoTWireless", + "Iot", + "IotData", + "IotDeviceAdvisor", + "Ivschat", + "KMS", + "Kafka", + "KafkaConnect", + "Kendra", + "Keyspaces", + "Kinesis", + "KinesisAnalytics", + "KinesisAnalyticsV2", + "KinesisVideo", + "KinesisVideoArchivedMedia", + "KinesisVideoMedia", + "KinesisVideoSignalingChannels", + "KinesisVideoWebRTCStorage", + "LakeFormation", + "Lambda", + "LexModelBuildingService", + "LexModelsV2", + "LexRuntime", + "LexRuntimeV2", + "LicenseManager", + "LicenseManagerLinuxSubscriptions", + "LicenseManagerUserSubscriptions", + "Lightsail", + "Location", + "LookoutEquipment", + "LookoutMetrics", + "LookoutVision", + "M2", + "MQ", + "MTurk", + "MWAA", + "MachineLearning", + "Macie", + "Macie2", + "ManagedBlockchain", + "MarketplaceCatalog", + "MarketplaceCommerceAnalytics", + "MarketplaceEntitlementService", + "MarketplaceMetering", + "MediaConnect", + "MediaConvert", + "MediaLive", + "MediaPackage", + "MediaPackageVod", + "MediaStore", + "MediaStoreData", + "MediaTailor", + "MemoryDB", + "Mgn", + "MigrationHub", + "MigrationHubConfig", + "MigrationHubOrchestrator", + "MigrationHubRefactorSpaces", + "MigrationHubStrategy", + "Mobile", + "Neptune", + "NetworkFirewall", + "NetworkManager", + "Nimble", + "OAM", + "Omics", + "OpenSearch", + "OpenSearchServerless", + "OpsWorks", + "OpsWorksCM", + "Organizations", + "Outposts", + "PI", + "Panorama", + "Personalize", + "PersonalizeEvents", + "PersonalizeRuntime", + "Pinpoint", + "PinpointEmail", + "PinpointSMSVoice", + "PinpointSMSVoiceV2", + "Pipes", + "Polly", + "Pricing", + "PrivateNetworks", + "Proton", + "QLDB", + "QLDBSession", + "QuickSight", + "RAM", + "RDS", + "RDSDataService", + "RUM", + "Rbin", + "Redshift", + "RedshiftData", + "RedshiftServerless", + "Rekognition", + "Resiliencehub", + "ResourceExplorer2", + "ResourceGroups", + "ResourceGroupsTaggingAPI", + "RoboMaker", + "RolesAnywhere", + "Route53", + "Route53Domains", + "Route53RecoveryCluster", + "Route53RecoveryControlConfig", + "Route53RecoveryReadiness", + "Route53Resolver", + "S3", + "S3Control", + "S3Outposts", + "SES", + "SESV2", + "SMS", + "SNS", + "SQS", + "SSM", + "SSMContacts", + "SSMIncidents", + "SSO", + "SSOAdmin", + "SSOOIDC", + "STS", + "SWF", + "SageMaker", + "SageMakerFeatureStoreRuntime", + "SageMakerGeospatial", + "SageMakerMetrics", + "SageMakerRuntime", + "SagemakerEdge", + "SavingsPlans", + "Scheduler", + "Schemas", + "SecretsManager", + "SecurityHub", + "SecurityLake", + "ServerlessApplicationRepository", + "ServiceCatalog", + "ServiceCatalogAppRegistry", + "ServiceDiscovery", + "ServiceQuotas", + "Shield", + "Signer", + "SimSpaceWeaver", + "SnowDeviceManagement", + "Snowball", + "SsmSap", + "StepFunctions", + "StorageGateway", + "Support", + "SupportApp", + "Synthetics", + "Textract", + "TimestreamQuery", + "TimestreamWrite", + "TranscribeService", + "Transfer", + "Translate", + "VoiceID", + "WAF", + "WAFRegional", + "WAFV2", + "WellArchitected", + "Wisdom", + "WorkDocs", + "WorkLink", + "WorkMail", + "WorkMailMessageFlow", + "WorkSpaces", + "WorkSpacesWeb", + "XRay" + ]; + } +}); + +// ../sdk-v2-to-v3-adapter/lib/client-package-names-map.ts +var CLIENT_PACKAGE_NAMES_MAP; +var init_client_package_names_map = __esm({ + "../sdk-v2-to-v3-adapter/lib/client-package-names-map.ts"() { + "use strict"; + init_client_names(); + CLIENT_PACKAGE_NAMES_MAP = { + ...CLIENT_NAMES.reduce( + (acc, name) => ({ + ...acc, + [name]: `client-${name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()}`.replace("-chime-sdk", "-chime-sdk-").replace("client-amplify-", "client-amplify").replace("client-cloud-", "client-cloud").replace("client-code-", "client-code").replace("client-connect-", "client-connect").replace("client-data-", "client-data").replace("client-io-t", "client-iot-").replace("client-iot-fleet-", "client-iotfleet").replace("client-lookout-", "client-lookout").replace("client-media-", "client-media").replace("client-migration-hub-", "client-migrationhub").replace("client-pinpoint-sms", "client-pinpoint-sms-").replace("client-route53", "client-route53-").replace("client-sage-maker", "client-sagemaker").replace("client-security-", "client-security").replace("client-work-", "client-work") + }), + {} + ), + AccessAnalyzer: "client-accessanalyzer", + ACMPCA: "client-acm-pca", + APIGateway: "client-api-gateway", + ApiGatewayManagementApi: "client-apigatewaymanagementapi", + ApiGatewayV2: "client-apigatewayv2", + AppConfig: "client-appconfig", + AppConfigData: "client-appconfigdata", + AppIntegrations: "client-appintegrations", + AppRunner: "client-apprunner", + AppStream: "client-appstream", + AppSync: "client-appsync", + ApplicationCostProfiler: "client-applicationcostprofiler", + ARCZonalShift: "client-arc-zonal-shift", + AugmentedAIRuntime: "client-sage-maker-a2iruntime", + AuditManager: "client-auditmanager", + BackupStorage: "client-backupstorage", + CUR: "client-cost-and-usage-report-service", + CloudHSMV2: "client-cloudhsm-v2", + CodeGuruProfiler: "client-codeguruprofiler", + CodeStarconnections: "client-codestar-connections", + CognitoIdentityServiceProvider: "client-cognito-identity-provider", + ComprehendMedical: "client-comprehendmedical", + ConnectContactLens: "client-connect-contact-lens", + ControlTower: "client-controltower", + DMS: "client-database-migration-service", + DataPipeline: "client-data-pipeline", + Discovery: "client-application-discovery-service", + DevOpsGuru: "client-devops-guru", + DynamoDB: "client-dynamodb", + DynamoDBStreams: "client-dynamodb-streams", + DocDB: "client-docdb", + DocDBElastic: "client-docdb-elastic", + EC2InstanceConnect: "client-ec2-instance-connect", + ECRPUBLIC: "client-ecr-public", + ELB: "client-elastic-load-balancing", + ELBv2: "client-elastic-load-balancing-v2", + ElastiCache: "client-elasticache", + EMRcontainers: "client-emr-containers", + EMRServerless: "client-emr-serverless", + ES: "client-elasticsearch-service", + EventBridge: "client-eventbridge", + Finspacedata: "client-finspace-data", + ForecastQueryService: "client-forecastquery", + ForecastService: "client-forecast", + FraudDetector: "client-frauddetector", + GameLift: "client-gamelift", + GameSparks: "client-gamesparks", + GreengrassV2: "client-greengrassv2", + GroundStation: "client-groundstation", + GuardDuty: "client-guardduty", + HealthLake: "client-healthlake", + IdentityStore: "client-identitystore", + IoTAnalytics: "client-iotanalytics", + IotData: "client-iot-data-plane", + IotDeviceAdvisor: "client-iotdeviceadvisor", + IoTSecureTunneling: "client-iotsecuretunneling", + IoTSiteWise: "client-iotsitewise", + IoTThingsGraph: "client-iotthingsgraph", + IoTTwinMaker: "client-iottwinmaker", + IoTRoboRunner: "client-iot-roborunner", + KafkaConnect: "client-kafkaconnect", + KinesisVideoSignalingChannels: "client-kinesis-video-signaling", + KinesisVideoWebRTCStorage: "client-kinesis-video-webrtc-storage", + LakeFormation: "client-lakeformation", + LexRuntime: "client-lex-runtime-service", + ManagedBlockchain: "client-managedblockchain", + MigrationHubConfig: "client-migrationhub-config", + MigrationHubRefactorSpaces: "client-migration-hub-refactor-spaces", + NetworkManager: "client-networkmanager", + OpenSearch: "client-opensearch", + OpenSearchServerless: "client-opensearchserverless", + OpsWorks: "client-opsworks", + OpsWorksCM: "client-opsworkscm", + PrivateNetworks: "client-privatenetworks", + QLDBSession: "client-qldb-session", + QuickSight: "client-quicksight", + ResourceExplorer2: "client-resource-explorer-2", + RDSDataService: "client-rds-data", + RoboMaker: "client-robomaker", + RolesAnywhere: "client-rolesanywhere", + Route53: "client-route-53", + Route53Domains: "client-route-53-domains", + Route53Resolver: "client-route53resolver", + S3Control: "client-s3-control", + SageMakerFeatureStoreRuntime: "client-sagemaker-featurestore-runtime", + SavingsPlans: "client-savingsplans", + SecurityHub: "client-securityhub", + ServerlessApplicationRepository: "client-serverlessapplicationrepository", + ServiceCatalogAppRegistry: "client-service-catalog-appregistry", + ServiceDiscovery: "client-servicediscovery", + SimSpaceWeaver: "client-simspaceweaver", + SSMContacts: "client-ssm-contacts", + SSMIncidents: "client-ssm-incidents", + SSOAdmin: "client-sso-admin", + SSOOIDC: "client-sso-oidc", + StepFunctions: "client-sfn", + TranscribeService: "client-transcribe", + WAFRegional: "client-waf-regional", + WellArchitected: "client-wellarchitected", + WorkMailMessageFlow: "client-workmailmessageflow" + }; + } +}); + +// ../sdk-v2-to-v3-adapter/lib/get-v3-client-package-name.ts +var get_v3_client_package_name_exports = {}; +__export(get_v3_client_package_name_exports, { + getV3ClientPackageName: () => getV3ClientPackageName +}); +var getV3ClientPackageName; +var init_get_v3_client_package_name = __esm({ + "../sdk-v2-to-v3-adapter/lib/get-v3-client-package-name.ts"() { + "use strict"; + init_client_package_names_map(); + getV3ClientPackageName = (clientName) => { + if (clientName in CLIENT_PACKAGE_NAMES_MAP) { + return `@aws-sdk/${CLIENT_PACKAGE_NAMES_MAP[clientName]}`; + } + throw new Error(`Client '${clientName}' is either deprecated or newly added. Please consider using the v3 package format (@aws-sdk/client-xxx).`); + }; + } +}); + +// ../sdk-v2-to-v3-adapter/lib/find-client-constructor.ts +var find_client_constructor_exports = {}; +__export(find_client_constructor_exports, { + findV3ClientConstructor: () => findV3ClientConstructor +}); +function findV3ClientConstructor(pkg) { + const [_clientName, ServiceClient] = Object.entries(pkg).find( + ([name]) => { + return name.endsWith("Client") && name !== "__Client"; + } + ); + return ServiceClient; +} +var init_find_client_constructor = __esm({ + "../sdk-v2-to-v3-adapter/lib/find-client-constructor.ts"() { + "use strict"; + } +}); + +// ../sdk-v2-to-v3-adapter/lib/index.js +var require_lib5 = __commonJS({ + "../sdk-v2-to-v3-adapter/lib/index.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.findV3ClientConstructor = exports.getV3ClientPackageName = void 0; + var get_v3_client_package_name_1 = (init_get_v3_client_package_name(), __toCommonJS(get_v3_client_package_name_exports)); + Object.defineProperty(exports, "getV3ClientPackageName", { enumerable: true, get: function() { + return get_v3_client_package_name_1.getV3ClientPackageName; + } }); + var find_client_constructor_1 = (init_find_client_constructor(), __toCommonJS(find_client_constructor_exports)); + Object.defineProperty(exports, "findV3ClientConstructor", { enumerable: true, get: function() { + return find_client_constructor_1.findV3ClientConstructor; + } }); + } +}); + // lib/assertions/providers/lambda-handler/index.ts var lambda_handler_exports = {}; __export(lambda_handler_exports, { @@ -30907,12 +31222,11 @@ var import_helpers_internal = __toESM(require_helpers_internal()); // lib/assertions/providers/lambda-handler/base.ts var https = __toESM(require("https")); var url = __toESM(require("url")); -var import_client_sfn = __toESM(require_dist_cjs54()); +var import_client_sfn = __toESM(require_dist_cjs53()); var CustomResourceHandler = class { constructor(event, context) { this.event = event; this.context = context; - this.timedOut = false; this.timeout = setTimeout(async () => { await this.respond({ status: "FAILED", @@ -30924,6 +31238,9 @@ var CustomResourceHandler = class { this.event = event; this.physicalResourceId = extractPhysicalResourceId(event); } + physicalResourceId; + timeout; + timedOut = false; /** * Handles executing the custom resource event. If `stateMachineArn` is present * in the props then trigger the waiter statemachine @@ -31057,6 +31374,7 @@ var AssertionHandler = class extends CustomResourceHandler { } }; var MatchCreator = class { + parsedObj; constructor(obj) { this.parsedObj = { matcher: obj @@ -31183,472 +31501,8 @@ var HttpHandler = class extends CustomResourceHandler { } }; -// ../sdk-v2-to-v3-adapter/lib/client-names.ts -var CLIENT_NAMES = [ - "ACM", - "ACMPCA", - "APIGateway", - "ARCZonalShift", - "AccessAnalyzer", - "Account", - "AlexaForBusiness", - "Amp", - "Amplify", - "AmplifyBackend", - "AmplifyUIBuilder", - "ApiGatewayManagementApi", - "ApiGatewayV2", - "AppConfig", - "AppConfigData", - "AppIntegrations", - "AppMesh", - "AppRunner", - "AppStream", - "AppSync", - "Appflow", - "ApplicationAutoScaling", - "ApplicationCostProfiler", - "ApplicationInsights", - "Athena", - "AuditManager", - "AugmentedAIRuntime", - "AutoScaling", - "AutoScalingPlans", - "Backup", - "BackupGateway", - "BackupStorage", - "Batch", - "Billingconductor", - "Braket", - "Budgets", - "CUR", - "Chime", - "ChimeSDKIdentity", - "ChimeSDKMediaPipelines", - "ChimeSDKMeetings", - "ChimeSDKMessaging", - "ChimeSDKVoice", - "Cloud9", - "CloudControl", - "CloudDirectory", - "CloudFormation", - "CloudFront", - "CloudHSM", - "CloudHSMV2", - "CloudSearch", - "CloudSearchDomain", - "CloudTrail", - "CloudWatch", - "CloudWatchEvents", - "CloudWatchLogs", - "CodeArtifact", - "CodeBuild", - "CodeCatalyst", - "CodeCommit", - "CodeDeploy", - "CodeGuruProfiler", - "CodeGuruReviewer", - "CodePipeline", - "CodeStar", - "CodeStarNotifications", - "CodeStarconnections", - "CognitoIdentity", - "CognitoIdentityServiceProvider", - "CognitoSync", - "Comprehend", - "ComprehendMedical", - "ComputeOptimizer", - "ConfigService", - "Connect", - "ConnectCampaigns", - "ConnectCases", - "ConnectContactLens", - "ConnectParticipant", - "ControlTower", - "CostExplorer", - "CustomerProfiles", - "DAX", - "DLM", - "DMS", - "DataBrew", - "DataExchange", - "DataPipeline", - "DataSync", - "Detective", - "DevOpsGuru", - "DeviceFarm", - "DirectConnect", - "DirectoryService", - "Discovery", - "DocDB", - "DocDBElastic", - "Drs", - "DynamoDB", - "DynamoDBStreams", - "EBS", - "EC2", - "EC2InstanceConnect", - "ECR", - "ECRPUBLIC", - "ECS", - "EFS", - "EKS", - "ELB", - "ELBv2", - "EMR", - "EMRServerless", - "EMRcontainers", - "ES", - "ElastiCache", - "ElasticBeanstalk", - "ElasticInference", - "ElasticTranscoder", - "EventBridge", - "Evidently", - "FMS", - "FSx", - "Finspace", - "Finspacedata", - "Firehose", - "Fis", - "ForecastQueryService", - "ForecastService", - "FraudDetector", - "GameLift", - "GameSparks", - "Glacier", - "GlobalAccelerator", - "Glue", - "Grafana", - "Greengrass", - "GreengrassV2", - "GroundStation", - "GuardDuty", - "Health", - "HealthLake", - "Honeycode", - "IAM", - "IVS", - "IdentityStore", - "Imagebuilder", - "Inspector", - "Inspector2", - "IoT1ClickDevicesService", - "IoT1ClickProjects", - "IoTAnalytics", - "IoTEvents", - "IoTEventsData", - "IoTFleetHub", - "IoTFleetWise", - "IoTJobsDataPlane", - "IoTRoboRunner", - "IoTSecureTunneling", - "IoTSiteWise", - "IoTThingsGraph", - "IoTTwinMaker", - "IoTWireless", - "Iot", - "IotData", - "IotDeviceAdvisor", - "Ivschat", - "KMS", - "Kafka", - "KafkaConnect", - "Kendra", - "Keyspaces", - "Kinesis", - "KinesisAnalytics", - "KinesisAnalyticsV2", - "KinesisVideo", - "KinesisVideoArchivedMedia", - "KinesisVideoMedia", - "KinesisVideoSignalingChannels", - "KinesisVideoWebRTCStorage", - "LakeFormation", - "Lambda", - "LexModelBuildingService", - "LexModelsV2", - "LexRuntime", - "LexRuntimeV2", - "LicenseManager", - "LicenseManagerLinuxSubscriptions", - "LicenseManagerUserSubscriptions", - "Lightsail", - "Location", - "LookoutEquipment", - "LookoutMetrics", - "LookoutVision", - "M2", - "MQ", - "MTurk", - "MWAA", - "MachineLearning", - "Macie", - "Macie2", - "ManagedBlockchain", - "MarketplaceCatalog", - "MarketplaceCommerceAnalytics", - "MarketplaceEntitlementService", - "MarketplaceMetering", - "MediaConnect", - "MediaConvert", - "MediaLive", - "MediaPackage", - "MediaPackageVod", - "MediaStore", - "MediaStoreData", - "MediaTailor", - "MemoryDB", - "Mgn", - "MigrationHub", - "MigrationHubConfig", - "MigrationHubOrchestrator", - "MigrationHubRefactorSpaces", - "MigrationHubStrategy", - "Mobile", - "Neptune", - "NetworkFirewall", - "NetworkManager", - "Nimble", - "OAM", - "Omics", - "OpenSearch", - "OpenSearchServerless", - "OpsWorks", - "OpsWorksCM", - "Organizations", - "Outposts", - "PI", - "Panorama", - "Personalize", - "PersonalizeEvents", - "PersonalizeRuntime", - "Pinpoint", - "PinpointEmail", - "PinpointSMSVoice", - "PinpointSMSVoiceV2", - "Pipes", - "Polly", - "Pricing", - "PrivateNetworks", - "Proton", - "QLDB", - "QLDBSession", - "QuickSight", - "RAM", - "RDS", - "RDSDataService", - "RUM", - "Rbin", - "Redshift", - "RedshiftData", - "RedshiftServerless", - "Rekognition", - "Resiliencehub", - "ResourceExplorer2", - "ResourceGroups", - "ResourceGroupsTaggingAPI", - "RoboMaker", - "RolesAnywhere", - "Route53", - "Route53Domains", - "Route53RecoveryCluster", - "Route53RecoveryControlConfig", - "Route53RecoveryReadiness", - "Route53Resolver", - "S3", - "S3Control", - "S3Outposts", - "SES", - "SESV2", - "SMS", - "SNS", - "SQS", - "SSM", - "SSMContacts", - "SSMIncidents", - "SSO", - "SSOAdmin", - "SSOOIDC", - "STS", - "SWF", - "SageMaker", - "SageMakerFeatureStoreRuntime", - "SageMakerGeospatial", - "SageMakerMetrics", - "SageMakerRuntime", - "SagemakerEdge", - "SavingsPlans", - "Scheduler", - "Schemas", - "SecretsManager", - "SecurityHub", - "SecurityLake", - "ServerlessApplicationRepository", - "ServiceCatalog", - "ServiceCatalogAppRegistry", - "ServiceDiscovery", - "ServiceQuotas", - "Shield", - "Signer", - "SimSpaceWeaver", - "SnowDeviceManagement", - "Snowball", - "SsmSap", - "StepFunctions", - "StorageGateway", - "Support", - "SupportApp", - "Synthetics", - "Textract", - "TimestreamQuery", - "TimestreamWrite", - "TranscribeService", - "Transfer", - "Translate", - "VoiceID", - "WAF", - "WAFRegional", - "WAFV2", - "WellArchitected", - "Wisdom", - "WorkDocs", - "WorkLink", - "WorkMail", - "WorkMailMessageFlow", - "WorkSpaces", - "WorkSpacesWeb", - "XRay" -]; - -// ../sdk-v2-to-v3-adapter/lib/client-package-names-map.ts -var CLIENT_PACKAGE_NAMES_MAP = { - ...CLIENT_NAMES.reduce( - (acc, name) => ({ - ...acc, - [name]: `client-${name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()}`.replace("-chime-sdk", "-chime-sdk-").replace("client-amplify-", "client-amplify").replace("client-cloud-", "client-cloud").replace("client-code-", "client-code").replace("client-connect-", "client-connect").replace("client-data-", "client-data").replace("client-io-t", "client-iot-").replace("client-iot-fleet-", "client-iotfleet").replace("client-lookout-", "client-lookout").replace("client-media-", "client-media").replace("client-migration-hub-", "client-migrationhub").replace("client-pinpoint-sms", "client-pinpoint-sms-").replace("client-route53", "client-route53-").replace("client-sage-maker", "client-sagemaker").replace("client-security-", "client-security").replace("client-work-", "client-work") - }), - {} - ), - AccessAnalyzer: "client-accessanalyzer", - ACMPCA: "client-acm-pca", - APIGateway: "client-api-gateway", - ApiGatewayManagementApi: "client-apigatewaymanagementapi", - ApiGatewayV2: "client-apigatewayv2", - AppConfig: "client-appconfig", - AppConfigData: "client-appconfigdata", - AppIntegrations: "client-appintegrations", - AppRunner: "client-apprunner", - AppStream: "client-appstream", - AppSync: "client-appsync", - ApplicationCostProfiler: "client-applicationcostprofiler", - ARCZonalShift: "client-arc-zonal-shift", - AugmentedAIRuntime: "client-sage-maker-a2iruntime", - AuditManager: "client-auditmanager", - BackupStorage: "client-backupstorage", - CUR: "client-cost-and-usage-report-service", - CloudHSMV2: "client-cloudhsm-v2", - CodeGuruProfiler: "client-codeguruprofiler", - CodeStarconnections: "client-codestar-connections", - CognitoIdentityServiceProvider: "client-cognito-identity-provider", - ComprehendMedical: "client-comprehendmedical", - ConnectContactLens: "client-connect-contact-lens", - ControlTower: "client-controltower", - DMS: "client-database-migration-service", - DataPipeline: "client-data-pipeline", - Discovery: "client-application-discovery-service", - DevOpsGuru: "client-devops-guru", - DynamoDB: "client-dynamodb", - DynamoDBStreams: "client-dynamodb-streams", - DocDB: "client-docdb", - DocDBElastic: "client-docdb-elastic", - EC2InstanceConnect: "client-ec2-instance-connect", - ECRPUBLIC: "client-ecr-public", - ELB: "client-elastic-load-balancing", - ELBv2: "client-elastic-load-balancing-v2", - ElastiCache: "client-elasticache", - EMRcontainers: "client-emr-containers", - EMRServerless: "client-emr-serverless", - ES: "client-elasticsearch-service", - EventBridge: "client-eventbridge", - Finspacedata: "client-finspace-data", - ForecastQueryService: "client-forecastquery", - ForecastService: "client-forecast", - FraudDetector: "client-frauddetector", - GameLift: "client-gamelift", - GameSparks: "client-gamesparks", - GreengrassV2: "client-greengrassv2", - GroundStation: "client-groundstation", - GuardDuty: "client-guardduty", - HealthLake: "client-healthlake", - IdentityStore: "client-identitystore", - IoTAnalytics: "client-iotanalytics", - IotData: "client-iot-data-plane", - IotDeviceAdvisor: "client-iotdeviceadvisor", - IoTSecureTunneling: "client-iotsecuretunneling", - IoTSiteWise: "client-iotsitewise", - IoTThingsGraph: "client-iotthingsgraph", - IoTTwinMaker: "client-iottwinmaker", - IoTRoboRunner: "client-iot-roborunner", - KafkaConnect: "client-kafkaconnect", - KinesisVideoSignalingChannels: "client-kinesis-video-signaling", - KinesisVideoWebRTCStorage: "client-kinesis-video-webrtc-storage", - LakeFormation: "client-lakeformation", - LexRuntime: "client-lex-runtime-service", - ManagedBlockchain: "client-managedblockchain", - MigrationHubConfig: "client-migrationhub-config", - MigrationHubRefactorSpaces: "client-migration-hub-refactor-spaces", - NetworkManager: "client-networkmanager", - OpenSearch: "client-opensearch", - OpenSearchServerless: "client-opensearchserverless", - OpsWorks: "client-opsworks", - OpsWorksCM: "client-opsworkscm", - PrivateNetworks: "client-privatenetworks", - QLDBSession: "client-qldb-session", - QuickSight: "client-quicksight", - ResourceExplorer2: "client-resource-explorer-2", - RDSDataService: "client-rds-data", - RoboMaker: "client-robomaker", - RolesAnywhere: "client-rolesanywhere", - Route53: "client-route-53", - Route53Domains: "client-route-53-domains", - Route53Resolver: "client-route53resolver", - S3Control: "client-s3-control", - SageMakerFeatureStoreRuntime: "client-sagemaker-featurestore-runtime", - SavingsPlans: "client-savingsplans", - SecurityHub: "client-securityhub", - ServerlessApplicationRepository: "client-serverlessapplicationrepository", - ServiceCatalogAppRegistry: "client-service-catalog-appregistry", - ServiceDiscovery: "client-servicediscovery", - SimSpaceWeaver: "client-simspaceweaver", - SSMContacts: "client-ssm-contacts", - SSMIncidents: "client-ssm-incidents", - SSOAdmin: "client-sso-admin", - SSOOIDC: "client-sso-oidc", - StepFunctions: "client-sfn", - TranscribeService: "client-transcribe", - WAFRegional: "client-waf-regional", - WellArchitected: "client-wellarchitected", - WorkMailMessageFlow: "client-workmailmessageflow" -}; - -// ../sdk-v2-to-v3-adapter/lib/get-v3-client-package-name.ts -var getV3ClientPackageName = (clientName) => { - if (clientName in CLIENT_PACKAGE_NAMES_MAP) { - return `@aws-sdk/${CLIENT_PACKAGE_NAMES_MAP[clientName]}`; - } - throw new Error(`Client '${clientName}' is either deprecated or newly added. Please consider using the v3 package format (@aws-sdk/client-xxx).`); -}; - -// ../sdk-v2-to-v3-adapter/lib/find-client-constructor.ts -function findV3ClientConstructor(pkg) { - const [_clientName, ServiceClient] = Object.entries(pkg).find( - ([name]) => { - return name.endsWith("Client") && name !== "__Client"; - } - ); - return ServiceClient; -} +// lib/assertions/providers/lambda-handler/sdk.ts +var import_sdk_v2_to_v3_adapter = __toESM(require_lib5()); // lib/assertions/providers/lambda-handler/utils.ts function parseJsonPayload(payload) { @@ -31685,7 +31539,7 @@ function flatten(object) { ); } function getServicePackage(service) { - const packageName = getV3ClientPackageName(service); + const packageName = (0, import_sdk_v2_to_v3_adapter.getV3ClientPackageName)(service); try { const pkg = require(packageName); return { @@ -31699,7 +31553,7 @@ function getServicePackage(service) { } function getServiceClient(sdkPkg) { try { - const ServiceClient = findV3ClientConstructor(sdkPkg.pkg); + const ServiceClient = (0, import_sdk_v2_to_v3_adapter.findV3ClientConstructor)(sdkPkg.pkg); return new ServiceClient({}); } catch (e) { console.error(e); diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9/nodejs/node_modules/canary.js b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8/nodejs/node_modules/canary.js similarity index 100% rename from packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9/nodejs/node_modules/canary.js rename to packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8/nodejs/node_modules/canary.js diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9/nodejs/node_modules/folder/canary.js b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8/nodejs/node_modules/folder/canary.js similarity index 100% rename from packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9/nodejs/node_modules/folder/canary.js rename to packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8/nodejs/node_modules/folder/canary.js diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9/python/canary.py b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8/python/canary.py similarity index 100% rename from packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9/python/canary.py rename to packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/asset.d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8/python/canary.py diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/canary-one.assets.json b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/canary-one.assets.json index deb54f04d6b3f..4ace87e7037d9 100644 --- a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/canary-one.assets.json +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/canary-one.assets.json @@ -14,15 +14,28 @@ } } }, - "4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9": { + "40129686bd15b9964212325144aa0db37ac362e1e290ab678d8679880f705e83": { "source": { - "path": "asset.4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9", + "path": "asset.40129686bd15b9964212325144aa0db37ac362e1e290ab678d8679880f705e83", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9.zip", + "objectKey": "40129686bd15b9964212325144aa0db37ac362e1e290ab678d8679880f705e83.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8": { + "source": { + "path": "asset.d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } @@ -40,7 +53,7 @@ } } }, - "f1ac961b93fcbae9fa5bbc92ca50eea4462c6e119529e40e43f0bbb7b5b919b5": { + "1e67d92055e2613f5917bd4854cfd269defa410312aea891208112d66dd62c6e": { "source": { "path": "canary-one.template.json", "packaging": "file" @@ -48,7 +61,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "f1ac961b93fcbae9fa5bbc92ca50eea4462c6e119529e40e43f0bbb7b5b919b5.json", + "objectKey": "1e67d92055e2613f5917bd4854cfd269defa410312aea891208112d66dd62c6e.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-synthetics-alpha/test/integ.canary.js.snapshot/canary-one.template.json b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/canary-one.template.json index 3637bb0b6660c..95b162de23360 100644 --- a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/canary-one.template.json +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/canary-one.template.json @@ -333,9 +333,132 @@ "DurationInSeconds": "0", "Expression": "rate(1 minute)" }, - "StartCanaryAfterCreation": true + "StartCanaryAfterCreation": true, + "Tags": [ + { + "Key": "aws-cdk:auto-delete-underlying-resources", + "Value": "true" + } + ] + } + }, + "InlineAssetAutoDeleteUnderlyingResourcesCustomResourceFABA77C7": { + "Type": "Custom::SyntheticsAutoDeleteUnderlyingResources", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderHandler26776D4E", + "Arn" + ] + }, + "CanaryName": { + "Ref": "InlineAsset5EAEB9B5" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderRole2D11A112": { + "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": [ + { + "Effect": "Allow", + "Action": [ + "lambda:DeleteFunction" + ], + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:cwsyn-*" + ] + ] + } + }, + { + "Effect": "Allow", + "Action": [ + "synthetics:GetCanary" + ], + "Resource": "*" + } + ] + } + } + ] } }, + "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderHandler26776D4E": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "40129686bd15b9964212325144aa0db37ac362e1e290ab678d8679880f705e83.zip" + }, + "Timeout": 900, + "MemorySize": 128, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderRole2D11A112", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Description": { + "Fn::Join": [ + "", + [ + "Lambda function for auto-deleting underlying resources created by ", + { + "Ref": "InlineAsset5EAEB9B5" + }, + "." + ] + ] + } + }, + "DependsOn": [ + "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderRole2D11A112" + ] + }, "DirectoryAssetArtifactsBucketA79AFD6C": { "Type": "AWS::S3::Bucket", "Properties": { @@ -516,9 +639,8 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9.zip" + "S3Key": "d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8.zip" }, - "DeleteLambdaResourcesOnCanaryDeletion": true, "ExecutionRoleArn": { "Fn::GetAtt": [ "DirectoryAssetServiceRole6C204C16", @@ -559,9 +681,31 @@ "DurationInSeconds": "0", "Expression": "rate(5 minutes)" }, - "StartCanaryAfterCreation": true + "StartCanaryAfterCreation": true, + "Tags": [ + { + "Key": "aws-cdk:auto-delete-underlying-resources", + "Value": "true" + } + ] } }, + "DirectoryAssetAutoDeleteUnderlyingResourcesCustomResourceD943D9DD": { + "Type": "Custom::SyntheticsAutoDeleteUnderlyingResources", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderHandler26776D4E", + "Arn" + ] + }, + "CanaryName": { + "Ref": "DirectoryAssetB49EFE5C" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, "FolderAssetArtifactsBucket4233584C": { "Type": "AWS::S3::Bucket", "Properties": { @@ -742,9 +886,8 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9.zip" + "S3Key": "d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8.zip" }, - "DeleteLambdaResourcesOnCanaryDeletion": true, "ExecutionRoleArn": { "Fn::GetAtt": [ "FolderAssetServiceRole87AE7EF1", @@ -785,9 +928,31 @@ "DurationInSeconds": "0", "Expression": "rate(5 minutes)" }, - "StartCanaryAfterCreation": true + "StartCanaryAfterCreation": true, + "Tags": [ + { + "Key": "aws-cdk:auto-delete-underlying-resources", + "Value": "true" + } + ] } }, + "FolderAssetAutoDeleteUnderlyingResourcesCustomResource9ED8468D": { + "Type": "Custom::SyntheticsAutoDeleteUnderlyingResources", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderHandler26776D4E", + "Arn" + ] + }, + "CanaryName": { + "Ref": "FolderAssetDC62ADA6" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, "ZipAssetArtifactsBucket8D4ED76C": { "Type": "AWS::S3::Bucket", "Properties": { @@ -990,9 +1155,31 @@ "DurationInSeconds": "0", "Expression": "rate(5 minutes)" }, - "StartCanaryAfterCreation": true + "StartCanaryAfterCreation": true, + "Tags": [ + { + "Key": "aws-cdk:auto-delete-underlying-resources", + "Value": "true" + } + ] } }, + "ZipAssetAutoDeleteUnderlyingResourcesCustomResource0AD8D2D4": { + "Type": "Custom::SyntheticsAutoDeleteUnderlyingResources", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderHandler26776D4E", + "Arn" + ] + }, + "CanaryName": { + "Ref": "ZipAssetA028C65F" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, "SynNodejsPuppeteer39ArtifactsBucketC3BBB932": { "Type": "AWS::S3::Bucket", "Properties": { @@ -1173,7 +1360,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9.zip" + "S3Key": "d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8.zip" }, "ExecutionRoleArn": { "Fn::GetAtt": [ @@ -1215,9 +1402,31 @@ "DurationInSeconds": "0", "Expression": "rate(5 minutes)" }, - "StartCanaryAfterCreation": true + "StartCanaryAfterCreation": true, + "Tags": [ + { + "Key": "aws-cdk:auto-delete-underlying-resources", + "Value": "true" + } + ] } }, + "SynNodejsPuppeteer39AutoDeleteUnderlyingResourcesCustomResourceB6D0DB57": { + "Type": "Custom::SyntheticsAutoDeleteUnderlyingResources", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderHandler26776D4E", + "Arn" + ] + }, + "CanaryName": { + "Ref": "SynNodejsPuppeteer3978815E0A" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, "SynNodejsPuppeteer40ArtifactsBucket30A9D9DC": { "Type": "AWS::S3::Bucket", "Properties": { @@ -1398,7 +1607,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9.zip" + "S3Key": "d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8.zip" }, "ExecutionRoleArn": { "Fn::GetAtt": [ @@ -1440,9 +1649,31 @@ "DurationInSeconds": "0", "Expression": "rate(5 minutes)" }, - "StartCanaryAfterCreation": true + "StartCanaryAfterCreation": true, + "Tags": [ + { + "Key": "aws-cdk:auto-delete-underlying-resources", + "Value": "true" + } + ] } }, + "SynNodejsPuppeteer40AutoDeleteUnderlyingResourcesCustomResourceD78DC158": { + "Type": "Custom::SyntheticsAutoDeleteUnderlyingResources", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderHandler26776D4E", + "Arn" + ] + }, + "CanaryName": { + "Ref": "SynNodejsPuppeteer406C46FFAF" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, "SynPythonSelenium13ArtifactsBucket084C41C8": { "Type": "AWS::S3::Bucket", "Properties": { @@ -1623,7 +1854,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9.zip" + "S3Key": "d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8.zip" }, "ExecutionRoleArn": { "Fn::GetAtt": [ @@ -1665,8 +1896,30 @@ "DurationInSeconds": "0", "Expression": "rate(5 minutes)" }, - "StartCanaryAfterCreation": true + "StartCanaryAfterCreation": true, + "Tags": [ + { + "Key": "aws-cdk:auto-delete-underlying-resources", + "Value": "true" + } + ] } + }, + "SynPythonSelenium13AutoDeleteUnderlyingResourcesCustomResourceA39E1D51": { + "Type": "Custom::SyntheticsAutoDeleteUnderlyingResources", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderHandler26776D4E", + "Arn" + ] + }, + "CanaryName": { + "Ref": "SynPythonSelenium13F92D8275" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" } }, "Outputs": { diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/manifest.json b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/manifest.json index f024e4f88ea3c..4935634aea0a5 100644 --- a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/manifest.json @@ -17,7 +17,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/f1ac961b93fcbae9fa5bbc92ca50eea4462c6e119529e40e43f0bbb7b5b919b5.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/1e67d92055e2613f5917bd4854cfd269defa410312aea891208112d66dd62c6e.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -105,6 +105,24 @@ "data": "InlineAsset5EAEB9B5" } ], + "/canary-one/InlineAsset/AutoDeleteUnderlyingResourcesCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "InlineAssetAutoDeleteUnderlyingResourcesCustomResourceFABA77C7" + } + ], + "/canary-one/Custom::SyntheticsAutoDeleteUnderlyingResourcesCustomResourceProvider/Role": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderRole2D11A112" + } + ], + "/canary-one/Custom::SyntheticsAutoDeleteUnderlyingResourcesCustomResourceProvider/Handler": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomSyntheticsAutoDeleteUnderlyingResourcesCustomResourceProviderHandler26776D4E" + } + ], "/canary-one/DirectoryAsset/ArtifactsBucket/Resource": [ { "type": "aws:cdk:logicalId", @@ -129,6 +147,12 @@ "data": "DirectoryAssetB49EFE5C" } ], + "/canary-one/DirectoryAsset/AutoDeleteUnderlyingResourcesCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "DirectoryAssetAutoDeleteUnderlyingResourcesCustomResourceD943D9DD" + } + ], "/canary-one/FolderAsset/ArtifactsBucket/Resource": [ { "type": "aws:cdk:logicalId", @@ -153,6 +177,12 @@ "data": "FolderAssetDC62ADA6" } ], + "/canary-one/FolderAsset/AutoDeleteUnderlyingResourcesCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "FolderAssetAutoDeleteUnderlyingResourcesCustomResource9ED8468D" + } + ], "/canary-one/ZipAsset/ArtifactsBucket/Resource": [ { "type": "aws:cdk:logicalId", @@ -177,6 +207,12 @@ "data": "ZipAssetA028C65F" } ], + "/canary-one/ZipAsset/AutoDeleteUnderlyingResourcesCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "ZipAssetAutoDeleteUnderlyingResourcesCustomResource0AD8D2D4" + } + ], "/canary-one/SynNodejsPuppeteer39/ArtifactsBucket/Resource": [ { "type": "aws:cdk:logicalId", @@ -201,6 +237,12 @@ "data": "SynNodejsPuppeteer3978815E0A" } ], + "/canary-one/SynNodejsPuppeteer39/AutoDeleteUnderlyingResourcesCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "SynNodejsPuppeteer39AutoDeleteUnderlyingResourcesCustomResourceB6D0DB57" + } + ], "/canary-one/SynNodejsPuppeteer40/ArtifactsBucket/Resource": [ { "type": "aws:cdk:logicalId", @@ -225,6 +267,12 @@ "data": "SynNodejsPuppeteer406C46FFAF" } ], + "/canary-one/SynNodejsPuppeteer40/AutoDeleteUnderlyingResourcesCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "SynNodejsPuppeteer40AutoDeleteUnderlyingResourcesCustomResourceD78DC158" + } + ], "/canary-one/SynPythonSelenium13/ArtifactsBucket/Resource": [ { "type": "aws:cdk:logicalId", @@ -249,6 +297,12 @@ "data": "SynPythonSelenium13F92D8275" } ], + "/canary-one/SynPythonSelenium13/AutoDeleteUnderlyingResourcesCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "SynPythonSelenium13AutoDeleteUnderlyingResourcesCustomResourceA39E1D51" + } + ], "/canary-one/Exports/Output{\"Ref\":\"InlineAsset5EAEB9B5\"}": [ { "type": "aws:cdk:logicalId", @@ -322,7 +376,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/df5ea21aeb8a2b4d703bce966a4cf197c3a558b9b1bd275879fa58d12447002e.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/8c08730d94137e65bc12948174518428ecc7274c82e0ac14815338b53bb23df8.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/tree.json b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/tree.json index 0b6573db984c9..41e4751d6198b 100644 --- a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.js.snapshot/tree.json @@ -470,13 +470,37 @@ "durationInSeconds": "0", "expression": "rate(1 minute)" }, - "startCanaryAfterCreation": true + "startCanaryAfterCreation": true, + "tags": [ + { + "key": "aws-cdk:auto-delete-underlying-resources", + "value": "true" + } + ] } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_synthetics.CfnCanary", "version": "0.0.0" } + }, + "AutoDeleteUnderlyingResourcesCustomResource": { + "id": "AutoDeleteUnderlyingResourcesCustomResource", + "path": "canary-one/InlineAsset/AutoDeleteUnderlyingResourcesCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "canary-one/InlineAsset/AutoDeleteUnderlyingResourcesCustomResource/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "0.0.0" + } } }, "constructInfo": { @@ -484,6 +508,40 @@ "version": "0.0.0" } }, + "Custom::SyntheticsAutoDeleteUnderlyingResourcesCustomResourceProvider": { + "id": "Custom::SyntheticsAutoDeleteUnderlyingResourcesCustomResourceProvider", + "path": "canary-one/Custom::SyntheticsAutoDeleteUnderlyingResourcesCustomResourceProvider", + "children": { + "Staging": { + "id": "Staging", + "path": "canary-one/Custom::SyntheticsAutoDeleteUnderlyingResourcesCustomResourceProvider/Staging", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "canary-one/Custom::SyntheticsAutoDeleteUnderlyingResourcesCustomResourceProvider/Role", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + }, + "Handler": { + "id": "Handler", + "path": "canary-one/Custom::SyntheticsAutoDeleteUnderlyingResourcesCustomResourceProvider/Handler", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResourceProvider", + "version": "0.0.0" + } + }, "DirectoryAsset": { "id": "DirectoryAsset", "path": "canary-one/DirectoryAsset", @@ -757,9 +815,8 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9.zip" + "s3Key": "d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8.zip" }, - "deleteLambdaResourcesOnCanaryDeletion": true, "executionRoleArn": { "Fn::GetAtt": [ "DirectoryAssetServiceRole6C204C16", @@ -800,13 +857,37 @@ "durationInSeconds": "0", "expression": "rate(5 minutes)" }, - "startCanaryAfterCreation": true + "startCanaryAfterCreation": true, + "tags": [ + { + "key": "aws-cdk:auto-delete-underlying-resources", + "value": "true" + } + ] } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_synthetics.CfnCanary", "version": "0.0.0" } + }, + "AutoDeleteUnderlyingResourcesCustomResource": { + "id": "AutoDeleteUnderlyingResourcesCustomResource", + "path": "canary-one/DirectoryAsset/AutoDeleteUnderlyingResourcesCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "canary-one/DirectoryAsset/AutoDeleteUnderlyingResourcesCustomResource/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "0.0.0" + } } }, "constructInfo": { @@ -1083,13 +1164,12 @@ ] }, "code": { - "handler": "folder/canary.handler", + "handler": "folder/canary.functionName", "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9.zip" + "s3Key": "d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8.zip" }, - "deleteLambdaResourcesOnCanaryDeletion": true, "executionRoleArn": { "Fn::GetAtt": [ "FolderAssetServiceRole87AE7EF1", @@ -1130,13 +1210,37 @@ "durationInSeconds": "0", "expression": "rate(5 minutes)" }, - "startCanaryAfterCreation": true + "startCanaryAfterCreation": true, + "tags": [ + { + "key": "aws-cdk:auto-delete-underlying-resources", + "value": "true" + } + ] } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_synthetics.CfnCanary", "version": "0.0.0" } + }, + "AutoDeleteUnderlyingResourcesCustomResource": { + "id": "AutoDeleteUnderlyingResourcesCustomResource", + "path": "canary-one/FolderAsset/AutoDeleteUnderlyingResourcesCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "canary-one/FolderAsset/AutoDeleteUnderlyingResourcesCustomResource/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "0.0.0" + } } }, "constructInfo": { @@ -1439,13 +1543,37 @@ "durationInSeconds": "0", "expression": "rate(5 minutes)" }, - "startCanaryAfterCreation": true + "startCanaryAfterCreation": true, + "tags": [ + { + "key": "aws-cdk:auto-delete-underlying-resources", + "value": "true" + } + ] } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_synthetics.CfnCanary", "version": "0.0.0" } + }, + "AutoDeleteUnderlyingResourcesCustomResource": { + "id": "AutoDeleteUnderlyingResourcesCustomResource", + "path": "canary-one/ZipAsset/AutoDeleteUnderlyingResourcesCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "canary-one/ZipAsset/AutoDeleteUnderlyingResourcesCustomResource/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "0.0.0" + } } }, "constructInfo": { @@ -1726,7 +1854,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9.zip" + "s3Key": "d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8.zip" }, "executionRoleArn": { "Fn::GetAtt": [ @@ -1768,13 +1896,37 @@ "durationInSeconds": "0", "expression": "rate(5 minutes)" }, - "startCanaryAfterCreation": true + "startCanaryAfterCreation": true, + "tags": [ + { + "key": "aws-cdk:auto-delete-underlying-resources", + "value": "true" + } + ] } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_synthetics.CfnCanary", "version": "0.0.0" } + }, + "AutoDeleteUnderlyingResourcesCustomResource": { + "id": "AutoDeleteUnderlyingResourcesCustomResource", + "path": "canary-one/SynNodejsPuppeteer39/AutoDeleteUnderlyingResourcesCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "canary-one/SynNodejsPuppeteer39/AutoDeleteUnderlyingResourcesCustomResource/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "0.0.0" + } } }, "constructInfo": { @@ -2055,7 +2207,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9.zip" + "s3Key": "d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8.zip" }, "executionRoleArn": { "Fn::GetAtt": [ @@ -2097,13 +2249,37 @@ "durationInSeconds": "0", "expression": "rate(5 minutes)" }, - "startCanaryAfterCreation": true + "startCanaryAfterCreation": true, + "tags": [ + { + "key": "aws-cdk:auto-delete-underlying-resources", + "value": "true" + } + ] } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_synthetics.CfnCanary", "version": "0.0.0" } + }, + "AutoDeleteUnderlyingResourcesCustomResource": { + "id": "AutoDeleteUnderlyingResourcesCustomResource", + "path": "canary-one/SynNodejsPuppeteer40/AutoDeleteUnderlyingResourcesCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "canary-one/SynNodejsPuppeteer40/AutoDeleteUnderlyingResourcesCustomResource/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "0.0.0" + } } }, "constructInfo": { @@ -2384,7 +2560,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "4914857a6c9238eb37ddc008b7f94fd44599625d49d95ee13c68e8e177dee7e9.zip" + "s3Key": "d6b51cbdd22d449b9e57c20ef9d0977e1cfbf06806f8008ce376101a2ad432a8.zip" }, "executionRoleArn": { "Fn::GetAtt": [ @@ -2426,13 +2602,37 @@ "durationInSeconds": "0", "expression": "rate(5 minutes)" }, - "startCanaryAfterCreation": true + "startCanaryAfterCreation": true, + "tags": [ + { + "key": "aws-cdk:auto-delete-underlying-resources", + "value": "true" + } + ] } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_synthetics.CfnCanary", "version": "0.0.0" } + }, + "AutoDeleteUnderlyingResourcesCustomResource": { + "id": "AutoDeleteUnderlyingResourcesCustomResource", + "path": "canary-one/SynPythonSelenium13/AutoDeleteUnderlyingResourcesCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "canary-one/SynPythonSelenium13/AutoDeleteUnderlyingResourcesCustomResource/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "0.0.0" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.ts b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.ts index 1c14a2a8b1933..baec0e4e32656 100644 --- a/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.ts +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/integ.canary.ts @@ -4,7 +4,7 @@ import * as path from 'path'; import * as apigateway from 'aws-cdk-lib/aws-apigateway'; import * as s3 from 'aws-cdk-lib/aws-s3'; import * as cdk from 'aws-cdk-lib'; -import { Canary, Code, Runtime, Schedule, Test } from '../lib'; +import { Canary, Cleanup, Code, Runtime, Schedule, Test } from '../lib'; import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha'; import { RemovalPolicy } from 'aws-cdk-lib'; @@ -41,6 +41,7 @@ const inlineAsset = new Canary(stack, 'InlineAsset', { schedule: Schedule.rate(cdk.Duration.minutes(1)), artifactsBucketLocation: { bucket, prefix }, runtime: Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0, + cleanup: Cleanup.LAMBDA, }); const directoryAsset = new Canary(stack, 'DirectoryAsset', { @@ -52,7 +53,7 @@ const directoryAsset = new Canary(stack, 'DirectoryAsset', { environmentVariables: { URL: api.url, }, - enableAutoDeleteLambdas: true, + cleanup: Cleanup.LAMBDA, }); const folderAsset = new Canary(stack, 'FolderAsset', { @@ -64,7 +65,7 @@ const folderAsset = new Canary(stack, 'FolderAsset', { environmentVariables: { URL: api.url, }, - enableAutoDeleteLambdas: true, + cleanup: Cleanup.LAMBDA, }); const zipAsset = new Canary(stack, 'ZipAsset', { @@ -78,6 +79,7 @@ const zipAsset = new Canary(stack, 'ZipAsset', { }, ], runtime: Runtime.SYNTHETICS_NODEJS_PUPPETEER_4_0, + cleanup: Cleanup.LAMBDA, }); const kebabToPascal = (text :string )=> text.replace(/(^\w|-\w)/g, (v) => v.replace(/-/, '').toUpperCase()); @@ -91,6 +93,7 @@ const createCanaryByRuntimes = (runtime: Runtime) => URL: api.url, }, runtime, + cleanup: Cleanup.LAMBDA, }); const puppeteer39 = createCanaryByRuntimes(Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_9); diff --git a/packages/@aws-cdk/aws-synthetics-alpha/test/metric.test.ts b/packages/@aws-cdk/aws-synthetics-alpha/test/metric.test.ts index 60984948e431b..550d28cdbc8b9 100644 --- a/packages/@aws-cdk/aws-synthetics-alpha/test/metric.test.ts +++ b/packages/@aws-cdk/aws-synthetics-alpha/test/metric.test.ts @@ -1,8 +1,7 @@ -import { testDeprecated } from '@aws-cdk/cdk-build-tools'; import { App, Stack } from 'aws-cdk-lib'; import * as synthetics from '../lib'; -testDeprecated('.metricXxx() methods can be used to obtain Metrics for the canary', () => { +test('.metricXxx() methods can be used to obtain Metrics for the canary', () => { // GIVEN const stack = new Stack(new App(), 'canaries'); @@ -42,7 +41,7 @@ testDeprecated('.metricXxx() methods can be used to obtain Metrics for the canar })); }); -testDeprecated('Metric can specify statistic', () => { +test('Metric can specify statistic', () => { // GIVEN const stack = new Stack(new App(), 'canaries'); diff --git a/packages/@aws-cdk/custom-resource-handlers/README.md b/packages/@aws-cdk/custom-resource-handlers/README.md index becd89e305151..af95011c5eeeb 100644 --- a/packages/@aws-cdk/custom-resource-handlers/README.md +++ b/packages/@aws-cdk/custom-resource-handlers/README.md @@ -4,6 +4,7 @@ This package contains the following custom resource handlers: - aws-s3/auto-delete-objects-handler - aws-ecr/auto-delete-images-handler +- aws-synthetics-alpha/auto-delete-underlying-resources-handler In addition, it includes `nodejs-entrypoint.ts`, which is a wrapper that talks to CloudFormation for you. At build time, `nodejs-entrypoint.js` is bundled into the diff --git a/packages/@aws-cdk/custom-resource-handlers/lib/aws-synthetics-alpha/auto-delete-underlying-resources-handler/index.ts b/packages/@aws-cdk/custom-resource-handlers/lib/aws-synthetics-alpha/auto-delete-underlying-resources-handler/index.ts new file mode 100644 index 0000000000000..a26b47c7552ef --- /dev/null +++ b/packages/@aws-cdk/custom-resource-handlers/lib/aws-synthetics-alpha/auto-delete-underlying-resources-handler/index.ts @@ -0,0 +1,95 @@ +/* eslint-disable no-console */ +/* eslint-disable import/no-extraneous-dependencies */ +import { LambdaClient, DeleteFunctionCommand } from '@aws-sdk/client-lambda'; +import { SyntheticsClient, GetCanaryCommand } from '@aws-sdk/client-synthetics'; +import { makeHandler } from '../../nodejs-entrypoint'; + +const AUTO_DELETE_UNDERLYING_RESOURCES_TAG = 'aws-cdk:auto-delete-underlying-resources'; + +const lambda = new LambdaClient({}); +const synthetics = new SyntheticsClient({}); + +export const handler = makeHandler(autoDeleteHandler); + +export async function autoDeleteHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { + switch (event.RequestType) { + case 'Create': + return { PhyscialResourceId: event.ResourceProperties?.CanaryName }; + case 'Update': + const response = await onUpdate(event); + return { PhysicalResourceId: response.PhysicalResourceId }; + case 'Delete': + return onDelete(event.ResourceProperties?.CanaryName); + } +}; + +async function onUpdate(event: AWSLambda.CloudFormationCustomResourceEvent) { + const updateEvent = event as AWSLambda.CloudFormationCustomResourceUpdateEvent; + const newCanaryName = updateEvent.ResourceProperties?.CanaryName; + + // If the name of the canary has changed, CloudFormation will delete the canary + // and create a new one with the new name. Returning a PhysicalResourceId that + // differs from the event's PhysicalResourceId will trigger a `Delete` event + // for this custom resource. Here, if `newCanaryName` differs from `event.PhysicalResourceId` + // then this will trigger a `Delete` event. + return { PhysicalResourceId: newCanaryName }; +} + +async function onDelete(canaryName: string) { + console.log(`Deleting lambda function associated with ${canaryName}`); + + if (!canaryName) { + throw new Error('No CanaryName was provided.'); + } + + try { + const response = (await synthetics.send(new GetCanaryCommand({ + Name: canaryName, + }))); + + // Unlikely to happen but here so I don't have to write '?' everywhere + if (response.Canary === undefined || response.Canary.Id === undefined) { + // Canary does not exist. Exiting. + return; + } else if (response.Canary.EngineArn === undefined) { + // Lambda does not exist. Exiting. + return; + } + + if (!isCanaryTaggedForDeletion(response.Canary.Tags)) { + console.log(`Canary does not have '${AUTO_DELETE_UNDERLYING_RESOURCES_TAG}' tag, skipping deletion.`); + return; + } + + // EngineArn is a qualified function arn, but double check that is the case before removing qualifier + let qualifiedFunctionArnComponents = response.Canary.EngineArn.split(':'); + if (!qualifiedFunctionArnComponents.at(-1)?.includes(response.Canary.Id)) { + qualifiedFunctionArnComponents.pop(); // remove qualifier + } + + const unqualifedFunctionArn = qualifiedFunctionArnComponents.join(':'); + console.log(`Deleting lambda ${unqualifedFunctionArn}`); + + await lambda.send(new DeleteFunctionCommand({ + FunctionName: unqualifedFunctionArn, + })); + } catch (error: any) { + if (error.name !== 'ResourceNotFoundException') { + throw error; + } + // Canary or Lambda doesn't exist. Exiting. + } +} + +/** + * The canary will only be tagged for deletion if it's being deleted in the same + * deployment as this Custom Resource. + * + * If the Custom Resource is ever deleted before the repository, it must be because + * `cleanup` has been switched to `Cleanup.NOTHING`, in which case the tag would have + * been removed before we get to this Delete event. + */ +function isCanaryTaggedForDeletion(tags?: Record): boolean { + if (!tags) return false; + return Object.keys(tags).some((tag) => tag === AUTO_DELETE_UNDERLYING_RESOURCES_TAG && tags[tag] === 'true'); +} diff --git a/packages/@aws-cdk/custom-resource-handlers/package.json b/packages/@aws-cdk/custom-resource-handlers/package.json index 6e72ce89d890a..00b73279981ad 100644 --- a/packages/@aws-cdk/custom-resource-handlers/package.json +++ b/packages/@aws-cdk/custom-resource-handlers/package.json @@ -32,6 +32,8 @@ "esbuild": "^0.19.2" }, "dependencies": { + "@aws-sdk/client-lambda": "^3.391.0", + "@aws-sdk/client-synthetics": "^3.391.0", "@aws-sdk/client-ecr": "^3.391.0", "@aws-sdk/client-s3": "^3.391.0" }, diff --git a/packages/@aws-cdk/custom-resource-handlers/test/aws-synthetics-alpha/auto-delete-underlying-resources-handler.test.ts b/packages/@aws-cdk/custom-resource-handlers/test/aws-synthetics-alpha/auto-delete-underlying-resources-handler.test.ts new file mode 100644 index 0000000000000..2be8237c29ef6 --- /dev/null +++ b/packages/@aws-cdk/custom-resource-handlers/test/aws-synthetics-alpha/auto-delete-underlying-resources-handler.test.ts @@ -0,0 +1,264 @@ +const mockSyntheticsClient = { + send: jest.fn(), +}; +const mockLambdaClient = { + send: jest.fn(), +}; +const mockGetCanaryCommand = jest.fn().mockImplementation(() => { return {}; }); +const mockDeleteFunctionCommand = jest.fn().mockImplementation(() => { return {}; }); + +import { autoDeleteHandler } from '../../lib/aws-synthetics-alpha/auto-delete-underlying-resources-handler'; + +jest.mock('@aws-sdk/client-lambda', () => { + return { + LambdaClient: jest.fn().mockImplementation(() => { + return mockLambdaClient; + }), + DeleteFunctionCommand: mockDeleteFunctionCommand, + }; +}); + +jest.mock('@aws-sdk/client-synthetics', () => { + return { + SyntheticsClient: jest.fn().mockImplementation(() => { + return mockSyntheticsClient; + }), + GetCanaryCommand: mockGetCanaryCommand, + }; +}); + +beforeEach(() => { + mockSyntheticsClient.send.mockReturnThis(); + mockLambdaClient.send.mockReturnThis(); +}); + +afterEach(() => { + jest.resetAllMocks(); +}); + +test('does nothing on create event', async () => { + // GIVEN + const event: Partial = { + RequestType: 'Create', + ResourceProperties: { + ServiceToken: 'Foo', + CanaryName: 'MyCanary', + }, + }; + + // WHEN + await invokeHandler(event); + + // THEN + expect(mockSyntheticsClient.send).toHaveBeenCalledTimes(0); + expect(mockLambdaClient.send).toHaveBeenCalledTimes(0); +}); + +test('does nothing on update event when everything remains the same', async () => { + // GIVEN + const event: Partial = { + RequestType: 'Update', + ResourceProperties: { + ServiceToken: 'Foo', + CanaryName: 'MyCanary', + }, + OldResourceProperties: { + ServiceToken: 'Foo', + CanaryName: 'MyCanary', + }, + }; + + // WHEN + await invokeHandler(event); + + // THEN + expect(mockSyntheticsClient.send).toHaveBeenCalledTimes(0); + expect(mockLambdaClient.send).toHaveBeenCalledTimes(0); +}); + +test('does nothing on update event when the bucket name remains the same but the service token changes', async () => { + // GIVEN + const event: Partial = { + RequestType: 'Update', + ResourceProperties: { + ServiceToken: 'Foo', + CanaryName: 'MyCanary', + }, + OldResourceProperties: { + ServiceToken: 'Bar', + CanaryName: 'MyCanary', + }, + }; + + // WHEN + await invokeHandler(event); + + // THEN + expect(mockSyntheticsClient.send).toHaveBeenCalledTimes(0); + expect(mockLambdaClient.send).toHaveBeenCalledTimes(0); +}); + +test('does nothing on update event when the old resource properties are absent', async () => { + // GIVEN + const event: Partial = { + RequestType: 'Update', + ResourceProperties: { + ServiceToken: 'Foo', + CanaryName: 'MyCanary', + }, + }; + + // WHEN + await invokeHandler(event); + + // THEN + expect(mockSyntheticsClient.send).toHaveBeenCalledTimes(0); + expect(mockLambdaClient.send).toHaveBeenCalledTimes(0); +}); + +test('does nothing on update event when the new resource properties are absent', async () => { + // GIVEN + const event: Partial = { + RequestType: 'Update', + OldResourceProperties: { + ServiceToken: 'Foo', + CanaryName: 'MyCanary', + }, + }; + + // WHEN + await invokeHandler(event); + + // THEN + expect(mockSyntheticsClient.send).toHaveBeenCalledTimes(0); + expect(mockLambdaClient.send).toHaveBeenCalledTimes(0); +}); + +test('deletes lambda when the name changes on update event', async () => { + // GIVEN + const id = '0000-0000-00000000'; + mockSyntheticsClient.send.mockReturnValue({ + Canary: { + Tags: { + 'aws-cdk:auto-delete-underlying-resources': 'true', + }, + Id: id, + }, + }); + + const event: Partial = { + RequestType: 'Update', + OldResourceProperties: { + ServiceToken: 'Foo', + CanaryName: 'MyCanary', + }, + ResourceProperties: { + ServiceToken: 'Foo', + CanaryName: 'MyCanary-renamed', + }, + }; + + // WHEN + const result = await invokeHandler(event); + + // THEN + expect((result as any).PhysicalResourceId).toEqual('MyCanary-renamed'); +}); + +test('deletes lambda on delete', async () => { + // GIVEN + const id = '0000-0000-00000000'; + mockSyntheticsClient.send.mockReturnValue({ + Canary: { + Tags: { + 'aws-cdk:auto-delete-underlying-resources': 'true', + }, + Id: id, + EngineArn: `arn:aws:lambda:region:account:function:cwsyn-name-${id}:1`, + }, + }); + + // WHEN + const event: Partial = { + RequestType: 'Delete', + ResourceProperties: { + ServiceToken: 'Foo', + CanaryName: 'MyCanary', + }, + }; + await invokeHandler(event); + + // THEN + expect(mockSyntheticsClient.send).toHaveBeenCalledTimes(1); + expect(mockGetCanaryCommand).toHaveBeenCalledWith({ Name: 'MyCanary' }); + expect(mockLambdaClient.send).toHaveBeenCalledTimes(1); + expect(mockDeleteFunctionCommand).toHaveBeenCalledWith({ + FunctionName: `arn:aws:lambda:region:account:function:cwsyn-name-${id}`, + }); +}); + +test('does not delete lambda if canary is not tagged', async () => { + // GIVEN + const id = '0000-0000-00000000'; + mockSyntheticsClient.send.mockReturnValue({ + Canary: { + Id: id, + EngineArn: `arn:aws:lambda:region:account:function:cwsyn-name-${id}:1`, + }, + }); + + // WHEN + const event: Partial = { + RequestType: 'Delete', + ResourceProperties: { + ServiceToken: 'Foo', + CanaryName: 'MyCanary', + }, + }; + await invokeHandler(event); + + // THEN + expect(mockSyntheticsClient.send).toHaveBeenCalledTimes(1); + expect(mockLambdaClient.send).not.toHaveBeenCalled(); +}); + +test('does nothing when the canary does not exist', async () => { + // GIVEN + mockSyntheticsClient.send.mockRejectedValue({ name: 'ResourceNotFoundException' }); + + // WHEN + const event: Partial = { + RequestType: 'Delete', + ResourceProperties: { + ServiceToken: 'Foo', + CanaryName: 'MyCanary', + }, + }; + await invokeHandler(event); + + expect(mockLambdaClient.send).not.toHaveBeenCalled(); +}); + +test('does nothing when the lambda does not exist', async () => { + // GIVEN + mockLambdaClient.send.mockRejectedValue({ name: 'ResourceNotFoundException' }); + + // WHEN + const event: Partial = { + RequestType: 'Delete', + ResourceProperties: { + ServiceToken: 'Foo', + CanaryName: 'MyCanary', + }, + }; + + await invokeHandler(event); + + // expect no error +}); + +// helper function to get around TypeScript expecting a complete event object, +// even though our tests only need some of the fields +async function invokeHandler(event: Partial) { + return autoDeleteHandler(event as AWSLambda.CloudFormationCustomResourceEvent); +} diff --git a/yarn.lock b/yarn.lock index 387da5f1b4d80..2e74fde77efa4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1036,6 +1036,45 @@ "@smithy/util-utf8" "^2.0.0" tslib "^2.5.0" +"@aws-sdk/client-sso@3.395.0": + version "3.395.0" + resolved "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.395.0.tgz#9604d3e6c131a48bd3e2421cb0eefc36faa50fc6" + integrity sha512-IEmqpZnflzFk6NTlkRpEXIcU2uBrTYl+pA5z4ZerbKclYWuxJ7MoLtLDNWgIn3mkNxvdroWgaPY1B2dkQlTe4g== + dependencies: + "@aws-crypto/sha256-browser" "3.0.0" + "@aws-crypto/sha256-js" "3.0.0" + "@aws-sdk/middleware-host-header" "3.391.0" + "@aws-sdk/middleware-logger" "3.391.0" + "@aws-sdk/middleware-recursion-detection" "3.391.0" + "@aws-sdk/middleware-user-agent" "3.391.0" + "@aws-sdk/types" "3.391.0" + "@aws-sdk/util-endpoints" "3.391.0" + "@aws-sdk/util-user-agent-browser" "3.391.0" + "@aws-sdk/util-user-agent-node" "3.391.0" + "@smithy/config-resolver" "^2.0.3" + "@smithy/fetch-http-handler" "^2.0.3" + "@smithy/hash-node" "^2.0.3" + "@smithy/invalid-dependency" "^2.0.3" + "@smithy/middleware-content-length" "^2.0.3" + "@smithy/middleware-endpoint" "^2.0.3" + "@smithy/middleware-retry" "^2.0.3" + "@smithy/middleware-serde" "^2.0.3" + "@smithy/middleware-stack" "^2.0.0" + "@smithy/node-config-provider" "^2.0.3" + "@smithy/node-http-handler" "^2.0.3" + "@smithy/protocol-http" "^2.0.3" + "@smithy/smithy-client" "^2.0.3" + "@smithy/types" "^2.2.0" + "@smithy/url-parser" "^2.0.3" + "@smithy/util-base64" "^2.0.0" + "@smithy/util-body-length-browser" "^2.0.0" + "@smithy/util-body-length-node" "^2.0.0" + "@smithy/util-defaults-mode-browser" "^2.0.3" + "@smithy/util-defaults-mode-node" "^2.0.3" + "@smithy/util-retry" "^2.0.0" + "@smithy/util-utf8" "^2.0.0" + tslib "^2.5.0" + "@aws-sdk/client-sts@3.391.0", "@aws-sdk/client-sts@^3.391.0": version "3.391.0" resolved "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.391.0.tgz#19d33625d9ae491c8ff53eebcbda34e1685952e0" @@ -1079,6 +1118,91 @@ fast-xml-parser "4.2.5" tslib "^2.5.0" +"@aws-sdk/client-sts@3.395.0": + version "3.395.0" + resolved "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.395.0.tgz#b70374b8ce171e2251fd8bbba71c8c1a13eed1c8" + integrity sha512-zWxZ+pjeP88uRN4k0Zzid6t/8Yhzg1Cv2LnrYX6kZzbS6AOTDho7fVGZgUl+cme33QZhtE8pXUvwGeJAptbhqg== + dependencies: + "@aws-crypto/sha256-browser" "3.0.0" + "@aws-crypto/sha256-js" "3.0.0" + "@aws-sdk/credential-provider-node" "3.395.0" + "@aws-sdk/middleware-host-header" "3.391.0" + "@aws-sdk/middleware-logger" "3.391.0" + "@aws-sdk/middleware-recursion-detection" "3.391.0" + "@aws-sdk/middleware-sdk-sts" "3.391.0" + "@aws-sdk/middleware-signing" "3.391.0" + "@aws-sdk/middleware-user-agent" "3.391.0" + "@aws-sdk/types" "3.391.0" + "@aws-sdk/util-endpoints" "3.391.0" + "@aws-sdk/util-user-agent-browser" "3.391.0" + "@aws-sdk/util-user-agent-node" "3.391.0" + "@smithy/config-resolver" "^2.0.3" + "@smithy/fetch-http-handler" "^2.0.3" + "@smithy/hash-node" "^2.0.3" + "@smithy/invalid-dependency" "^2.0.3" + "@smithy/middleware-content-length" "^2.0.3" + "@smithy/middleware-endpoint" "^2.0.3" + "@smithy/middleware-retry" "^2.0.3" + "@smithy/middleware-serde" "^2.0.3" + "@smithy/middleware-stack" "^2.0.0" + "@smithy/node-config-provider" "^2.0.3" + "@smithy/node-http-handler" "^2.0.3" + "@smithy/protocol-http" "^2.0.3" + "@smithy/smithy-client" "^2.0.3" + "@smithy/types" "^2.2.0" + "@smithy/url-parser" "^2.0.3" + "@smithy/util-base64" "^2.0.0" + "@smithy/util-body-length-browser" "^2.0.0" + "@smithy/util-body-length-node" "^2.0.0" + "@smithy/util-defaults-mode-browser" "^2.0.3" + "@smithy/util-defaults-mode-node" "^2.0.3" + "@smithy/util-retry" "^2.0.0" + "@smithy/util-utf8" "^2.0.0" + fast-xml-parser "4.2.5" + tslib "^2.5.0" + +"@aws-sdk/client-synthetics@^3.391.0": + version "3.395.0" + resolved "https://registry.npmjs.org/@aws-sdk/client-synthetics/-/client-synthetics-3.395.0.tgz#e8a317281928cca3c5df154d2eeaba73f92ad1d8" + integrity sha512-WXzUFhv0tXs7+YG7AV4ulArV/J1Gn/eAixelqVStzPHpgQ+Kn7jsv38GvxSbRqYFqDQuQWxF0og8izzPSRJdNw== + dependencies: + "@aws-crypto/sha256-browser" "3.0.0" + "@aws-crypto/sha256-js" "3.0.0" + "@aws-sdk/client-sts" "3.395.0" + "@aws-sdk/credential-provider-node" "3.395.0" + "@aws-sdk/middleware-host-header" "3.391.0" + "@aws-sdk/middleware-logger" "3.391.0" + "@aws-sdk/middleware-recursion-detection" "3.391.0" + "@aws-sdk/middleware-signing" "3.391.0" + "@aws-sdk/middleware-user-agent" "3.391.0" + "@aws-sdk/types" "3.391.0" + "@aws-sdk/util-endpoints" "3.391.0" + "@aws-sdk/util-user-agent-browser" "3.391.0" + "@aws-sdk/util-user-agent-node" "3.391.0" + "@smithy/config-resolver" "^2.0.3" + "@smithy/fetch-http-handler" "^2.0.3" + "@smithy/hash-node" "^2.0.3" + "@smithy/invalid-dependency" "^2.0.3" + "@smithy/middleware-content-length" "^2.0.3" + "@smithy/middleware-endpoint" "^2.0.3" + "@smithy/middleware-retry" "^2.0.3" + "@smithy/middleware-serde" "^2.0.3" + "@smithy/middleware-stack" "^2.0.0" + "@smithy/node-config-provider" "^2.0.3" + "@smithy/node-http-handler" "^2.0.3" + "@smithy/protocol-http" "^2.0.3" + "@smithy/smithy-client" "^2.0.3" + "@smithy/types" "^2.2.0" + "@smithy/url-parser" "^2.0.3" + "@smithy/util-base64" "^2.0.0" + "@smithy/util-body-length-browser" "^2.0.0" + "@smithy/util-body-length-node" "^2.0.0" + "@smithy/util-defaults-mode-browser" "^2.0.3" + "@smithy/util-defaults-mode-node" "^2.0.3" + "@smithy/util-retry" "^2.0.0" + "@smithy/util-utf8" "^2.0.0" + tslib "^2.5.0" + "@aws-sdk/credential-provider-cognito-identity@3.391.0": version "3.391.0" resolved "https://registry.npmjs.org/@aws-sdk/credential-provider-cognito-identity/-/credential-provider-cognito-identity-3.391.0.tgz#07b2b92e1528de4df38bd0b8153a13b605c18f84" @@ -1116,6 +1240,22 @@ "@smithy/types" "^2.2.0" tslib "^2.5.0" +"@aws-sdk/credential-provider-ini@3.395.0": + version "3.395.0" + resolved "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.395.0.tgz#d8d85300bcf3888a09c95700a5d5a24e10a44def" + integrity sha512-t7cWs+syJsSkj9NGdKyZ1t/+nYQyOec2nPjTtPWwKs8D7rvH3IMIgJwkvAGNzYaiIoIpXXx0wgCqys84TSEIYQ== + dependencies: + "@aws-sdk/credential-provider-env" "3.391.0" + "@aws-sdk/credential-provider-process" "3.391.0" + "@aws-sdk/credential-provider-sso" "3.395.0" + "@aws-sdk/credential-provider-web-identity" "3.391.0" + "@aws-sdk/types" "3.391.0" + "@smithy/credential-provider-imds" "^2.0.0" + "@smithy/property-provider" "^2.0.0" + "@smithy/shared-ini-file-loader" "^2.0.0" + "@smithy/types" "^2.2.0" + tslib "^2.5.0" + "@aws-sdk/credential-provider-node@3.391.0": version "3.391.0" resolved "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.391.0.tgz#4f88dadb80aa4428378df0b23fb1dbb7c3e5c109" @@ -1133,6 +1273,23 @@ "@smithy/types" "^2.2.0" tslib "^2.5.0" +"@aws-sdk/credential-provider-node@3.395.0": + version "3.395.0" + resolved "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.395.0.tgz#79ebf5c9c9245a07ef8d9cf88b3083f35c239628" + integrity sha512-qJawWTYf5L7Z1Is0sSJEYc4e96Qd0HWGqluO2h9qoUNrRREZ9RSxsDq+LGxVVAYLupYFcIFtiCnA/MoBBIWhzg== + dependencies: + "@aws-sdk/credential-provider-env" "3.391.0" + "@aws-sdk/credential-provider-ini" "3.395.0" + "@aws-sdk/credential-provider-process" "3.391.0" + "@aws-sdk/credential-provider-sso" "3.395.0" + "@aws-sdk/credential-provider-web-identity" "3.391.0" + "@aws-sdk/types" "3.391.0" + "@smithy/credential-provider-imds" "^2.0.0" + "@smithy/property-provider" "^2.0.0" + "@smithy/shared-ini-file-loader" "^2.0.0" + "@smithy/types" "^2.2.0" + tslib "^2.5.0" + "@aws-sdk/credential-provider-process@3.391.0": version "3.391.0" resolved "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.391.0.tgz#7f008fa719680dfeab35d77fa6787b7b31b62143" @@ -1157,6 +1314,19 @@ "@smithy/types" "^2.2.0" tslib "^2.5.0" +"@aws-sdk/credential-provider-sso@3.395.0": + version "3.395.0" + resolved "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.395.0.tgz#b3362c6afd72b52ce9438c1715f3ed90358cd355" + integrity sha512-wAoHG9XqO0L8TvJv4cjwN/2XkYskp0cbnupKKTJm+D29MYcctKEtL0aYOHxaNN2ECAYxIFIQDdlo62GKb3nJ5Q== + dependencies: + "@aws-sdk/client-sso" "3.395.0" + "@aws-sdk/token-providers" "3.391.0" + "@aws-sdk/types" "3.391.0" + "@smithy/property-provider" "^2.0.0" + "@smithy/shared-ini-file-loader" "^2.0.0" + "@smithy/types" "^2.2.0" + tslib "^2.5.0" + "@aws-sdk/credential-provider-web-identity@3.391.0": version "3.391.0" resolved "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.391.0.tgz#c27aa6f2a215601a444ad7e3259f3ed55ccb39e7"