@go-to-k/cdkd 0.20.0 → 0.22.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 +799 -11
- package/dist/cli.js.map +3 -3
- package/dist/go-to-k-cdkd-0.22.0.tgz +0 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
- package/dist/go-to-k-cdkd-0.20.0.tgz +0 -0
package/dist/cli.js
CHANGED
|
@@ -1218,9 +1218,9 @@ async function bucketHasAnyState(client, bucketName) {
|
|
|
1218
1218
|
}
|
|
1219
1219
|
}
|
|
1220
1220
|
async function bucketExists(client, bucketName) {
|
|
1221
|
-
const { HeadBucketCommand:
|
|
1221
|
+
const { HeadBucketCommand: HeadBucketCommand6 } = await import("@aws-sdk/client-s3");
|
|
1222
1222
|
try {
|
|
1223
|
-
await client.send(new
|
|
1223
|
+
await client.send(new HeadBucketCommand6({ Bucket: bucketName }));
|
|
1224
1224
|
return true;
|
|
1225
1225
|
} catch (error) {
|
|
1226
1226
|
const err = error;
|
|
@@ -7749,6 +7749,27 @@ var CustomResourceProvider = class _CustomResourceProvider {
|
|
|
7749
7749
|
sleep(ms) {
|
|
7750
7750
|
return new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
7751
7751
|
}
|
|
7752
|
+
/**
|
|
7753
|
+
* Adopt an existing custom resource into cdkd state.
|
|
7754
|
+
*
|
|
7755
|
+
* **Explicit override only.** A custom resource's identity is the
|
|
7756
|
+
* `PhysicalResourceId` returned by its user-supplied Lambda handler at
|
|
7757
|
+
* Create time — there is no AWS-side resource cdkd can introspect, no
|
|
7758
|
+
* tag API, and no `aws:cdk:path` to look up by. cdkd cannot rediscover
|
|
7759
|
+
* a custom resource without invoking the handler, which would mutate
|
|
7760
|
+
* state.
|
|
7761
|
+
*
|
|
7762
|
+
* Users adopting an existing custom resource should pass
|
|
7763
|
+
* `--resource <logicalId>=<physicalResourceId>` — the same value the
|
|
7764
|
+
* handler returned originally.
|
|
7765
|
+
*/
|
|
7766
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- explicit-override-only intentionally has no AWS calls
|
|
7767
|
+
async import(input) {
|
|
7768
|
+
if (input.knownPhysicalId) {
|
|
7769
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
7770
|
+
}
|
|
7771
|
+
return null;
|
|
7772
|
+
}
|
|
7752
7773
|
};
|
|
7753
7774
|
|
|
7754
7775
|
// src/provisioning/provider-registry.ts
|
|
@@ -8864,6 +8885,27 @@ var IAMPolicyProvider = class {
|
|
|
8864
8885
|
);
|
|
8865
8886
|
}
|
|
8866
8887
|
}
|
|
8888
|
+
/**
|
|
8889
|
+
* Adopt an existing IAM inline policy into cdkd state.
|
|
8890
|
+
*
|
|
8891
|
+
* **Explicit override only.** `AWS::IAM::Policy` in CloudFormation is an
|
|
8892
|
+
* inline policy attached to roles / groups / users — not a standalone
|
|
8893
|
+
* resource. Inline policies are not taggable and have no global identity,
|
|
8894
|
+
* so tag-based auto-lookup via `aws:cdk:path` is not feasible. Users
|
|
8895
|
+
* adopting inline policies must pass `--resource <logicalId>=<policyName>`
|
|
8896
|
+
* (the physical id is the policy name itself).
|
|
8897
|
+
*
|
|
8898
|
+
* For standalone managed policies (`AWS::IAM::ManagedPolicy`), the
|
|
8899
|
+
* Cloud Control API fallback handles import via the same explicit
|
|
8900
|
+
* override mode.
|
|
8901
|
+
*/
|
|
8902
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- explicit-override-only intentionally has no AWS calls
|
|
8903
|
+
async import(input) {
|
|
8904
|
+
if (input.knownPhysicalId) {
|
|
8905
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
8906
|
+
}
|
|
8907
|
+
return null;
|
|
8908
|
+
}
|
|
8867
8909
|
};
|
|
8868
8910
|
|
|
8869
8911
|
// src/provisioning/providers/iam-instance-profile-provider.ts
|
|
@@ -8871,6 +8913,7 @@ import {
|
|
|
8871
8913
|
CreateInstanceProfileCommand,
|
|
8872
8914
|
DeleteInstanceProfileCommand,
|
|
8873
8915
|
GetInstanceProfileCommand,
|
|
8916
|
+
ListInstanceProfilesCommand,
|
|
8874
8917
|
AddRoleToInstanceProfileCommand,
|
|
8875
8918
|
RemoveRoleFromInstanceProfileCommand as RemoveRoleFromInstanceProfileCommand2,
|
|
8876
8919
|
NoSuchEntityException as NoSuchEntityException3
|
|
@@ -9072,6 +9115,48 @@ var IAMInstanceProfileProvider = class {
|
|
|
9072
9115
|
);
|
|
9073
9116
|
}
|
|
9074
9117
|
}
|
|
9118
|
+
/**
|
|
9119
|
+
* Adopt an existing IAM instance profile into cdkd state.
|
|
9120
|
+
*
|
|
9121
|
+
* Lookup order:
|
|
9122
|
+
* 1. `--resource` override or `Properties.InstanceProfileName` → verify
|
|
9123
|
+
* via `GetInstanceProfile`.
|
|
9124
|
+
* 2. `ListInstanceProfiles` paginator + match `aws:cdk:path` against the
|
|
9125
|
+
* `InstanceProfile.Tags` array returned inline (no separate
|
|
9126
|
+
* `ListInstanceProfileTags` call needed).
|
|
9127
|
+
*
|
|
9128
|
+
* IAM is global; this walks every instance profile in the account once.
|
|
9129
|
+
*/
|
|
9130
|
+
async import(input) {
|
|
9131
|
+
const explicit = resolveExplicitPhysicalId(input, "InstanceProfileName");
|
|
9132
|
+
if (explicit) {
|
|
9133
|
+
try {
|
|
9134
|
+
await this.iamClient.send(new GetInstanceProfileCommand({ InstanceProfileName: explicit }));
|
|
9135
|
+
return { physicalId: explicit, attributes: {} };
|
|
9136
|
+
} catch (err) {
|
|
9137
|
+
if (err instanceof NoSuchEntityException3)
|
|
9138
|
+
return null;
|
|
9139
|
+
throw err;
|
|
9140
|
+
}
|
|
9141
|
+
}
|
|
9142
|
+
if (!input.cdkPath)
|
|
9143
|
+
return null;
|
|
9144
|
+
let marker;
|
|
9145
|
+
do {
|
|
9146
|
+
const list = await this.iamClient.send(
|
|
9147
|
+
new ListInstanceProfilesCommand({ ...marker && { Marker: marker } })
|
|
9148
|
+
);
|
|
9149
|
+
for (const profile of list.InstanceProfiles ?? []) {
|
|
9150
|
+
if (!profile.InstanceProfileName)
|
|
9151
|
+
continue;
|
|
9152
|
+
if (matchesCdkPath(profile.Tags, input.cdkPath)) {
|
|
9153
|
+
return { physicalId: profile.InstanceProfileName, attributes: {} };
|
|
9154
|
+
}
|
|
9155
|
+
}
|
|
9156
|
+
marker = list.IsTruncated ? list.Marker : void 0;
|
|
9157
|
+
} while (marker);
|
|
9158
|
+
return null;
|
|
9159
|
+
}
|
|
9075
9160
|
};
|
|
9076
9161
|
|
|
9077
9162
|
// src/provisioning/providers/iam-user-group-provider.ts
|
|
@@ -9102,6 +9187,8 @@ import {
|
|
|
9102
9187
|
DeleteLoginProfileCommand,
|
|
9103
9188
|
ListAccessKeysCommand,
|
|
9104
9189
|
DeleteAccessKeyCommand,
|
|
9190
|
+
ListUsersCommand,
|
|
9191
|
+
ListUserTagsCommand,
|
|
9105
9192
|
NoSuchEntityException as NoSuchEntityException4,
|
|
9106
9193
|
TagUserCommand,
|
|
9107
9194
|
PutUserPermissionsBoundaryCommand,
|
|
@@ -10080,6 +10167,92 @@ var IAMUserGroupProvider = class {
|
|
|
10080
10167
|
);
|
|
10081
10168
|
}
|
|
10082
10169
|
}
|
|
10170
|
+
// ─── Import dispatch ──────────────────────────────────────────────
|
|
10171
|
+
/**
|
|
10172
|
+
* Adopt an existing IAM user / group / user-to-group addition into cdkd state.
|
|
10173
|
+
*
|
|
10174
|
+
* - **AWS::IAM::User**: tag-based auto-lookup via `ListUsers` +
|
|
10175
|
+
* `ListUserTags`. Falls back to `--resource` override or
|
|
10176
|
+
* `Properties.UserName`.
|
|
10177
|
+
* - **AWS::IAM::Group**: explicit-override only. IAM groups are not
|
|
10178
|
+
* taggable (no `ListGroupTags` API), so tag-based auto-lookup is not
|
|
10179
|
+
* possible. Caller can still pass `Properties.GroupName` or
|
|
10180
|
+
* `--resource` to verify and adopt by name.
|
|
10181
|
+
* - **AWS::IAM::UserToGroupAddition**: explicit-override only. Has no
|
|
10182
|
+
* AWS-side identity beyond the (group, users) attachment itself.
|
|
10183
|
+
*/
|
|
10184
|
+
async import(input) {
|
|
10185
|
+
switch (input.resourceType) {
|
|
10186
|
+
case "AWS::IAM::User":
|
|
10187
|
+
return this.importUser(input);
|
|
10188
|
+
case "AWS::IAM::Group":
|
|
10189
|
+
return this.importGroup(input);
|
|
10190
|
+
case "AWS::IAM::UserToGroupAddition":
|
|
10191
|
+
return this.importUserToGroupAddition(input);
|
|
10192
|
+
default:
|
|
10193
|
+
return null;
|
|
10194
|
+
}
|
|
10195
|
+
}
|
|
10196
|
+
async importUser(input) {
|
|
10197
|
+
const explicit = resolveExplicitPhysicalId(input, "UserName");
|
|
10198
|
+
if (explicit) {
|
|
10199
|
+
try {
|
|
10200
|
+
await this.iamClient.send(new GetUserCommand({ UserName: explicit }));
|
|
10201
|
+
return { physicalId: explicit, attributes: {} };
|
|
10202
|
+
} catch (err) {
|
|
10203
|
+
if (err instanceof NoSuchEntityException4)
|
|
10204
|
+
return null;
|
|
10205
|
+
throw err;
|
|
10206
|
+
}
|
|
10207
|
+
}
|
|
10208
|
+
if (!input.cdkPath)
|
|
10209
|
+
return null;
|
|
10210
|
+
let marker;
|
|
10211
|
+
do {
|
|
10212
|
+
const list = await this.iamClient.send(
|
|
10213
|
+
new ListUsersCommand({ ...marker && { Marker: marker } })
|
|
10214
|
+
);
|
|
10215
|
+
for (const user of list.Users ?? []) {
|
|
10216
|
+
if (!user.UserName)
|
|
10217
|
+
continue;
|
|
10218
|
+
try {
|
|
10219
|
+
const tags = await this.iamClient.send(
|
|
10220
|
+
new ListUserTagsCommand({ UserName: user.UserName })
|
|
10221
|
+
);
|
|
10222
|
+
if (matchesCdkPath(tags.Tags, input.cdkPath)) {
|
|
10223
|
+
return { physicalId: user.UserName, attributes: {} };
|
|
10224
|
+
}
|
|
10225
|
+
} catch (err) {
|
|
10226
|
+
if (err instanceof NoSuchEntityException4)
|
|
10227
|
+
continue;
|
|
10228
|
+
throw err;
|
|
10229
|
+
}
|
|
10230
|
+
}
|
|
10231
|
+
marker = list.IsTruncated ? list.Marker : void 0;
|
|
10232
|
+
} while (marker);
|
|
10233
|
+
return null;
|
|
10234
|
+
}
|
|
10235
|
+
async importGroup(input) {
|
|
10236
|
+
const explicit = resolveExplicitPhysicalId(input, "GroupName");
|
|
10237
|
+
if (explicit) {
|
|
10238
|
+
try {
|
|
10239
|
+
await this.iamClient.send(new GetGroupCommand({ GroupName: explicit }));
|
|
10240
|
+
return { physicalId: explicit, attributes: {} };
|
|
10241
|
+
} catch (err) {
|
|
10242
|
+
if (err instanceof NoSuchEntityException4)
|
|
10243
|
+
return null;
|
|
10244
|
+
throw err;
|
|
10245
|
+
}
|
|
10246
|
+
}
|
|
10247
|
+
return null;
|
|
10248
|
+
}
|
|
10249
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- explicit-override-only intentionally has no AWS calls
|
|
10250
|
+
async importUserToGroupAddition(input) {
|
|
10251
|
+
if (input.knownPhysicalId) {
|
|
10252
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
10253
|
+
}
|
|
10254
|
+
return null;
|
|
10255
|
+
}
|
|
10083
10256
|
};
|
|
10084
10257
|
|
|
10085
10258
|
// src/provisioning/providers/s3-bucket-provider.ts
|
|
@@ -11220,6 +11393,25 @@ var S3BucketPolicyProvider = class {
|
|
|
11220
11393
|
);
|
|
11221
11394
|
}
|
|
11222
11395
|
}
|
|
11396
|
+
/**
|
|
11397
|
+
* Adopt an existing S3 bucket policy into cdkd state.
|
|
11398
|
+
*
|
|
11399
|
+
* **Explicit override only.** An `S3::BucketPolicy` is a policy document
|
|
11400
|
+
* attached to a bucket via `PutBucketPolicy` — it has no standalone
|
|
11401
|
+
* identity and is not independently taggable. There is no `aws:cdk:path`
|
|
11402
|
+
* tag to look up by; only the bucket itself is taggable.
|
|
11403
|
+
*
|
|
11404
|
+
* Users adopting an existing bucket policy should pass
|
|
11405
|
+
* `--resource <logicalId>=<bucketName>` (matching the physical id
|
|
11406
|
+
* format returned by `create()`).
|
|
11407
|
+
*/
|
|
11408
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- explicit-override-only intentionally has no AWS calls
|
|
11409
|
+
async import(input) {
|
|
11410
|
+
if (input.knownPhysicalId) {
|
|
11411
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
11412
|
+
}
|
|
11413
|
+
return null;
|
|
11414
|
+
}
|
|
11223
11415
|
};
|
|
11224
11416
|
|
|
11225
11417
|
// src/provisioning/providers/sqs-queue-provider.ts
|
|
@@ -11656,6 +11848,25 @@ var SQSQueuePolicyProvider = class {
|
|
|
11656
11848
|
);
|
|
11657
11849
|
}
|
|
11658
11850
|
}
|
|
11851
|
+
/**
|
|
11852
|
+
* Adopt an existing SQS queue policy into cdkd state.
|
|
11853
|
+
*
|
|
11854
|
+
* **Explicit override only.** A `QueuePolicy` is an attachment applied to
|
|
11855
|
+
* a queue via `SetQueueAttributes(Policy=...)` — it has no standalone
|
|
11856
|
+
* identity and is not independently taggable. There is no `aws:cdk:path`
|
|
11857
|
+
* tag to look up by; only the queue itself is taggable.
|
|
11858
|
+
*
|
|
11859
|
+
* Users adopting an existing queue policy should pass
|
|
11860
|
+
* `--resource <logicalId>=<queueUrl>` (matching the physical id format
|
|
11861
|
+
* returned by `create()`, which uses the first queue URL).
|
|
11862
|
+
*/
|
|
11863
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- explicit-override-only intentionally has no AWS calls
|
|
11864
|
+
async import(input) {
|
|
11865
|
+
if (input.knownPhysicalId) {
|
|
11866
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
11867
|
+
}
|
|
11868
|
+
return null;
|
|
11869
|
+
}
|
|
11659
11870
|
};
|
|
11660
11871
|
|
|
11661
11872
|
// src/provisioning/providers/sns-topic-provider.ts
|
|
@@ -12148,6 +12359,25 @@ var SNSSubscriptionProvider = class {
|
|
|
12148
12359
|
);
|
|
12149
12360
|
}
|
|
12150
12361
|
}
|
|
12362
|
+
/**
|
|
12363
|
+
* Adopt an existing SNS subscription into cdkd state.
|
|
12364
|
+
*
|
|
12365
|
+
* **Explicit override only.** SNS subscriptions are attached to a parent
|
|
12366
|
+
* topic and identified by their `SubscriptionArn`, but the SubscribeAPI
|
|
12367
|
+
* does not accept tags and the AWS tag APIs do not cover subscriptions
|
|
12368
|
+
* (only Topics are taggable). There is therefore no `aws:cdk:path` tag
|
|
12369
|
+
* we could use for auto-lookup.
|
|
12370
|
+
*
|
|
12371
|
+
* Users adopting an existing subscription should pass
|
|
12372
|
+
* `--resource <logicalId>=<subscriptionArn>`.
|
|
12373
|
+
*/
|
|
12374
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- explicit-override-only intentionally has no AWS calls
|
|
12375
|
+
async import(input) {
|
|
12376
|
+
if (input.knownPhysicalId) {
|
|
12377
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
12378
|
+
}
|
|
12379
|
+
return null;
|
|
12380
|
+
}
|
|
12151
12381
|
};
|
|
12152
12382
|
|
|
12153
12383
|
// src/provisioning/providers/sns-topic-policy-provider.ts
|
|
@@ -12287,6 +12517,26 @@ var SNSTopicPolicyProvider = class {
|
|
|
12287
12517
|
}
|
|
12288
12518
|
this.logger.debug(`Successfully deleted SNS topic policy ${logicalId}`);
|
|
12289
12519
|
}
|
|
12520
|
+
/**
|
|
12521
|
+
* Adopt an existing SNS topic policy into cdkd state.
|
|
12522
|
+
*
|
|
12523
|
+
* **Explicit override only.** A `TopicPolicy` is an attachment to one or
|
|
12524
|
+
* more SNS topics applied via `SetTopicAttributes(AttributeName=Policy)` —
|
|
12525
|
+
* it has no standalone identity and is not independently taggable. There
|
|
12526
|
+
* is no `aws:cdk:path` tag to look up by, and the policy has no name/ARN
|
|
12527
|
+
* of its own.
|
|
12528
|
+
*
|
|
12529
|
+
* Users adopting an existing topic policy should pass
|
|
12530
|
+
* `--resource <logicalId>=<comma-joined-topic-ARNs>` (matching the
|
|
12531
|
+
* physical id format returned by `create()`).
|
|
12532
|
+
*/
|
|
12533
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- explicit-override-only intentionally has no AWS calls
|
|
12534
|
+
async import(input) {
|
|
12535
|
+
if (input.knownPhysicalId) {
|
|
12536
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
12537
|
+
}
|
|
12538
|
+
return null;
|
|
12539
|
+
}
|
|
12290
12540
|
/**
|
|
12291
12541
|
* Set the policy on a single SNS topic
|
|
12292
12542
|
*/
|
|
@@ -13142,6 +13392,26 @@ var LambdaPermissionProvider = class {
|
|
|
13142
13392
|
);
|
|
13143
13393
|
}
|
|
13144
13394
|
}
|
|
13395
|
+
/**
|
|
13396
|
+
* Adopt an existing Lambda permission into cdkd state.
|
|
13397
|
+
*
|
|
13398
|
+
* **Explicit override only.** A `Lambda::Permission` is a single statement
|
|
13399
|
+
* within a function's resource-based policy added via `AddPermission`. It
|
|
13400
|
+
* has no independent ARN, no taggable identity, and the only way to find
|
|
13401
|
+
* it is to call `GetPolicy` on the parent function and parse the JSON
|
|
13402
|
+
* statements — which the user knows by `StatementId` already.
|
|
13403
|
+
*
|
|
13404
|
+
* Users adopting an existing permission should pass
|
|
13405
|
+
* `--resource <logicalId>=<statementId>` (matching the physical id
|
|
13406
|
+
* format returned by `create()`).
|
|
13407
|
+
*/
|
|
13408
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- explicit-override-only intentionally has no AWS calls
|
|
13409
|
+
async import(input) {
|
|
13410
|
+
if (input.knownPhysicalId) {
|
|
13411
|
+
return { physicalId: input.knownPhysicalId, attributes: { Id: input.knownPhysicalId } };
|
|
13412
|
+
}
|
|
13413
|
+
return null;
|
|
13414
|
+
}
|
|
13145
13415
|
};
|
|
13146
13416
|
|
|
13147
13417
|
// src/provisioning/providers/lambda-url-provider.ts
|
|
@@ -13275,6 +13545,26 @@ var LambdaUrlProvider = class {
|
|
|
13275
13545
|
);
|
|
13276
13546
|
}
|
|
13277
13547
|
}
|
|
13548
|
+
/**
|
|
13549
|
+
* Adopt an existing Lambda Function URL into cdkd state.
|
|
13550
|
+
*
|
|
13551
|
+
* **Explicit override only.** A `Lambda::Url` is a configuration attached
|
|
13552
|
+
* to a Lambda function — it has no standalone identity (the natural
|
|
13553
|
+
* physical id is the parent function's ARN/name) and `FunctionUrlConfig`
|
|
13554
|
+
* is not independently taggable. There is no `aws:cdk:path` tag to look
|
|
13555
|
+
* up by; only the parent function carries the CDK path tag.
|
|
13556
|
+
*
|
|
13557
|
+
* Users adopting an existing function URL should pass
|
|
13558
|
+
* `--resource <logicalId>=<functionArnOrName>` (matching the physical id
|
|
13559
|
+
* format returned by `create()`).
|
|
13560
|
+
*/
|
|
13561
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- explicit-override-only intentionally has no AWS calls
|
|
13562
|
+
async import(input) {
|
|
13563
|
+
if (input.knownPhysicalId) {
|
|
13564
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
13565
|
+
}
|
|
13566
|
+
return null;
|
|
13567
|
+
}
|
|
13278
13568
|
/**
|
|
13279
13569
|
* Build CORS configuration from CDK properties
|
|
13280
13570
|
*/
|
|
@@ -13517,12 +13807,36 @@ var LambdaEventSourceMappingProvider = class {
|
|
|
13517
13807
|
);
|
|
13518
13808
|
}
|
|
13519
13809
|
}
|
|
13810
|
+
/**
|
|
13811
|
+
* Adopt an existing Lambda event source mapping into cdkd state.
|
|
13812
|
+
*
|
|
13813
|
+
* **Explicit override only.** Event source mappings are identified by a
|
|
13814
|
+
* UUID returned at create time. While Lambda event source mappings ARE
|
|
13815
|
+
* taggable since 2020, CDK does NOT propagate the `aws:cdk:path` tag to
|
|
13816
|
+
* them by default (the `Tags` property must be explicitly opted into),
|
|
13817
|
+
* and the natural lookup is by `(FunctionName, EventSourceArn)` — which
|
|
13818
|
+
* the user already knows.
|
|
13819
|
+
*
|
|
13820
|
+
* Users adopting an existing event source mapping should pass
|
|
13821
|
+
* `--resource <logicalId>=<UUID>` (matching the physical id format
|
|
13822
|
+
* returned by `create()`).
|
|
13823
|
+
*/
|
|
13824
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- explicit-override-only intentionally has no AWS calls
|
|
13825
|
+
async import(input) {
|
|
13826
|
+
if (input.knownPhysicalId) {
|
|
13827
|
+
return { physicalId: input.knownPhysicalId, attributes: { Id: input.knownPhysicalId } };
|
|
13828
|
+
}
|
|
13829
|
+
return null;
|
|
13830
|
+
}
|
|
13520
13831
|
};
|
|
13521
13832
|
|
|
13522
13833
|
// src/provisioning/providers/lambda-layer-provider.ts
|
|
13523
13834
|
import {
|
|
13524
13835
|
PublishLayerVersionCommand,
|
|
13525
13836
|
DeleteLayerVersionCommand,
|
|
13837
|
+
GetLayerVersionByArnCommand,
|
|
13838
|
+
ListLayersCommand,
|
|
13839
|
+
ListTagsCommand as ListTagsCommand2,
|
|
13526
13840
|
ResourceNotFoundException as ResourceNotFoundException5
|
|
13527
13841
|
} from "@aws-sdk/client-lambda";
|
|
13528
13842
|
init_aws_clients();
|
|
@@ -13661,6 +13975,67 @@ var LambdaLayerVersionProvider = class {
|
|
|
13661
13975
|
);
|
|
13662
13976
|
}
|
|
13663
13977
|
}
|
|
13978
|
+
/**
|
|
13979
|
+
* Adopt an existing Lambda layer version into cdkd state.
|
|
13980
|
+
*
|
|
13981
|
+
* Lookup order:
|
|
13982
|
+
* 1. `--resource <id>=<layerVersionArn>` override → verify with
|
|
13983
|
+
* `GetLayerVersionByArn`. (Note: there is no `LayerName` field that
|
|
13984
|
+
* uniquely names a *version*; a layer name resolves to the latest
|
|
13985
|
+
* version, so an explicit ARN is the only unambiguous override.)
|
|
13986
|
+
* 2. `ListLayers` paginator + `ListTags(Resource: layerArn)` (which
|
|
13987
|
+
* returns a `Tags: Record<string,string>` map keyed by tag name).
|
|
13988
|
+
* Match `aws:cdk:path` and adopt `LatestMatchingVersion.LayerVersionArn`.
|
|
13989
|
+
*
|
|
13990
|
+
* **Caveat**: Lambda layer versions are immutable, so auto-lookup adopts
|
|
13991
|
+
* the LATEST version of the named layer that carries the matching CDK
|
|
13992
|
+
* path tag. If the user's CDK app has since published newer versions
|
|
13993
|
+
* outside cdkd's tracking, the adopted physical id may be stale; pass
|
|
13994
|
+
* `--resource <id>=<arn>` to pin a specific version.
|
|
13995
|
+
*/
|
|
13996
|
+
async import(input) {
|
|
13997
|
+
if (input.knownPhysicalId) {
|
|
13998
|
+
try {
|
|
13999
|
+
await this.lambdaClient.send(
|
|
14000
|
+
new GetLayerVersionByArnCommand({ Arn: input.knownPhysicalId })
|
|
14001
|
+
);
|
|
14002
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
14003
|
+
} catch (err) {
|
|
14004
|
+
if (err instanceof ResourceNotFoundException5)
|
|
14005
|
+
return null;
|
|
14006
|
+
throw err;
|
|
14007
|
+
}
|
|
14008
|
+
}
|
|
14009
|
+
if (!input.cdkPath)
|
|
14010
|
+
return null;
|
|
14011
|
+
let marker;
|
|
14012
|
+
do {
|
|
14013
|
+
const list = await this.lambdaClient.send(
|
|
14014
|
+
new ListLayersCommand({ ...marker && { Marker: marker } })
|
|
14015
|
+
);
|
|
14016
|
+
for (const layer of list.Layers ?? []) {
|
|
14017
|
+
if (!layer.LayerArn || !layer.LatestMatchingVersion?.LayerVersionArn)
|
|
14018
|
+
continue;
|
|
14019
|
+
try {
|
|
14020
|
+
const tagsResp = await this.lambdaClient.send(
|
|
14021
|
+
new ListTagsCommand2({ Resource: layer.LayerArn })
|
|
14022
|
+
);
|
|
14023
|
+
if (tagsResp.Tags?.[CDK_PATH_TAG] === input.cdkPath) {
|
|
14024
|
+
return {
|
|
14025
|
+
physicalId: layer.LatestMatchingVersion.LayerVersionArn,
|
|
14026
|
+
attributes: {}
|
|
14027
|
+
};
|
|
14028
|
+
}
|
|
14029
|
+
} catch (err) {
|
|
14030
|
+
if (err instanceof ResourceNotFoundException5)
|
|
14031
|
+
continue;
|
|
14032
|
+
throw err;
|
|
14033
|
+
}
|
|
14034
|
+
}
|
|
14035
|
+
marker = list.NextMarker;
|
|
14036
|
+
} while (marker);
|
|
14037
|
+
return null;
|
|
14038
|
+
}
|
|
13664
14039
|
};
|
|
13665
14040
|
|
|
13666
14041
|
// src/provisioning/providers/dynamodb-table-provider.ts
|
|
@@ -19576,6 +19951,25 @@ var CloudFrontOAIProvider = class {
|
|
|
19576
19951
|
`Unsupported attribute: ${attributeName} for AWS::CloudFront::CloudFrontOriginAccessIdentity`
|
|
19577
19952
|
);
|
|
19578
19953
|
}
|
|
19954
|
+
/**
|
|
19955
|
+
* Adopt an existing CloudFront Origin Access Identity into cdkd state.
|
|
19956
|
+
*
|
|
19957
|
+
* **Explicit override only.** OAIs do not support tags — their identity
|
|
19958
|
+
* is the `CallerReference` set at create time, plus the auto-generated
|
|
19959
|
+
* `Id`. There is no `aws:cdk:path` tag API to look up by; CloudFront's
|
|
19960
|
+
* `ListCloudFrontOriginAccessIdentities` returns Id/Comment/CallerReference
|
|
19961
|
+
* but no tags.
|
|
19962
|
+
*
|
|
19963
|
+
* Users adopting an existing OAI should pass
|
|
19964
|
+
* `--resource <logicalId>=<oaiId>` (e.g. `E1ABCDEF123456`).
|
|
19965
|
+
*/
|
|
19966
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- explicit-override-only intentionally has no AWS calls
|
|
19967
|
+
async import(input) {
|
|
19968
|
+
if (input.knownPhysicalId) {
|
|
19969
|
+
return { physicalId: input.knownPhysicalId, attributes: { Id: input.knownPhysicalId } };
|
|
19970
|
+
}
|
|
19971
|
+
return null;
|
|
19972
|
+
}
|
|
19579
19973
|
};
|
|
19580
19974
|
|
|
19581
19975
|
// src/provisioning/providers/cloudfront-distribution-provider.ts
|
|
@@ -20299,6 +20693,27 @@ var AgentCoreRuntimeProvider = class {
|
|
|
20299
20693
|
}
|
|
20300
20694
|
throw new Error(`Unsupported attribute: ${attributeName} for AWS::BedrockAgentCore::Runtime`);
|
|
20301
20695
|
}
|
|
20696
|
+
/**
|
|
20697
|
+
* Adopt an existing BedrockAgentCore Runtime into cdkd state.
|
|
20698
|
+
*
|
|
20699
|
+
* **Explicit override only (for now).** The BedrockAgentCore SDK does
|
|
20700
|
+
* expose `ListTagsForResource`, so a future PR could add full tag-based
|
|
20701
|
+
* auto-lookup. For this batch we keep it override-only to ship
|
|
20702
|
+
* consistently with the other batch-5 attachment-style providers; users
|
|
20703
|
+
* adopting an existing runtime should pass
|
|
20704
|
+
* `--resource <logicalId>=<agentRuntimeId>` (e.g. `runtime-12345`,
|
|
20705
|
+
* matching the physical id format returned by `create()`).
|
|
20706
|
+
*/
|
|
20707
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- explicit-override-only intentionally has no AWS calls
|
|
20708
|
+
async import(input) {
|
|
20709
|
+
if (input.knownPhysicalId) {
|
|
20710
|
+
return {
|
|
20711
|
+
physicalId: input.knownPhysicalId,
|
|
20712
|
+
attributes: { AgentRuntimeId: input.knownPhysicalId }
|
|
20713
|
+
};
|
|
20714
|
+
}
|
|
20715
|
+
return null;
|
|
20716
|
+
}
|
|
20302
20717
|
};
|
|
20303
20718
|
|
|
20304
20719
|
// src/provisioning/providers/stepfunctions-provider.ts
|
|
@@ -24768,7 +25183,12 @@ import {
|
|
|
24768
25183
|
DeleteNamespaceCommand,
|
|
24769
25184
|
CreateServiceCommand as CreateServiceCommand2,
|
|
24770
25185
|
DeleteServiceCommand as DeleteServiceCommand2,
|
|
25186
|
+
GetNamespaceCommand,
|
|
24771
25187
|
GetOperationCommand,
|
|
25188
|
+
GetServiceCommand,
|
|
25189
|
+
ListNamespacesCommand,
|
|
25190
|
+
ListServicesCommand as ListServicesCommand2,
|
|
25191
|
+
ListTagsForResourceCommand as ListTagsForResourceCommand15,
|
|
24772
25192
|
NamespaceNotFound,
|
|
24773
25193
|
ServiceNotFound
|
|
24774
25194
|
} from "@aws-sdk/client-servicediscovery";
|
|
@@ -25089,6 +25509,107 @@ var ServiceDiscoveryProvider = class {
|
|
|
25089
25509
|
logicalId
|
|
25090
25510
|
);
|
|
25091
25511
|
}
|
|
25512
|
+
// ─── Import dispatch ──────────────────────────────────────────────
|
|
25513
|
+
/**
|
|
25514
|
+
* Adopt an existing Cloud Map (Service Discovery) resource into cdkd state.
|
|
25515
|
+
*
|
|
25516
|
+
* - **AWS::ServiceDiscovery::PrivateDnsNamespace**: tag-based auto-lookup
|
|
25517
|
+
* via `ListNamespaces` + `ListTagsForResource(ResourceARN)` (Tag[]
|
|
25518
|
+
* array). Falls back to `--resource` override or matching
|
|
25519
|
+
* `Properties.Name` against the namespace name.
|
|
25520
|
+
* - **AWS::ServiceDiscovery::Service**: same shape — `ListServices` +
|
|
25521
|
+
* `ListTagsForResource`. Both use `Tag[]` arrays.
|
|
25522
|
+
*/
|
|
25523
|
+
async import(input) {
|
|
25524
|
+
switch (input.resourceType) {
|
|
25525
|
+
case "AWS::ServiceDiscovery::PrivateDnsNamespace":
|
|
25526
|
+
return this.importNamespaceResource(input);
|
|
25527
|
+
case "AWS::ServiceDiscovery::Service":
|
|
25528
|
+
return this.importServiceResource(input);
|
|
25529
|
+
default:
|
|
25530
|
+
return null;
|
|
25531
|
+
}
|
|
25532
|
+
}
|
|
25533
|
+
async importNamespaceResource(input) {
|
|
25534
|
+
if (input.knownPhysicalId) {
|
|
25535
|
+
try {
|
|
25536
|
+
await this.getClient().send(new GetNamespaceCommand({ Id: input.knownPhysicalId }));
|
|
25537
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
25538
|
+
} catch (err) {
|
|
25539
|
+
if (err instanceof NamespaceNotFound)
|
|
25540
|
+
return null;
|
|
25541
|
+
throw err;
|
|
25542
|
+
}
|
|
25543
|
+
}
|
|
25544
|
+
const desiredName = typeof input.properties?.["Name"] === "string" ? input.properties["Name"] : void 0;
|
|
25545
|
+
let token;
|
|
25546
|
+
do {
|
|
25547
|
+
const list = await this.getClient().send(
|
|
25548
|
+
new ListNamespacesCommand({ ...token && { NextToken: token } })
|
|
25549
|
+
);
|
|
25550
|
+
for (const ns of list.Namespaces ?? []) {
|
|
25551
|
+
if (!ns.Id || !ns.Arn)
|
|
25552
|
+
continue;
|
|
25553
|
+
if (desiredName && ns.Name === desiredName) {
|
|
25554
|
+
return { physicalId: ns.Id, attributes: {} };
|
|
25555
|
+
}
|
|
25556
|
+
if (input.cdkPath) {
|
|
25557
|
+
try {
|
|
25558
|
+
const tagsResp = await this.getClient().send(
|
|
25559
|
+
new ListTagsForResourceCommand15({ ResourceARN: ns.Arn })
|
|
25560
|
+
);
|
|
25561
|
+
if (matchesCdkPath(tagsResp.Tags, input.cdkPath)) {
|
|
25562
|
+
return { physicalId: ns.Id, attributes: {} };
|
|
25563
|
+
}
|
|
25564
|
+
} catch (err) {
|
|
25565
|
+
if (err instanceof NamespaceNotFound)
|
|
25566
|
+
continue;
|
|
25567
|
+
throw err;
|
|
25568
|
+
}
|
|
25569
|
+
}
|
|
25570
|
+
}
|
|
25571
|
+
token = list.NextToken;
|
|
25572
|
+
} while (token);
|
|
25573
|
+
return null;
|
|
25574
|
+
}
|
|
25575
|
+
async importServiceResource(input) {
|
|
25576
|
+
if (input.knownPhysicalId) {
|
|
25577
|
+
try {
|
|
25578
|
+
await this.getClient().send(new GetServiceCommand({ Id: input.knownPhysicalId }));
|
|
25579
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
25580
|
+
} catch (err) {
|
|
25581
|
+
if (err instanceof ServiceNotFound)
|
|
25582
|
+
return null;
|
|
25583
|
+
throw err;
|
|
25584
|
+
}
|
|
25585
|
+
}
|
|
25586
|
+
if (!input.cdkPath)
|
|
25587
|
+
return null;
|
|
25588
|
+
let token;
|
|
25589
|
+
do {
|
|
25590
|
+
const list = await this.getClient().send(
|
|
25591
|
+
new ListServicesCommand2({ ...token && { NextToken: token } })
|
|
25592
|
+
);
|
|
25593
|
+
for (const svc of list.Services ?? []) {
|
|
25594
|
+
if (!svc.Id || !svc.Arn)
|
|
25595
|
+
continue;
|
|
25596
|
+
try {
|
|
25597
|
+
const tagsResp = await this.getClient().send(
|
|
25598
|
+
new ListTagsForResourceCommand15({ ResourceARN: svc.Arn })
|
|
25599
|
+
);
|
|
25600
|
+
if (matchesCdkPath(tagsResp.Tags, input.cdkPath)) {
|
|
25601
|
+
return { physicalId: svc.Id, attributes: {} };
|
|
25602
|
+
}
|
|
25603
|
+
} catch (err) {
|
|
25604
|
+
if (err instanceof ServiceNotFound)
|
|
25605
|
+
continue;
|
|
25606
|
+
throw err;
|
|
25607
|
+
}
|
|
25608
|
+
}
|
|
25609
|
+
token = list.NextToken;
|
|
25610
|
+
} while (token);
|
|
25611
|
+
return null;
|
|
25612
|
+
}
|
|
25092
25613
|
/**
|
|
25093
25614
|
* Build a namespace ARN from namespace ID.
|
|
25094
25615
|
* Format: arn:aws:servicediscovery:{region}:{account}:namespace/{namespaceId}
|
|
@@ -27977,7 +28498,7 @@ import {
|
|
|
27977
28498
|
PutInsightSelectorsCommand,
|
|
27978
28499
|
GetTrailCommand,
|
|
27979
28500
|
ListTrailsCommand,
|
|
27980
|
-
ListTagsCommand as
|
|
28501
|
+
ListTagsCommand as ListTagsCommand3,
|
|
27981
28502
|
TrailNotFoundException
|
|
27982
28503
|
} from "@aws-sdk/client-cloudtrail";
|
|
27983
28504
|
var CloudTrailProvider = class {
|
|
@@ -28241,7 +28762,7 @@ var CloudTrailProvider = class {
|
|
|
28241
28762
|
continue;
|
|
28242
28763
|
try {
|
|
28243
28764
|
const tagsResp = await this.getClient().send(
|
|
28244
|
-
new
|
|
28765
|
+
new ListTagsCommand3({ ResourceIdList: [trail.TrailARN] })
|
|
28245
28766
|
);
|
|
28246
28767
|
const list2 = tagsResp.ResourceTagList?.[0];
|
|
28247
28768
|
if (matchesCdkPath(list2?.TagsList, input.cdkPath)) {
|
|
@@ -28580,7 +29101,10 @@ import {
|
|
|
28580
29101
|
S3VectorsClient,
|
|
28581
29102
|
CreateVectorBucketCommand,
|
|
28582
29103
|
DeleteVectorBucketCommand,
|
|
29104
|
+
GetVectorBucketCommand,
|
|
28583
29105
|
ListIndexesCommand,
|
|
29106
|
+
ListVectorBucketsCommand,
|
|
29107
|
+
ListTagsForResourceCommand as ListTagsForResourceCommand16,
|
|
28584
29108
|
DeleteIndexCommand
|
|
28585
29109
|
} from "@aws-sdk/client-s3vectors";
|
|
28586
29110
|
var S3VectorsProvider = class {
|
|
@@ -28737,6 +29261,54 @@ var S3VectorsProvider = class {
|
|
|
28737
29261
|
nextToken = listResult.nextToken;
|
|
28738
29262
|
} while (nextToken);
|
|
28739
29263
|
}
|
|
29264
|
+
/**
|
|
29265
|
+
* Adopt an existing S3 Vector Bucket into cdkd state.
|
|
29266
|
+
*
|
|
29267
|
+
* Lookup order:
|
|
29268
|
+
* 1. `--resource <id>=<name>` override or `Properties.VectorBucketName`
|
|
29269
|
+
* → verify via `GetVectorBucket`. The physical id is the bucket name.
|
|
29270
|
+
* 2. `ListVectorBuckets` paginator + `ListTagsForResource(resourceArn)`
|
|
29271
|
+
* (tags map keyed by tag name) and match `aws:cdk:path`.
|
|
29272
|
+
*/
|
|
29273
|
+
async import(input) {
|
|
29274
|
+
const explicit = input.knownPhysicalId ?? (typeof input.properties?.["VectorBucketName"] === "string" && input.properties["VectorBucketName"].length > 0 ? input.properties["VectorBucketName"] : void 0);
|
|
29275
|
+
if (explicit) {
|
|
29276
|
+
try {
|
|
29277
|
+
await this.getClient().send(new GetVectorBucketCommand({ vectorBucketName: explicit }));
|
|
29278
|
+
return { physicalId: explicit, attributes: {} };
|
|
29279
|
+
} catch (err) {
|
|
29280
|
+
if (this.isNotFoundError(err))
|
|
29281
|
+
return null;
|
|
29282
|
+
throw err;
|
|
29283
|
+
}
|
|
29284
|
+
}
|
|
29285
|
+
if (!input.cdkPath)
|
|
29286
|
+
return null;
|
|
29287
|
+
let token;
|
|
29288
|
+
do {
|
|
29289
|
+
const list = await this.getClient().send(
|
|
29290
|
+
new ListVectorBucketsCommand({ ...token && { nextToken: token } })
|
|
29291
|
+
);
|
|
29292
|
+
for (const bucket of list.vectorBuckets ?? []) {
|
|
29293
|
+
if (!bucket.vectorBucketName || !bucket.vectorBucketArn)
|
|
29294
|
+
continue;
|
|
29295
|
+
try {
|
|
29296
|
+
const tagsResp = await this.getClient().send(
|
|
29297
|
+
new ListTagsForResourceCommand16({ resourceArn: bucket.vectorBucketArn })
|
|
29298
|
+
);
|
|
29299
|
+
if (tagsResp.tags?.[CDK_PATH_TAG] === input.cdkPath) {
|
|
29300
|
+
return { physicalId: bucket.vectorBucketName, attributes: {} };
|
|
29301
|
+
}
|
|
29302
|
+
} catch (err) {
|
|
29303
|
+
if (this.isNotFoundError(err))
|
|
29304
|
+
continue;
|
|
29305
|
+
throw err;
|
|
29306
|
+
}
|
|
29307
|
+
}
|
|
29308
|
+
token = list.nextToken;
|
|
29309
|
+
} while (token);
|
|
29310
|
+
return null;
|
|
29311
|
+
}
|
|
28740
29312
|
isNotFoundError(error) {
|
|
28741
29313
|
if (error instanceof Error) {
|
|
28742
29314
|
const name = error.name;
|
|
@@ -28750,6 +29322,9 @@ var S3VectorsProvider = class {
|
|
|
28750
29322
|
import {
|
|
28751
29323
|
CreateBucketCommand as CreateBucketCommand3,
|
|
28752
29324
|
DeleteBucketCommand as DeleteBucketCommand2,
|
|
29325
|
+
HeadBucketCommand as HeadBucketCommand4,
|
|
29326
|
+
ListDirectoryBucketsCommand,
|
|
29327
|
+
GetBucketTaggingCommand as GetBucketTaggingCommand2,
|
|
28753
29328
|
ListObjectsV2Command as ListObjectsV2Command2,
|
|
28754
29329
|
DeleteObjectsCommand as DeleteObjectsCommand2
|
|
28755
29330
|
} from "@aws-sdk/client-s3";
|
|
@@ -28955,6 +29530,56 @@ var S3DirectoryBucketProvider = class {
|
|
|
28955
29530
|
continuationToken = listResponse.IsTruncated ? listResponse.NextContinuationToken : void 0;
|
|
28956
29531
|
} while (continuationToken);
|
|
28957
29532
|
}
|
|
29533
|
+
/**
|
|
29534
|
+
* Adopt an existing S3 Express Directory Bucket into cdkd state.
|
|
29535
|
+
*
|
|
29536
|
+
* Lookup order:
|
|
29537
|
+
* 1. `--resource <id>=<name>` override or `Properties.BucketName` →
|
|
29538
|
+
* verify via `HeadBucket`.
|
|
29539
|
+
* 2. `ListDirectoryBuckets` paginator + `GetBucketTagging` (TagSet:
|
|
29540
|
+
* Tag[]) and match `aws:cdk:path`. `GetBucketTagging` may surface
|
|
29541
|
+
* `NoSuchTagSet` / `AccessDenied` per-bucket — those are skipped
|
|
29542
|
+
* rather than fatal.
|
|
29543
|
+
*/
|
|
29544
|
+
async import(input) {
|
|
29545
|
+
const explicit = resolveExplicitPhysicalId(input, "BucketName");
|
|
29546
|
+
if (explicit) {
|
|
29547
|
+
try {
|
|
29548
|
+
await this.s3Client.send(new HeadBucketCommand4({ Bucket: explicit }));
|
|
29549
|
+
return { physicalId: explicit, attributes: {} };
|
|
29550
|
+
} catch (err) {
|
|
29551
|
+
const e = err;
|
|
29552
|
+
if (e.name === "NotFound" || e.name === "NoSuchBucket")
|
|
29553
|
+
return null;
|
|
29554
|
+
throw err;
|
|
29555
|
+
}
|
|
29556
|
+
}
|
|
29557
|
+
if (!input.cdkPath)
|
|
29558
|
+
return null;
|
|
29559
|
+
let token;
|
|
29560
|
+
do {
|
|
29561
|
+
const list = await this.s3Client.send(
|
|
29562
|
+
new ListDirectoryBucketsCommand({ ...token && { ContinuationToken: token } })
|
|
29563
|
+
);
|
|
29564
|
+
for (const b of list.Buckets ?? []) {
|
|
29565
|
+
if (!b.Name)
|
|
29566
|
+
continue;
|
|
29567
|
+
try {
|
|
29568
|
+
const tagging = await this.s3Client.send(new GetBucketTaggingCommand2({ Bucket: b.Name }));
|
|
29569
|
+
if (matchesCdkPath(tagging.TagSet, input.cdkPath)) {
|
|
29570
|
+
return { physicalId: b.Name, attributes: {} };
|
|
29571
|
+
}
|
|
29572
|
+
} catch (err) {
|
|
29573
|
+
const e = err;
|
|
29574
|
+
if (e.name === "NoSuchTagSet" || e.name === "AccessDenied")
|
|
29575
|
+
continue;
|
|
29576
|
+
throw err;
|
|
29577
|
+
}
|
|
29578
|
+
}
|
|
29579
|
+
token = list.ContinuationToken;
|
|
29580
|
+
} while (token);
|
|
29581
|
+
return null;
|
|
29582
|
+
}
|
|
28958
29583
|
};
|
|
28959
29584
|
|
|
28960
29585
|
// src/provisioning/providers/s3-tables-provider.ts
|
|
@@ -28966,8 +29591,12 @@ import {
|
|
|
28966
29591
|
DeleteNamespaceCommand as DeleteNamespaceCommand2,
|
|
28967
29592
|
CreateTableCommand as CreateTableCommand3,
|
|
28968
29593
|
DeleteTableCommand as DeleteTableCommand3,
|
|
28969
|
-
|
|
29594
|
+
GetTableBucketCommand,
|
|
29595
|
+
GetTableCommand as GetTableCommand2,
|
|
29596
|
+
ListNamespacesCommand as ListNamespacesCommand2,
|
|
28970
29597
|
ListTablesCommand as ListTablesCommand2,
|
|
29598
|
+
ListTableBucketsCommand,
|
|
29599
|
+
ListTagsForResourceCommand as ListTagsForResourceCommand17,
|
|
28971
29600
|
NotFoundException as NotFoundException6
|
|
28972
29601
|
} from "@aws-sdk/client-s3tables";
|
|
28973
29602
|
var S3TablesProvider = class {
|
|
@@ -29101,7 +29730,7 @@ var S3TablesProvider = class {
|
|
|
29101
29730
|
let namespaceContinuationToken;
|
|
29102
29731
|
do {
|
|
29103
29732
|
const namespacesResult = await this.getClient().send(
|
|
29104
|
-
new
|
|
29733
|
+
new ListNamespacesCommand2({
|
|
29105
29734
|
tableBucketARN,
|
|
29106
29735
|
continuationToken: namespaceContinuationToken
|
|
29107
29736
|
})
|
|
@@ -29305,6 +29934,165 @@ var S3TablesProvider = class {
|
|
|
29305
29934
|
);
|
|
29306
29935
|
}
|
|
29307
29936
|
}
|
|
29937
|
+
// ─── Import dispatch ──────────────────────────────────────────────
|
|
29938
|
+
/**
|
|
29939
|
+
* Adopt an existing S3 Tables resource into cdkd state.
|
|
29940
|
+
*
|
|
29941
|
+
* - **AWS::S3Tables::TableBucket**: tag-based auto-lookup via
|
|
29942
|
+
* `ListTableBuckets` + `ListTagsForResource(resourceArn)` (tags map).
|
|
29943
|
+
* Falls back to `--resource <id>=<arn>` or `Properties.TableBucketName`
|
|
29944
|
+
* (resolved by ARN suffix match against `ListTableBuckets`).
|
|
29945
|
+
* - **AWS::S3Tables::Table**: tag-based auto-lookup walks every
|
|
29946
|
+
* table bucket → namespace → table and calls `ListTagsForResource`
|
|
29947
|
+
* on each table ARN; matches `aws:cdk:path`.
|
|
29948
|
+
* - **AWS::S3Tables::Namespace**: explicit-override only. Namespaces
|
|
29949
|
+
* are not taggable in S3 Tables (`ListTagsForResource` accepts only
|
|
29950
|
+
* table-bucket or table ARNs), so auto-lookup is impossible.
|
|
29951
|
+
*/
|
|
29952
|
+
async import(input) {
|
|
29953
|
+
switch (input.resourceType) {
|
|
29954
|
+
case "AWS::S3Tables::TableBucket":
|
|
29955
|
+
return this.importTableBucket(input);
|
|
29956
|
+
case "AWS::S3Tables::Namespace":
|
|
29957
|
+
return this.importNamespace(input);
|
|
29958
|
+
case "AWS::S3Tables::Table":
|
|
29959
|
+
return this.importTable(input);
|
|
29960
|
+
default:
|
|
29961
|
+
return null;
|
|
29962
|
+
}
|
|
29963
|
+
}
|
|
29964
|
+
async importTableBucket(input) {
|
|
29965
|
+
if (input.knownPhysicalId) {
|
|
29966
|
+
try {
|
|
29967
|
+
await this.getClient().send(
|
|
29968
|
+
new GetTableBucketCommand({ tableBucketARN: input.knownPhysicalId })
|
|
29969
|
+
);
|
|
29970
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
29971
|
+
} catch (err) {
|
|
29972
|
+
if (err instanceof NotFoundException6)
|
|
29973
|
+
return null;
|
|
29974
|
+
throw err;
|
|
29975
|
+
}
|
|
29976
|
+
}
|
|
29977
|
+
const desiredName = typeof input.properties?.["TableBucketName"] === "string" ? input.properties["TableBucketName"] : void 0;
|
|
29978
|
+
let token;
|
|
29979
|
+
do {
|
|
29980
|
+
const list = await this.getClient().send(
|
|
29981
|
+
new ListTableBucketsCommand({ ...token && { continuationToken: token } })
|
|
29982
|
+
);
|
|
29983
|
+
for (const bucket of list.tableBuckets ?? []) {
|
|
29984
|
+
if (!bucket.arn)
|
|
29985
|
+
continue;
|
|
29986
|
+
if (desiredName && bucket.name === desiredName) {
|
|
29987
|
+
return { physicalId: bucket.arn, attributes: {} };
|
|
29988
|
+
}
|
|
29989
|
+
if (input.cdkPath) {
|
|
29990
|
+
try {
|
|
29991
|
+
const tagsResp = await this.getClient().send(
|
|
29992
|
+
new ListTagsForResourceCommand17({ resourceArn: bucket.arn })
|
|
29993
|
+
);
|
|
29994
|
+
if (tagsResp.tags?.[CDK_PATH_TAG] === input.cdkPath) {
|
|
29995
|
+
return { physicalId: bucket.arn, attributes: {} };
|
|
29996
|
+
}
|
|
29997
|
+
} catch (err) {
|
|
29998
|
+
if (err instanceof NotFoundException6)
|
|
29999
|
+
continue;
|
|
30000
|
+
throw err;
|
|
30001
|
+
}
|
|
30002
|
+
}
|
|
30003
|
+
}
|
|
30004
|
+
token = list.continuationToken;
|
|
30005
|
+
} while (token);
|
|
30006
|
+
return null;
|
|
30007
|
+
}
|
|
30008
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- explicit-override-only intentionally has no AWS calls
|
|
30009
|
+
async importNamespace(input) {
|
|
30010
|
+
if (input.knownPhysicalId) {
|
|
30011
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
30012
|
+
}
|
|
30013
|
+
return null;
|
|
30014
|
+
}
|
|
30015
|
+
async importTable(input) {
|
|
30016
|
+
if (input.knownPhysicalId) {
|
|
30017
|
+
const parts = input.knownPhysicalId.split("|");
|
|
30018
|
+
if (parts.length >= 3) {
|
|
30019
|
+
try {
|
|
30020
|
+
await this.getClient().send(
|
|
30021
|
+
new GetTableCommand2({
|
|
30022
|
+
tableBucketARN: parts[0],
|
|
30023
|
+
namespace: parts[1],
|
|
30024
|
+
name: parts[2]
|
|
30025
|
+
})
|
|
30026
|
+
);
|
|
30027
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
30028
|
+
} catch (err) {
|
|
30029
|
+
if (err instanceof NotFoundException6)
|
|
30030
|
+
return null;
|
|
30031
|
+
throw err;
|
|
30032
|
+
}
|
|
30033
|
+
}
|
|
30034
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
30035
|
+
}
|
|
30036
|
+
if (!input.cdkPath)
|
|
30037
|
+
return null;
|
|
30038
|
+
let bucketToken;
|
|
30039
|
+
do {
|
|
30040
|
+
const buckets = await this.getClient().send(
|
|
30041
|
+
new ListTableBucketsCommand({ ...bucketToken && { continuationToken: bucketToken } })
|
|
30042
|
+
);
|
|
30043
|
+
for (const bucket of buckets.tableBuckets ?? []) {
|
|
30044
|
+
if (!bucket.arn)
|
|
30045
|
+
continue;
|
|
30046
|
+
let nsToken;
|
|
30047
|
+
do {
|
|
30048
|
+
const namespaces = await this.getClient().send(
|
|
30049
|
+
new ListNamespacesCommand2({
|
|
30050
|
+
tableBucketARN: bucket.arn,
|
|
30051
|
+
...nsToken && { continuationToken: nsToken }
|
|
30052
|
+
})
|
|
30053
|
+
);
|
|
30054
|
+
for (const ns of namespaces.namespaces ?? []) {
|
|
30055
|
+
const namespaceName = ns.namespace?.[0];
|
|
30056
|
+
if (!namespaceName)
|
|
30057
|
+
continue;
|
|
30058
|
+
let tableToken;
|
|
30059
|
+
do {
|
|
30060
|
+
const tables = await this.getClient().send(
|
|
30061
|
+
new ListTablesCommand2({
|
|
30062
|
+
tableBucketARN: bucket.arn,
|
|
30063
|
+
namespace: namespaceName,
|
|
30064
|
+
...tableToken && { continuationToken: tableToken }
|
|
30065
|
+
})
|
|
30066
|
+
);
|
|
30067
|
+
for (const table of tables.tables ?? []) {
|
|
30068
|
+
if (!table.name || !table.tableARN)
|
|
30069
|
+
continue;
|
|
30070
|
+
try {
|
|
30071
|
+
const tagsResp = await this.getClient().send(
|
|
30072
|
+
new ListTagsForResourceCommand17({ resourceArn: table.tableARN })
|
|
30073
|
+
);
|
|
30074
|
+
if (tagsResp.tags?.[CDK_PATH_TAG] === input.cdkPath) {
|
|
30075
|
+
return {
|
|
30076
|
+
physicalId: `${bucket.arn}|${namespaceName}|${table.name}`,
|
|
30077
|
+
attributes: {}
|
|
30078
|
+
};
|
|
30079
|
+
}
|
|
30080
|
+
} catch (err) {
|
|
30081
|
+
if (err instanceof NotFoundException6)
|
|
30082
|
+
continue;
|
|
30083
|
+
throw err;
|
|
30084
|
+
}
|
|
30085
|
+
}
|
|
30086
|
+
tableToken = tables.continuationToken;
|
|
30087
|
+
} while (tableToken);
|
|
30088
|
+
}
|
|
30089
|
+
nsToken = namespaces.continuationToken;
|
|
30090
|
+
} while (nsToken);
|
|
30091
|
+
}
|
|
30092
|
+
bucketToken = buckets.continuationToken;
|
|
30093
|
+
} while (bucketToken);
|
|
30094
|
+
return null;
|
|
30095
|
+
}
|
|
29308
30096
|
async deleteTable(logicalId, physicalId, resourceType, context) {
|
|
29309
30097
|
this.logger.debug(`Deleting S3 Tables Table ${logicalId}: ${physicalId}`);
|
|
29310
30098
|
const parts = physicalId.split("|");
|
|
@@ -29364,7 +30152,7 @@ import {
|
|
|
29364
30152
|
PutImageScanningConfigurationCommand,
|
|
29365
30153
|
PutImageTagMutabilityCommand,
|
|
29366
30154
|
TagResourceCommand as TagResourceCommand7,
|
|
29367
|
-
ListTagsForResourceCommand as
|
|
30155
|
+
ListTagsForResourceCommand as ListTagsForResourceCommand18,
|
|
29368
30156
|
RepositoryNotFoundException
|
|
29369
30157
|
} from "@aws-sdk/client-ecr";
|
|
29370
30158
|
var ECRProvider = class {
|
|
@@ -29633,7 +30421,7 @@ var ECRProvider = class {
|
|
|
29633
30421
|
continue;
|
|
29634
30422
|
try {
|
|
29635
30423
|
const tagsResp = await this.getClient().send(
|
|
29636
|
-
new
|
|
30424
|
+
new ListTagsForResourceCommand18({ resourceArn: repo.repositoryArn })
|
|
29637
30425
|
);
|
|
29638
30426
|
if (matchesCdkPath(tagsResp.tags, input.cdkPath)) {
|
|
29639
30427
|
return { physicalId: repo.repositoryName, attributes: {} };
|
|
@@ -32210,7 +32998,7 @@ import {
|
|
|
32210
32998
|
CreateBucketCommand as CreateBucketCommand4,
|
|
32211
32999
|
DeleteBucketCommand as DeleteBucketCommand3,
|
|
32212
33000
|
DeleteObjectsCommand as DeleteObjectsCommand3,
|
|
32213
|
-
HeadBucketCommand as
|
|
33001
|
+
HeadBucketCommand as HeadBucketCommand5,
|
|
32214
33002
|
ListObjectVersionsCommand as ListObjectVersionsCommand2,
|
|
32215
33003
|
ListObjectsV2Command as ListObjectsV2Command3,
|
|
32216
33004
|
PutBucketEncryptionCommand as PutBucketEncryptionCommand3,
|
|
@@ -32333,7 +33121,7 @@ async function stateMigrateCommand(options) {
|
|
|
32333
33121
|
}
|
|
32334
33122
|
async function bucketExists2(s3, bucketName) {
|
|
32335
33123
|
try {
|
|
32336
|
-
await s3.send(new
|
|
33124
|
+
await s3.send(new HeadBucketCommand5({ Bucket: bucketName }));
|
|
32337
33125
|
return true;
|
|
32338
33126
|
} catch (error) {
|
|
32339
33127
|
const err = error;
|
|
@@ -33559,7 +34347,7 @@ function reorderArgs(argv) {
|
|
|
33559
34347
|
}
|
|
33560
34348
|
async function main() {
|
|
33561
34349
|
const program = new Command13();
|
|
33562
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
34350
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.22.0");
|
|
33563
34351
|
program.addCommand(createBootstrapCommand());
|
|
33564
34352
|
program.addCommand(createSynthCommand());
|
|
33565
34353
|
program.addCommand(createListCommand());
|