@go-to-k/cdkd 0.216.0 → 0.217.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-DWUnLza1.js";
|
|
3
|
-
import { $ as CFN_TEMPLATE_URL_LIMIT, A as DagBuilder, B as getDockerCmd, C as CloudControlProvider, D as IntrinsicFunctionResolver, Dt as withErrorHandling, E as isTerminationProtectionPropagationError, Et as normalizeAwsError, F as AssetPublisher, Ft as generateResourceName, G as getLegacyStateBucketName, H as runDockerStreaming, I as stringifyValue, It as generateResourceNameWithFallback, J as resolveSkipPrefix, K as resolveApp, L as WorkGraph, Lt as withSkipPrefix, M as LockManager, Mt as getLiveRenderer, N as S3StateBackend, Nt as PATTERN_B_NAME_PROPERTIES, O as applyRoleArnIfSet, P as shouldRetainResource, Pt as PATTERN_B_RESOURCE_TYPES, Q as CFN_TEMPLATE_BODY_LIMIT, R as buildDockerImage, Rt as withStackName, S as findActionableSilentDrops, T as disableInstanceApiTermination, U as Synthesizer, V as runDockerForeground, W as getDefaultStateBucketName, X as resolveStateBucketWithDefaultAndSource, Y as resolveStateBucketWithDefault, Z as warnDeprecatedNoPrefixCliFlag, _ as CDK_PATH_TAG, _t as ProvisioningError, a as withRetry, at as resolveBucketRegion, b as resolveExplicitPhysicalId, bt as StackHasActiveImportsError, c as formatResourceLine, d as gray, dt as LocalMigrateError, et as MIGRATE_TMP_PREFIX, f as green, ft as LocalStartServiceError, g as collectInlinePolicyNamesManagedBySiblings, gt as PartialFailureError, h as IAMRoleProvider, ht as NestedStackChildDirectDestroyError, i as withResourceDeadline, j as TemplateParser, jt as runStackBuffered, k as DiffCalculator, kt as getLogger, l as bold, m as yellow, mt as MissingCdkCliError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as uploadCfnTemplate, o as isRetryableTransientError, p as red, q as resolveCaptureObservedState, r as DeployEngine, rt as AssemblyReader, s as IMPLICIT_DELETE_DEPENDENCIES, st as CdkdError, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as findLargeInlineResources, u as cyan, ut as LocalInvokeBuildError$1, v as matchesCdkPath, vt as ResourceTimeoutError, w as assertRegionMatch, x as ProviderRegistry, xt as StackTerminationProtectionError, y as normalizeAwsTagsToCfn, yt as ResourceUpdateNotSupportedError, z as formatDockerLoginError } from "./deploy-engine-
|
|
3
|
+
import { $ as CFN_TEMPLATE_URL_LIMIT, A as DagBuilder, B as getDockerCmd, C as CloudControlProvider, D as IntrinsicFunctionResolver, Dt as withErrorHandling, E as isTerminationProtectionPropagationError, Et as normalizeAwsError, F as AssetPublisher, Ft as generateResourceName, G as getLegacyStateBucketName, H as runDockerStreaming, I as stringifyValue, It as generateResourceNameWithFallback, J as resolveSkipPrefix, K as resolveApp, L as WorkGraph, Lt as withSkipPrefix, M as LockManager, Mt as getLiveRenderer, N as S3StateBackend, Nt as PATTERN_B_NAME_PROPERTIES, O as applyRoleArnIfSet, P as shouldRetainResource, Pt as PATTERN_B_RESOURCE_TYPES, Q as CFN_TEMPLATE_BODY_LIMIT, R as buildDockerImage, Rt as withStackName, S as findActionableSilentDrops, T as disableInstanceApiTermination, U as Synthesizer, V as runDockerForeground, W as getDefaultStateBucketName, X as resolveStateBucketWithDefaultAndSource, Y as resolveStateBucketWithDefault, Z as warnDeprecatedNoPrefixCliFlag, _ as CDK_PATH_TAG, _t as ProvisioningError, a as withRetry, at as resolveBucketRegion, b as resolveExplicitPhysicalId, bt as StackHasActiveImportsError, c as formatResourceLine, d as gray, dt as LocalMigrateError, et as MIGRATE_TMP_PREFIX, f as green, ft as LocalStartServiceError, g as collectInlinePolicyNamesManagedBySiblings, gt as PartialFailureError, h as IAMRoleProvider, ht as NestedStackChildDirectDestroyError, i as withResourceDeadline, j as TemplateParser, jt as runStackBuffered, k as DiffCalculator, kt as getLogger, l as bold, m as yellow, mt as MissingCdkCliError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as uploadCfnTemplate, o as isRetryableTransientError, p as red, q as resolveCaptureObservedState, r as DeployEngine, rt as AssemblyReader, s as IMPLICIT_DELETE_DEPENDENCIES, st as CdkdError, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as findLargeInlineResources, u as cyan, ut as LocalInvokeBuildError$1, v as matchesCdkPath, vt as ResourceTimeoutError, w as assertRegionMatch, x as ProviderRegistry, xt as StackTerminationProtectionError, y as normalizeAwsTagsToCfn, yt as ResourceUpdateNotSupportedError, z as formatDockerLoginError } from "./deploy-engine-UctzfQ8M.js";
|
|
4
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
5
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
6
6
|
import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListBucketsCommand, ListDirectoryBucketsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
|
|
@@ -10,7 +10,7 @@ import { CreateTopicCommand, DeleteTopicCommand, GetSubscriptionAttributesComman
|
|
|
10
10
|
import { AddPermissionCommand, CreateEventSourceMappingCommand, CreateFunctionCommand, CreateFunctionUrlConfigCommand, DeleteEventSourceMappingCommand, DeleteFunctionCommand, DeleteFunctionConcurrencyCommand, DeleteFunctionUrlConfigCommand, DeleteLayerVersionCommand, GetEventSourceMappingCommand, GetFunctionCommand, GetFunctionConcurrencyCommand, GetFunctionRecursionConfigCommand, GetFunctionUrlConfigCommand, GetLayerVersionByArnCommand, GetPolicyCommand as GetPolicyCommand$1, LambdaClient, ListFunctionsCommand, ListLayersCommand, ListTagsCommand, PublishLayerVersionCommand, PutFunctionConcurrencyCommand, PutFunctionRecursionConfigCommand, RemovePermissionCommand, ResourceNotFoundException, TagResourceCommand as TagResourceCommand$1, UntagResourceCommand as UntagResourceCommand$1, UpdateEventSourceMappingCommand, UpdateFunctionCodeCommand, UpdateFunctionConfigurationCommand, UpdateFunctionUrlConfigCommand, waitUntilFunctionUpdatedV2 } from "@aws-sdk/client-lambda";
|
|
11
11
|
import { AssumeRoleCommand, GetCallerIdentityCommand, STSClient } from "@aws-sdk/client-sts";
|
|
12
12
|
import { AssociateRouteTableCommand, AttachInternetGatewayCommand, AuthorizeSecurityGroupEgressCommand, AuthorizeSecurityGroupIngressCommand, CreateInternetGatewayCommand, CreateNatGatewayCommand, CreateNetworkAclCommand, CreateNetworkAclEntryCommand, CreateRouteCommand, CreateRouteTableCommand, CreateSecurityGroupCommand, CreateSubnetCommand, CreateTagsCommand, CreateVpcCommand, DeleteInternetGatewayCommand, DeleteNatGatewayCommand, DeleteNetworkAclCommand, DeleteNetworkAclEntryCommand, DeleteNetworkInterfaceCommand, DeleteRouteCommand, DeleteRouteTableCommand, DeleteSecurityGroupCommand, DeleteSubnetCommand, DeleteTagsCommand, DeleteVpcCommand, DescribeAvailabilityZonesCommand, DescribeInstanceAttributeCommand, DescribeInstancesCommand, DescribeInternetGatewaysCommand, DescribeNatGatewaysCommand, DescribeNetworkAclsCommand, DescribeNetworkInterfacesCommand, DescribeRouteTablesCommand, DescribeSecurityGroupsCommand, DescribeSubnetsCommand, DescribeVolumesCommand, DescribeVpcAttributeCommand, DescribeVpcsCommand, DetachInternetGatewayCommand, DisassociateRouteTableCommand, EC2Client, ModifySubnetAttributeCommand, ModifyVpcAttributeCommand, ReplaceNetworkAclAssociationCommand, RevokeSecurityGroupEgressCommand, RevokeSecurityGroupIngressCommand, RunInstancesCommand, TerminateInstancesCommand, waitUntilInstanceRunning, waitUntilInstanceTerminated, waitUntilNatGatewayAvailable, waitUntilNatGatewayDeleted } from "@aws-sdk/client-ec2";
|
|
13
|
-
import { CreateTableCommand, DeleteTableCommand, DescribeContinuousBackupsCommand, DescribeContributorInsightsCommand, DescribeKinesisStreamingDestinationCommand, DescribeTableCommand, DescribeTimeToLiveCommand, DynamoDBClient, ListTablesCommand, ListTagsOfResourceCommand, ResourceNotFoundException as ResourceNotFoundException$1, TagResourceCommand as TagResourceCommand$2, UntagResourceCommand as UntagResourceCommand$2, UpdateContinuousBackupsCommand, UpdateTableCommand, UpdateTimeToLiveCommand } from "@aws-sdk/client-dynamodb";
|
|
13
|
+
import { CreateTableCommand, DeleteResourcePolicyCommand, DeleteTableCommand, DescribeContinuousBackupsCommand, DescribeContributorInsightsCommand, DescribeKinesisStreamingDestinationCommand, DescribeTableCommand, DescribeTimeToLiveCommand, DisableKinesisStreamingDestinationCommand, DynamoDBClient, EnableKinesisStreamingDestinationCommand, GetResourcePolicyCommand, ListTablesCommand, ListTagsOfResourceCommand, PutResourcePolicyCommand, ResourceNotFoundException as ResourceNotFoundException$1, TagResourceCommand as TagResourceCommand$2, UntagResourceCommand as UntagResourceCommand$2, UpdateContinuousBackupsCommand, UpdateContributorInsightsCommand, UpdateTableCommand, UpdateTimeToLiveCommand } from "@aws-sdk/client-dynamodb";
|
|
14
14
|
import { CloudFormationClient, CreateChangeSetCommand, DeleteChangeSetCommand, DeleteStackCommand, DescribeChangeSetCommand, DescribeStackEventsCommand, DescribeStackResourcesCommand, DescribeStacksCommand, DescribeTypeCommand, ExecuteChangeSetCommand, GetTemplateCommand, UpdateStackCommand, waitUntilChangeSetCreateComplete, waitUntilStackDeleteComplete, waitUntilStackImportComplete, waitUntilStackUpdateComplete } from "@aws-sdk/client-cloudformation";
|
|
15
15
|
import { APIGatewayClient, CreateAuthorizerCommand, CreateDeploymentCommand, CreateResourceCommand, CreateStageCommand, DeleteAuthorizerCommand, DeleteDeploymentCommand, DeleteMethodCommand, DeleteResourceCommand, DeleteStageCommand, GetAccountCommand, GetAuthorizerCommand, GetDeploymentCommand, GetMethodCommand, GetResourceCommand, GetStageCommand, NotFoundException as NotFoundException$1, PutIntegrationCommand, PutIntegrationResponseCommand, PutMethodCommand, PutMethodResponseCommand, TagResourceCommand as TagResourceCommand$3, UntagResourceCommand as UntagResourceCommand$3, UpdateAccountCommand, UpdateAuthorizerCommand, UpdateMethodCommand, UpdateStageCommand } from "@aws-sdk/client-api-gateway";
|
|
16
16
|
import { CreateEventBusCommand, DeleteEventBusCommand, DeleteRuleCommand, DescribeEventBusCommand, DescribeRuleCommand, EventBridgeClient, ListEventBusesCommand, ListRulesCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$1, ListTargetsByRuleCommand, PutRuleCommand, PutTargetsCommand, RemoveTargetsCommand, ResourceNotFoundException as ResourceNotFoundException$2, TagResourceCommand as TagResourceCommand$4, UntagResourceCommand as UntagResourceCommand$4, UpdateEventBusCommand } from "@aws-sdk/client-eventbridge";
|
|
@@ -8997,8 +8997,12 @@ var DynamoDBTableProvider = class {
|
|
|
8997
8997
|
"DeletionProtectionEnabled",
|
|
8998
8998
|
"TableClass",
|
|
8999
8999
|
"PointInTimeRecoverySpecification",
|
|
9000
|
-
"TimeToLiveSpecification"
|
|
9000
|
+
"TimeToLiveSpecification",
|
|
9001
|
+
"ResourcePolicy",
|
|
9002
|
+
"KinesisStreamSpecification",
|
|
9003
|
+
"ContributorInsightsSpecification"
|
|
9001
9004
|
])]]);
|
|
9005
|
+
unhandledByDesign = new Map([["AWS::DynamoDB::Table", new Map([["ImportSourceSpecification", "S3 import uses the separate ImportTable API (not CreateTable) and is create-only with no readback; deferred to a dedicated import-from-S3 PR"]])]]);
|
|
9002
9006
|
constructor() {
|
|
9003
9007
|
const awsClients = getAwsClients();
|
|
9004
9008
|
this.dynamoDBClient = awsClients.dynamoDB;
|
|
@@ -9041,12 +9045,16 @@ var DynamoDBTableProvider = class {
|
|
|
9041
9045
|
if (properties["Tags"]) createParams.Tags = properties["Tags"];
|
|
9042
9046
|
if (properties["DeletionProtectionEnabled"] !== void 0) createParams.DeletionProtectionEnabled = properties["DeletionProtectionEnabled"];
|
|
9043
9047
|
if (properties["TableClass"]) createParams.TableClass = properties["TableClass"];
|
|
9048
|
+
const createResourcePolicyDoc = this.extractResourcePolicyDocument(properties["ResourcePolicy"]);
|
|
9049
|
+
if (createResourcePolicyDoc !== void 0) createParams.ResourcePolicy = createResourcePolicyDoc;
|
|
9044
9050
|
await this.dynamoDBClient.send(new CreateTableCommand(createParams));
|
|
9045
9051
|
tableCreated = true;
|
|
9046
9052
|
this.logger.debug(`CreateTable initiated for ${tableName}, waiting for ACTIVE status`);
|
|
9047
9053
|
const tableInfo = await this.waitForTableActive(tableName);
|
|
9048
9054
|
await this.applyPointInTimeRecovery(tableName, properties["PointInTimeRecoverySpecification"]);
|
|
9049
9055
|
await this.applyTimeToLive(tableName, properties["TimeToLiveSpecification"]);
|
|
9056
|
+
await this.applyKinesisStreamingDestination(tableName, properties["KinesisStreamSpecification"]);
|
|
9057
|
+
await this.applyContributorInsights(tableName, properties["ContributorInsightsSpecification"]);
|
|
9050
9058
|
this.logger.debug(`Successfully created DynamoDB table ${logicalId}: ${tableName}`);
|
|
9051
9059
|
return {
|
|
9052
9060
|
physicalId: tableName,
|
|
@@ -9101,6 +9109,12 @@ var DynamoDBTableProvider = class {
|
|
|
9101
9109
|
}
|
|
9102
9110
|
if (JSON.stringify(properties["PointInTimeRecoverySpecification"]) !== JSON.stringify(previousProperties["PointInTimeRecoverySpecification"])) await this.applyPointInTimeRecovery(physicalId, properties["PointInTimeRecoverySpecification"], previousProperties["PointInTimeRecoverySpecification"]);
|
|
9103
9111
|
if (JSON.stringify(properties["TimeToLiveSpecification"]) !== JSON.stringify(previousProperties["TimeToLiveSpecification"])) await this.applyTimeToLive(physicalId, properties["TimeToLiveSpecification"], previousProperties["TimeToLiveSpecification"]);
|
|
9112
|
+
if (JSON.stringify(properties["ResourcePolicy"]) !== JSON.stringify(previousProperties["ResourcePolicy"])) {
|
|
9113
|
+
if (!table?.TableArn) throw new ProvisioningError(`Cannot apply ResourcePolicy change for DynamoDB table ${logicalId}: DescribeTable returned no TableArn`, resourceType, logicalId, physicalId);
|
|
9114
|
+
await this.applyResourcePolicy(table.TableArn, properties["ResourcePolicy"], previousProperties["ResourcePolicy"]);
|
|
9115
|
+
}
|
|
9116
|
+
if (JSON.stringify(properties["KinesisStreamSpecification"]) !== JSON.stringify(previousProperties["KinesisStreamSpecification"])) await this.applyKinesisStreamingDestination(physicalId, properties["KinesisStreamSpecification"], previousProperties["KinesisStreamSpecification"]);
|
|
9117
|
+
if (JSON.stringify(properties["ContributorInsightsSpecification"]) !== JSON.stringify(previousProperties["ContributorInsightsSpecification"])) await this.applyContributorInsights(physicalId, properties["ContributorInsightsSpecification"], previousProperties["ContributorInsightsSpecification"]);
|
|
9104
9118
|
return {
|
|
9105
9119
|
physicalId,
|
|
9106
9120
|
wasReplaced: false,
|
|
@@ -9275,6 +9289,114 @@ var DynamoDBTableProvider = class {
|
|
|
9275
9289
|
}
|
|
9276
9290
|
}
|
|
9277
9291
|
/**
|
|
9292
|
+
* Extract the resource-policy document from the CFn `ResourcePolicy`
|
|
9293
|
+
* property and serialize it to the JSON string the DynamoDB APIs expect.
|
|
9294
|
+
*
|
|
9295
|
+
* CFn shape is `{ PolicyDocument: <JSON object | string> }`. Both
|
|
9296
|
+
* `CreateTable.ResourcePolicy` and `PutResourcePolicy.Policy` take a JSON
|
|
9297
|
+
* STRING, so a document already supplied as a string is passed through
|
|
9298
|
+
* verbatim (CDK can emit either an object or, post-intrinsic-resolution, a
|
|
9299
|
+
* string). Returns `undefined` when there is no policy document to apply.
|
|
9300
|
+
*/
|
|
9301
|
+
extractResourcePolicyDocument(spec) {
|
|
9302
|
+
if (spec === void 0 || spec === null) return void 0;
|
|
9303
|
+
const doc = spec["PolicyDocument"];
|
|
9304
|
+
if (doc === void 0 || doc === null) return void 0;
|
|
9305
|
+
return typeof doc === "string" ? doc : JSON.stringify(doc);
|
|
9306
|
+
}
|
|
9307
|
+
/**
|
|
9308
|
+
* Apply the table's `ResourcePolicy` via the separate `PutResourcePolicy` /
|
|
9309
|
+
* `DeleteResourcePolicy` APIs (used by `update()` — `create()` rides the
|
|
9310
|
+
* policy on CreateTable directly). On removal — when the template drops the
|
|
9311
|
+
* block but it was present before — the existing policy is deleted.
|
|
9312
|
+
*/
|
|
9313
|
+
async applyResourcePolicy(tableArn, spec, previousSpec) {
|
|
9314
|
+
const policyDoc = this.extractResourcePolicyDocument(spec);
|
|
9315
|
+
if (policyDoc !== void 0) {
|
|
9316
|
+
await this.retryOnTransientControlPlane(() => this.dynamoDBClient.send(new PutResourcePolicyCommand({
|
|
9317
|
+
ResourceArn: tableArn,
|
|
9318
|
+
Policy: policyDoc
|
|
9319
|
+
})), `put ResourcePolicy on ${tableArn}`);
|
|
9320
|
+
this.logger.debug(`Put ResourcePolicy on DynamoDB table ${tableArn}`);
|
|
9321
|
+
return;
|
|
9322
|
+
}
|
|
9323
|
+
if (previousSpec !== void 0 && previousSpec !== null) try {
|
|
9324
|
+
await this.retryOnTransientControlPlane(() => this.dynamoDBClient.send(new DeleteResourcePolicyCommand({ ResourceArn: tableArn })), `delete ResourcePolicy on ${tableArn}`);
|
|
9325
|
+
this.logger.debug(`Deleted ResourcePolicy on DynamoDB table ${tableArn}`);
|
|
9326
|
+
} catch (error) {
|
|
9327
|
+
if (!(error instanceof ResourceNotFoundException$1)) throw error;
|
|
9328
|
+
}
|
|
9329
|
+
}
|
|
9330
|
+
/**
|
|
9331
|
+
* Apply the table's `KinesisStreamSpecification` via the separate
|
|
9332
|
+
* Enable/Disable/Update `KinesisStreamingDestination` APIs (NOT a field on
|
|
9333
|
+
* CreateTable). CFn shape is
|
|
9334
|
+
* `{ StreamArn: string, ApproximateCreationDateTimePrecision?: 'MICROSECOND' | 'MILLISECOND' }`.
|
|
9335
|
+
*
|
|
9336
|
+
* Called from both `create()` (after the table is ACTIVE) and `update()`
|
|
9337
|
+
* (only when the value changed). On `update()`-side removal — template drops
|
|
9338
|
+
* the block but it was present before — streaming is disabled to the PREVIOUS
|
|
9339
|
+
* stream ARN. A same-ARN change of only the precision is a deliberate no-op
|
|
9340
|
+
* (re-enabling against an already-enabled stream errors), matching the
|
|
9341
|
+
* pre-existing WarmThroughput "no clean remap" stance; precision changes flow
|
|
9342
|
+
* through on the create / first-enable path.
|
|
9343
|
+
*/
|
|
9344
|
+
async applyKinesisStreamingDestination(tableName, spec, previousSpec) {
|
|
9345
|
+
const newArn = this.extractKinesisStreamArn(spec);
|
|
9346
|
+
const prevArn = this.extractKinesisStreamArn(previousSpec);
|
|
9347
|
+
if (newArn === prevArn) {
|
|
9348
|
+
if (newArn && JSON.stringify(spec?.["ApproximateCreationDateTimePrecision"]) !== JSON.stringify(previousSpec?.["ApproximateCreationDateTimePrecision"])) this.logger.warn(`Kinesis streaming ApproximateCreationDateTimePrecision change on ${tableName} was not applied (same stream ARN; precision-only updates are not yet supported)`);
|
|
9349
|
+
return;
|
|
9350
|
+
}
|
|
9351
|
+
if (prevArn) {
|
|
9352
|
+
await this.retryOnTransientControlPlane(() => this.dynamoDBClient.send(new DisableKinesisStreamingDestinationCommand({
|
|
9353
|
+
TableName: tableName,
|
|
9354
|
+
StreamArn: prevArn
|
|
9355
|
+
})), `disable Kinesis streaming on ${tableName}`);
|
|
9356
|
+
this.logger.debug(`Disabled Kinesis streaming destination ${prevArn} on DynamoDB table ${tableName}`);
|
|
9357
|
+
}
|
|
9358
|
+
if (newArn) {
|
|
9359
|
+
const precision = spec["ApproximateCreationDateTimePrecision"];
|
|
9360
|
+
await this.retryOnTransientControlPlane(() => this.dynamoDBClient.send(new EnableKinesisStreamingDestinationCommand({
|
|
9361
|
+
TableName: tableName,
|
|
9362
|
+
StreamArn: newArn,
|
|
9363
|
+
...precision ? { EnableKinesisStreamingConfiguration: { ApproximateCreationDateTimePrecision: precision } } : {}
|
|
9364
|
+
})), `enable Kinesis streaming on ${tableName}`);
|
|
9365
|
+
this.logger.debug(`Enabled Kinesis streaming destination ${newArn} on DynamoDB table ${tableName}`);
|
|
9366
|
+
}
|
|
9367
|
+
}
|
|
9368
|
+
extractKinesisStreamArn(spec) {
|
|
9369
|
+
if (spec === void 0 || spec === null) return void 0;
|
|
9370
|
+
const arn = spec["StreamArn"];
|
|
9371
|
+
return typeof arn === "string" ? arn : void 0;
|
|
9372
|
+
}
|
|
9373
|
+
/**
|
|
9374
|
+
* Apply the table's `ContributorInsightsSpecification` via the separate
|
|
9375
|
+
* `UpdateContributorInsights` API (NOT a field on CreateTable). CFn shape is
|
|
9376
|
+
* `{ Enabled: boolean, Mode?: 'ACCESSED_AND_THROTTLED_KEYS' | 'THROTTLED_KEYS' }`.
|
|
9377
|
+
*
|
|
9378
|
+
* Called from both `create()` (after the table is ACTIVE) and `update()`
|
|
9379
|
+
* (only when the value changed). On `update()`-side removal — template drops
|
|
9380
|
+
* the block but it was present before — insights is disabled.
|
|
9381
|
+
*/
|
|
9382
|
+
async applyContributorInsights(tableName, spec, previousSpec) {
|
|
9383
|
+
let action;
|
|
9384
|
+
let mode;
|
|
9385
|
+
if (spec !== void 0 && spec !== null) {
|
|
9386
|
+
const s = spec;
|
|
9387
|
+
const enabled = Boolean(s["Enabled"]);
|
|
9388
|
+
action = enabled ? "ENABLE" : "DISABLE";
|
|
9389
|
+
if (enabled && s["Mode"] !== void 0) mode = s["Mode"];
|
|
9390
|
+
} else if (previousSpec !== void 0 && previousSpec !== null) action = "DISABLE";
|
|
9391
|
+
if (action === void 0) return;
|
|
9392
|
+
await this.retryOnTransientControlPlane(() => this.dynamoDBClient.send(new UpdateContributorInsightsCommand({
|
|
9393
|
+
TableName: tableName,
|
|
9394
|
+
ContributorInsightsAction: action,
|
|
9395
|
+
...mode ? { ContributorInsightsMode: mode } : {}
|
|
9396
|
+
})), `set ContributorInsights on ${tableName}`);
|
|
9397
|
+
this.logger.debug(`Set ContributorInsightsAction=${action}${mode !== void 0 ? ` Mode=${mode}` : ""} on DynamoDB table ${tableName}`);
|
|
9398
|
+
}
|
|
9399
|
+
/**
|
|
9278
9400
|
* Poll DescribeTable until the table reaches ACTIVE status
|
|
9279
9401
|
*
|
|
9280
9402
|
* Uses a tight polling loop (1s intervals) instead of CC API's exponential
|
|
@@ -9425,6 +9547,39 @@ var DynamoDBTableProvider = class {
|
|
|
9425
9547
|
} catch (err) {
|
|
9426
9548
|
this.logger.debug(`Could not read TimeToLive for ${physicalId}: ${err instanceof Error ? err.message : String(err)}`);
|
|
9427
9549
|
}
|
|
9550
|
+
if (table.TableArn) try {
|
|
9551
|
+
const rpResp = await this.dynamoDBClient.send(new GetResourcePolicyCommand({ ResourceArn: table.TableArn }));
|
|
9552
|
+
if (rpResp.Policy) {
|
|
9553
|
+
let doc = rpResp.Policy;
|
|
9554
|
+
try {
|
|
9555
|
+
doc = JSON.parse(rpResp.Policy);
|
|
9556
|
+
} catch {}
|
|
9557
|
+
result["ResourcePolicy"] = { PolicyDocument: doc };
|
|
9558
|
+
}
|
|
9559
|
+
} catch (err) {
|
|
9560
|
+
if (!(err instanceof ResourceNotFoundException$1)) this.logger.debug(`Could not read ResourcePolicy for ${physicalId}: ${err instanceof Error ? err.message : String(err)}`);
|
|
9561
|
+
}
|
|
9562
|
+
try {
|
|
9563
|
+
const active = ((await this.dynamoDBClient.send(new DescribeKinesisStreamingDestinationCommand({ TableName: physicalId }))).KinesisDataStreamDestinations ?? []).find((d) => d.DestinationStatus === "ACTIVE" || d.DestinationStatus === "ENABLING");
|
|
9564
|
+
if (active?.StreamArn) {
|
|
9565
|
+
const kspec = { StreamArn: active.StreamArn };
|
|
9566
|
+
if (active.ApproximateCreationDateTimePrecision !== void 0) kspec["ApproximateCreationDateTimePrecision"] = active.ApproximateCreationDateTimePrecision;
|
|
9567
|
+
result["KinesisStreamSpecification"] = kspec;
|
|
9568
|
+
}
|
|
9569
|
+
} catch (err) {
|
|
9570
|
+
this.logger.debug(`Could not read KinesisStreamingDestination for ${physicalId}: ${err instanceof Error ? err.message : String(err)}`);
|
|
9571
|
+
}
|
|
9572
|
+
try {
|
|
9573
|
+
const ciResp = await this.dynamoDBClient.send(new DescribeContributorInsightsCommand({ TableName: physicalId }));
|
|
9574
|
+
const status = ciResp.ContributorInsightsStatus;
|
|
9575
|
+
if (status === "ENABLED" || status === "DISABLED") {
|
|
9576
|
+
const cspec = { Enabled: status === "ENABLED" };
|
|
9577
|
+
if (status === "ENABLED" && ciResp.ContributorInsightsMode !== void 0) cspec["Mode"] = ciResp.ContributorInsightsMode;
|
|
9578
|
+
result["ContributorInsightsSpecification"] = cspec;
|
|
9579
|
+
}
|
|
9580
|
+
} catch (err) {
|
|
9581
|
+
this.logger.debug(`Could not read ContributorInsights for ${physicalId}: ${err instanceof Error ? err.message : String(err)}`);
|
|
9582
|
+
}
|
|
9428
9583
|
return result;
|
|
9429
9584
|
} catch (err) {
|
|
9430
9585
|
if (err instanceof ResourceNotFoundException$1) return void 0;
|
|
@@ -53173,7 +53328,7 @@ function reorderArgs(argv) {
|
|
|
53173
53328
|
async function main() {
|
|
53174
53329
|
installPipeCloseHandler();
|
|
53175
53330
|
const program = new Command();
|
|
53176
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
53331
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.217.0");
|
|
53177
53332
|
program.addCommand(createBootstrapCommand());
|
|
53178
53333
|
program.addCommand(createSynthCommand());
|
|
53179
53334
|
program.addCommand(createListCommand());
|