@go-to-k/cdkd 0.200.0 → 0.201.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 uploadCfnTemplate, A as S3StateBackend, At as PATTERN_B_NAME_PROPERTIES, B as Synthesizer, C as assertRegionMatch, Ct as normalizeAwsError, D as DagBuilder, E as DiffCalculator, Et as getLogger, F as buildDockerImage, Ft as withStackName, G as resolveSkipPrefix, H as getLegacyStateBucketName, I as formatDockerLoginError, J as warnDeprecatedNoPrefixCliFlag, K as resolveStateBucketWithDefault, L as getDockerCmd, M as AssetPublisher, Mt as generateResourceName, N as stringifyValue, Nt as generateResourceNameWithFallback, O as TemplateParser, Ot as runStackBuffered, P as WorkGraph, Pt as withSkipPrefix, Q as findLargeInlineResources, R as runDockerForeground, S as CloudControlProvider, T as applyRoleArnIfSet, U as resolveApp, V as getDefaultStateBucketName, W as resolveCaptureObservedState, X as CFN_TEMPLATE_URL_LIMIT, Y as CFN_TEMPLATE_BODY_LIMIT, Z as MIGRATE_TMP_PREFIX, _ as matchesCdkPath, _t as StackHasActiveImportsError, a as withRetry, b as ProviderRegistry, c as bold, ct as LocalMigrateError, d as green, dt as MissingCdkCliError, et as AssemblyReader, f as red, ft as NestedStackChildDirectDestroyError, g as CDK_PATH_TAG, gt as ResourceUpdateNotSupportedError, h as collectInlinePolicyNamesManagedBySiblings, ht as ResourceTimeoutError, i as withResourceDeadline, it as CdkdError, j as shouldRetainResource, jt as PATTERN_B_RESOURCE_TYPES, k as LockManager, kt as getLiveRenderer, l as cyan, lt as LocalStartServiceError, m as IAMRoleProvider, mt as ProvisioningError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as resolveBucketRegion, o as IMPLICIT_DELETE_DEPENDENCIES, p as yellow, pt as PartialFailureError, q as resolveStateBucketWithDefaultAndSource, r as DeployEngine, s as formatResourceLine, st as LocalInvokeBuildError$1, t as DEFAULT_RESOURCE_TIMEOUT_MS, u as gray, v as normalizeAwsTagsToCfn, vt as StackTerminationProtectionError, w as IntrinsicFunctionResolver, wt as withErrorHandling, x as findActionableSilentDrops, y as resolveExplicitPhysicalId, z as runDockerStreaming } from "./deploy-engine-
|
|
3
|
+
import { $ as uploadCfnTemplate, A as S3StateBackend, At as PATTERN_B_NAME_PROPERTIES, B as Synthesizer, C as assertRegionMatch, Ct as normalizeAwsError, D as DagBuilder, E as DiffCalculator, Et as getLogger, F as buildDockerImage, Ft as withStackName, G as resolveSkipPrefix, H as getLegacyStateBucketName, I as formatDockerLoginError, J as warnDeprecatedNoPrefixCliFlag, K as resolveStateBucketWithDefault, L as getDockerCmd, M as AssetPublisher, Mt as generateResourceName, N as stringifyValue, Nt as generateResourceNameWithFallback, O as TemplateParser, Ot as runStackBuffered, P as WorkGraph, Pt as withSkipPrefix, Q as findLargeInlineResources, R as runDockerForeground, S as CloudControlProvider, T as applyRoleArnIfSet, U as resolveApp, V as getDefaultStateBucketName, W as resolveCaptureObservedState, X as CFN_TEMPLATE_URL_LIMIT, Y as CFN_TEMPLATE_BODY_LIMIT, Z as MIGRATE_TMP_PREFIX, _ as matchesCdkPath, _t as StackHasActiveImportsError, a as withRetry, b as ProviderRegistry, c as bold, ct as LocalMigrateError, d as green, dt as MissingCdkCliError, et as AssemblyReader, f as red, ft as NestedStackChildDirectDestroyError, g as CDK_PATH_TAG, gt as ResourceUpdateNotSupportedError, h as collectInlinePolicyNamesManagedBySiblings, ht as ResourceTimeoutError, i as withResourceDeadline, it as CdkdError, j as shouldRetainResource, jt as PATTERN_B_RESOURCE_TYPES, k as LockManager, kt as getLiveRenderer, l as cyan, lt as LocalStartServiceError, m as IAMRoleProvider, mt as ProvisioningError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as resolveBucketRegion, o as IMPLICIT_DELETE_DEPENDENCIES, p as yellow, pt as PartialFailureError, q as resolveStateBucketWithDefaultAndSource, r as DeployEngine, s as formatResourceLine, st as LocalInvokeBuildError$1, t as DEFAULT_RESOURCE_TIMEOUT_MS, u as gray, v as normalizeAwsTagsToCfn, vt as StackTerminationProtectionError, w as IntrinsicFunctionResolver, wt as withErrorHandling, x as findActionableSilentDrops, y as resolveExplicitPhysicalId, z as runDockerStreaming } from "./deploy-engine-5CVA5VWR.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";
|
|
@@ -58,7 +58,7 @@ import { CreateDeliveryStreamCommand, DeleteDeliveryStreamCommand, DescribeDeliv
|
|
|
58
58
|
import { AddTagsCommand as AddTagsCommand$1, CloudTrailClient, CreateTrailCommand, DeleteTrailCommand, GetEventSelectorsCommand, GetInsightSelectorsCommand, GetTrailCommand, GetTrailStatusCommand, ListTagsCommand as ListTagsCommand$1, ListTrailsCommand, PutEventSelectorsCommand, PutInsightSelectorsCommand, RemoveTagsCommand as RemoveTagsCommand$1, StartLoggingCommand, StopLoggingCommand, TrailNotFoundException, UpdateTrailCommand } from "@aws-sdk/client-cloudtrail";
|
|
59
59
|
import { BatchGetProjectsCommand, CodeBuildClient, CreateProjectCommand, DeleteProjectCommand, ListProjectsCommand, ResourceNotFoundException as ResourceNotFoundException$10, UpdateProjectCommand } from "@aws-sdk/client-codebuild";
|
|
60
60
|
import { CreateVectorBucketCommand, DeleteIndexCommand, DeleteVectorBucketCommand, GetVectorBucketCommand, ListIndexesCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$18, ListVectorBucketsCommand, S3VectorsClient } from "@aws-sdk/client-s3vectors";
|
|
61
|
-
import { CreateNamespaceCommand, CreateTableBucketCommand, CreateTableCommand as CreateTableCommand$2, DeleteNamespaceCommand as DeleteNamespaceCommand$1, DeleteTableBucketCommand, DeleteTableCommand as DeleteTableCommand$2, GetTableBucketCommand, GetTableCommand as GetTableCommand$1, ListNamespacesCommand as ListNamespacesCommand$1, ListTableBucketsCommand, ListTablesCommand as ListTablesCommand$1, ListTagsForResourceCommand as ListTagsForResourceCommand$19, NotFoundException as NotFoundException$5, S3TablesClient } from "@aws-sdk/client-s3tables";
|
|
61
|
+
import { CreateNamespaceCommand, CreateTableBucketCommand, CreateTableCommand as CreateTableCommand$2, DeleteNamespaceCommand as DeleteNamespaceCommand$1, DeleteTableBucketCommand, DeleteTableCommand as DeleteTableCommand$2, GetTableBucketCommand, GetTableCommand as GetTableCommand$1, ListNamespacesCommand as ListNamespacesCommand$1, ListTableBucketsCommand, ListTablesCommand as ListTablesCommand$1, ListTagsForResourceCommand as ListTagsForResourceCommand$19, NotFoundException as NotFoundException$5, S3TablesClient, TagResourceCommand as TagResourceCommand$16, UntagResourceCommand as UntagResourceCommand$15 } from "@aws-sdk/client-s3tables";
|
|
62
62
|
import { AttachLoadBalancerTargetGroupsCommand, AttachLoadBalancersCommand, AttachTrafficSourcesCommand, AutoScalingClient, CreateAutoScalingGroupCommand, CreateOrUpdateTagsCommand, DeleteAutoScalingGroupCommand, DeleteLifecycleHookCommand, DeleteNotificationConfigurationCommand, DeleteTagsCommand as DeleteTagsCommand$1, DescribeAutoScalingGroupsCommand, DescribeLifecycleHooksCommand, DescribeNotificationConfigurationsCommand, DescribeTrafficSourcesCommand, DetachLoadBalancerTargetGroupsCommand, DetachLoadBalancersCommand, DetachTrafficSourcesCommand, DisableMetricsCollectionCommand, EnableMetricsCollectionCommand, PutLifecycleHookCommand, PutNotificationConfigurationCommand, UpdateAutoScalingGroupCommand } from "@aws-sdk/client-auto-scaling";
|
|
63
63
|
import { Document, Pair, Scalar, YAMLMap, YAMLSeq, parse as parse$1, stringify } from "yaml";
|
|
64
64
|
import { createLocalStateProvider, getEmbedConfig, isCfnFlagPresent, listTargets, rejectExplicitCfnStackWithMultipleStacks, resolveCfnFallbackRegion, setEmbedConfig, substituteAgainstState, substituteAgainstStateAsync, substituteEnvVarsFromState, substituteEnvVarsFromStateAsync } from "cdk-local";
|
|
@@ -32005,7 +32005,9 @@ var S3TablesProvider = class {
|
|
|
32005
32005
|
"Namespace",
|
|
32006
32006
|
"TableName",
|
|
32007
32007
|
"Name",
|
|
32008
|
-
"
|
|
32008
|
+
"OpenTableFormat",
|
|
32009
|
+
"Format",
|
|
32010
|
+
"Tags"
|
|
32009
32011
|
])]
|
|
32010
32012
|
]);
|
|
32011
32013
|
getClient() {
|
|
@@ -32020,12 +32022,13 @@ var S3TablesProvider = class {
|
|
|
32020
32022
|
default: throw new ProvisioningError(`Unsupported resource type: ${resourceType}`, resourceType, logicalId);
|
|
32021
32023
|
}
|
|
32022
32024
|
}
|
|
32023
|
-
update(logicalId, physicalId, resourceType,
|
|
32024
|
-
|
|
32025
|
-
|
|
32025
|
+
async update(logicalId, physicalId, resourceType, properties, previousProperties) {
|
|
32026
|
+
if (resourceType === "AWS::S3Tables::Table") await this.applyTableTagsDiff(physicalId, previousProperties["Tags"], properties["Tags"]);
|
|
32027
|
+
else this.logger.debug(`Update is no-op for ${resourceType} ${logicalId}`);
|
|
32028
|
+
return {
|
|
32026
32029
|
physicalId,
|
|
32027
32030
|
wasReplaced: false
|
|
32028
|
-
}
|
|
32031
|
+
};
|
|
32029
32032
|
}
|
|
32030
32033
|
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
32031
32034
|
switch (resourceType) {
|
|
@@ -32121,9 +32124,11 @@ var S3TablesProvider = class {
|
|
|
32121
32124
|
this.logger.debug(`Creating S3 Tables Namespace ${logicalId}`);
|
|
32122
32125
|
const tableBucketARN = properties["TableBucketARN"];
|
|
32123
32126
|
if (!tableBucketARN) throw new ProvisioningError(`TableBucketARN is required for S3 Tables Namespace ${logicalId}`, resourceType, logicalId);
|
|
32124
|
-
const
|
|
32125
|
-
|
|
32126
|
-
|
|
32127
|
+
const rawNs = properties["Namespace"];
|
|
32128
|
+
let namespaceName;
|
|
32129
|
+
if (Array.isArray(rawNs) && rawNs.length > 0 && typeof rawNs[0] === "string") namespaceName = rawNs[0];
|
|
32130
|
+
else if (typeof rawNs === "string" && rawNs.length > 0) namespaceName = rawNs;
|
|
32131
|
+
if (!namespaceName) throw new ProvisioningError(`Namespace is required for S3 Tables Namespace ${logicalId}`, resourceType, logicalId);
|
|
32127
32132
|
try {
|
|
32128
32133
|
await this.getClient().send(new CreateNamespaceCommand({
|
|
32129
32134
|
tableBucketARN,
|
|
@@ -32168,20 +32173,24 @@ var S3TablesProvider = class {
|
|
|
32168
32173
|
if (!namespace) throw new ProvisioningError(`Namespace is required for S3 Tables Table ${logicalId}`, resourceType, logicalId);
|
|
32169
32174
|
const name = properties["TableName"] ?? properties["Name"];
|
|
32170
32175
|
if (!name) throw new ProvisioningError(`TableName is required for S3 Tables Table ${logicalId}`, resourceType, logicalId);
|
|
32171
|
-
const format = properties["Format"];
|
|
32172
|
-
if (!format) throw new ProvisioningError(`
|
|
32176
|
+
const format = properties["OpenTableFormat"] ?? properties["Format"];
|
|
32177
|
+
if (!format) throw new ProvisioningError(`OpenTableFormat is required for S3 Tables Table ${logicalId}`, resourceType, logicalId);
|
|
32178
|
+
const tags = this.cfnTagsToSdkMap(properties["Tags"]);
|
|
32173
32179
|
try {
|
|
32174
|
-
await this.getClient().send(new CreateTableCommand$2({
|
|
32180
|
+
const response = await this.getClient().send(new CreateTableCommand$2({
|
|
32175
32181
|
tableBucketARN,
|
|
32176
32182
|
namespace,
|
|
32177
32183
|
name,
|
|
32178
|
-
format
|
|
32184
|
+
format,
|
|
32185
|
+
...tags !== void 0 && { tags }
|
|
32179
32186
|
}));
|
|
32180
32187
|
const physicalId = `${tableBucketARN}|${namespace}|${name}`;
|
|
32188
|
+
if (!response.tableARN) throw new ProvisioningError(`CreateTable did not return a tableARN for ${logicalId} (${physicalId}) — refusing to record an empty TableARN attribute`, resourceType, logicalId, physicalId);
|
|
32189
|
+
const tableARN = response.tableARN;
|
|
32181
32190
|
this.logger.debug(`Successfully created S3 Tables Table ${logicalId}: ${physicalId}`);
|
|
32182
32191
|
return {
|
|
32183
32192
|
physicalId,
|
|
32184
|
-
attributes: {}
|
|
32193
|
+
attributes: { TableARN: tableARN }
|
|
32185
32194
|
};
|
|
32186
32195
|
} catch (error) {
|
|
32187
32196
|
const cause = error instanceof Error ? error : void 0;
|
|
@@ -32233,7 +32242,7 @@ var S3TablesProvider = class {
|
|
|
32233
32242
|
if (!tableBucketARN || !namespaceName) return void 0;
|
|
32234
32243
|
return {
|
|
32235
32244
|
TableBucketARN: tableBucketARN,
|
|
32236
|
-
Namespace:
|
|
32245
|
+
Namespace: namespaceName
|
|
32237
32246
|
};
|
|
32238
32247
|
}
|
|
32239
32248
|
async readTableCurrentState(physicalId) {
|
|
@@ -32259,7 +32268,11 @@ var S3TablesProvider = class {
|
|
|
32259
32268
|
Name: tableNameValue,
|
|
32260
32269
|
TableName: tableNameValue
|
|
32261
32270
|
};
|
|
32262
|
-
if (resp.format !== void 0)
|
|
32271
|
+
if (resp.format !== void 0) {
|
|
32272
|
+
result["OpenTableFormat"] = resp.format;
|
|
32273
|
+
result["Format"] = resp.format;
|
|
32274
|
+
}
|
|
32275
|
+
result["Tags"] = resp.tableARN ? await this.readTagsBestEffort(resp.tableARN) : [];
|
|
32263
32276
|
return result;
|
|
32264
32277
|
}
|
|
32265
32278
|
/**
|
|
@@ -32416,6 +32429,123 @@ var S3TablesProvider = class {
|
|
|
32416
32429
|
throw new ProvisioningError(`Failed to delete S3 Tables Table ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
|
|
32417
32430
|
}
|
|
32418
32431
|
}
|
|
32432
|
+
/**
|
|
32433
|
+
* Convert CFn `Tags: [{ Key, Value }]` to the S3Tables SDK's
|
|
32434
|
+
* `Record<string, string>` shape. Returns `undefined` when the input
|
|
32435
|
+
* is absent, empty, or invalid (so the caller can omit the field
|
|
32436
|
+
* from CreateTableCommand — the SDK rejects an empty `tags: {}` map
|
|
32437
|
+
* with InvalidRequestException). Entries missing a `Key` are skipped;
|
|
32438
|
+
* a missing `Value` is normalized to `''` (matches the on-AWS
|
|
32439
|
+
* representation — empty-string tag values are legal).
|
|
32440
|
+
*/
|
|
32441
|
+
cfnTagsToSdkMap(value) {
|
|
32442
|
+
if (!Array.isArray(value) || value.length === 0) return void 0;
|
|
32443
|
+
const map = {};
|
|
32444
|
+
for (const entry of value) {
|
|
32445
|
+
if (!entry || typeof entry !== "object") continue;
|
|
32446
|
+
const key = entry.Key;
|
|
32447
|
+
if (typeof key !== "string" || key.length === 0) continue;
|
|
32448
|
+
const raw = entry.Value;
|
|
32449
|
+
if (typeof raw === "string") map[key] = raw;
|
|
32450
|
+
else if (raw === void 0 || raw === null) map[key] = "";
|
|
32451
|
+
else if (typeof raw === "number" || typeof raw === "boolean") map[key] = String(raw);
|
|
32452
|
+
else continue;
|
|
32453
|
+
}
|
|
32454
|
+
return Object.keys(map).length > 0 ? map : void 0;
|
|
32455
|
+
}
|
|
32456
|
+
/**
|
|
32457
|
+
* Look up a table's real AWS ARN given its cdkd-compound physical
|
|
32458
|
+
* id parts. The real ARN is opaque (NOT `<bucketArn>/table/<ns>/<name>`
|
|
32459
|
+
* — that shape returns BadRequestException) and only AWS knows it,
|
|
32460
|
+
* so we call `GetTable` and pull `tableARN` from the response. Used
|
|
32461
|
+
* by the tag-diff path in update() and the readback's tag-fetch leg.
|
|
32462
|
+
* Returns null if the table is gone (NotFoundException → caller can
|
|
32463
|
+
* skip the tag op gracefully).
|
|
32464
|
+
*/
|
|
32465
|
+
async lookupTableArn(tableBucketARN, namespace, name) {
|
|
32466
|
+
try {
|
|
32467
|
+
return (await this.getClient().send(new GetTableCommand$1({
|
|
32468
|
+
tableBucketARN,
|
|
32469
|
+
namespace,
|
|
32470
|
+
name
|
|
32471
|
+
}))).tableARN ?? null;
|
|
32472
|
+
} catch (err) {
|
|
32473
|
+
if (err instanceof NotFoundException$5) return null;
|
|
32474
|
+
throw err;
|
|
32475
|
+
}
|
|
32476
|
+
}
|
|
32477
|
+
/**
|
|
32478
|
+
* Best-effort tag readback. ListTagsForResource against a freshly-
|
|
32479
|
+
* created table can briefly 404 due to eventual consistency; emit
|
|
32480
|
+
* `[]` on any failure rather than propagate (matches the S3Vectors /
|
|
32481
|
+
* CloudFront patterns and keeps the drift comparator happy).
|
|
32482
|
+
*/
|
|
32483
|
+
async readTagsBestEffort(resourceArn) {
|
|
32484
|
+
try {
|
|
32485
|
+
const tags = (await this.getClient().send(new ListTagsForResourceCommand$19({ resourceArn }))).tags ?? {};
|
|
32486
|
+
const out = [];
|
|
32487
|
+
for (const [Key, Value] of Object.entries(tags)) out.push({
|
|
32488
|
+
Key,
|
|
32489
|
+
Value
|
|
32490
|
+
});
|
|
32491
|
+
return out;
|
|
32492
|
+
} catch (err) {
|
|
32493
|
+
this.logger.debug(`readTagsBestEffort: ListTagsForResource failed for ${resourceArn}: ${err instanceof Error ? err.message : String(err)} — emitting Tags: []`);
|
|
32494
|
+
return [];
|
|
32495
|
+
}
|
|
32496
|
+
}
|
|
32497
|
+
/**
|
|
32498
|
+
* Apply a tag-diff against a Table resource ARN: keys present in
|
|
32499
|
+
* `previousTags` but absent / value-changed in `newTags` go through
|
|
32500
|
+
* `UntagResource`, then the full upsert set (additions + value
|
|
32501
|
+
* rewrites) goes through `TagResource`. Removal runs FIRST so a
|
|
32502
|
+
* value-only rewrite on key K isn't accidentally cleared by a stale
|
|
32503
|
+
* UntagResource pass (matches the CloudFront / S3Vectors pattern).
|
|
32504
|
+
*
|
|
32505
|
+
* Tag ops are best-effort post-step in update(): a tag-side failure
|
|
32506
|
+
* MUST NOT flip the deploy engine into a retry that would re-issue
|
|
32507
|
+
* the no-op `update()` body. Log at warn instead so the user sees
|
|
32508
|
+
* the unapplied delta but the deploy still progresses.
|
|
32509
|
+
*/
|
|
32510
|
+
async applyTableTagsDiff(physicalId, previousTags, newTags) {
|
|
32511
|
+
const parts = physicalId.split("|");
|
|
32512
|
+
if (parts.length < 3) {
|
|
32513
|
+
this.logger.warn(`applyTableTagsDiff: cannot derive table ARN from physicalId '${physicalId}' — skipping tag-diff`);
|
|
32514
|
+
return;
|
|
32515
|
+
}
|
|
32516
|
+
const [tableBucketARN, namespace, name] = parts;
|
|
32517
|
+
if (!tableBucketARN || !namespace || !name) {
|
|
32518
|
+
this.logger.warn(`applyTableTagsDiff: cannot derive table ARN from malformed physicalId '${physicalId}' (empty part after split) — skipping tag-diff`);
|
|
32519
|
+
return;
|
|
32520
|
+
}
|
|
32521
|
+
const prev = this.cfnTagsToSdkMap(previousTags) ?? {};
|
|
32522
|
+
const next = this.cfnTagsToSdkMap(newTags) ?? {};
|
|
32523
|
+
const removedKeys = Object.keys(prev).filter((k) => !(k in next));
|
|
32524
|
+
const upserts = {};
|
|
32525
|
+
for (const [k, v] of Object.entries(next)) if (prev[k] !== v) upserts[k] = v;
|
|
32526
|
+
if (removedKeys.length === 0 && Object.keys(upserts).length === 0) return;
|
|
32527
|
+
const resourceArn = await this.lookupTableArn(tableBucketARN, namespace, name);
|
|
32528
|
+
if (!resourceArn) {
|
|
32529
|
+
this.logger.warn(`applyTableTagsDiff: GetTable returned no tableARN for ${physicalId} — skipping tag-diff (table gone? state out-of-sync?)`);
|
|
32530
|
+
return;
|
|
32531
|
+
}
|
|
32532
|
+
if (removedKeys.length > 0) try {
|
|
32533
|
+
await this.getClient().send(new UntagResourceCommand$15({
|
|
32534
|
+
resourceArn,
|
|
32535
|
+
tagKeys: removedKeys
|
|
32536
|
+
}));
|
|
32537
|
+
} catch (err) {
|
|
32538
|
+
this.logger.warn(`applyTableTagsDiff: UntagResource failed for ${resourceArn} (keys: ${removedKeys.join(", ")}): ${err instanceof Error ? err.message : String(err)}`);
|
|
32539
|
+
}
|
|
32540
|
+
if (Object.keys(upserts).length > 0) try {
|
|
32541
|
+
await this.getClient().send(new TagResourceCommand$16({
|
|
32542
|
+
resourceArn,
|
|
32543
|
+
tags: upserts
|
|
32544
|
+
}));
|
|
32545
|
+
} catch (err) {
|
|
32546
|
+
this.logger.warn(`applyTableTagsDiff: TagResource failed for ${resourceArn} (keys: ${Object.keys(upserts).join(", ")}): ${err instanceof Error ? err.message : String(err)}`);
|
|
32547
|
+
}
|
|
32548
|
+
}
|
|
32419
32549
|
};
|
|
32420
32550
|
|
|
32421
32551
|
//#endregion
|
|
@@ -51726,7 +51856,7 @@ function reorderArgs(argv) {
|
|
|
51726
51856
|
*/
|
|
51727
51857
|
async function main() {
|
|
51728
51858
|
const program = new Command();
|
|
51729
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
51859
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.201.0");
|
|
51730
51860
|
program.addCommand(createBootstrapCommand());
|
|
51731
51861
|
program.addCommand(createSynthCommand());
|
|
51732
51862
|
program.addCommand(createListCommand());
|