From a584b509e8d84d800a905d28b95dc04072762403 Mon Sep 17 00:00:00 2001 From: Francis Date: Fri, 8 Sep 2023 13:49:15 -0700 Subject: [PATCH 1/3] generate correct logical ids Signed-off-by: Francis --- .../aws-cdk-global-table.assets.json | 4 +- .../aws-cdk-global-table.template.json | 2 +- .../manifest.json | 8 +- .../tree.json | 366 ++++---- .../BarStack.assets.json | 4 +- .../BarStack.template.json | 4 +- .../index.js | 804 ++++++++++++++++-- ...efaultTestDeployAssertD4C775F5.assets.json | 10 +- ...aultTestDeployAssertD4C775F5.template.json | 4 +- .../manifest.json | 10 +- .../tree.json | 84 +- .../aws-cdk-lib/aws-dynamodb/lib/table-v2.ts | 2 +- .../aws-dynamodb/test/table-v2.test.ts | 21 +- 13 files changed, 1024 insertions(+), 299 deletions(-) rename packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/{asset.c7f4a8ca56d10961cf5e40d181faddf14f2ea8b39c5d65c7b61a366b17c7a2ce.bundle => asset.d4087f9b90522f437499693de83d9bb1d3d93a99d4d34dad4625e71132244692.bundle}/index.js (99%) diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-global.js.snapshot/aws-cdk-global-table.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-global.js.snapshot/aws-cdk-global-table.assets.json index 4b20ad0e2e0b6..2a47502d9bdf3 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-global.js.snapshot/aws-cdk-global-table.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-global.js.snapshot/aws-cdk-global-table.assets.json @@ -1,7 +1,7 @@ { "version": "34.0.0", "files": { - "68a3bb36a940031cf3b515e0cad696adef98469abd9e58c2eb45fb68296fcd2e": { + "116ecd47ef9b5b3d293d7b3733b6a742a38eb54e2d54d79f9009fdbbb8c36dff": { "source": { "path": "aws-cdk-global-table.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-us-east-1": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-us-east-1", - "objectKey": "68a3bb36a940031cf3b515e0cad696adef98469abd9e58c2eb45fb68296fcd2e.json", + "objectKey": "116ecd47ef9b5b3d293d7b3733b6a742a38eb54e2d54d79f9009fdbbb8c36dff.json", "region": "us-east-1", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-us-east-1" } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-global.js.snapshot/aws-cdk-global-table.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-global.js.snapshot/aws-cdk-global-table.template.json index dd2eb52a30fc9..a441ef44c2b15 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-global.js.snapshot/aws-cdk-global-table.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-global.js.snapshot/aws-cdk-global-table.template.json @@ -19,7 +19,7 @@ } } }, - "Resource": { + "GlobalTable89F068B2": { "Type": "AWS::DynamoDB::GlobalTable", "Properties": { "AttributeDefinitions": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-global.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-global.js.snapshot/manifest.json index 6e9df0a0c378d..9f5f8980ccc4a 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-global.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-global.js.snapshot/manifest.json @@ -17,7 +17,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-us-east-1", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-us-east-1", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-us-east-1/68a3bb36a940031cf3b515e0cad696adef98469abd9e58c2eb45fb68296fcd2e.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-us-east-1/116ecd47ef9b5b3d293d7b3733b6a742a38eb54e2d54d79f9009fdbbb8c36dff.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -49,14 +49,14 @@ { "type": "aws:cdk:hasPhysicalName", "data": { - "Ref": "Resource" + "Ref": "GlobalTable89F068B2" } } ], - "/aws-cdk-global-table/Resource": [ + "/aws-cdk-global-table/GlobalTable/Resource": [ { "type": "aws:cdk:logicalId", - "data": "Resource" + "data": "GlobalTable89F068B2" } ], "/aws-cdk-global-table/BootstrapVersion": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-global.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-global.js.snapshot/tree.json index de3eb344b4a9c..88de97ce10b61 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-global.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-global.js.snapshot/tree.json @@ -56,237 +56,239 @@ "GlobalTable": { "id": "GlobalTable", "path": "aws-cdk-global-table/GlobalTable", - "constructInfo": { - "fqn": "aws-cdk-lib.aws_dynamodb.TableV2", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-cdk-global-table/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::DynamoDB::GlobalTable", - "aws:cdk:cloudformation:props": { - "attributeDefinitions": [ - { - "attributeName": "pk", - "attributeType": "S" - }, - { - "attributeName": "sk", - "attributeType": "N" - } - ], - "billingMode": "PROVISIONED", - "globalSecondaryIndexes": [ - { - "indexName": "gsi1", - "keySchema": [ - { - "attributeName": "pk", - "keyType": "HASH" - } - ], - "projection": { - "projectionType": "ALL" - }, - "writeProvisionedThroughputSettings": { - "writeCapacityAutoScalingSettings": { - "minCapacity": 1, - "maxCapacity": 20, - "targetTrackingScalingPolicyConfiguration": { - "targetValue": 60 - } - } - } - }, - { - "indexName": "gsi2", - "keySchema": [ - { - "attributeName": "pk", - "keyType": "HASH" - } - ], - "projection": { - "projectionType": "ALL" - }, - "writeProvisionedThroughputSettings": { - "writeCapacityAutoScalingSettings": { - "minCapacity": 1, - "maxCapacity": 30, - "targetTrackingScalingPolicyConfiguration": { - "targetValue": 70 - } - } - } - } - ], - "keySchema": [ - { - "attributeName": "pk", - "keyType": "HASH" - }, - { - "attributeName": "sk", - "keyType": "RANGE" - } - ], - "localSecondaryIndexes": [ - { - "indexName": "lsi", - "keySchema": [ + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-global-table/GlobalTable/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::GlobalTable", + "aws:cdk:cloudformation:props": { + "attributeDefinitions": [ { "attributeName": "pk", - "keyType": "HASH" + "attributeType": "S" }, { "attributeName": "sk", - "keyType": "RANGE" + "attributeType": "N" } ], - "projection": { - "projectionType": "ALL" - } - } - ], - "replicas": [ - { - "region": "us-east-2", + "billingMode": "PROVISIONED", "globalSecondaryIndexes": [ { "indexName": "gsi1", - "readProvisionedThroughputSettings": { - "readCapacityUnits": 10 + "keySchema": [ + { + "attributeName": "pk", + "keyType": "HASH" + } + ], + "projection": { + "projectionType": "ALL" }, - "contributorInsightsSpecification": { - "enabled": true + "writeProvisionedThroughputSettings": { + "writeCapacityAutoScalingSettings": { + "minCapacity": 1, + "maxCapacity": 20, + "targetTrackingScalingPolicyConfiguration": { + "targetValue": 60 + } + } } }, { "indexName": "gsi2", - "readProvisionedThroughputSettings": { - "readCapacityUnits": 10 + "keySchema": [ + { + "attributeName": "pk", + "keyType": "HASH" + } + ], + "projection": { + "projectionType": "ALL" }, - "contributorInsightsSpecification": { - "enabled": false + "writeProvisionedThroughputSettings": { + "writeCapacityAutoScalingSettings": { + "minCapacity": 1, + "maxCapacity": 30, + "targetTrackingScalingPolicyConfiguration": { + "targetValue": 70 + } + } } } ], - "tableClass": "STANDARD_INFREQUENT_ACCESS", - "contributorInsightsSpecification": { - "enabled": true - }, - "pointInTimeRecoverySpecification": { - "pointInTimeRecoveryEnabled": true - }, - "readProvisionedThroughputSettings": { - "readCapacityAutoScalingSettings": { - "minCapacity": 5, - "maxCapacity": 25, - "targetTrackingScalingPolicyConfiguration": { - "targetValue": 70 - } - } - } - }, - { - "region": "us-west-2", - "globalSecondaryIndexes": [ + "keySchema": [ { - "indexName": "gsi1", - "readProvisionedThroughputSettings": { - "readCapacityUnits": 15 - } + "attributeName": "pk", + "keyType": "HASH" }, { - "indexName": "gsi2", - "readProvisionedThroughputSettings": { - "readCapacityUnits": 10 - }, - "contributorInsightsSpecification": { - "enabled": true + "attributeName": "sk", + "keyType": "RANGE" + } + ], + "localSecondaryIndexes": [ + { + "indexName": "lsi", + "keySchema": [ + { + "attributeName": "pk", + "keyType": "HASH" + }, + { + "attributeName": "sk", + "keyType": "RANGE" + } + ], + "projection": { + "projectionType": "ALL" } } ], - "tableClass": "STANDARD", - "contributorInsightsSpecification": { - "enabled": false - }, - "pointInTimeRecoverySpecification": { - "pointInTimeRecoveryEnabled": true - }, - "readProvisionedThroughputSettings": { - "readCapacityUnits": 10 - } - }, - { - "region": "us-east-1", - "globalSecondaryIndexes": [ + "replicas": [ { - "indexName": "gsi1", - "readProvisionedThroughputSettings": { - "readCapacityUnits": 10 - }, + "region": "us-east-2", + "globalSecondaryIndexes": [ + { + "indexName": "gsi1", + "readProvisionedThroughputSettings": { + "readCapacityUnits": 10 + }, + "contributorInsightsSpecification": { + "enabled": true + } + }, + { + "indexName": "gsi2", + "readProvisionedThroughputSettings": { + "readCapacityUnits": 10 + }, + "contributorInsightsSpecification": { + "enabled": false + } + } + ], + "tableClass": "STANDARD_INFREQUENT_ACCESS", "contributorInsightsSpecification": { "enabled": true + }, + "pointInTimeRecoverySpecification": { + "pointInTimeRecoveryEnabled": true + }, + "readProvisionedThroughputSettings": { + "readCapacityAutoScalingSettings": { + "minCapacity": 5, + "maxCapacity": 25, + "targetTrackingScalingPolicyConfiguration": { + "targetValue": 70 + } + } } }, { - "indexName": "gsi2", + "region": "us-west-2", + "globalSecondaryIndexes": [ + { + "indexName": "gsi1", + "readProvisionedThroughputSettings": { + "readCapacityUnits": 15 + } + }, + { + "indexName": "gsi2", + "readProvisionedThroughputSettings": { + "readCapacityUnits": 10 + }, + "contributorInsightsSpecification": { + "enabled": true + } + } + ], + "tableClass": "STANDARD", + "contributorInsightsSpecification": { + "enabled": false + }, + "pointInTimeRecoverySpecification": { + "pointInTimeRecoveryEnabled": true + }, "readProvisionedThroughputSettings": { "readCapacityUnits": 10 + } + }, + { + "region": "us-east-1", + "globalSecondaryIndexes": [ + { + "indexName": "gsi1", + "readProvisionedThroughputSettings": { + "readCapacityUnits": 10 + }, + "contributorInsightsSpecification": { + "enabled": true + } + }, + { + "indexName": "gsi2", + "readProvisionedThroughputSettings": { + "readCapacityUnits": 10 + }, + "contributorInsightsSpecification": { + "enabled": true + } + } + ], + "tableClass": "STANDARD_INFREQUENT_ACCESS", + "kinesisStreamSpecification": { + "streamArn": { + "Fn::GetAtt": [ + "Stream790BDEE4", + "Arn" + ] + } }, "contributorInsightsSpecification": { "enabled": true + }, + "pointInTimeRecoverySpecification": { + "pointInTimeRecoveryEnabled": true + }, + "readProvisionedThroughputSettings": { + "readCapacityUnits": 10 } } ], - "tableClass": "STANDARD_INFREQUENT_ACCESS", - "kinesisStreamSpecification": { - "streamArn": { - "Fn::GetAtt": [ - "Stream790BDEE4", - "Arn" - ] - } + "sseSpecification": { + "sseEnabled": true, + "sseType": "KMS" }, - "contributorInsightsSpecification": { - "enabled": true + "streamSpecification": { + "streamViewType": "NEW_AND_OLD_IMAGES" }, - "pointInTimeRecoverySpecification": { - "pointInTimeRecoveryEnabled": true + "tableName": "my-global-table", + "timeToLiveSpecification": { + "attributeName": "attr", + "enabled": true }, - "readProvisionedThroughputSettings": { - "readCapacityUnits": 10 + "writeProvisionedThroughputSettings": { + "writeCapacityAutoScalingSettings": { + "minCapacity": 1, + "maxCapacity": 20, + "targetTrackingScalingPolicyConfiguration": { + "targetValue": 60 + } + } } } - ], - "sseSpecification": { - "sseEnabled": true, - "sseType": "KMS" }, - "streamSpecification": { - "streamViewType": "NEW_AND_OLD_IMAGES" - }, - "tableName": "my-global-table", - "timeToLiveSpecification": { - "attributeName": "attr", - "enabled": true - }, - "writeProvisionedThroughputSettings": { - "writeCapacityAutoScalingSettings": { - "minCapacity": 1, - "maxCapacity": 20, - "targetTrackingScalingPolicyConfiguration": { - "targetValue": 60 - } - } + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.CfnGlobalTable", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_dynamodb.CfnGlobalTable", + "fqn": "aws-cdk-lib.aws_dynamodb.TableV2", "version": "0.0.0" } }, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/BarStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/BarStack.assets.json index 8bffb8580aa8b..e66b1e8c4cece 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/BarStack.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/BarStack.assets.json @@ -15,7 +15,7 @@ } } }, - "ae0dd0d32332147cd7ad825eef90902d72051b1cb41575b1da051ae1432ceeb3": { + "1df2a063637431950933d7ccf8615a083531eab4220b10ff7fd125499eef355e": { "source": { "path": "BarStack.template.json", "packaging": "file" @@ -23,7 +23,7 @@ "destinations": { "current_account-us-east-1": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-us-east-1", - "objectKey": "ae0dd0d32332147cd7ad825eef90902d72051b1cb41575b1da051ae1432ceeb3.json", + "objectKey": "1df2a063637431950933d7ccf8615a083531eab4220b10ff7fd125499eef355e.json", "region": "us-east-1", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-us-east-1" } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/BarStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/BarStack.template.json index a674ebcf18684..ada39aca0694c 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/BarStack.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/BarStack.template.json @@ -55,7 +55,7 @@ }, ":table/", { - "Ref": "Resource" + "Ref": "GlobalTable89F068B2" } ] ] @@ -96,7 +96,7 @@ "FunctionServiceRole675BB04A" ] }, - "Resource": { + "GlobalTable89F068B2": { "Type": "AWS::DynamoDB::GlobalTable", "Properties": { "AttributeDefinitions": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/asset.c7f4a8ca56d10961cf5e40d181faddf14f2ea8b39c5d65c7b61a366b17c7a2ce.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/asset.d4087f9b90522f437499693de83d9bb1d3d93a99d4d34dad4625e71132244692.bundle/index.js similarity index 99% rename from packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/asset.c7f4a8ca56d10961cf5e40d181faddf14f2ea8b39c5d65c7b61a366b17c7a2ce.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/asset.d4087f9b90522f437499693de83d9bb1d3d93a99d4d34dad4625e71132244692.bundle/index.js index c90588a2c6499..3f961c84ea7a1 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/asset.c7f4a8ca56d10961cf5e40d181faddf14f2ea8b39c5d65c7b61a366b17c7a2ce.bundle/index.js +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/asset.d4087f9b90522f437499693de83d9bb1d3d93a99d4d34dad4625e71132244692.bundle/index.js @@ -2275,20 +2275,25 @@ var require_chain = __commonJS({ Object.defineProperty(exports, "__esModule", { value: true }); exports.chain = void 0; var ProviderError_1 = require_ProviderError(); - function chain(...providers) { - return () => { - let promise = Promise.reject(new ProviderError_1.ProviderError("No providers in chain")); - for (const provider of providers) { - promise = promise.catch((err) => { - if (err === null || err === void 0 ? void 0 : err.tryNextLink) { - return provider(); - } - throw err; - }); + var chain = (...providers) => async () => { + if (providers.length === 0) { + throw new ProviderError_1.ProviderError("No providers in chain"); + } + let lastProviderError; + for (const provider of providers) { + try { + const credentials = await provider(); + return credentials; + } catch (err) { + lastProviderError = err; + if (err === null || err === void 0 ? void 0 : err.tryNextLink) { + continue; + } + throw err; } - return promise; - }; - } + } + throw lastProviderError; + }; exports.chain = chain; } }); @@ -10574,7 +10579,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.398.0", + version: "3.405.0", scripts: { build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", "build:cjs": "tsc -p tsconfig.cjs.json", @@ -10594,8 +10599,8 @@ var require_package = __commonJS({ dependencies: { "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/client-sts": "3.398.0", - "@aws-sdk/credential-provider-node": "3.398.0", + "@aws-sdk/client-sts": "3.405.0", + "@aws-sdk/credential-provider-node": "3.405.0", "@aws-sdk/middleware-host-header": "3.398.0", "@aws-sdk/middleware-logger": "3.398.0", "@aws-sdk/middleware-recursion-detection": "3.398.0", @@ -10604,7 +10609,7 @@ var require_package = __commonJS({ "@aws-sdk/types": "3.398.0", "@aws-sdk/util-endpoints": "3.398.0", "@aws-sdk/util-user-agent-browser": "3.398.0", - "@aws-sdk/util-user-agent-node": "3.398.0", + "@aws-sdk/util-user-agent-node": "3.405.0", "@smithy/config-resolver": "^2.0.5", "@smithy/fetch-http-handler": "^2.0.5", "@smithy/hash-node": "^2.0.5", @@ -10614,7 +10619,7 @@ var require_package = __commonJS({ "@smithy/middleware-retry": "^2.0.5", "@smithy/middleware-serde": "^2.0.5", "@smithy/middleware-stack": "^2.0.0", - "@smithy/node-config-provider": "^2.0.5", + "@smithy/node-config-provider": "^2.0.6", "@smithy/node-http-handler": "^2.0.5", "@smithy/protocol-http": "^2.0.5", "@smithy/smithy-client": "^2.0.5", @@ -10623,8 +10628,8 @@ var require_package = __commonJS({ "@smithy/util-base64": "^2.0.0", "@smithy/util-body-length-browser": "^2.0.0", "@smithy/util-body-length-node": "^2.1.0", - "@smithy/util-defaults-mode-browser": "^2.0.5", - "@smithy/util-defaults-mode-node": "^2.0.5", + "@smithy/util-defaults-mode-browser": "^2.0.6", + "@smithy/util-defaults-mode-node": "^2.0.6", "@smithy/util-retry": "^2.0.0", "@smithy/util-utf8": "^2.0.0", tslib: "^2.5.0" @@ -10713,7 +10718,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.398.0", + version: "3.405.0", scripts: { build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", "build:cjs": "tsc -p tsconfig.cjs.json", @@ -10735,7 +10740,7 @@ 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.398.0", + "@aws-sdk/credential-provider-node": "3.405.0", "@aws-sdk/middleware-host-header": "3.398.0", "@aws-sdk/middleware-logger": "3.398.0", "@aws-sdk/middleware-recursion-detection": "3.398.0", @@ -10745,7 +10750,7 @@ var require_package2 = __commonJS({ "@aws-sdk/types": "3.398.0", "@aws-sdk/util-endpoints": "3.398.0", "@aws-sdk/util-user-agent-browser": "3.398.0", - "@aws-sdk/util-user-agent-node": "3.398.0", + "@aws-sdk/util-user-agent-node": "3.405.0", "@smithy/config-resolver": "^2.0.5", "@smithy/fetch-http-handler": "^2.0.5", "@smithy/hash-node": "^2.0.5", @@ -10755,7 +10760,7 @@ var require_package2 = __commonJS({ "@smithy/middleware-retry": "^2.0.5", "@smithy/middleware-serde": "^2.0.5", "@smithy/middleware-stack": "^2.0.0", - "@smithy/node-config-provider": "^2.0.5", + "@smithy/node-config-provider": "^2.0.6", "@smithy/node-http-handler": "^2.0.5", "@smithy/protocol-http": "^2.0.5", "@smithy/smithy-client": "^2.0.5", @@ -10764,8 +10769,8 @@ var require_package2 = __commonJS({ "@smithy/util-base64": "^2.0.0", "@smithy/util-body-length-browser": "^2.0.0", "@smithy/util-body-length-node": "^2.1.0", - "@smithy/util-defaults-mode-browser": "^2.0.5", - "@smithy/util-defaults-mode-node": "^2.0.5", + "@smithy/util-defaults-mode-browser": "^2.0.6", + "@smithy/util-defaults-mode-node": "^2.0.6", "@smithy/util-retry": "^2.0.0", "@smithy/util-utf8": "^2.0.0", "fast-xml-parser": "4.2.5", @@ -13944,6 +13949,14 @@ var require_getHomeDir = __commonJS({ exports.getHomeDir = void 0; var os_1 = require("os"); var path_1 = require("path"); + var process_1 = require("process"); + var homeDirCache = {}; + var getHomeDirCacheKey = () => { + if (process_1.geteuid) { + return `${(0, process_1.geteuid)()}`; + } + return "DEFAULT"; + }; var getHomeDir = () => { const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${path_1.sep}` } = process.env; if (HOME) @@ -13952,7 +13965,10 @@ var require_getHomeDir = __commonJS({ return USERPROFILE; if (HOMEPATH) return `${HOMEDRIVE}${HOMEPATH}`; - return (0, os_1.homedir)(); + const homeDirCacheKey = getHomeDirCacheKey(); + if (!homeDirCache[homeDirCacheKey]) + homeDirCache[homeDirCacheKey] = (0, os_1.homedir)(); + return homeDirCache[homeDirCacheKey]; }; exports.getHomeDir = getHomeDir; } @@ -14984,7 +15000,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.398.0", + version: "3.405.0", scripts: { build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", "build:cjs": "tsc -p tsconfig.cjs.json", @@ -15011,7 +15027,7 @@ var require_package3 = __commonJS({ "@aws-sdk/types": "3.398.0", "@aws-sdk/util-endpoints": "3.398.0", "@aws-sdk/util-user-agent-browser": "3.398.0", - "@aws-sdk/util-user-agent-node": "3.398.0", + "@aws-sdk/util-user-agent-node": "3.405.0", "@smithy/config-resolver": "^2.0.5", "@smithy/fetch-http-handler": "^2.0.5", "@smithy/hash-node": "^2.0.5", @@ -15021,7 +15037,7 @@ var require_package3 = __commonJS({ "@smithy/middleware-retry": "^2.0.5", "@smithy/middleware-serde": "^2.0.5", "@smithy/middleware-stack": "^2.0.0", - "@smithy/node-config-provider": "^2.0.5", + "@smithy/node-config-provider": "^2.0.6", "@smithy/node-http-handler": "^2.0.5", "@smithy/protocol-http": "^2.0.5", "@smithy/smithy-client": "^2.0.5", @@ -15030,8 +15046,8 @@ var require_package3 = __commonJS({ "@smithy/util-base64": "^2.0.0", "@smithy/util-body-length-browser": "^2.0.0", "@smithy/util-body-length-node": "^2.1.0", - "@smithy/util-defaults-mode-browser": "^2.0.5", - "@smithy/util-defaults-mode-node": "^2.0.5", + "@smithy/util-defaults-mode-browser": "^2.0.6", + "@smithy/util-defaults-mode-node": "^2.0.6", "@smithy/util-retry": "^2.0.0", "@smithy/util-utf8": "^2.0.0", tslib: "^2.5.0" @@ -30859,6 +30875,632 @@ var require_lib4 = __commonJS({ } }); +// ../sdk-v2-to-v3-adapter/lib/parameter-types.ts +var UINT8ARRAY_PARAMETERS; +var init_parameter_types = __esm({ + "../sdk-v2-to-v3-adapter/lib/parameter-types.ts"() { + "use strict"; + UINT8ARRAY_PARAMETERS = { + "acm": { + "exportcertificate": [ + "Passphrase" + ], + "importcertificate": [ + "Certificate", + "CertificateChain", + "PrivateKey" + ] + }, + "acm-pca": { + "importcertificateauthoritycertificate": [ + "Certificate", + "CertificateChain" + ], + "issuecertificate": [ + "Csr" + ] + }, + "apigateway": { + "importapikeys": [ + "body" + ], + "importdocumentationparts": [ + "body" + ], + "importrestapi": [ + "body" + ], + "putrestapi": [ + "body" + ], + "posttoconnection": [ + "Data" + ] + }, + "appconfig": { + "createhostedconfigurationversion": [ + "Content" + ] + }, + "appsync": { + "startschemacreation": [ + "definition" + ] + }, + "awsmobilehubservice": { + "createproject": [ + "contents" + ], + "updateproject": [ + "contents" + ] + }, + "backup-storage": { + "notifyobjectcomplete": [ + "MetadataBlob" + ], + "putchunk": [ + "Data" + ], + "putobject": [ + "InlineChunk" + ] + }, + "cloudfront": { + "createfunction": [ + "FunctionCode" + ], + "testfunction": [ + "EventObject" + ], + "updatefunction": [ + "FunctionCode" + ] + }, + "cloudsearch": { + "uploaddocuments": [ + "documents" + ] + }, + "codeartifact": { + "publishpackageversion": [ + "assetContent" + ] + }, + "codecommit": { + "createcommit": [ + "putFiles.*.fileContent" + ], + "createunreferencedmergecommit": [ + "conflictResolution.replaceContents.*.content" + ], + "mergebranchesbysquash": [ + "conflictResolution.replaceContents.*.content" + ], + "mergebranchesbythreeway": [ + "conflictResolution.replaceContents.*.content" + ], + "mergepullrequestbysquash": [ + "conflictResolution.replaceContents.*.content" + ], + "mergepullrequestbythreeway": [ + "conflictResolution.replaceContents.*.content" + ], + "putfile": [ + "fileContent" + ] + }, + "cognito-idp": { + "setuicustomization": [ + "ImageFile" + ] + }, + "comprehend": { + "classifydocument": [ + "Bytes" + ], + "detectentities": [ + "Bytes" + ] + }, + "datasync": { + "createlocationhdfs": [ + "KerberosKeytab", + "KerberosKrb5Conf" + ], + "createlocationobjectstorage": [ + "ServerCertificate" + ], + "updatelocationhdfs": [ + "KerberosKeytab", + "KerberosKrb5Conf" + ], + "updatelocationobjectstorage": [ + "ServerCertificate" + ] + }, + "dms": { + "importcertificate": [ + "CertificateWallet" + ] + }, + "ebs": { + "putsnapshotblock": [ + "BlockData" + ] + }, + "ec2": { + "bundleinstance": [ + "Storage.S3.UploadPolicy" + ], + "importkeypair": [ + "PublicKeyMaterial" + ], + "modifyinstanceattribute": [ + "UserData.Value" + ] + }, + "ecr": { + "uploadlayerpart": [ + "layerPartBlob" + ] + }, + "ecr-public": { + "createrepository": [ + "catalogData.logoImageBlob" + ], + "putrepositorycatalogdata": [ + "catalogData.logoImageBlob" + ], + "uploadlayerpart": [ + "layerPartBlob" + ] + }, + "firehose": { + "putrecord": [ + "Record.Data" + ], + "putrecordbatch": [ + "Records.*.Data" + ] + }, + "gamelift": { + "createscript": [ + "ZipFile" + ], + "updatescript": [ + "ZipFile" + ] + }, + "gamesparks": { + "importgameconfiguration": [ + "ImportSource.File" + ] + }, + "glacier": { + "uploadarchive": [ + "body" + ], + "uploadmultipartpart": [ + "body" + ] + }, + "glue": { + "updatecolumnstatisticsforpartition": [ + "ColumnStatisticsList.*.StatisticsData.DecimalColumnStatisticsData.MaximumValue.UnscaledValue" + ], + "updatecolumnstatisticsfortable": [ + "ColumnStatisticsList.*.StatisticsData.DecimalColumnStatisticsData.MaximumValue.UnscaledValue" + ] + }, + "greengrass": { + "createcomponentversion": [ + "inlineRecipe" + ] + }, + "iot": { + "createotaupdate": [ + "files.*.codeSigning.customCodeSigning.signature.inlineDocument" + ], + "testinvokeauthorizer": [ + "mqttContext.password" + ] + }, + "iotanalytics": { + "batchputmessage": [ + "messages.*.payload" + ], + "runpipelineactivity": [ + "payloads.*" + ] + }, + "iotdata": { + "publish": [ + "payload" + ], + "updatethingshadow": [ + "payload" + ] + }, + "ioteventsdata": { + "batchputmessage": [ + "messages.*.payload" + ] + }, + "iotsitewise": { + "createportal": [ + "portalLogoImageFile.data" + ], + "updateportal": [ + "portalLogoImage.file.data" + ] + }, + "iotwireless": { + "updateresourceposition": [ + "GeoJsonPayload" + ] + }, + "kafka": { + "createconfiguration": [ + "ServerProperties" + ], + "updateconfiguration": [ + "ServerProperties" + ] + }, + "kendra": { + "batchputdocument": [ + "Documents.*.Blob" + ] + }, + "kinesis": { + "putrecord": [ + "Data" + ], + "putrecords": [ + "Records.*.Data" + ] + }, + "kinesisanalytics": { + "createapplication": [ + "ApplicationConfiguration.ApplicationCodeConfiguration.CodeContent.ZipFileContent" + ], + "updateapplication": [ + "ApplicationConfigurationUpdate.ApplicationCodeConfigurationUpdate.CodeContentUpdate.ZipFileContentUpdate" + ] + }, + "kms": { + "decrypt": [ + "CiphertextBlob", + "Recipient.AttestationDocument" + ], + "encrypt": [ + "Plaintext" + ], + "generatedatakey": [ + "Recipient.AttestationDocument" + ], + "generatedatakeypair": [ + "Recipient.AttestationDocument" + ], + "generatemac": [ + "Message" + ], + "generaterandom": [ + "Recipient.AttestationDocument" + ], + "importkeymaterial": [ + "EncryptedKeyMaterial" + ], + "reencrypt": [ + "CiphertextBlob" + ], + "sign": [ + "Message" + ], + "verify": [ + "Message", + "Signature" + ], + "verifymac": [ + "Mac", + "Message" + ] + }, + "lambda": { + "createfunction": [ + "Code.ZipFile" + ], + "invoke": [ + "Payload" + ], + "invokeasync": [ + "InvokeArgs" + ], + "invokewithresponsestream": [ + "Payload" + ], + "publishlayerversion": [ + "Content.ZipFile" + ], + "updatefunctioncode": [ + "ZipFile" + ] + }, + "lex": { + "startimport": [ + "payload" + ], + "postcontent": [ + "inputStream" + ], + "recognizeutterance": [ + "inputStream" + ] + }, + "lookoutvision": { + "detectanomalies": [ + "Body" + ], + "updatedatasetentries": [ + "Changes" + ] + }, + "mediastore": { + "putobject": [ + "Body" + ] + }, + "mobiletargeting": { + "sendmessages": [ + "MessageRequest.MessageConfiguration.EmailMessage.RawEmail.Data" + ], + "sendusersmessages": [ + "SendUsersMessageRequest.MessageConfiguration.EmailMessage.RawEmail.Data" + ] + }, + "qldb": { + "sendcommand": [ + "CommitTransaction.CommitDigest", + "ExecuteStatement.Parameters.*.IonBinary" + ] + }, + "quicksight": { + "startassetbundleimportjob": [ + "AssetBundleImportSource.Body" + ] + }, + "rekognition": { + "comparefaces": [ + "SourceImage.Bytes" + ], + "detectcustomlabels": [ + "Image.Bytes" + ], + "detectfaces": [ + "Image.Bytes" + ], + "detectlabels": [ + "Image.Bytes" + ], + "detectmoderationlabels": [ + "Image.Bytes" + ], + "detectprotectiveequipment": [ + "Image.Bytes" + ], + "detecttext": [ + "Image.Bytes" + ], + "indexfaces": [ + "Image.Bytes" + ], + "recognizecelebrities": [ + "Image.Bytes" + ], + "searchfacesbyimage": [ + "Image.Bytes" + ], + "searchusersbyimage": [ + "Image.Bytes" + ], + "updatedatasetentries": [ + "Changes.GroundTruth" + ] + }, + "s3": { + "putobject": [ + "Body" + ], + "uploadpart": [ + "Body" + ], + "writegetobjectresponse": [ + "Body" + ] + }, + "sagemaker": { + "invokeendpoint": [ + "Body" + ], + "invokeendpointwithresponsestream": [ + "Body" + ] + }, + "secretsmanager": { + "createsecret": [ + "SecretBinary" + ], + "putsecretvalue": [ + "SecretBinary" + ], + "updatesecret": [ + "SecretBinary" + ] + }, + "ses": { + "createdeliverabilitytestreport": [ + "Content.Raw.Data", + "Content.Raw.Data" + ], + "sendemail": [ + "Content.Raw.Data", + "Content.Raw.Data" + ], + "sendrawemail": [ + "RawMessage.Data" + ] + }, + "signer": { + "signpayload": [ + "payload" + ] + }, + "ssm": { + "registertaskwithmaintenancewindow": [ + "TaskInvocationParameters.Lambda.Payload" + ], + "updatemaintenancewindowtask": [ + "TaskInvocationParameters.Lambda.Payload" + ] + }, + "support": { + "addattachmentstoset": [ + "attachments.*.data" + ] + }, + "synthetics": { + "createcanary": [ + "Code.ZipFile" + ], + "updatecanary": [ + "Code.ZipFile" + ] + }, + "textract": { + "analyzedocument": [ + "Document.Bytes" + ], + "analyzeexpense": [ + "Document.Bytes" + ], + "analyzeid": [ + "DocumentPages.*.Bytes" + ], + "detectdocumenttext": [ + "Document.Bytes" + ] + }, + "translate": { + "importterminology": [ + "TerminologyData.File" + ], + "translatedocument": [ + "Document.Content" + ] + }, + "waf": { + "updatebytematchset": [ + "Updates.*.ByteMatchTuple.TargetString" + ] + }, + "waf-regional": { + "updatebytematchset": [ + "Updates.*.ByteMatchTuple.TargetString" + ] + }, + "wafv2": { + "checkcapacity": [ + "Rules.*.Statement.ByteMatchStatement.SearchString" + ], + "createrulegroup": [ + "Rules.*.Statement.ByteMatchStatement.SearchString" + ], + "createwebacl": [ + "Rules.*.Statement.ByteMatchStatement.SearchString" + ], + "updaterulegroup": [ + "Rules.*.Statement.ByteMatchStatement.SearchString" + ], + "updatewebacl": [ + "Rules.*.Statement.ByteMatchStatement.SearchString" + ] + }, + "workspaces": { + "importclientbranding": [ + "DeviceTypeAndroid.Logo", + "DeviceTypeIos.Logo", + "DeviceTypeIos.Logo2x", + "DeviceTypeIos.Logo3x" + ] + } + }; + } +}); + +// ../sdk-v2-to-v3-adapter/lib/coerce-api-parameters.ts +var coerce_api_parameters_exports = {}; +__export(coerce_api_parameters_exports, { + coerceApiParametersToUint8Array: () => coerceApiParametersToUint8Array, + coerceToUint8Array: () => coerceToUint8Array +}); +function coerceApiParametersToUint8Array(service, action, parameters = {}) { + const pathsToCoerce = UINT8ARRAY_PARAMETERS?.[service.toLowerCase()]?.[action.toLowerCase()] ?? []; + for (const path of pathsToCoerce) { + coerceToUint8Array(parameters, path.split(".")); + } + return parameters; +} +function coerceToUint8Array(obj, path) { + if (path.length === 0) { + return coerceValueToUint8Array(obj); + } + if (path[0] === "*" && Array.isArray(obj)) { + return obj.map((e) => coerceToUint8Array(e, path.slice(1))); + } + if (obj && typeof obj === "object") { + if (path[0] in obj) { + obj[path[0]] = coerceToUint8Array(obj[path[0]], path.slice(1)); + } + return obj; + } + return obj; +} +function coerceValueToUint8Array(x) { + if (x instanceof Uint8Array) { + return x; + } + if (typeof x === "string" || typeof x === "number") { + return new TextEncoder().encode(x.toString()); + } + return x; +} +var init_coerce_api_parameters = __esm({ + "../sdk-v2-to-v3-adapter/lib/coerce-api-parameters.ts"() { + "use strict"; + init_parameter_types(); + } +}); + +// ../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/client-names.ts var CLIENT_NAMES; var init_client_names = __esm({ @@ -31340,22 +31982,51 @@ var init_get_v3_client_package_name = __esm({ } }); -// ../sdk-v2-to-v3-adapter/lib/find-client-constructor.ts -var find_client_constructor_exports = {}; -__export(find_client_constructor_exports, { - findV3ClientConstructor: () => findV3ClientConstructor +// ../sdk-v2-to-v3-adapter/lib/sdk-v3-helpers.ts +var sdk_v3_helpers_exports = {}; +__export(sdk_v3_helpers_exports, { + getV3Client: () => getV3Client, + getV3Command: () => getV3Command, + loadV3ClientPackage: () => loadV3ClientPackage }); -function findV3ClientConstructor(pkg) { - const [_clientName, ServiceClient] = Object.entries(pkg).find( - ([name]) => { - return name.endsWith("Client") && name !== "__Client"; - } - ); - return ServiceClient; +function loadV3ClientPackage(service) { + const packageName = service.startsWith("@aws-sdk/") ? service : getV3ClientPackageName(service); + try { + const pkg = require(packageName); + const { version: version2 } = require(packageName + "/package.json"); + return { + service: packageName.replace("@aws-sdk/client-", ""), + pkg, + packageName, + packageVersion: version2 + }; + } catch (e) { + throw Error(`Service ${service} client package with name '${packageName}' does not exist.`); + } } -var init_find_client_constructor = __esm({ - "../sdk-v2-to-v3-adapter/lib/find-client-constructor.ts"() { +function getV3Client(sdkPkg, clientOptions = {}) { + try { + const ServiceClient = findV3ClientConstructor(sdkPkg.pkg); + return new ServiceClient(clientOptions); + } catch (e) { + throw Error(`No client constructor found within package: ${sdkPkg.packageName}`); + } +} +function getV3Command(sdkPkg, action) { + const commandName = action.endsWith("Command") ? action : `${action}Command`; + const command = Object.entries(sdkPkg.pkg).find( + ([name]) => name.toLowerCase() === commandName.toLowerCase() + )?.[1]; + if (!command) { + throw new Error(`Unable to find command named: ${commandName} for api: ${action} in service package`); + } + return command; +} +var init_sdk_v3_helpers = __esm({ + "../sdk-v2-to-v3-adapter/lib/sdk-v3-helpers.ts"() { "use strict"; + init_find_client_constructor(); + init_get_v3_client_package_name(); } }); @@ -31363,16 +32034,41 @@ var init_find_client_constructor = __esm({ var require_lib5 = __commonJS({ "../sdk-v2-to-v3-adapter/lib/index.js"(exports) { "use strict"; + var __createBinding3 = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __exportStar3 = exports && exports.__exportStar || function(m, exports2) { + for (var p in m) + if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) + __createBinding3(exports2, m, p); + }; 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; + exports.getV3ClientPackageName = exports.findV3ClientConstructor = exports.coerceApiParametersToUint8Array = void 0; + var coerce_api_parameters_1 = (init_coerce_api_parameters(), __toCommonJS(coerce_api_parameters_exports)); + Object.defineProperty(exports, "coerceApiParametersToUint8Array", { enumerable: true, get: function() { + return coerce_api_parameters_1.coerceApiParametersToUint8Array; } }); 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; } }); + 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; + } }); + __exportStar3((init_sdk_v3_helpers(), __toCommonJS(sdk_v3_helpers_exports)), exports); } }); @@ -31682,12 +32378,20 @@ function parseJsonPayload(payload) { function decodeParameters(obj) { return Object.fromEntries(Object.entries(obj).map(([key, value]) => { try { - return [key, JSON.parse(value)]; + return [key, decodeValue(value)]; } catch { return [key, value]; } })); } +function decodeValue(value) { + if (value != null && !Array.isArray(value) && typeof value === "object") { + if (value.$type === "ArrayBufferView") { + return new TextEncoder().encode(value.string); + } + } + return JSON.parse(value); +} // lib/assertions/providers/lambda-handler/sdk.ts function flatten(object) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/awscdkglobaltablereplicaintegDefaultTestDeployAssertD4C775F5.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/awscdkglobaltablereplicaintegDefaultTestDeployAssertD4C775F5.assets.json index 332283a161659..2041adc633b96 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/awscdkglobaltablereplicaintegDefaultTestDeployAssertD4C775F5.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/awscdkglobaltablereplicaintegDefaultTestDeployAssertD4C775F5.assets.json @@ -1,20 +1,20 @@ { "version": "34.0.0", "files": { - "c7f4a8ca56d10961cf5e40d181faddf14f2ea8b39c5d65c7b61a366b17c7a2ce": { + "d4087f9b90522f437499693de83d9bb1d3d93a99d4d34dad4625e71132244692": { "source": { - "path": "asset.c7f4a8ca56d10961cf5e40d181faddf14f2ea8b39c5d65c7b61a366b17c7a2ce.bundle", + "path": "asset.d4087f9b90522f437499693de83d9bb1d3d93a99d4d34dad4625e71132244692.bundle", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "c7f4a8ca56d10961cf5e40d181faddf14f2ea8b39c5d65c7b61a366b17c7a2ce.zip", + "objectKey": "d4087f9b90522f437499693de83d9bb1d3d93a99d4d34dad4625e71132244692.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "d84b161adac191a3d95e0159eef748887619f5e395685d03abb2e6093b913505": { + "e679ff0ed7219610286b91fef2fccc9e00c903d344fa3d93358b440940c5a71e": { "source": { "path": "awscdkglobaltablereplicaintegDefaultTestDeployAssertD4C775F5.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "d84b161adac191a3d95e0159eef748887619f5e395685d03abb2e6093b913505.json", + "objectKey": "e679ff0ed7219610286b91fef2fccc9e00c903d344fa3d93358b440940c5a71e.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/awscdkglobaltablereplicaintegDefaultTestDeployAssertD4C775F5.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/awscdkglobaltablereplicaintegDefaultTestDeployAssertD4C775F5.template.json index 2e316c3e9e0dc..4439c0a52a352 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/awscdkglobaltablereplicaintegDefaultTestDeployAssertD4C775F5.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/awscdkglobaltablereplicaintegDefaultTestDeployAssertD4C775F5.template.json @@ -16,7 +16,7 @@ "FunctionName": "\"global-table-lambda\"" }, "flattenResponse": "false", - "salt": "1694006226261" + "salt": "1694205517464" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -111,7 +111,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "c7f4a8ca56d10961cf5e40d181faddf14f2ea8b39c5d65c7b61a366b17c7a2ce.zip" + "S3Key": "d4087f9b90522f437499693de83d9bb1d3d93a99d4d34dad4625e71132244692.zip" }, "Timeout": 120, "Handler": "index.handler", diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/manifest.json index 7a974a6403d4d..8dc1d0d7beefa 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/manifest.json @@ -17,7 +17,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-us-east-1", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-us-east-1", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-us-east-1/ae0dd0d32332147cd7ad825eef90902d72051b1cb41575b1da051ae1432ceeb3.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-us-east-1/1df2a063637431950933d7ccf8615a083531eab4220b10ff7fd125499eef355e.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -55,14 +55,14 @@ { "type": "aws:cdk:hasPhysicalName", "data": { - "Ref": "Resource" + "Ref": "GlobalTable89F068B2" } } ], - "/BarStack/Resource": [ + "/BarStack/GlobalTable/Resource": [ { "type": "aws:cdk:logicalId", - "data": "Resource" + "data": "GlobalTable89F068B2" } ], "/BarStack/BootstrapVersion": [ @@ -96,7 +96,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}/d84b161adac191a3d95e0159eef748887619f5e395685d03abb2e6093b913505.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/e679ff0ed7219610286b91fef2fccc9e00c903d344fa3d93358b440940c5a71e.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/tree.json index e960c78b99761..204e28a7e5cc0 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/tree.json @@ -94,7 +94,7 @@ }, ":table/", { - "Ref": "Resource" + "Ref": "GlobalTable89F068B2" } ] ] @@ -192,6 +192,47 @@ "id": "GlobalTable", "path": "BarStack/GlobalTable", "children": { + "Resource": { + "id": "Resource", + "path": "BarStack/GlobalTable/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::GlobalTable", + "aws:cdk:cloudformation:props": { + "attributeDefinitions": [ + { + "attributeName": "pk", + "attributeType": "S" + } + ], + "billingMode": "PAY_PER_REQUEST", + "keySchema": [ + { + "attributeName": "pk", + "keyType": "HASH" + } + ], + "replicas": [ + { + "region": "us-west-1" + }, + { + "region": "us-east-2" + }, + { + "region": "us-east-1" + } + ], + "streamSpecification": { + "streamViewType": "NEW_AND_OLD_IMAGES" + }, + "tableName": "global-table" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.CfnGlobalTable", + "version": "0.0.0" + } + }, "ReplicaTableus-west-1": { "id": "ReplicaTableus-west-1", "path": "BarStack/GlobalTable/ReplicaTableus-west-1", @@ -206,47 +247,6 @@ "version": "0.0.0" } }, - "Resource": { - "id": "Resource", - "path": "BarStack/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::DynamoDB::GlobalTable", - "aws:cdk:cloudformation:props": { - "attributeDefinitions": [ - { - "attributeName": "pk", - "attributeType": "S" - } - ], - "billingMode": "PAY_PER_REQUEST", - "keySchema": [ - { - "attributeName": "pk", - "keyType": "HASH" - } - ], - "replicas": [ - { - "region": "us-west-1" - }, - { - "region": "us-east-2" - }, - { - "region": "us-east-1" - } - ], - "streamSpecification": { - "streamViewType": "NEW_AND_OLD_IMAGES" - }, - "tableName": "global-table" - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_dynamodb.CfnGlobalTable", - "version": "0.0.0" - } - }, "BootstrapVersion": { "id": "BootstrapVersion", "path": "BarStack/BootstrapVersion", diff --git a/packages/aws-cdk-lib/aws-dynamodb/lib/table-v2.ts b/packages/aws-cdk-lib/aws-dynamodb/lib/table-v2.ts index 796c37b47c489..f2b37fbd038cd 100644 --- a/packages/aws-cdk-lib/aws-dynamodb/lib/table-v2.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/lib/table-v2.ts @@ -470,7 +470,7 @@ export class TableV2 extends TableBaseV2 { props.globalSecondaryIndexes?.forEach(gsi => this.addGlobalSecondaryIndex(gsi)); props.localSecondaryIndexes?.forEach(lsi => this.addLocalSecondaryIndex(lsi)); - const resource = new CfnGlobalTable(scope, 'Resource', { + const resource = new CfnGlobalTable(this, 'Resource', { tableName: this.physicalName, keySchema: this.keySchema, attributeDefinitions: Lazy.any({ produce: () => this.attributeDefinitions }), diff --git a/packages/aws-cdk-lib/aws-dynamodb/test/table-v2.test.ts b/packages/aws-cdk-lib/aws-dynamodb/test/table-v2.test.ts index 820e9b7af24c6..2d704e76674ba 100644 --- a/packages/aws-cdk-lib/aws-dynamodb/test/table-v2.test.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/test/table-v2.test.ts @@ -4,7 +4,7 @@ import { Key } from '../../aws-kms'; import { CfnDeletionPolicy, Lazy, RemovalPolicy, Stack } from '../../core'; import { AttributeType, Billing, Capacity, GlobalSecondaryIndexPropsV2, TableV2, - LocalSecondaryIndexProps, ProjectionType, StreamViewType, TableClass, TableEncryptionV2, + LocalSecondaryIndexProps, ProjectionType, StreamViewType, TableClass, TableEncryptionV2, CfnGlobalTable, } from '../lib'; describe('table', () => { @@ -953,6 +953,25 @@ describe('table', () => { }); }); + test('multiple tables', () => { + // GIVEN + const stack = new Stack(undefined, 'Stack'); + + // WHEN + new TableV2(stack, 'Table1', { + partitionKey: { name: 'pk', type: AttributeType.STRING }, + }); + new TableV2(stack, 'Table2', { + partitionKey: { name: 'pk', type: AttributeType.STRING }, + }); + new TableV2(stack, 'Table3', { + partitionKey: { name: 'pk', type: AttributeType.STRING }, + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::DynamoDB::GlobalTable', 3); + }); + test('throws if defining non-default replica table in region agnostic stack', () => { // GIVEN const stack = new Stack(undefined, 'Stack'); From 9e3b593a08e4eaf76c84fe5f8c01795fc9ba886e Mon Sep 17 00:00:00 2001 From: Francis Date: Fri, 8 Sep 2023 13:53:05 -0700 Subject: [PATCH 2/3] remove unused CfnGlobalTable import Signed-off-by: Francis --- packages/aws-cdk-lib/aws-dynamodb/test/table-v2.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-dynamodb/test/table-v2.test.ts b/packages/aws-cdk-lib/aws-dynamodb/test/table-v2.test.ts index 2d704e76674ba..896db2374b1bb 100644 --- a/packages/aws-cdk-lib/aws-dynamodb/test/table-v2.test.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/test/table-v2.test.ts @@ -4,7 +4,7 @@ import { Key } from '../../aws-kms'; import { CfnDeletionPolicy, Lazy, RemovalPolicy, Stack } from '../../core'; import { AttributeType, Billing, Capacity, GlobalSecondaryIndexPropsV2, TableV2, - LocalSecondaryIndexProps, ProjectionType, StreamViewType, TableClass, TableEncryptionV2, CfnGlobalTable, + LocalSecondaryIndexProps, ProjectionType, StreamViewType, TableClass, TableEncryptionV2, } from '../lib'; describe('table', () => { From 139c6552cad8fc7ec32ccef5823cf7dd79be0a0d Mon Sep 17 00:00:00 2001 From: Francis Date: Fri, 8 Sep 2023 14:25:51 -0700 Subject: [PATCH 3/3] update logical id in unit tests for metrics and grants Signed-off-by: Francis --- .../aws-dynamodb/test/table-v2-base.test.ts | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/packages/aws-cdk-lib/aws-dynamodb/test/table-v2-base.test.ts b/packages/aws-cdk-lib/aws-dynamodb/test/table-v2-base.test.ts index 1926ea5d8619f..07ee95aa4d3ad 100644 --- a/packages/aws-cdk-lib/aws-dynamodb/test/table-v2-base.test.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/test/table-v2-base.test.ts @@ -65,7 +65,7 @@ describe('grants', () => { Effect: 'Allow', Resource: { 'Fn::GetAtt': [ - 'Resource', + 'GlobalTable89F068B2', 'Arn', ], }, @@ -115,7 +115,7 @@ describe('grants', () => { Effect: 'Allow', Resource: { 'Fn::GetAtt': [ - 'Resource', + 'GlobalTable89F068B2', 'Arn', ], }, @@ -184,7 +184,7 @@ describe('grants', () => { Effect: 'Allow', Resource: { 'Fn::GetAtt': [ - 'Resource', + 'GlobalTable89F068B2', 'Arn', ], }, @@ -232,7 +232,7 @@ describe('grants', () => { Effect: 'Allow', Resource: { 'Fn::GetAtt': [ - 'Resource', + 'GlobalTable89F068B2', 'Arn', ], }, @@ -301,7 +301,7 @@ describe('grants', () => { Effect: 'Allow', Resource: { 'Fn::GetAtt': [ - 'Resource', + 'GlobalTable89F068B2', 'Arn', ], }, @@ -356,7 +356,7 @@ describe('grants', () => { Effect: 'Allow', Resource: { 'Fn::GetAtt': [ - 'Resource', + 'GlobalTable89F068B2', 'Arn', ], }, @@ -432,7 +432,7 @@ describe('grants', () => { Effect: 'Allow', Resource: { 'Fn::GetAtt': [ - 'Resource', + 'GlobalTable89F068B2', 'Arn', ], }, @@ -474,7 +474,7 @@ describe('grants', () => { Effect: 'Allow', Resource: { 'Fn::GetAtt': [ - 'Resource', + 'GlobalTable89F068B2', 'Arn', ], }, @@ -537,7 +537,7 @@ describe('grants', () => { Effect: 'Allow', Resource: { 'Fn::GetAtt': [ - 'Resource', + 'GlobalTable89F068B2', 'Arn', ], }, @@ -595,7 +595,7 @@ describe('grants', () => { Resource: [ { 'Fn::GetAtt': [ - 'Resource', + 'GlobalTable89F068B2', 'Arn', ], }, @@ -605,7 +605,7 @@ describe('grants', () => { [ { 'Fn::GetAtt': [ - 'Resource', + 'GlobalTable89F068B2', 'Arn', ], }, @@ -653,7 +653,7 @@ describe('grants', () => { ], Resource: { 'Fn::GetAtt': [ - 'Resource', + 'GlobalTable89F068B2', 'StreamArn', ], }, @@ -694,7 +694,7 @@ describe('grants', () => { Effect: 'Allow', Resource: { 'Fn::GetAtt': [ - 'Resource', + 'GlobalTable89F068B2', 'StreamArn', ], }, @@ -708,7 +708,7 @@ describe('grants', () => { Effect: 'Allow', Resource: { 'Fn::GetAtt': [ - 'Resource', + 'GlobalTable89F068B2', 'StreamArn', ], }, @@ -749,7 +749,7 @@ describe('grants', () => { Effect: 'Allow', Resource: { 'Fn::GetAtt': [ - 'Resource', + 'GlobalTable89F068B2', 'StreamArn', ], }, @@ -776,7 +776,7 @@ describe('grants', () => { Effect: 'Allow', Resource: { 'Fn::GetAtt': [ - 'Resource', + 'GlobalTable89F068B2', 'StreamArn', ], }, @@ -812,7 +812,7 @@ describe('grants', () => { Effect: 'Allow', Resource: { 'Fn::GetAtt': [ - 'Resource', + 'GlobalTable89F068B2', 'StreamArn', ], }, @@ -871,7 +871,7 @@ describe('grants', () => { }, ':table/', { - Ref: 'Resource', + Ref: 'GlobalTable89F068B2', }, '/stream/*', ], @@ -907,7 +907,7 @@ describe('grants', () => { }, ':table/', { - Ref: 'Resource', + Ref: 'GlobalTable89F068B2', }, '/stream/*', ], @@ -986,7 +986,7 @@ describe('grants', () => { }, ':table/', { - Ref: 'Resource', + Ref: 'GlobalTable89F068B2', }, ], ], @@ -1355,7 +1355,7 @@ describe('metrics', () => { }, dimensions: { TableName: { - Ref: 'Resource', + Ref: 'TableCD117FA1', }, }, namespace: 'AWS/DynamoDB', @@ -1381,7 +1381,7 @@ describe('metrics', () => { }, dimensions: { TableName: { - Ref: 'Resource', + Ref: 'TableCD117FA1', }, }, namespace: 'AWS/DynamoDB', @@ -1440,7 +1440,7 @@ describe('metrics', () => { dimensions: { Operation: 'GetItem', TableName: { - Ref: 'Resource', + Ref: 'TableCD117FA1', }, }, metricName: 'SystemErrors', @@ -1457,7 +1457,7 @@ describe('metrics', () => { dimensions: { Operation: 'PutItem', TableName: { - Ref: 'Resource', + Ref: 'TableCD117FA1', }, }, metricName: 'SystemErrors', @@ -1507,7 +1507,7 @@ describe('metrics', () => { amount: 5, unit: { label: 'minutes', isoLabel: 'M', inMillis: 60000 }, }, - dimensions: { TableName: { Ref: 'Resource' } }, + dimensions: { TableName: { Ref: 'TableCD117FA1' } }, namespace: 'AWS/DynamoDB', metricName: 'ConditionalCheckFailedRequests', statistic: 'Sum', @@ -1545,7 +1545,7 @@ describe('metrics', () => { amount: 5, unit: { label: 'minutes', isoLabel: 'M', inMillis: 60000 }, }, - dimensions: { TableName: { Ref: 'Resource' }, Operation: 'GetItem' }, + dimensions: { TableName: { Ref: 'TableCD117FA1' }, Operation: 'GetItem' }, namespace: 'AWS/DynamoDB', metricName: 'SuccessfulRequestLatency', statistic: 'Average', @@ -1568,7 +1568,7 @@ describe('metrics', () => { unit: { label: 'minutes', isoLabel: 'M', inMillis: 60000 }, }, metricName: 'ThrottledRequests', - dimensions: { TableName: { Ref: 'Resource' }, Operation: 'PutItem' }, + dimensions: { TableName: { Ref: 'TableCD117FA1' }, Operation: 'PutItem' }, namespace: 'AWS/DynamoDB', account: { Ref: 'AWS::AccountId' }, region: { Ref: 'AWS::Region' }, @@ -1598,7 +1598,7 @@ describe('metrics', () => { dimensions: { Operation: 'GetItem', TableName: { - Ref: 'Resource', + Ref: 'TableCD117FA1', }, }, metricName: 'ThrottledRequests', @@ -1615,7 +1615,7 @@ describe('metrics', () => { dimensions: { Operation: 'PutItem', TableName: { - Ref: 'Resource', + Ref: 'TableCD117FA1', }, }, metricName: 'ThrottledRequests', @@ -1766,7 +1766,7 @@ describe('metrics', () => { amount: 5, unit: { label: 'minutes', isoLabel: 'M', inMillis: 60000 }, }, - dimensions: { TableName: { Ref: 'Resource' } }, + dimensions: { TableName: { Ref: 'TableCD117FA1' } }, namespace: 'AWS/DynamoDB', metricName: 'ThrottledRequests', statistic: 'Sum', @@ -1802,7 +1802,7 @@ describe('metrics', () => { amount: 5, unit: { label: 'minutes', isoLabel: 'M', inMillis: 60000 }, }, - dimensions: { TableName: { Ref: 'Resource' }, Operation: 'GetItem' }, + dimensions: { TableName: { Ref: 'TableCD117FA1' }, Operation: 'GetItem' }, namespace: 'AWS/DynamoDB', metricName: 'SystemErrors', statistic: 'Sum',