@go-to-k/cdkd 0.207.4 → 0.207.5
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 +47 -28
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -11888,6 +11888,33 @@ var SSMParameterProvider = class {
|
|
|
11888
11888
|
this.ssmClient = awsClients.ssm;
|
|
11889
11889
|
}
|
|
11890
11890
|
/**
|
|
11891
|
+
* Normalize a CFn `AWS::SSM::Parameter.Tags` value into the SDK `Tag[]`
|
|
11892
|
+
* shape. Unlike most CFn resources (whose `Tags` is a `{Key,Value}[]` list),
|
|
11893
|
+
* `AWS::SSM::Parameter.Tags` is a key->value **map** (`{ "Env": "prod" }`) —
|
|
11894
|
+
* CDK synthesizes the map form, so `properties['Tags'].map(...)` throws
|
|
11895
|
+
* `Tags.map is not a function`. Accept the map (canonical) AND the list
|
|
11896
|
+
* (defensive, in case a hand-authored / escape-hatched template supplies it),
|
|
11897
|
+
* coerce each value to a string (SSM tag values must be strings), and drop
|
|
11898
|
+
* `aws:`-prefixed reserved keys (AWS rejects user attempts to set them).
|
|
11899
|
+
*/
|
|
11900
|
+
cfnTagsToSdkTags(raw) {
|
|
11901
|
+
if (raw === void 0 || raw === null) return [];
|
|
11902
|
+
const coerce = (v) => typeof v === "string" ? v : typeof v === "number" || typeof v === "boolean" ? String(v) : "";
|
|
11903
|
+
let entries;
|
|
11904
|
+
if (Array.isArray(raw)) entries = raw.map((t) => [t?.["Key"], t?.["Value"]]);
|
|
11905
|
+
else if (typeof raw === "object") entries = Object.entries(raw);
|
|
11906
|
+
else entries = [];
|
|
11907
|
+
const out = [];
|
|
11908
|
+
for (const [key, value] of entries) {
|
|
11909
|
+
if (typeof key !== "string" || key.length === 0 || key.startsWith("aws:")) continue;
|
|
11910
|
+
out.push({
|
|
11911
|
+
Key: key,
|
|
11912
|
+
Value: coerce(value)
|
|
11913
|
+
});
|
|
11914
|
+
}
|
|
11915
|
+
return out;
|
|
11916
|
+
}
|
|
11917
|
+
/**
|
|
11891
11918
|
* Create an SSM parameter
|
|
11892
11919
|
*/
|
|
11893
11920
|
async create(logicalId, resourceType, properties) {
|
|
@@ -11913,17 +11940,12 @@ var SSMParameterProvider = class {
|
|
|
11913
11940
|
if (properties["DataType"]) putParams.DataType = properties["DataType"];
|
|
11914
11941
|
await this.ssmClient.send(new PutParameterCommand(putParams));
|
|
11915
11942
|
try {
|
|
11916
|
-
|
|
11917
|
-
|
|
11918
|
-
|
|
11919
|
-
|
|
11920
|
-
|
|
11921
|
-
|
|
11922
|
-
ResourceType: "Parameter",
|
|
11923
|
-
ResourceId: name,
|
|
11924
|
-
Tags: ssmTags
|
|
11925
|
-
}));
|
|
11926
|
-
}
|
|
11943
|
+
const ssmTags = this.cfnTagsToSdkTags(properties["Tags"]);
|
|
11944
|
+
if (ssmTags.length > 0) await this.ssmClient.send(new AddTagsToResourceCommand({
|
|
11945
|
+
ResourceType: "Parameter",
|
|
11946
|
+
ResourceId: name,
|
|
11947
|
+
Tags: ssmTags
|
|
11948
|
+
}));
|
|
11927
11949
|
} catch (innerError) {
|
|
11928
11950
|
try {
|
|
11929
11951
|
await this.ssmClient.send(new DeleteParameterCommand({ Name: name }));
|
|
@@ -11967,25 +11989,21 @@ var SSMParameterProvider = class {
|
|
|
11967
11989
|
if (properties["Policies"] !== void 0) putParams.Policies = properties["Policies"];
|
|
11968
11990
|
if (properties["DataType"] !== void 0) putParams.DataType = properties["DataType"];
|
|
11969
11991
|
await this.ssmClient.send(new PutParameterCommand(putParams));
|
|
11970
|
-
const newTags = properties["Tags"];
|
|
11971
|
-
const oldTags = previousProperties["Tags"];
|
|
11972
|
-
|
|
11973
|
-
|
|
11992
|
+
const newTags = this.cfnTagsToSdkTags(properties["Tags"]);
|
|
11993
|
+
const oldTags = this.cfnTagsToSdkTags(previousProperties["Tags"]);
|
|
11994
|
+
const tagKey = (t) => t.Key;
|
|
11995
|
+
const sortedJson = (tags) => JSON.stringify([...tags].sort((a, b) => tagKey(a).localeCompare(tagKey(b))));
|
|
11996
|
+
if (sortedJson(newTags) !== sortedJson(oldTags)) {
|
|
11997
|
+
if (oldTags.length > 0) await this.ssmClient.send(new RemoveTagsFromResourceCommand({
|
|
11974
11998
|
ResourceType: "Parameter",
|
|
11975
11999
|
ResourceId: physicalId,
|
|
11976
12000
|
TagKeys: oldTags.map((t) => t.Key)
|
|
11977
12001
|
}));
|
|
11978
|
-
if (newTags
|
|
11979
|
-
|
|
11980
|
-
|
|
11981
|
-
|
|
11982
|
-
|
|
11983
|
-
await this.ssmClient.send(new AddTagsToResourceCommand({
|
|
11984
|
-
ResourceType: "Parameter",
|
|
11985
|
-
ResourceId: physicalId,
|
|
11986
|
-
Tags: ssmTags
|
|
11987
|
-
}));
|
|
11988
|
-
}
|
|
12002
|
+
if (newTags.length > 0) await this.ssmClient.send(new AddTagsToResourceCommand({
|
|
12003
|
+
ResourceType: "Parameter",
|
|
12004
|
+
ResourceId: physicalId,
|
|
12005
|
+
Tags: newTags
|
|
12006
|
+
}));
|
|
11989
12007
|
this.logger.debug(`Updated tags for SSM parameter ${physicalId}`);
|
|
11990
12008
|
}
|
|
11991
12009
|
this.logger.debug(`Successfully updated SSM parameter ${logicalId}`);
|
|
@@ -12096,10 +12114,11 @@ var SSMParameterProvider = class {
|
|
|
12096
12114
|
} catch {}
|
|
12097
12115
|
if (!policiesEmitted) result["Policies"] = [];
|
|
12098
12116
|
try {
|
|
12099
|
-
|
|
12117
|
+
const tagArr = normalizeAwsTagsToCfn((await this.ssmClient.send(new ListTagsForResourceCommand$2({
|
|
12100
12118
|
ResourceType: "Parameter",
|
|
12101
12119
|
ResourceId: physicalId
|
|
12102
12120
|
}))).TagList);
|
|
12121
|
+
result["Tags"] = Object.fromEntries(tagArr.map((t) => [t.Key, t.Value]));
|
|
12103
12122
|
} catch {}
|
|
12104
12123
|
return result;
|
|
12105
12124
|
}
|
|
@@ -52699,7 +52718,7 @@ function reorderArgs(argv) {
|
|
|
52699
52718
|
*/
|
|
52700
52719
|
async function main() {
|
|
52701
52720
|
const program = new Command();
|
|
52702
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.207.
|
|
52721
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.207.5");
|
|
52703
52722
|
program.addCommand(createBootstrapCommand());
|
|
52704
52723
|
program.addCommand(createSynthCommand());
|
|
52705
52724
|
program.addCommand(createListCommand());
|