@go-to-k/cdkd 0.19.0 → 0.21.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 +1534 -85
- package/dist/cli.js.map +3 -3
- package/dist/go-to-k-cdkd-0.21.0.tgz +0 -0
- package/package.json +1 -1
- package/dist/go-to-k-cdkd-0.19.0.tgz +0 -0
package/dist/cli.js
CHANGED
|
@@ -1155,11 +1155,11 @@ async function resolveStateBucketWithDefaultAndSource(cliBucket, region) {
|
|
|
1155
1155
|
return syncResult;
|
|
1156
1156
|
const logger = getLogger();
|
|
1157
1157
|
logger.debug("No state bucket specified, resolving default from account...");
|
|
1158
|
-
const { GetCallerIdentityCommand:
|
|
1158
|
+
const { GetCallerIdentityCommand: GetCallerIdentityCommand11 } = await import("@aws-sdk/client-sts");
|
|
1159
1159
|
const { S3Client: S3Client11 } = await import("@aws-sdk/client-s3");
|
|
1160
1160
|
const { getAwsClients: getAwsClients2 } = await Promise.resolve().then(() => (init_aws_clients(), aws_clients_exports));
|
|
1161
1161
|
const awsClients = getAwsClients2();
|
|
1162
|
-
const identity = await awsClients.sts.send(new
|
|
1162
|
+
const identity = await awsClients.sts.send(new GetCallerIdentityCommand11({}));
|
|
1163
1163
|
const accountId = identity.Account;
|
|
1164
1164
|
const newName = getDefaultStateBucketName(accountId);
|
|
1165
1165
|
const legacyName = getLegacyStateBucketName(accountId, region);
|
|
@@ -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;
|
|
@@ -3431,9 +3431,9 @@ var AssetPublisher = class {
|
|
|
3431
3431
|
const region = options.region || process.env["AWS_REGION"] || "us-east-1";
|
|
3432
3432
|
let accountId = options.accountId;
|
|
3433
3433
|
if (!accountId) {
|
|
3434
|
-
const { STSClient:
|
|
3435
|
-
const stsClient = new
|
|
3436
|
-
const identity = await stsClient.send(new
|
|
3434
|
+
const { STSClient: STSClient9, GetCallerIdentityCommand: GetCallerIdentityCommand11 } = await import("@aws-sdk/client-sts");
|
|
3435
|
+
const stsClient = new STSClient9({ region });
|
|
3436
|
+
const identity = await stsClient.send(new GetCallerIdentityCommand11({}));
|
|
3437
3437
|
accountId = identity.Account;
|
|
3438
3438
|
stsClient.destroy();
|
|
3439
3439
|
}
|
|
@@ -8864,6 +8864,27 @@ var IAMPolicyProvider = class {
|
|
|
8864
8864
|
);
|
|
8865
8865
|
}
|
|
8866
8866
|
}
|
|
8867
|
+
/**
|
|
8868
|
+
* Adopt an existing IAM inline policy into cdkd state.
|
|
8869
|
+
*
|
|
8870
|
+
* **Explicit override only.** `AWS::IAM::Policy` in CloudFormation is an
|
|
8871
|
+
* inline policy attached to roles / groups / users — not a standalone
|
|
8872
|
+
* resource. Inline policies are not taggable and have no global identity,
|
|
8873
|
+
* so tag-based auto-lookup via `aws:cdk:path` is not feasible. Users
|
|
8874
|
+
* adopting inline policies must pass `--resource <logicalId>=<policyName>`
|
|
8875
|
+
* (the physical id is the policy name itself).
|
|
8876
|
+
*
|
|
8877
|
+
* For standalone managed policies (`AWS::IAM::ManagedPolicy`), the
|
|
8878
|
+
* Cloud Control API fallback handles import via the same explicit
|
|
8879
|
+
* override mode.
|
|
8880
|
+
*/
|
|
8881
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- explicit-override-only intentionally has no AWS calls
|
|
8882
|
+
async import(input) {
|
|
8883
|
+
if (input.knownPhysicalId) {
|
|
8884
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
8885
|
+
}
|
|
8886
|
+
return null;
|
|
8887
|
+
}
|
|
8867
8888
|
};
|
|
8868
8889
|
|
|
8869
8890
|
// src/provisioning/providers/iam-instance-profile-provider.ts
|
|
@@ -8871,6 +8892,7 @@ import {
|
|
|
8871
8892
|
CreateInstanceProfileCommand,
|
|
8872
8893
|
DeleteInstanceProfileCommand,
|
|
8873
8894
|
GetInstanceProfileCommand,
|
|
8895
|
+
ListInstanceProfilesCommand,
|
|
8874
8896
|
AddRoleToInstanceProfileCommand,
|
|
8875
8897
|
RemoveRoleFromInstanceProfileCommand as RemoveRoleFromInstanceProfileCommand2,
|
|
8876
8898
|
NoSuchEntityException as NoSuchEntityException3
|
|
@@ -9072,6 +9094,48 @@ var IAMInstanceProfileProvider = class {
|
|
|
9072
9094
|
);
|
|
9073
9095
|
}
|
|
9074
9096
|
}
|
|
9097
|
+
/**
|
|
9098
|
+
* Adopt an existing IAM instance profile into cdkd state.
|
|
9099
|
+
*
|
|
9100
|
+
* Lookup order:
|
|
9101
|
+
* 1. `--resource` override or `Properties.InstanceProfileName` → verify
|
|
9102
|
+
* via `GetInstanceProfile`.
|
|
9103
|
+
* 2. `ListInstanceProfiles` paginator + match `aws:cdk:path` against the
|
|
9104
|
+
* `InstanceProfile.Tags` array returned inline (no separate
|
|
9105
|
+
* `ListInstanceProfileTags` call needed).
|
|
9106
|
+
*
|
|
9107
|
+
* IAM is global; this walks every instance profile in the account once.
|
|
9108
|
+
*/
|
|
9109
|
+
async import(input) {
|
|
9110
|
+
const explicit = resolveExplicitPhysicalId(input, "InstanceProfileName");
|
|
9111
|
+
if (explicit) {
|
|
9112
|
+
try {
|
|
9113
|
+
await this.iamClient.send(new GetInstanceProfileCommand({ InstanceProfileName: explicit }));
|
|
9114
|
+
return { physicalId: explicit, attributes: {} };
|
|
9115
|
+
} catch (err) {
|
|
9116
|
+
if (err instanceof NoSuchEntityException3)
|
|
9117
|
+
return null;
|
|
9118
|
+
throw err;
|
|
9119
|
+
}
|
|
9120
|
+
}
|
|
9121
|
+
if (!input.cdkPath)
|
|
9122
|
+
return null;
|
|
9123
|
+
let marker;
|
|
9124
|
+
do {
|
|
9125
|
+
const list = await this.iamClient.send(
|
|
9126
|
+
new ListInstanceProfilesCommand({ ...marker && { Marker: marker } })
|
|
9127
|
+
);
|
|
9128
|
+
for (const profile of list.InstanceProfiles ?? []) {
|
|
9129
|
+
if (!profile.InstanceProfileName)
|
|
9130
|
+
continue;
|
|
9131
|
+
if (matchesCdkPath(profile.Tags, input.cdkPath)) {
|
|
9132
|
+
return { physicalId: profile.InstanceProfileName, attributes: {} };
|
|
9133
|
+
}
|
|
9134
|
+
}
|
|
9135
|
+
marker = list.IsTruncated ? list.Marker : void 0;
|
|
9136
|
+
} while (marker);
|
|
9137
|
+
return null;
|
|
9138
|
+
}
|
|
9075
9139
|
};
|
|
9076
9140
|
|
|
9077
9141
|
// src/provisioning/providers/iam-user-group-provider.ts
|
|
@@ -9102,6 +9166,8 @@ import {
|
|
|
9102
9166
|
DeleteLoginProfileCommand,
|
|
9103
9167
|
ListAccessKeysCommand,
|
|
9104
9168
|
DeleteAccessKeyCommand,
|
|
9169
|
+
ListUsersCommand,
|
|
9170
|
+
ListUserTagsCommand,
|
|
9105
9171
|
NoSuchEntityException as NoSuchEntityException4,
|
|
9106
9172
|
TagUserCommand,
|
|
9107
9173
|
PutUserPermissionsBoundaryCommand,
|
|
@@ -10080,6 +10146,92 @@ var IAMUserGroupProvider = class {
|
|
|
10080
10146
|
);
|
|
10081
10147
|
}
|
|
10082
10148
|
}
|
|
10149
|
+
// ─── Import dispatch ──────────────────────────────────────────────
|
|
10150
|
+
/**
|
|
10151
|
+
* Adopt an existing IAM user / group / user-to-group addition into cdkd state.
|
|
10152
|
+
*
|
|
10153
|
+
* - **AWS::IAM::User**: tag-based auto-lookup via `ListUsers` +
|
|
10154
|
+
* `ListUserTags`. Falls back to `--resource` override or
|
|
10155
|
+
* `Properties.UserName`.
|
|
10156
|
+
* - **AWS::IAM::Group**: explicit-override only. IAM groups are not
|
|
10157
|
+
* taggable (no `ListGroupTags` API), so tag-based auto-lookup is not
|
|
10158
|
+
* possible. Caller can still pass `Properties.GroupName` or
|
|
10159
|
+
* `--resource` to verify and adopt by name.
|
|
10160
|
+
* - **AWS::IAM::UserToGroupAddition**: explicit-override only. Has no
|
|
10161
|
+
* AWS-side identity beyond the (group, users) attachment itself.
|
|
10162
|
+
*/
|
|
10163
|
+
async import(input) {
|
|
10164
|
+
switch (input.resourceType) {
|
|
10165
|
+
case "AWS::IAM::User":
|
|
10166
|
+
return this.importUser(input);
|
|
10167
|
+
case "AWS::IAM::Group":
|
|
10168
|
+
return this.importGroup(input);
|
|
10169
|
+
case "AWS::IAM::UserToGroupAddition":
|
|
10170
|
+
return this.importUserToGroupAddition(input);
|
|
10171
|
+
default:
|
|
10172
|
+
return null;
|
|
10173
|
+
}
|
|
10174
|
+
}
|
|
10175
|
+
async importUser(input) {
|
|
10176
|
+
const explicit = resolveExplicitPhysicalId(input, "UserName");
|
|
10177
|
+
if (explicit) {
|
|
10178
|
+
try {
|
|
10179
|
+
await this.iamClient.send(new GetUserCommand({ UserName: explicit }));
|
|
10180
|
+
return { physicalId: explicit, attributes: {} };
|
|
10181
|
+
} catch (err) {
|
|
10182
|
+
if (err instanceof NoSuchEntityException4)
|
|
10183
|
+
return null;
|
|
10184
|
+
throw err;
|
|
10185
|
+
}
|
|
10186
|
+
}
|
|
10187
|
+
if (!input.cdkPath)
|
|
10188
|
+
return null;
|
|
10189
|
+
let marker;
|
|
10190
|
+
do {
|
|
10191
|
+
const list = await this.iamClient.send(
|
|
10192
|
+
new ListUsersCommand({ ...marker && { Marker: marker } })
|
|
10193
|
+
);
|
|
10194
|
+
for (const user of list.Users ?? []) {
|
|
10195
|
+
if (!user.UserName)
|
|
10196
|
+
continue;
|
|
10197
|
+
try {
|
|
10198
|
+
const tags = await this.iamClient.send(
|
|
10199
|
+
new ListUserTagsCommand({ UserName: user.UserName })
|
|
10200
|
+
);
|
|
10201
|
+
if (matchesCdkPath(tags.Tags, input.cdkPath)) {
|
|
10202
|
+
return { physicalId: user.UserName, attributes: {} };
|
|
10203
|
+
}
|
|
10204
|
+
} catch (err) {
|
|
10205
|
+
if (err instanceof NoSuchEntityException4)
|
|
10206
|
+
continue;
|
|
10207
|
+
throw err;
|
|
10208
|
+
}
|
|
10209
|
+
}
|
|
10210
|
+
marker = list.IsTruncated ? list.Marker : void 0;
|
|
10211
|
+
} while (marker);
|
|
10212
|
+
return null;
|
|
10213
|
+
}
|
|
10214
|
+
async importGroup(input) {
|
|
10215
|
+
const explicit = resolveExplicitPhysicalId(input, "GroupName");
|
|
10216
|
+
if (explicit) {
|
|
10217
|
+
try {
|
|
10218
|
+
await this.iamClient.send(new GetGroupCommand({ GroupName: explicit }));
|
|
10219
|
+
return { physicalId: explicit, attributes: {} };
|
|
10220
|
+
} catch (err) {
|
|
10221
|
+
if (err instanceof NoSuchEntityException4)
|
|
10222
|
+
return null;
|
|
10223
|
+
throw err;
|
|
10224
|
+
}
|
|
10225
|
+
}
|
|
10226
|
+
return null;
|
|
10227
|
+
}
|
|
10228
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- explicit-override-only intentionally has no AWS calls
|
|
10229
|
+
async importUserToGroupAddition(input) {
|
|
10230
|
+
if (input.knownPhysicalId) {
|
|
10231
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
10232
|
+
}
|
|
10233
|
+
return null;
|
|
10234
|
+
}
|
|
10083
10235
|
};
|
|
10084
10236
|
|
|
10085
10237
|
// src/provisioning/providers/s3-bucket-provider.ts
|
|
@@ -13523,6 +13675,9 @@ var LambdaEventSourceMappingProvider = class {
|
|
|
13523
13675
|
import {
|
|
13524
13676
|
PublishLayerVersionCommand,
|
|
13525
13677
|
DeleteLayerVersionCommand,
|
|
13678
|
+
GetLayerVersionByArnCommand,
|
|
13679
|
+
ListLayersCommand,
|
|
13680
|
+
ListTagsCommand as ListTagsCommand2,
|
|
13526
13681
|
ResourceNotFoundException as ResourceNotFoundException5
|
|
13527
13682
|
} from "@aws-sdk/client-lambda";
|
|
13528
13683
|
init_aws_clients();
|
|
@@ -13661,6 +13816,67 @@ var LambdaLayerVersionProvider = class {
|
|
|
13661
13816
|
);
|
|
13662
13817
|
}
|
|
13663
13818
|
}
|
|
13819
|
+
/**
|
|
13820
|
+
* Adopt an existing Lambda layer version into cdkd state.
|
|
13821
|
+
*
|
|
13822
|
+
* Lookup order:
|
|
13823
|
+
* 1. `--resource <id>=<layerVersionArn>` override → verify with
|
|
13824
|
+
* `GetLayerVersionByArn`. (Note: there is no `LayerName` field that
|
|
13825
|
+
* uniquely names a *version*; a layer name resolves to the latest
|
|
13826
|
+
* version, so an explicit ARN is the only unambiguous override.)
|
|
13827
|
+
* 2. `ListLayers` paginator + `ListTags(Resource: layerArn)` (which
|
|
13828
|
+
* returns a `Tags: Record<string,string>` map keyed by tag name).
|
|
13829
|
+
* Match `aws:cdk:path` and adopt `LatestMatchingVersion.LayerVersionArn`.
|
|
13830
|
+
*
|
|
13831
|
+
* **Caveat**: Lambda layer versions are immutable, so auto-lookup adopts
|
|
13832
|
+
* the LATEST version of the named layer that carries the matching CDK
|
|
13833
|
+
* path tag. If the user's CDK app has since published newer versions
|
|
13834
|
+
* outside cdkd's tracking, the adopted physical id may be stale; pass
|
|
13835
|
+
* `--resource <id>=<arn>` to pin a specific version.
|
|
13836
|
+
*/
|
|
13837
|
+
async import(input) {
|
|
13838
|
+
if (input.knownPhysicalId) {
|
|
13839
|
+
try {
|
|
13840
|
+
await this.lambdaClient.send(
|
|
13841
|
+
new GetLayerVersionByArnCommand({ Arn: input.knownPhysicalId })
|
|
13842
|
+
);
|
|
13843
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
13844
|
+
} catch (err) {
|
|
13845
|
+
if (err instanceof ResourceNotFoundException5)
|
|
13846
|
+
return null;
|
|
13847
|
+
throw err;
|
|
13848
|
+
}
|
|
13849
|
+
}
|
|
13850
|
+
if (!input.cdkPath)
|
|
13851
|
+
return null;
|
|
13852
|
+
let marker;
|
|
13853
|
+
do {
|
|
13854
|
+
const list = await this.lambdaClient.send(
|
|
13855
|
+
new ListLayersCommand({ ...marker && { Marker: marker } })
|
|
13856
|
+
);
|
|
13857
|
+
for (const layer of list.Layers ?? []) {
|
|
13858
|
+
if (!layer.LayerArn || !layer.LatestMatchingVersion?.LayerVersionArn)
|
|
13859
|
+
continue;
|
|
13860
|
+
try {
|
|
13861
|
+
const tagsResp = await this.lambdaClient.send(
|
|
13862
|
+
new ListTagsCommand2({ Resource: layer.LayerArn })
|
|
13863
|
+
);
|
|
13864
|
+
if (tagsResp.Tags?.[CDK_PATH_TAG] === input.cdkPath) {
|
|
13865
|
+
return {
|
|
13866
|
+
physicalId: layer.LatestMatchingVersion.LayerVersionArn,
|
|
13867
|
+
attributes: {}
|
|
13868
|
+
};
|
|
13869
|
+
}
|
|
13870
|
+
} catch (err) {
|
|
13871
|
+
if (err instanceof ResourceNotFoundException5)
|
|
13872
|
+
continue;
|
|
13873
|
+
throw err;
|
|
13874
|
+
}
|
|
13875
|
+
}
|
|
13876
|
+
marker = list.NextMarker;
|
|
13877
|
+
} while (marker);
|
|
13878
|
+
return null;
|
|
13879
|
+
}
|
|
13664
13880
|
};
|
|
13665
13881
|
|
|
13666
13882
|
// src/provisioning/providers/dynamodb-table-provider.ts
|
|
@@ -15109,7 +15325,9 @@ import {
|
|
|
15109
15325
|
RemoveTargetsCommand,
|
|
15110
15326
|
DeleteRuleCommand,
|
|
15111
15327
|
DescribeRuleCommand,
|
|
15328
|
+
ListRulesCommand,
|
|
15112
15329
|
ListTargetsByRuleCommand,
|
|
15330
|
+
ListTagsForResourceCommand as ListTagsForResourceCommand5,
|
|
15113
15331
|
TagResourceCommand as TagResourceCommand4,
|
|
15114
15332
|
UntagResourceCommand as UntagResourceCommand4,
|
|
15115
15333
|
ResourceNotFoundException as ResourceNotFoundException9
|
|
@@ -15377,6 +15595,85 @@ var EventBridgeRuleProvider = class {
|
|
|
15377
15595
|
}
|
|
15378
15596
|
throw new Error(`Unsupported attribute: ${attributeName} for AWS::Events::Rule`);
|
|
15379
15597
|
}
|
|
15598
|
+
/**
|
|
15599
|
+
* Adopt an existing EventBridge rule into cdkd state.
|
|
15600
|
+
*
|
|
15601
|
+
* Lookup order:
|
|
15602
|
+
* 1. `--resource <id>=<arnOrName>` override → verify with
|
|
15603
|
+
* `DescribeRule` (scoped to the same `EventBusName` declared in
|
|
15604
|
+
* the template, if any). The override is honored as-is so users
|
|
15605
|
+
* can pass either the ARN (cdkd's standard physicalId form for
|
|
15606
|
+
* this provider) or just the rule name.
|
|
15607
|
+
* 2. If the template carries `Properties.Name` use that as the rule
|
|
15608
|
+
* name lookup, then verify with `DescribeRule` and return the
|
|
15609
|
+
* rule's ARN as physicalId.
|
|
15610
|
+
* 3. Walk `ListRules(EventBusName?)` and match `aws:cdk:path` via
|
|
15611
|
+
* `ListTagsForResource(ResourceARN=rule.Arn)`. Returns the rule
|
|
15612
|
+
* ARN as physicalId — same shape that `create` returns.
|
|
15613
|
+
*
|
|
15614
|
+
* EventBridge tags use the standard `Tag[]` array shape
|
|
15615
|
+
* (`Key`/`Value`).
|
|
15616
|
+
*/
|
|
15617
|
+
async import(input) {
|
|
15618
|
+
const eventBusName = input.properties["EventBusName"];
|
|
15619
|
+
if (input.knownPhysicalId) {
|
|
15620
|
+
try {
|
|
15621
|
+
const ruleName = this.extractRuleNameFromArn(input.knownPhysicalId);
|
|
15622
|
+
const resp = await this.eventBridgeClient.send(
|
|
15623
|
+
new DescribeRuleCommand({
|
|
15624
|
+
Name: ruleName,
|
|
15625
|
+
...eventBusName && { EventBusName: eventBusName }
|
|
15626
|
+
})
|
|
15627
|
+
);
|
|
15628
|
+
return { physicalId: resp.Arn ?? input.knownPhysicalId, attributes: {} };
|
|
15629
|
+
} catch (err) {
|
|
15630
|
+
if (err instanceof ResourceNotFoundException9)
|
|
15631
|
+
return null;
|
|
15632
|
+
throw err;
|
|
15633
|
+
}
|
|
15634
|
+
}
|
|
15635
|
+
const templateName = input.properties["Name"];
|
|
15636
|
+
if (templateName) {
|
|
15637
|
+
try {
|
|
15638
|
+
const resp = await this.eventBridgeClient.send(
|
|
15639
|
+
new DescribeRuleCommand({
|
|
15640
|
+
Name: templateName,
|
|
15641
|
+
...eventBusName && { EventBusName: eventBusName }
|
|
15642
|
+
})
|
|
15643
|
+
);
|
|
15644
|
+
if (resp.Arn)
|
|
15645
|
+
return { physicalId: resp.Arn, attributes: {} };
|
|
15646
|
+
return null;
|
|
15647
|
+
} catch (err) {
|
|
15648
|
+
if (err instanceof ResourceNotFoundException9)
|
|
15649
|
+
return null;
|
|
15650
|
+
throw err;
|
|
15651
|
+
}
|
|
15652
|
+
}
|
|
15653
|
+
if (!input.cdkPath)
|
|
15654
|
+
return null;
|
|
15655
|
+
let nextToken;
|
|
15656
|
+
do {
|
|
15657
|
+
const list = await this.eventBridgeClient.send(
|
|
15658
|
+
new ListRulesCommand({
|
|
15659
|
+
...eventBusName && { EventBusName: eventBusName },
|
|
15660
|
+
...nextToken && { NextToken: nextToken }
|
|
15661
|
+
})
|
|
15662
|
+
);
|
|
15663
|
+
for (const rule of list.Rules ?? []) {
|
|
15664
|
+
if (!rule.Arn)
|
|
15665
|
+
continue;
|
|
15666
|
+
const tagsResp = await this.eventBridgeClient.send(
|
|
15667
|
+
new ListTagsForResourceCommand5({ ResourceARN: rule.Arn })
|
|
15668
|
+
);
|
|
15669
|
+
if (matchesCdkPath(tagsResp.Tags, input.cdkPath)) {
|
|
15670
|
+
return { physicalId: rule.Arn, attributes: {} };
|
|
15671
|
+
}
|
|
15672
|
+
}
|
|
15673
|
+
nextToken = list.NextToken;
|
|
15674
|
+
} while (nextToken);
|
|
15675
|
+
return null;
|
|
15676
|
+
}
|
|
15380
15677
|
/**
|
|
15381
15678
|
* Extract rule name from an ARN
|
|
15382
15679
|
*
|
|
@@ -15399,8 +15696,8 @@ import {
|
|
|
15399
15696
|
UpdateEventBusCommand,
|
|
15400
15697
|
DescribeEventBusCommand,
|
|
15401
15698
|
ListEventBusesCommand,
|
|
15402
|
-
ListRulesCommand,
|
|
15403
|
-
ListTagsForResourceCommand as
|
|
15699
|
+
ListRulesCommand as ListRulesCommand2,
|
|
15700
|
+
ListTagsForResourceCommand as ListTagsForResourceCommand6,
|
|
15404
15701
|
RemoveTargetsCommand as RemoveTargetsCommand2,
|
|
15405
15702
|
DeleteRuleCommand as DeleteRuleCommand2,
|
|
15406
15703
|
ListTargetsByRuleCommand as ListTargetsByRuleCommand2,
|
|
@@ -15595,7 +15892,7 @@ var EventBridgeBusProvider = class {
|
|
|
15595
15892
|
async cleanupRulesOnBus(busName) {
|
|
15596
15893
|
try {
|
|
15597
15894
|
const rulesResponse = await this.eventBridgeClient.send(
|
|
15598
|
-
new
|
|
15895
|
+
new ListRulesCommand2({ EventBusName: busName })
|
|
15599
15896
|
);
|
|
15600
15897
|
const rules = rulesResponse.Rules ?? [];
|
|
15601
15898
|
if (rules.length === 0)
|
|
@@ -15672,7 +15969,7 @@ var EventBridgeBusProvider = class {
|
|
|
15672
15969
|
continue;
|
|
15673
15970
|
try {
|
|
15674
15971
|
const tagsResp = await this.eventBridgeClient.send(
|
|
15675
|
-
new
|
|
15972
|
+
new ListTagsForResourceCommand6({ ResourceARN: bus.Arn })
|
|
15676
15973
|
);
|
|
15677
15974
|
if (matchesCdkPath(tagsResp.Tags, input.cdkPath)) {
|
|
15678
15975
|
return { physicalId: bus.Name, attributes: {} };
|
|
@@ -19505,7 +19802,7 @@ import {
|
|
|
19505
19802
|
GetDistributionCommand,
|
|
19506
19803
|
GetDistributionConfigCommand,
|
|
19507
19804
|
ListDistributionsCommand,
|
|
19508
|
-
ListTagsForResourceCommand as
|
|
19805
|
+
ListTagsForResourceCommand as ListTagsForResourceCommand7,
|
|
19509
19806
|
NoSuchDistribution
|
|
19510
19807
|
} from "@aws-sdk/client-cloudfront";
|
|
19511
19808
|
init_aws_clients();
|
|
@@ -19941,7 +20238,7 @@ var CloudFrontDistributionProvider = class {
|
|
|
19941
20238
|
continue;
|
|
19942
20239
|
try {
|
|
19943
20240
|
const tagsResp = await this.cloudFrontClient.send(
|
|
19944
|
-
new
|
|
20241
|
+
new ListTagsForResourceCommand7({ Resource: d.ARN })
|
|
19945
20242
|
);
|
|
19946
20243
|
if (matchesCdkPath(tagsResp.Tags?.Items, input.cdkPath)) {
|
|
19947
20244
|
return { physicalId: d.Id, attributes: {} };
|
|
@@ -20227,6 +20524,8 @@ import {
|
|
|
20227
20524
|
UpdateStateMachineCommand,
|
|
20228
20525
|
DeleteStateMachineCommand,
|
|
20229
20526
|
DescribeStateMachineCommand,
|
|
20527
|
+
ListStateMachinesCommand,
|
|
20528
|
+
ListTagsForResourceCommand as ListTagsForResourceCommand8,
|
|
20230
20529
|
StateMachineDoesNotExist
|
|
20231
20530
|
} from "@aws-sdk/client-sfn";
|
|
20232
20531
|
var StepFunctionsProvider = class {
|
|
@@ -20409,6 +20708,67 @@ var StepFunctionsProvider = class {
|
|
|
20409
20708
|
);
|
|
20410
20709
|
}
|
|
20411
20710
|
}
|
|
20711
|
+
/**
|
|
20712
|
+
* Adopt an existing Step Functions state machine into cdkd state.
|
|
20713
|
+
*
|
|
20714
|
+
* Lookup order:
|
|
20715
|
+
* 1. `--resource <id>=<arn>` override → verify with `DescribeStateMachine`.
|
|
20716
|
+
* 2. Walk `ListStateMachines` paginator → `ListTagsForResource(arn)`,
|
|
20717
|
+
* match the lowercase `key`/`value` `aws:cdk:path` tag (SFN uses
|
|
20718
|
+
* lowercase tags, so `matchesCdkPath` from import-helpers does not
|
|
20719
|
+
* apply directly).
|
|
20720
|
+
*
|
|
20721
|
+
* SFN state machines do not expose a template-supplied name field
|
|
20722
|
+
* usable as a stable physicalId — the physicalId is the ARN — so the
|
|
20723
|
+
* fallback to `Properties.<NameField>` in `resolveExplicitPhysicalId`
|
|
20724
|
+
* is skipped here.
|
|
20725
|
+
*/
|
|
20726
|
+
async import(input) {
|
|
20727
|
+
if (input.knownPhysicalId) {
|
|
20728
|
+
try {
|
|
20729
|
+
await this.getClient().send(
|
|
20730
|
+
new DescribeStateMachineCommand({ stateMachineArn: input.knownPhysicalId })
|
|
20731
|
+
);
|
|
20732
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
20733
|
+
} catch (err) {
|
|
20734
|
+
if (err instanceof StateMachineDoesNotExist)
|
|
20735
|
+
return null;
|
|
20736
|
+
throw err;
|
|
20737
|
+
}
|
|
20738
|
+
}
|
|
20739
|
+
if (!input.cdkPath)
|
|
20740
|
+
return null;
|
|
20741
|
+
let nextToken;
|
|
20742
|
+
do {
|
|
20743
|
+
const list = await this.getClient().send(
|
|
20744
|
+
new ListStateMachinesCommand({ ...nextToken && { nextToken } })
|
|
20745
|
+
);
|
|
20746
|
+
for (const sm of list.stateMachines ?? []) {
|
|
20747
|
+
if (!sm.stateMachineArn)
|
|
20748
|
+
continue;
|
|
20749
|
+
const tagsResp = await this.getClient().send(
|
|
20750
|
+
new ListTagsForResourceCommand8({ resourceArn: sm.stateMachineArn })
|
|
20751
|
+
);
|
|
20752
|
+
if (this.tagsMatchCdkPath(tagsResp.tags, input.cdkPath)) {
|
|
20753
|
+
return { physicalId: sm.stateMachineArn, attributes: {} };
|
|
20754
|
+
}
|
|
20755
|
+
}
|
|
20756
|
+
nextToken = list.nextToken;
|
|
20757
|
+
} while (nextToken);
|
|
20758
|
+
return null;
|
|
20759
|
+
}
|
|
20760
|
+
/**
|
|
20761
|
+
* Match SFN's lowercase `key`/`value` tag shape against the CDK path.
|
|
20762
|
+
*/
|
|
20763
|
+
tagsMatchCdkPath(tags, cdkPath) {
|
|
20764
|
+
if (!tags)
|
|
20765
|
+
return false;
|
|
20766
|
+
for (const t of tags) {
|
|
20767
|
+
if (t.key === CDK_PATH_TAG && t.value === cdkPath)
|
|
20768
|
+
return true;
|
|
20769
|
+
}
|
|
20770
|
+
return false;
|
|
20771
|
+
}
|
|
20412
20772
|
/**
|
|
20413
20773
|
* Build definition string from CDK properties.
|
|
20414
20774
|
* Handles both DefinitionString (string) and DefinitionString (object) forms.
|
|
@@ -20448,7 +20808,7 @@ import {
|
|
|
20448
20808
|
DescribeServicesCommand,
|
|
20449
20809
|
ListClustersCommand,
|
|
20450
20810
|
ListServicesCommand,
|
|
20451
|
-
ListTagsForResourceCommand as
|
|
20811
|
+
ListTagsForResourceCommand as ListTagsForResourceCommand9
|
|
20452
20812
|
} from "@aws-sdk/client-ecs";
|
|
20453
20813
|
function convertTags(tags) {
|
|
20454
20814
|
if (!tags || tags.length === 0)
|
|
@@ -21226,7 +21586,7 @@ var ECSProvider = class {
|
|
|
21226
21586
|
);
|
|
21227
21587
|
for (const arn of list.clusterArns ?? []) {
|
|
21228
21588
|
const tagsResp = await this.getClient().send(
|
|
21229
|
-
new
|
|
21589
|
+
new ListTagsForResourceCommand9({ resourceArn: arn })
|
|
21230
21590
|
);
|
|
21231
21591
|
if (this.tagsMatchCdkPath(tagsResp.tags, input.cdkPath)) {
|
|
21232
21592
|
const name = arn.substring(arn.lastIndexOf("/") + 1);
|
|
@@ -21259,7 +21619,7 @@ var ECSProvider = class {
|
|
|
21259
21619
|
);
|
|
21260
21620
|
for (const svcArn of svcList.serviceArns ?? []) {
|
|
21261
21621
|
const tagsResp = await this.getClient().send(
|
|
21262
|
-
new
|
|
21622
|
+
new ListTagsForResourceCommand9({ resourceArn: svcArn })
|
|
21263
21623
|
);
|
|
21264
21624
|
if (this.tagsMatchCdkPath(tagsResp.tags, input.cdkPath)) {
|
|
21265
21625
|
const svcName = svcArn.substring(svcArn.lastIndexOf("/") + 1);
|
|
@@ -21311,6 +21671,7 @@ import {
|
|
|
21311
21671
|
DeleteTargetGroupCommand,
|
|
21312
21672
|
ModifyTargetGroupCommand,
|
|
21313
21673
|
DescribeTargetGroupsCommand,
|
|
21674
|
+
DescribeTagsCommand,
|
|
21314
21675
|
CreateListenerCommand,
|
|
21315
21676
|
DeleteListenerCommand,
|
|
21316
21677
|
ModifyListenerCommand
|
|
@@ -21807,33 +22168,134 @@ var ELBv2Provider = class {
|
|
|
21807
22168
|
return certificates;
|
|
21808
22169
|
}
|
|
21809
22170
|
/**
|
|
21810
|
-
*
|
|
22171
|
+
* Adopt an existing ELBv2 LoadBalancer or TargetGroup into cdkd state.
|
|
22172
|
+
*
|
|
22173
|
+
* Lookup order:
|
|
22174
|
+
* 1. `--resource <id>=<arn>` override → verify with `DescribeLoadBalancers`
|
|
22175
|
+
* or `DescribeTargetGroups`.
|
|
22176
|
+
* 2. Walk `DescribeLoadBalancers` / `DescribeTargetGroups` paginators →
|
|
22177
|
+
* batch-fetch tags for each ARN with `DescribeTags(ResourceArns)`
|
|
22178
|
+
* and match `aws:cdk:path` (standard `Key`/`Value` Tag[] shape).
|
|
22179
|
+
*
|
|
22180
|
+
* Listener is not auto-importable (no template-supplied stable
|
|
22181
|
+
* identifier and no convenient tag-by-LB-context shortcut); use
|
|
22182
|
+
* `--resource <listenerId>=<arn>` for those.
|
|
21811
22183
|
*/
|
|
21812
|
-
|
|
21813
|
-
|
|
21814
|
-
|
|
21815
|
-
|
|
21816
|
-
|
|
21817
|
-
|
|
22184
|
+
async import(input) {
|
|
22185
|
+
switch (input.resourceType) {
|
|
22186
|
+
case "AWS::ElasticLoadBalancingV2::LoadBalancer":
|
|
22187
|
+
return this.importLoadBalancer(input);
|
|
22188
|
+
case "AWS::ElasticLoadBalancingV2::TargetGroup":
|
|
22189
|
+
return this.importTargetGroup(input);
|
|
22190
|
+
case "AWS::ElasticLoadBalancingV2::Listener":
|
|
22191
|
+
if (input.knownPhysicalId) {
|
|
22192
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
22193
|
+
}
|
|
22194
|
+
return null;
|
|
22195
|
+
default:
|
|
22196
|
+
return null;
|
|
22197
|
+
}
|
|
21818
22198
|
}
|
|
21819
|
-
|
|
21820
|
-
|
|
21821
|
-
|
|
21822
|
-
|
|
21823
|
-
|
|
21824
|
-
|
|
21825
|
-
|
|
21826
|
-
|
|
21827
|
-
|
|
21828
|
-
|
|
21829
|
-
|
|
21830
|
-
|
|
21831
|
-
|
|
21832
|
-
|
|
22199
|
+
async importLoadBalancer(input) {
|
|
22200
|
+
if (input.knownPhysicalId) {
|
|
22201
|
+
try {
|
|
22202
|
+
const resp = await this.getClient().send(
|
|
22203
|
+
new DescribeLoadBalancersCommand2({ LoadBalancerArns: [input.knownPhysicalId] })
|
|
22204
|
+
);
|
|
22205
|
+
return resp.LoadBalancers?.[0]?.LoadBalancerArn ? { physicalId: resp.LoadBalancers[0].LoadBalancerArn, attributes: {} } : null;
|
|
22206
|
+
} catch (err) {
|
|
22207
|
+
if (this.isNotFoundError(err))
|
|
22208
|
+
return null;
|
|
22209
|
+
throw err;
|
|
22210
|
+
}
|
|
22211
|
+
}
|
|
22212
|
+
if (!input.cdkPath)
|
|
22213
|
+
return null;
|
|
22214
|
+
let marker;
|
|
22215
|
+
do {
|
|
22216
|
+
const list = await this.getClient().send(
|
|
22217
|
+
new DescribeLoadBalancersCommand2({ ...marker && { Marker: marker } })
|
|
22218
|
+
);
|
|
22219
|
+
const arns = (list.LoadBalancers ?? []).map((lb) => lb.LoadBalancerArn).filter((arn) => Boolean(arn));
|
|
22220
|
+
for (let i = 0; i < arns.length; i += 20) {
|
|
22221
|
+
const batch = arns.slice(i, i + 20);
|
|
22222
|
+
const tagsResp = await this.getClient().send(
|
|
22223
|
+
new DescribeTagsCommand({ ResourceArns: batch })
|
|
22224
|
+
);
|
|
22225
|
+
for (const td of tagsResp.TagDescriptions ?? []) {
|
|
22226
|
+
if (td.ResourceArn && matchesCdkPath(td.Tags, input.cdkPath)) {
|
|
22227
|
+
return { physicalId: td.ResourceArn, attributes: {} };
|
|
22228
|
+
}
|
|
22229
|
+
}
|
|
22230
|
+
}
|
|
22231
|
+
marker = list.NextMarker;
|
|
22232
|
+
} while (marker);
|
|
22233
|
+
return null;
|
|
22234
|
+
}
|
|
22235
|
+
async importTargetGroup(input) {
|
|
22236
|
+
if (input.knownPhysicalId) {
|
|
22237
|
+
try {
|
|
22238
|
+
const resp = await this.getClient().send(
|
|
22239
|
+
new DescribeTargetGroupsCommand({ TargetGroupArns: [input.knownPhysicalId] })
|
|
22240
|
+
);
|
|
22241
|
+
return resp.TargetGroups?.[0]?.TargetGroupArn ? { physicalId: resp.TargetGroups[0].TargetGroupArn, attributes: {} } : null;
|
|
22242
|
+
} catch (err) {
|
|
22243
|
+
if (this.isNotFoundError(err))
|
|
22244
|
+
return null;
|
|
22245
|
+
throw err;
|
|
22246
|
+
}
|
|
22247
|
+
}
|
|
22248
|
+
if (!input.cdkPath)
|
|
22249
|
+
return null;
|
|
22250
|
+
let marker;
|
|
22251
|
+
do {
|
|
22252
|
+
const list = await this.getClient().send(
|
|
22253
|
+
new DescribeTargetGroupsCommand({ ...marker && { Marker: marker } })
|
|
22254
|
+
);
|
|
22255
|
+
const arns = (list.TargetGroups ?? []).map((tg) => tg.TargetGroupArn).filter((arn) => Boolean(arn));
|
|
22256
|
+
for (let i = 0; i < arns.length; i += 20) {
|
|
22257
|
+
const batch = arns.slice(i, i + 20);
|
|
22258
|
+
const tagsResp = await this.getClient().send(
|
|
22259
|
+
new DescribeTagsCommand({ ResourceArns: batch })
|
|
22260
|
+
);
|
|
22261
|
+
for (const td of tagsResp.TagDescriptions ?? []) {
|
|
22262
|
+
if (td.ResourceArn && matchesCdkPath(td.Tags, input.cdkPath)) {
|
|
22263
|
+
return { physicalId: td.ResourceArn, attributes: {} };
|
|
22264
|
+
}
|
|
22265
|
+
}
|
|
22266
|
+
}
|
|
22267
|
+
marker = list.NextMarker;
|
|
22268
|
+
} while (marker);
|
|
22269
|
+
return null;
|
|
22270
|
+
}
|
|
22271
|
+
/**
|
|
22272
|
+
* Check if an error indicates the resource was not found
|
|
22273
|
+
*/
|
|
22274
|
+
isNotFoundError(error) {
|
|
22275
|
+
if (!(error instanceof Error))
|
|
22276
|
+
return false;
|
|
22277
|
+
const message = (error.message || "").toLowerCase();
|
|
22278
|
+
const name = error.name ?? "";
|
|
22279
|
+
return message.includes("not found") || message.includes("does not exist") || name === "LoadBalancerNotFoundException" || name === "TargetGroupNotFoundException" || name === "ListenerNotFoundException";
|
|
22280
|
+
}
|
|
22281
|
+
};
|
|
22282
|
+
|
|
22283
|
+
// src/provisioning/providers/rds-provider.ts
|
|
22284
|
+
import {
|
|
22285
|
+
RDSClient,
|
|
22286
|
+
CreateDBClusterCommand,
|
|
22287
|
+
DeleteDBClusterCommand,
|
|
22288
|
+
ModifyDBClusterCommand,
|
|
22289
|
+
DescribeDBClustersCommand,
|
|
22290
|
+
CreateDBInstanceCommand,
|
|
22291
|
+
DeleteDBInstanceCommand,
|
|
22292
|
+
ModifyDBInstanceCommand,
|
|
22293
|
+
DescribeDBInstancesCommand,
|
|
22294
|
+
CreateDBSubnetGroupCommand,
|
|
21833
22295
|
DeleteDBSubnetGroupCommand,
|
|
21834
22296
|
DescribeDBSubnetGroupsCommand,
|
|
21835
22297
|
ModifyDBSubnetGroupCommand,
|
|
21836
|
-
ListTagsForResourceCommand as
|
|
22298
|
+
ListTagsForResourceCommand as ListTagsForResourceCommand10
|
|
21837
22299
|
} from "@aws-sdk/client-rds";
|
|
21838
22300
|
var RDSProvider = class {
|
|
21839
22301
|
rdsClient;
|
|
@@ -22474,7 +22936,7 @@ var RDSProvider = class {
|
|
|
22474
22936
|
if (!inst.DBInstanceIdentifier || !inst.DBInstanceArn)
|
|
22475
22937
|
continue;
|
|
22476
22938
|
const tagsResp = await this.getClient().send(
|
|
22477
|
-
new
|
|
22939
|
+
new ListTagsForResourceCommand10({ ResourceName: inst.DBInstanceArn })
|
|
22478
22940
|
);
|
|
22479
22941
|
if (matchesCdkPath(tagsResp.TagList, input.cdkPath)) {
|
|
22480
22942
|
return { physicalId: inst.DBInstanceIdentifier, attributes: {} };
|
|
@@ -22509,7 +22971,7 @@ var RDSProvider = class {
|
|
|
22509
22971
|
if (!c.DBClusterIdentifier || !c.DBClusterArn)
|
|
22510
22972
|
continue;
|
|
22511
22973
|
const tagsResp = await this.getClient().send(
|
|
22512
|
-
new
|
|
22974
|
+
new ListTagsForResourceCommand10({ ResourceName: c.DBClusterArn })
|
|
22513
22975
|
);
|
|
22514
22976
|
if (matchesCdkPath(tagsResp.TagList, input.cdkPath)) {
|
|
22515
22977
|
return { physicalId: c.DBClusterIdentifier, attributes: {} };
|
|
@@ -22544,7 +23006,7 @@ var RDSProvider = class {
|
|
|
22544
23006
|
if (!sg.DBSubnetGroupName || !sg.DBSubnetGroupArn)
|
|
22545
23007
|
continue;
|
|
22546
23008
|
const tagsResp = await this.getClient().send(
|
|
22547
|
-
new
|
|
23009
|
+
new ListTagsForResourceCommand10({ ResourceName: sg.DBSubnetGroupArn })
|
|
22548
23010
|
);
|
|
22549
23011
|
if (matchesCdkPath(tagsResp.TagList, input.cdkPath)) {
|
|
22550
23012
|
return { physicalId: sg.DBSubnetGroupName, attributes: {} };
|
|
@@ -22570,7 +23032,9 @@ import {
|
|
|
22570
23032
|
CreateQueryLoggingConfigCommand,
|
|
22571
23033
|
DeleteQueryLoggingConfigCommand,
|
|
22572
23034
|
ListQueryLoggingConfigsCommand,
|
|
22573
|
-
ListHostedZonesByNameCommand as ListHostedZonesByNameCommand2
|
|
23035
|
+
ListHostedZonesByNameCommand as ListHostedZonesByNameCommand2,
|
|
23036
|
+
ListHostedZonesCommand,
|
|
23037
|
+
ListTagsForResourceCommand as ListTagsForResourceCommand11
|
|
22574
23038
|
} from "@aws-sdk/client-route-53";
|
|
22575
23039
|
var Route53Provider = class {
|
|
22576
23040
|
route53Client;
|
|
@@ -23217,6 +23681,69 @@ var Route53Provider = class {
|
|
|
23217
23681
|
physicalId
|
|
23218
23682
|
);
|
|
23219
23683
|
}
|
|
23684
|
+
/**
|
|
23685
|
+
* Adopt an existing Route 53 resource into cdkd state.
|
|
23686
|
+
*
|
|
23687
|
+
* Supported types: `AWS::Route53::HostedZone` (full tag-based
|
|
23688
|
+
* lookup); `AWS::Route53::RecordSet` (override-only — RecordSets are
|
|
23689
|
+
* not taggable, and the composite child-of-zone identity makes auto
|
|
23690
|
+
* lookup impractical).
|
|
23691
|
+
*/
|
|
23692
|
+
async import(input) {
|
|
23693
|
+
switch (input.resourceType) {
|
|
23694
|
+
case "AWS::Route53::HostedZone":
|
|
23695
|
+
return this.importHostedZone(input);
|
|
23696
|
+
case "AWS::Route53::RecordSet":
|
|
23697
|
+
if (input.knownPhysicalId) {
|
|
23698
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
23699
|
+
}
|
|
23700
|
+
return null;
|
|
23701
|
+
default:
|
|
23702
|
+
return null;
|
|
23703
|
+
}
|
|
23704
|
+
}
|
|
23705
|
+
async importHostedZone(input) {
|
|
23706
|
+
if (input.knownPhysicalId) {
|
|
23707
|
+
try {
|
|
23708
|
+
await this.getClient().send(new GetHostedZoneCommand2({ Id: input.knownPhysicalId }));
|
|
23709
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
23710
|
+
} catch (err) {
|
|
23711
|
+
if (err instanceof Error && err.name === "NoSuchHostedZone")
|
|
23712
|
+
return null;
|
|
23713
|
+
throw err;
|
|
23714
|
+
}
|
|
23715
|
+
}
|
|
23716
|
+
if (!input.cdkPath)
|
|
23717
|
+
return null;
|
|
23718
|
+
let marker;
|
|
23719
|
+
do {
|
|
23720
|
+
const list = await this.getClient().send(
|
|
23721
|
+
new ListHostedZonesCommand({ ...marker && { Marker: marker } })
|
|
23722
|
+
);
|
|
23723
|
+
for (const zone of list.HostedZones ?? []) {
|
|
23724
|
+
if (!zone.Id)
|
|
23725
|
+
continue;
|
|
23726
|
+
const zoneId = zone.Id.replace("/hostedzone/", "");
|
|
23727
|
+
try {
|
|
23728
|
+
const tagsResp = await this.getClient().send(
|
|
23729
|
+
new ListTagsForResourceCommand11({
|
|
23730
|
+
ResourceType: "hostedzone",
|
|
23731
|
+
ResourceId: zoneId
|
|
23732
|
+
})
|
|
23733
|
+
);
|
|
23734
|
+
if (matchesCdkPath(tagsResp.ResourceTagSet?.Tags, input.cdkPath)) {
|
|
23735
|
+
return { physicalId: zoneId, attributes: {} };
|
|
23736
|
+
}
|
|
23737
|
+
} catch (err) {
|
|
23738
|
+
if (err instanceof Error && err.name === "NoSuchHostedZone")
|
|
23739
|
+
continue;
|
|
23740
|
+
throw err;
|
|
23741
|
+
}
|
|
23742
|
+
}
|
|
23743
|
+
marker = list.IsTruncated ? list.NextMarker : void 0;
|
|
23744
|
+
} while (marker);
|
|
23745
|
+
return null;
|
|
23746
|
+
}
|
|
23220
23747
|
};
|
|
23221
23748
|
|
|
23222
23749
|
// src/provisioning/providers/wafv2-provider.ts
|
|
@@ -23226,6 +23753,8 @@ import {
|
|
|
23226
23753
|
UpdateWebACLCommand,
|
|
23227
23754
|
DeleteWebACLCommand,
|
|
23228
23755
|
GetWebACLCommand,
|
|
23756
|
+
ListWebACLsCommand,
|
|
23757
|
+
ListTagsForResourceCommand as ListTagsForResourceCommand12,
|
|
23229
23758
|
WAFNonexistentItemException
|
|
23230
23759
|
} from "@aws-sdk/client-wafv2";
|
|
23231
23760
|
function parseWebACLArn(arn) {
|
|
@@ -23440,6 +23969,54 @@ var WAFv2WebACLProvider = class {
|
|
|
23440
23969
|
);
|
|
23441
23970
|
}
|
|
23442
23971
|
}
|
|
23972
|
+
/**
|
|
23973
|
+
* Adopt an existing WAFv2 WebACL into cdkd state.
|
|
23974
|
+
*
|
|
23975
|
+
* Lookup order:
|
|
23976
|
+
* 1. `--resource <id>=<arn>` override → verify with `GetWebACL` (parses
|
|
23977
|
+
* Name/Id/Scope back out of the ARN).
|
|
23978
|
+
* 2. Walk `ListWebACLs(Scope)` → match `aws:cdk:path` via
|
|
23979
|
+
* `ListTagsForResource(ResourceARN)` (returns
|
|
23980
|
+
* `TagInfoForResource.TagList`, standard `Key`/`Value` shape).
|
|
23981
|
+
*
|
|
23982
|
+
* `Scope` is required by `ListWebACLs` — read from
|
|
23983
|
+
* `Properties.Scope` (`REGIONAL` is the default).
|
|
23984
|
+
*/
|
|
23985
|
+
async import(input) {
|
|
23986
|
+
if (input.knownPhysicalId) {
|
|
23987
|
+
try {
|
|
23988
|
+
const { id, name, scope: scope2 } = parseWebACLArn(input.knownPhysicalId);
|
|
23989
|
+
await this.getClient().send(new GetWebACLCommand({ Id: id, Name: name, Scope: scope2 }));
|
|
23990
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
23991
|
+
} catch (err) {
|
|
23992
|
+
if (err instanceof WAFNonexistentItemException)
|
|
23993
|
+
return null;
|
|
23994
|
+
throw err;
|
|
23995
|
+
}
|
|
23996
|
+
}
|
|
23997
|
+
if (!input.cdkPath)
|
|
23998
|
+
return null;
|
|
23999
|
+
const scope = input.properties["Scope"] || "REGIONAL";
|
|
24000
|
+
let nextMarker;
|
|
24001
|
+
do {
|
|
24002
|
+
const list = await this.getClient().send(
|
|
24003
|
+
new ListWebACLsCommand({ Scope: scope, ...nextMarker && { NextMarker: nextMarker } })
|
|
24004
|
+
);
|
|
24005
|
+
for (const item of list.WebACLs ?? []) {
|
|
24006
|
+
if (!item.ARN)
|
|
24007
|
+
continue;
|
|
24008
|
+
const tagsResp = await this.getClient().send(
|
|
24009
|
+
new ListTagsForResourceCommand12({ ResourceARN: item.ARN })
|
|
24010
|
+
);
|
|
24011
|
+
const tagList = tagsResp.TagInfoForResource?.TagList;
|
|
24012
|
+
if (matchesCdkPath(tagList, input.cdkPath)) {
|
|
24013
|
+
return { physicalId: item.ARN, attributes: {} };
|
|
24014
|
+
}
|
|
24015
|
+
}
|
|
24016
|
+
nextMarker = list.NextMarker;
|
|
24017
|
+
} while (nextMarker);
|
|
24018
|
+
return null;
|
|
24019
|
+
}
|
|
23443
24020
|
};
|
|
23444
24021
|
|
|
23445
24022
|
// src/provisioning/providers/cognito-provider.ts
|
|
@@ -23450,7 +24027,7 @@ import {
|
|
|
23450
24027
|
UpdateUserPoolCommand,
|
|
23451
24028
|
DescribeUserPoolCommand,
|
|
23452
24029
|
ListUserPoolsCommand,
|
|
23453
|
-
ListTagsForResourceCommand as
|
|
24030
|
+
ListTagsForResourceCommand as ListTagsForResourceCommand13,
|
|
23454
24031
|
ResourceNotFoundException as ResourceNotFoundException12
|
|
23455
24032
|
} from "@aws-sdk/client-cognito-identity-provider";
|
|
23456
24033
|
var CognitoUserPoolProvider = class {
|
|
@@ -23835,7 +24412,7 @@ var CognitoUserPoolProvider = class {
|
|
|
23835
24412
|
if (!arn)
|
|
23836
24413
|
continue;
|
|
23837
24414
|
const tagsResp = await this.getClient().send(
|
|
23838
|
-
new
|
|
24415
|
+
new ListTagsForResourceCommand13({ ResourceArn: arn })
|
|
23839
24416
|
);
|
|
23840
24417
|
if (tagsResp.Tags?.[CDK_PATH_TAG] === input.cdkPath) {
|
|
23841
24418
|
return { physicalId: pool.Id, attributes: {} };
|
|
@@ -23859,13 +24436,18 @@ import {
|
|
|
23859
24436
|
CreateCacheClusterCommand,
|
|
23860
24437
|
DeleteCacheClusterCommand,
|
|
23861
24438
|
DescribeCacheClustersCommand,
|
|
24439
|
+
DescribeCacheSubnetGroupsCommand,
|
|
23862
24440
|
CreateCacheSubnetGroupCommand,
|
|
23863
24441
|
DeleteCacheSubnetGroupCommand,
|
|
23864
24442
|
ModifyCacheSubnetGroupCommand,
|
|
23865
|
-
ModifyCacheClusterCommand
|
|
24443
|
+
ModifyCacheClusterCommand,
|
|
24444
|
+
ListTagsForResourceCommand as ListTagsForResourceCommand14
|
|
23866
24445
|
} from "@aws-sdk/client-elasticache";
|
|
24446
|
+
import { STSClient as STSClient5, GetCallerIdentityCommand as GetCallerIdentityCommand6 } from "@aws-sdk/client-sts";
|
|
23867
24447
|
var ElastiCacheProvider = class {
|
|
23868
24448
|
client;
|
|
24449
|
+
stsClient;
|
|
24450
|
+
cachedAccountId;
|
|
23869
24451
|
providerRegion = process.env["AWS_REGION"];
|
|
23870
24452
|
logger = getLogger().child("ElastiCacheProvider");
|
|
23871
24453
|
handledProperties = /* @__PURE__ */ new Map([
|
|
@@ -24267,6 +24849,132 @@ var ElastiCacheProvider = class {
|
|
|
24267
24849
|
sleep(ms) {
|
|
24268
24850
|
return new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
24269
24851
|
}
|
|
24852
|
+
/**
|
|
24853
|
+
* Adopt an existing ElastiCache resource into cdkd state.
|
|
24854
|
+
*
|
|
24855
|
+
* Supported types:
|
|
24856
|
+
* - `AWS::ElastiCache::CacheCluster` — full tag-based lookup via
|
|
24857
|
+
* `DescribeCacheClusters` + `ListTagsForResource(ResourceName=arn)`.
|
|
24858
|
+
* - `AWS::ElastiCache::SubnetGroup` — full tag-based lookup via
|
|
24859
|
+
* `DescribeCacheSubnetGroups` + `ListTagsForResource(ResourceName=arn)`.
|
|
24860
|
+
*
|
|
24861
|
+
* `ListTagsForResource` requires an ARN. Both `CacheCluster.ARN` and
|
|
24862
|
+
* `CacheSubnetGroup.ARN` are returned by the Describe APIs, so no
|
|
24863
|
+
* extra reconstruction is needed in normal flow; for the explicit
|
|
24864
|
+
* override path we build the ARN from `region` + STS account id +
|
|
24865
|
+
* the resource name.
|
|
24866
|
+
*/
|
|
24867
|
+
async import(input) {
|
|
24868
|
+
switch (input.resourceType) {
|
|
24869
|
+
case "AWS::ElastiCache::CacheCluster":
|
|
24870
|
+
return this.importCacheCluster(input);
|
|
24871
|
+
case "AWS::ElastiCache::SubnetGroup":
|
|
24872
|
+
return this.importSubnetGroup(input);
|
|
24873
|
+
default:
|
|
24874
|
+
return null;
|
|
24875
|
+
}
|
|
24876
|
+
}
|
|
24877
|
+
async importCacheCluster(input) {
|
|
24878
|
+
const explicit = resolveExplicitPhysicalId(input, "ClusterName");
|
|
24879
|
+
if (explicit) {
|
|
24880
|
+
try {
|
|
24881
|
+
const resp = await this.getClient().send(
|
|
24882
|
+
new DescribeCacheClustersCommand({ CacheClusterId: explicit })
|
|
24883
|
+
);
|
|
24884
|
+
const c = resp.CacheClusters?.[0];
|
|
24885
|
+
return c?.CacheClusterId ? { physicalId: c.CacheClusterId, attributes: {} } : null;
|
|
24886
|
+
} catch (err) {
|
|
24887
|
+
if (this.isNotFoundError(err, "CacheClusterNotFoundFault"))
|
|
24888
|
+
return null;
|
|
24889
|
+
throw err;
|
|
24890
|
+
}
|
|
24891
|
+
}
|
|
24892
|
+
if (!input.cdkPath)
|
|
24893
|
+
return null;
|
|
24894
|
+
let marker;
|
|
24895
|
+
do {
|
|
24896
|
+
const list = await this.getClient().send(
|
|
24897
|
+
new DescribeCacheClustersCommand({ ...marker && { Marker: marker } })
|
|
24898
|
+
);
|
|
24899
|
+
for (const c of list.CacheClusters ?? []) {
|
|
24900
|
+
if (!c.CacheClusterId)
|
|
24901
|
+
continue;
|
|
24902
|
+
const arn = c.ARN ?? await this.buildClusterArn(c.CacheClusterId);
|
|
24903
|
+
const tagsResp = await this.getClient().send(
|
|
24904
|
+
new ListTagsForResourceCommand14({ ResourceName: arn })
|
|
24905
|
+
);
|
|
24906
|
+
if (matchesCdkPath(tagsResp.TagList, input.cdkPath)) {
|
|
24907
|
+
return { physicalId: c.CacheClusterId, attributes: {} };
|
|
24908
|
+
}
|
|
24909
|
+
}
|
|
24910
|
+
marker = list.Marker;
|
|
24911
|
+
} while (marker);
|
|
24912
|
+
return null;
|
|
24913
|
+
}
|
|
24914
|
+
async importSubnetGroup(input) {
|
|
24915
|
+
const explicit = resolveExplicitPhysicalId(input, "CacheSubnetGroupName");
|
|
24916
|
+
if (explicit) {
|
|
24917
|
+
try {
|
|
24918
|
+
const resp = await this.getClient().send(
|
|
24919
|
+
new DescribeCacheSubnetGroupsCommand({ CacheSubnetGroupName: explicit })
|
|
24920
|
+
);
|
|
24921
|
+
const g = resp.CacheSubnetGroups?.[0];
|
|
24922
|
+
return g?.CacheSubnetGroupName ? { physicalId: g.CacheSubnetGroupName, attributes: {} } : null;
|
|
24923
|
+
} catch (err) {
|
|
24924
|
+
if (this.isNotFoundError(err, "CacheSubnetGroupNotFoundFault"))
|
|
24925
|
+
return null;
|
|
24926
|
+
throw err;
|
|
24927
|
+
}
|
|
24928
|
+
}
|
|
24929
|
+
if (!input.cdkPath)
|
|
24930
|
+
return null;
|
|
24931
|
+
let marker;
|
|
24932
|
+
do {
|
|
24933
|
+
const list = await this.getClient().send(
|
|
24934
|
+
new DescribeCacheSubnetGroupsCommand({ ...marker && { Marker: marker } })
|
|
24935
|
+
);
|
|
24936
|
+
for (const g of list.CacheSubnetGroups ?? []) {
|
|
24937
|
+
if (!g.CacheSubnetGroupName)
|
|
24938
|
+
continue;
|
|
24939
|
+
const arn = g.ARN ?? await this.buildSubnetGroupArn(g.CacheSubnetGroupName);
|
|
24940
|
+
const tagsResp = await this.getClient().send(
|
|
24941
|
+
new ListTagsForResourceCommand14({ ResourceName: arn })
|
|
24942
|
+
);
|
|
24943
|
+
if (matchesCdkPath(tagsResp.TagList, input.cdkPath)) {
|
|
24944
|
+
return { physicalId: g.CacheSubnetGroupName, attributes: {} };
|
|
24945
|
+
}
|
|
24946
|
+
}
|
|
24947
|
+
marker = list.Marker;
|
|
24948
|
+
} while (marker);
|
|
24949
|
+
return null;
|
|
24950
|
+
}
|
|
24951
|
+
async buildClusterArn(clusterName) {
|
|
24952
|
+
const region = await this.getRegion();
|
|
24953
|
+
const account = await this.getAccountId();
|
|
24954
|
+
return `arn:aws:elasticache:${region}:${account}:cluster:${clusterName}`;
|
|
24955
|
+
}
|
|
24956
|
+
async buildSubnetGroupArn(subnetGroupName) {
|
|
24957
|
+
const region = await this.getRegion();
|
|
24958
|
+
const account = await this.getAccountId();
|
|
24959
|
+
return `arn:aws:elasticache:${region}:${account}:subnetgroup:${subnetGroupName}`;
|
|
24960
|
+
}
|
|
24961
|
+
async getRegion() {
|
|
24962
|
+
const region = await this.getClient().config.region();
|
|
24963
|
+
return region || this.providerRegion || "us-east-1";
|
|
24964
|
+
}
|
|
24965
|
+
async getAccountId() {
|
|
24966
|
+
if (this.cachedAccountId)
|
|
24967
|
+
return this.cachedAccountId;
|
|
24968
|
+
if (!this.stsClient) {
|
|
24969
|
+
this.stsClient = new STSClient5(this.providerRegion ? { region: this.providerRegion } : {});
|
|
24970
|
+
}
|
|
24971
|
+
const identity = await this.stsClient.send(new GetCallerIdentityCommand6({}));
|
|
24972
|
+
if (!identity.Account) {
|
|
24973
|
+
throw new Error("Failed to resolve AWS account id from STS");
|
|
24974
|
+
}
|
|
24975
|
+
this.cachedAccountId = identity.Account;
|
|
24976
|
+
return this.cachedAccountId;
|
|
24977
|
+
}
|
|
24270
24978
|
};
|
|
24271
24979
|
|
|
24272
24980
|
// src/provisioning/providers/servicediscovery-provider.ts
|
|
@@ -24276,11 +24984,16 @@ import {
|
|
|
24276
24984
|
DeleteNamespaceCommand,
|
|
24277
24985
|
CreateServiceCommand as CreateServiceCommand2,
|
|
24278
24986
|
DeleteServiceCommand as DeleteServiceCommand2,
|
|
24987
|
+
GetNamespaceCommand,
|
|
24279
24988
|
GetOperationCommand,
|
|
24989
|
+
GetServiceCommand,
|
|
24990
|
+
ListNamespacesCommand,
|
|
24991
|
+
ListServicesCommand as ListServicesCommand2,
|
|
24992
|
+
ListTagsForResourceCommand as ListTagsForResourceCommand15,
|
|
24280
24993
|
NamespaceNotFound,
|
|
24281
24994
|
ServiceNotFound
|
|
24282
24995
|
} from "@aws-sdk/client-servicediscovery";
|
|
24283
|
-
import { STSClient as
|
|
24996
|
+
import { STSClient as STSClient6, GetCallerIdentityCommand as GetCallerIdentityCommand7 } from "@aws-sdk/client-sts";
|
|
24284
24997
|
var ServiceDiscoveryProvider = class {
|
|
24285
24998
|
client;
|
|
24286
24999
|
stsClient;
|
|
@@ -24312,7 +25025,7 @@ var ServiceDiscoveryProvider = class {
|
|
|
24312
25025
|
}
|
|
24313
25026
|
getStsClient() {
|
|
24314
25027
|
if (!this.stsClient) {
|
|
24315
|
-
this.stsClient = new
|
|
25028
|
+
this.stsClient = new STSClient6(this.providerRegion ? { region: this.providerRegion } : {});
|
|
24316
25029
|
}
|
|
24317
25030
|
return this.stsClient;
|
|
24318
25031
|
}
|
|
@@ -24597,13 +25310,114 @@ var ServiceDiscoveryProvider = class {
|
|
|
24597
25310
|
logicalId
|
|
24598
25311
|
);
|
|
24599
25312
|
}
|
|
25313
|
+
// ─── Import dispatch ──────────────────────────────────────────────
|
|
25314
|
+
/**
|
|
25315
|
+
* Adopt an existing Cloud Map (Service Discovery) resource into cdkd state.
|
|
25316
|
+
*
|
|
25317
|
+
* - **AWS::ServiceDiscovery::PrivateDnsNamespace**: tag-based auto-lookup
|
|
25318
|
+
* via `ListNamespaces` + `ListTagsForResource(ResourceARN)` (Tag[]
|
|
25319
|
+
* array). Falls back to `--resource` override or matching
|
|
25320
|
+
* `Properties.Name` against the namespace name.
|
|
25321
|
+
* - **AWS::ServiceDiscovery::Service**: same shape — `ListServices` +
|
|
25322
|
+
* `ListTagsForResource`. Both use `Tag[]` arrays.
|
|
25323
|
+
*/
|
|
25324
|
+
async import(input) {
|
|
25325
|
+
switch (input.resourceType) {
|
|
25326
|
+
case "AWS::ServiceDiscovery::PrivateDnsNamespace":
|
|
25327
|
+
return this.importNamespaceResource(input);
|
|
25328
|
+
case "AWS::ServiceDiscovery::Service":
|
|
25329
|
+
return this.importServiceResource(input);
|
|
25330
|
+
default:
|
|
25331
|
+
return null;
|
|
25332
|
+
}
|
|
25333
|
+
}
|
|
25334
|
+
async importNamespaceResource(input) {
|
|
25335
|
+
if (input.knownPhysicalId) {
|
|
25336
|
+
try {
|
|
25337
|
+
await this.getClient().send(new GetNamespaceCommand({ Id: input.knownPhysicalId }));
|
|
25338
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
25339
|
+
} catch (err) {
|
|
25340
|
+
if (err instanceof NamespaceNotFound)
|
|
25341
|
+
return null;
|
|
25342
|
+
throw err;
|
|
25343
|
+
}
|
|
25344
|
+
}
|
|
25345
|
+
const desiredName = typeof input.properties?.["Name"] === "string" ? input.properties["Name"] : void 0;
|
|
25346
|
+
let token;
|
|
25347
|
+
do {
|
|
25348
|
+
const list = await this.getClient().send(
|
|
25349
|
+
new ListNamespacesCommand({ ...token && { NextToken: token } })
|
|
25350
|
+
);
|
|
25351
|
+
for (const ns of list.Namespaces ?? []) {
|
|
25352
|
+
if (!ns.Id || !ns.Arn)
|
|
25353
|
+
continue;
|
|
25354
|
+
if (desiredName && ns.Name === desiredName) {
|
|
25355
|
+
return { physicalId: ns.Id, attributes: {} };
|
|
25356
|
+
}
|
|
25357
|
+
if (input.cdkPath) {
|
|
25358
|
+
try {
|
|
25359
|
+
const tagsResp = await this.getClient().send(
|
|
25360
|
+
new ListTagsForResourceCommand15({ ResourceARN: ns.Arn })
|
|
25361
|
+
);
|
|
25362
|
+
if (matchesCdkPath(tagsResp.Tags, input.cdkPath)) {
|
|
25363
|
+
return { physicalId: ns.Id, attributes: {} };
|
|
25364
|
+
}
|
|
25365
|
+
} catch (err) {
|
|
25366
|
+
if (err instanceof NamespaceNotFound)
|
|
25367
|
+
continue;
|
|
25368
|
+
throw err;
|
|
25369
|
+
}
|
|
25370
|
+
}
|
|
25371
|
+
}
|
|
25372
|
+
token = list.NextToken;
|
|
25373
|
+
} while (token);
|
|
25374
|
+
return null;
|
|
25375
|
+
}
|
|
25376
|
+
async importServiceResource(input) {
|
|
25377
|
+
if (input.knownPhysicalId) {
|
|
25378
|
+
try {
|
|
25379
|
+
await this.getClient().send(new GetServiceCommand({ Id: input.knownPhysicalId }));
|
|
25380
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
25381
|
+
} catch (err) {
|
|
25382
|
+
if (err instanceof ServiceNotFound)
|
|
25383
|
+
return null;
|
|
25384
|
+
throw err;
|
|
25385
|
+
}
|
|
25386
|
+
}
|
|
25387
|
+
if (!input.cdkPath)
|
|
25388
|
+
return null;
|
|
25389
|
+
let token;
|
|
25390
|
+
do {
|
|
25391
|
+
const list = await this.getClient().send(
|
|
25392
|
+
new ListServicesCommand2({ ...token && { NextToken: token } })
|
|
25393
|
+
);
|
|
25394
|
+
for (const svc of list.Services ?? []) {
|
|
25395
|
+
if (!svc.Id || !svc.Arn)
|
|
25396
|
+
continue;
|
|
25397
|
+
try {
|
|
25398
|
+
const tagsResp = await this.getClient().send(
|
|
25399
|
+
new ListTagsForResourceCommand15({ ResourceARN: svc.Arn })
|
|
25400
|
+
);
|
|
25401
|
+
if (matchesCdkPath(tagsResp.Tags, input.cdkPath)) {
|
|
25402
|
+
return { physicalId: svc.Id, attributes: {} };
|
|
25403
|
+
}
|
|
25404
|
+
} catch (err) {
|
|
25405
|
+
if (err instanceof ServiceNotFound)
|
|
25406
|
+
continue;
|
|
25407
|
+
throw err;
|
|
25408
|
+
}
|
|
25409
|
+
}
|
|
25410
|
+
token = list.NextToken;
|
|
25411
|
+
} while (token);
|
|
25412
|
+
return null;
|
|
25413
|
+
}
|
|
24600
25414
|
/**
|
|
24601
25415
|
* Build a namespace ARN from namespace ID.
|
|
24602
25416
|
* Format: arn:aws:servicediscovery:{region}:{account}:namespace/{namespaceId}
|
|
24603
25417
|
*/
|
|
24604
25418
|
async buildNamespaceArn(namespaceId) {
|
|
24605
25419
|
const stsClient = this.getStsClient();
|
|
24606
|
-
const identity = await stsClient.send(new
|
|
25420
|
+
const identity = await stsClient.send(new GetCallerIdentityCommand7({}));
|
|
24607
25421
|
const accountId = identity.Account || "";
|
|
24608
25422
|
const region = await this.getClient().config.region();
|
|
24609
25423
|
return `arn:aws:servicediscovery:${region}:${accountId}:namespace/${namespaceId}`;
|
|
@@ -25187,10 +26001,18 @@ import {
|
|
|
25187
26001
|
CreateTableCommand as CreateTableCommand2,
|
|
25188
26002
|
UpdateTableCommand,
|
|
25189
26003
|
DeleteTableCommand as DeleteTableCommand2,
|
|
26004
|
+
GetDatabaseCommand,
|
|
26005
|
+
GetDatabasesCommand,
|
|
26006
|
+
GetTableCommand,
|
|
26007
|
+
GetTablesCommand,
|
|
26008
|
+
GetTagsCommand,
|
|
25190
26009
|
EntityNotFoundException
|
|
25191
26010
|
} from "@aws-sdk/client-glue";
|
|
26011
|
+
import { STSClient as STSClient7, GetCallerIdentityCommand as GetCallerIdentityCommand8 } from "@aws-sdk/client-sts";
|
|
25192
26012
|
var GlueProvider = class {
|
|
25193
26013
|
client;
|
|
26014
|
+
stsClient;
|
|
26015
|
+
cachedAccountId;
|
|
25194
26016
|
providerRegion = process.env["AWS_REGION"];
|
|
25195
26017
|
logger = getLogger().child("GlueProvider");
|
|
25196
26018
|
handledProperties = /* @__PURE__ */ new Map([
|
|
@@ -25561,6 +26383,167 @@ var GlueProvider = class {
|
|
|
25561
26383
|
}
|
|
25562
26384
|
return result;
|
|
25563
26385
|
}
|
|
26386
|
+
/**
|
|
26387
|
+
* Adopt an existing Glue Database or Table into cdkd state.
|
|
26388
|
+
*
|
|
26389
|
+
* Lookup order (per type):
|
|
26390
|
+
* 1. Explicit override / template name → verify with `GetDatabase`
|
|
26391
|
+
* or `GetTable`.
|
|
26392
|
+
* 2. Walk `GetDatabases` / `GetTables` paginators and match the
|
|
26393
|
+
* `aws:cdk:path` tag via `GetTags(ResourceArn)`. Glue tags are
|
|
26394
|
+
* a `Record<string,string>` map (not a `Tag[]` array), so the
|
|
26395
|
+
* match is `tags?.[CDK_PATH_TAG] === input.cdkPath`.
|
|
26396
|
+
*
|
|
26397
|
+
* Glue list APIs return only names — ARNs are constructed locally
|
|
26398
|
+
* for the per-item GetTags call.
|
|
26399
|
+
*/
|
|
26400
|
+
async import(input) {
|
|
26401
|
+
switch (input.resourceType) {
|
|
26402
|
+
case "AWS::Glue::Database":
|
|
26403
|
+
return this.importDatabase(input);
|
|
26404
|
+
case "AWS::Glue::Table":
|
|
26405
|
+
return this.importTable(input);
|
|
26406
|
+
default:
|
|
26407
|
+
return null;
|
|
26408
|
+
}
|
|
26409
|
+
}
|
|
26410
|
+
async importDatabase(input) {
|
|
26411
|
+
const explicitName = input.knownPhysicalId ?? input.properties["DatabaseInput"]?.["Name"];
|
|
26412
|
+
const catalogId = input.properties["CatalogId"];
|
|
26413
|
+
if (explicitName) {
|
|
26414
|
+
try {
|
|
26415
|
+
await this.getClient().send(
|
|
26416
|
+
new GetDatabaseCommand({ Name: explicitName, ...catalogId && { CatalogId: catalogId } })
|
|
26417
|
+
);
|
|
26418
|
+
return { physicalId: explicitName, attributes: {} };
|
|
26419
|
+
} catch (err) {
|
|
26420
|
+
if (err instanceof EntityNotFoundException)
|
|
26421
|
+
return null;
|
|
26422
|
+
throw err;
|
|
26423
|
+
}
|
|
26424
|
+
}
|
|
26425
|
+
if (!input.cdkPath)
|
|
26426
|
+
return null;
|
|
26427
|
+
let nextToken;
|
|
26428
|
+
do {
|
|
26429
|
+
const list = await this.getClient().send(
|
|
26430
|
+
new GetDatabasesCommand({
|
|
26431
|
+
...nextToken && { NextToken: nextToken },
|
|
26432
|
+
...catalogId && { CatalogId: catalogId }
|
|
26433
|
+
})
|
|
26434
|
+
);
|
|
26435
|
+
for (const db of list.DatabaseList ?? []) {
|
|
26436
|
+
if (!db.Name)
|
|
26437
|
+
continue;
|
|
26438
|
+
const arn = await this.buildDatabaseArn(db.Name, db.CatalogId);
|
|
26439
|
+
if (await this.tagsMatchCdkPath(arn, input.cdkPath)) {
|
|
26440
|
+
return { physicalId: db.Name, attributes: {} };
|
|
26441
|
+
}
|
|
26442
|
+
}
|
|
26443
|
+
nextToken = list.NextToken;
|
|
26444
|
+
} while (nextToken);
|
|
26445
|
+
return null;
|
|
26446
|
+
}
|
|
26447
|
+
async importTable(input) {
|
|
26448
|
+
const databaseName = input.properties["DatabaseName"];
|
|
26449
|
+
const tableInput = input.properties["TableInput"];
|
|
26450
|
+
const templateTableName = tableInput?.["Name"];
|
|
26451
|
+
const catalogId = input.properties["CatalogId"];
|
|
26452
|
+
if (input.knownPhysicalId) {
|
|
26453
|
+
const [dbName, tName] = input.knownPhysicalId.split("|");
|
|
26454
|
+
if (!dbName || !tName)
|
|
26455
|
+
return null;
|
|
26456
|
+
try {
|
|
26457
|
+
await this.getClient().send(
|
|
26458
|
+
new GetTableCommand({
|
|
26459
|
+
DatabaseName: dbName,
|
|
26460
|
+
Name: tName,
|
|
26461
|
+
...catalogId && { CatalogId: catalogId }
|
|
26462
|
+
})
|
|
26463
|
+
);
|
|
26464
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
26465
|
+
} catch (err) {
|
|
26466
|
+
if (err instanceof EntityNotFoundException)
|
|
26467
|
+
return null;
|
|
26468
|
+
throw err;
|
|
26469
|
+
}
|
|
26470
|
+
}
|
|
26471
|
+
if (databaseName && templateTableName) {
|
|
26472
|
+
try {
|
|
26473
|
+
await this.getClient().send(
|
|
26474
|
+
new GetTableCommand({
|
|
26475
|
+
DatabaseName: databaseName,
|
|
26476
|
+
Name: templateTableName,
|
|
26477
|
+
...catalogId && { CatalogId: catalogId }
|
|
26478
|
+
})
|
|
26479
|
+
);
|
|
26480
|
+
return { physicalId: `${databaseName}|${templateTableName}`, attributes: {} };
|
|
26481
|
+
} catch (err) {
|
|
26482
|
+
if (err instanceof EntityNotFoundException)
|
|
26483
|
+
return null;
|
|
26484
|
+
throw err;
|
|
26485
|
+
}
|
|
26486
|
+
}
|
|
26487
|
+
if (!input.cdkPath || !databaseName)
|
|
26488
|
+
return null;
|
|
26489
|
+
let nextToken;
|
|
26490
|
+
do {
|
|
26491
|
+
const list = await this.getClient().send(
|
|
26492
|
+
new GetTablesCommand({
|
|
26493
|
+
DatabaseName: databaseName,
|
|
26494
|
+
...nextToken && { NextToken: nextToken },
|
|
26495
|
+
...catalogId && { CatalogId: catalogId }
|
|
26496
|
+
})
|
|
26497
|
+
);
|
|
26498
|
+
for (const t of list.TableList ?? []) {
|
|
26499
|
+
if (!t.Name)
|
|
26500
|
+
continue;
|
|
26501
|
+
const arn = await this.buildTableArn(databaseName, t.Name, catalogId);
|
|
26502
|
+
if (await this.tagsMatchCdkPath(arn, input.cdkPath)) {
|
|
26503
|
+
return { physicalId: `${databaseName}|${t.Name}`, attributes: {} };
|
|
26504
|
+
}
|
|
26505
|
+
}
|
|
26506
|
+
nextToken = list.NextToken;
|
|
26507
|
+
} while (nextToken);
|
|
26508
|
+
return null;
|
|
26509
|
+
}
|
|
26510
|
+
async tagsMatchCdkPath(arn, cdkPath) {
|
|
26511
|
+
try {
|
|
26512
|
+
const resp = await this.getClient().send(new GetTagsCommand({ ResourceArn: arn }));
|
|
26513
|
+
return resp.Tags?.[CDK_PATH_TAG] === cdkPath;
|
|
26514
|
+
} catch (err) {
|
|
26515
|
+
if (err instanceof EntityNotFoundException)
|
|
26516
|
+
return false;
|
|
26517
|
+
throw err;
|
|
26518
|
+
}
|
|
26519
|
+
}
|
|
26520
|
+
async buildDatabaseArn(databaseName, catalogId) {
|
|
26521
|
+
const region = await this.getRegion();
|
|
26522
|
+
const account = catalogId ?? await this.getAccountId();
|
|
26523
|
+
return `arn:aws:glue:${region}:${account}:database/${databaseName}`;
|
|
26524
|
+
}
|
|
26525
|
+
async buildTableArn(databaseName, tableName, catalogId) {
|
|
26526
|
+
const region = await this.getRegion();
|
|
26527
|
+
const account = catalogId ?? await this.getAccountId();
|
|
26528
|
+
return `arn:aws:glue:${region}:${account}:table/${databaseName}/${tableName}`;
|
|
26529
|
+
}
|
|
26530
|
+
async getRegion() {
|
|
26531
|
+
const region = await this.getClient().config.region();
|
|
26532
|
+
return region || this.providerRegion || "us-east-1";
|
|
26533
|
+
}
|
|
26534
|
+
async getAccountId() {
|
|
26535
|
+
if (this.cachedAccountId)
|
|
26536
|
+
return this.cachedAccountId;
|
|
26537
|
+
if (!this.stsClient) {
|
|
26538
|
+
this.stsClient = new STSClient7(this.providerRegion ? { region: this.providerRegion } : {});
|
|
26539
|
+
}
|
|
26540
|
+
const identity = await this.stsClient.send(new GetCallerIdentityCommand8({}));
|
|
26541
|
+
if (!identity.Account) {
|
|
26542
|
+
throw new Error("Failed to resolve AWS account id from STS");
|
|
26543
|
+
}
|
|
26544
|
+
this.cachedAccountId = identity.Account;
|
|
26545
|
+
return this.cachedAccountId;
|
|
26546
|
+
}
|
|
25564
26547
|
};
|
|
25565
26548
|
|
|
25566
26549
|
// src/provisioning/providers/kms-provider.ts
|
|
@@ -26042,6 +27025,8 @@ import {
|
|
|
26042
27025
|
DecreaseStreamRetentionPeriodCommand,
|
|
26043
27026
|
StartStreamEncryptionCommand,
|
|
26044
27027
|
StopStreamEncryptionCommand,
|
|
27028
|
+
ListStreamsCommand,
|
|
27029
|
+
ListTagsForStreamCommand,
|
|
26045
27030
|
ResourceNotFoundException as ResourceNotFoundException13
|
|
26046
27031
|
} from "@aws-sdk/client-kinesis";
|
|
26047
27032
|
var KinesisStreamProvider = class {
|
|
@@ -26270,29 +27255,77 @@ var KinesisStreamProvider = class {
|
|
|
26270
27255
|
EnforceConsumerDeletion: true
|
|
26271
27256
|
})
|
|
26272
27257
|
);
|
|
26273
|
-
this.logger.debug(`Successfully deleted Kinesis stream ${logicalId}`);
|
|
26274
|
-
} catch (error) {
|
|
26275
|
-
if (error instanceof ResourceNotFoundException13) {
|
|
26276
|
-
const clientRegion = await this.getClient().config.region();
|
|
26277
|
-
assertRegionMatch(
|
|
26278
|
-
clientRegion,
|
|
26279
|
-
context?.expectedRegion,
|
|
26280
|
-
resourceType,
|
|
26281
|
-
logicalId,
|
|
26282
|
-
physicalId
|
|
27258
|
+
this.logger.debug(`Successfully deleted Kinesis stream ${logicalId}`);
|
|
27259
|
+
} catch (error) {
|
|
27260
|
+
if (error instanceof ResourceNotFoundException13) {
|
|
27261
|
+
const clientRegion = await this.getClient().config.region();
|
|
27262
|
+
assertRegionMatch(
|
|
27263
|
+
clientRegion,
|
|
27264
|
+
context?.expectedRegion,
|
|
27265
|
+
resourceType,
|
|
27266
|
+
logicalId,
|
|
27267
|
+
physicalId
|
|
27268
|
+
);
|
|
27269
|
+
this.logger.debug(`Kinesis stream ${physicalId} does not exist, skipping deletion`);
|
|
27270
|
+
return;
|
|
27271
|
+
}
|
|
27272
|
+
const cause = error instanceof Error ? error : void 0;
|
|
27273
|
+
throw new ProvisioningError(
|
|
27274
|
+
`Failed to delete Kinesis stream ${logicalId}: ${error instanceof Error ? error.message : String(error)}`,
|
|
27275
|
+
resourceType,
|
|
27276
|
+
logicalId,
|
|
27277
|
+
physicalId,
|
|
27278
|
+
cause
|
|
27279
|
+
);
|
|
27280
|
+
}
|
|
27281
|
+
}
|
|
27282
|
+
/**
|
|
27283
|
+
* Adopt an existing Kinesis stream into cdkd state.
|
|
27284
|
+
*
|
|
27285
|
+
* Lookup order:
|
|
27286
|
+
* 1. `--resource <id>=<name>` override or `Properties.Name` → verify
|
|
27287
|
+
* with `DescribeStream`.
|
|
27288
|
+
* 2. Walk `ListStreams` (paged via `ExclusiveStartStreamName`) and
|
|
27289
|
+
* match the `aws:cdk:path` tag via `ListTagsForStream(StreamName)`.
|
|
27290
|
+
*
|
|
27291
|
+
* Kinesis tags use the standard `Tag[]` array shape (`Key`/`Value`),
|
|
27292
|
+
* so `matchesCdkPath` from import-helpers applies directly.
|
|
27293
|
+
*/
|
|
27294
|
+
async import(input) {
|
|
27295
|
+
const explicit = resolveExplicitPhysicalId(input, "Name");
|
|
27296
|
+
if (explicit) {
|
|
27297
|
+
try {
|
|
27298
|
+
await this.getClient().send(new DescribeStreamCommand({ StreamName: explicit }));
|
|
27299
|
+
return { physicalId: explicit, attributes: {} };
|
|
27300
|
+
} catch (err) {
|
|
27301
|
+
if (err instanceof ResourceNotFoundException13)
|
|
27302
|
+
return null;
|
|
27303
|
+
throw err;
|
|
27304
|
+
}
|
|
27305
|
+
}
|
|
27306
|
+
if (!input.cdkPath)
|
|
27307
|
+
return null;
|
|
27308
|
+
let exclusiveStartStreamName;
|
|
27309
|
+
while (true) {
|
|
27310
|
+
const list = await this.getClient().send(
|
|
27311
|
+
new ListStreamsCommand({
|
|
27312
|
+
...exclusiveStartStreamName && { ExclusiveStartStreamName: exclusiveStartStreamName }
|
|
27313
|
+
})
|
|
27314
|
+
);
|
|
27315
|
+
const names = list.StreamNames ?? [];
|
|
27316
|
+
for (const streamName of names) {
|
|
27317
|
+
const tagsResp = await this.getClient().send(
|
|
27318
|
+
new ListTagsForStreamCommand({ StreamName: streamName })
|
|
26283
27319
|
);
|
|
26284
|
-
|
|
26285
|
-
|
|
27320
|
+
if (matchesCdkPath(tagsResp.Tags, input.cdkPath)) {
|
|
27321
|
+
return { physicalId: streamName, attributes: {} };
|
|
27322
|
+
}
|
|
26286
27323
|
}
|
|
26287
|
-
|
|
26288
|
-
|
|
26289
|
-
|
|
26290
|
-
resourceType,
|
|
26291
|
-
logicalId,
|
|
26292
|
-
physicalId,
|
|
26293
|
-
cause
|
|
26294
|
-
);
|
|
27324
|
+
if (!list.HasMoreStreams || names.length === 0)
|
|
27325
|
+
break;
|
|
27326
|
+
exclusiveStartStreamName = names[names.length - 1];
|
|
26295
27327
|
}
|
|
27328
|
+
return null;
|
|
26296
27329
|
}
|
|
26297
27330
|
/**
|
|
26298
27331
|
* Poll DescribeStream until the stream reaches ACTIVE status
|
|
@@ -26336,6 +27369,7 @@ import {
|
|
|
26336
27369
|
CreateAccessPointCommand,
|
|
26337
27370
|
DeleteAccessPointCommand,
|
|
26338
27371
|
DescribeFileSystemsCommand,
|
|
27372
|
+
DescribeAccessPointsCommand,
|
|
26339
27373
|
FileSystemNotFound,
|
|
26340
27374
|
MountTargetNotFound,
|
|
26341
27375
|
AccessPointNotFound
|
|
@@ -26737,6 +27771,100 @@ var EFSProvider = class {
|
|
|
26737
27771
|
);
|
|
26738
27772
|
}
|
|
26739
27773
|
}
|
|
27774
|
+
/**
|
|
27775
|
+
* Adopt an existing EFS resource into cdkd state.
|
|
27776
|
+
*
|
|
27777
|
+
* Supported types:
|
|
27778
|
+
* - `AWS::EFS::FileSystem` — full tag-based lookup via
|
|
27779
|
+
* `DescribeFileSystems` with `Tags` inline on each item.
|
|
27780
|
+
* - `AWS::EFS::AccessPoint` — full tag-based lookup via
|
|
27781
|
+
* `DescribeAccessPoints` with `Tags` inline on each item.
|
|
27782
|
+
* - `AWS::EFS::MountTarget` — override-only (mount targets are
|
|
27783
|
+
* not taggable; auto lookup is impractical).
|
|
27784
|
+
*/
|
|
27785
|
+
async import(input) {
|
|
27786
|
+
switch (input.resourceType) {
|
|
27787
|
+
case "AWS::EFS::FileSystem":
|
|
27788
|
+
return this.importFileSystem(input);
|
|
27789
|
+
case "AWS::EFS::AccessPoint":
|
|
27790
|
+
return this.importAccessPoint(input);
|
|
27791
|
+
case "AWS::EFS::MountTarget":
|
|
27792
|
+
if (input.knownPhysicalId) {
|
|
27793
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
27794
|
+
}
|
|
27795
|
+
return null;
|
|
27796
|
+
default:
|
|
27797
|
+
return null;
|
|
27798
|
+
}
|
|
27799
|
+
}
|
|
27800
|
+
async importFileSystem(input) {
|
|
27801
|
+
if (input.knownPhysicalId) {
|
|
27802
|
+
try {
|
|
27803
|
+
const resp = await this.getClient().send(
|
|
27804
|
+
new DescribeFileSystemsCommand({ FileSystemId: input.knownPhysicalId })
|
|
27805
|
+
);
|
|
27806
|
+
const fs = resp.FileSystems?.[0];
|
|
27807
|
+
return fs?.FileSystemId ? { physicalId: fs.FileSystemId, attributes: {} } : null;
|
|
27808
|
+
} catch (err) {
|
|
27809
|
+
if (err instanceof FileSystemNotFound)
|
|
27810
|
+
return null;
|
|
27811
|
+
throw err;
|
|
27812
|
+
}
|
|
27813
|
+
}
|
|
27814
|
+
if (!input.cdkPath)
|
|
27815
|
+
return null;
|
|
27816
|
+
let marker;
|
|
27817
|
+
do {
|
|
27818
|
+
const list = await this.getClient().send(
|
|
27819
|
+
new DescribeFileSystemsCommand({ ...marker && { Marker: marker } })
|
|
27820
|
+
);
|
|
27821
|
+
for (const fs of list.FileSystems ?? []) {
|
|
27822
|
+
if (!fs.FileSystemId)
|
|
27823
|
+
continue;
|
|
27824
|
+
if (matchesCdkPath(fs.Tags, input.cdkPath)) {
|
|
27825
|
+
return { physicalId: fs.FileSystemId, attributes: {} };
|
|
27826
|
+
}
|
|
27827
|
+
}
|
|
27828
|
+
marker = list.NextMarker;
|
|
27829
|
+
} while (marker);
|
|
27830
|
+
return null;
|
|
27831
|
+
}
|
|
27832
|
+
async importAccessPoint(input) {
|
|
27833
|
+
if (input.knownPhysicalId) {
|
|
27834
|
+
try {
|
|
27835
|
+
const resp = await this.getClient().send(
|
|
27836
|
+
new DescribeAccessPointsCommand({ AccessPointId: input.knownPhysicalId })
|
|
27837
|
+
);
|
|
27838
|
+
const ap = resp.AccessPoints?.[0];
|
|
27839
|
+
return ap?.AccessPointId ? { physicalId: ap.AccessPointId, attributes: {} } : null;
|
|
27840
|
+
} catch (err) {
|
|
27841
|
+
if (err instanceof AccessPointNotFound)
|
|
27842
|
+
return null;
|
|
27843
|
+
throw err;
|
|
27844
|
+
}
|
|
27845
|
+
}
|
|
27846
|
+
if (!input.cdkPath)
|
|
27847
|
+
return null;
|
|
27848
|
+
const fileSystemId = input.properties["FileSystemId"];
|
|
27849
|
+
let nextToken;
|
|
27850
|
+
do {
|
|
27851
|
+
const list = await this.getClient().send(
|
|
27852
|
+
new DescribeAccessPointsCommand({
|
|
27853
|
+
...nextToken && { NextToken: nextToken },
|
|
27854
|
+
...fileSystemId && { FileSystemId: fileSystemId }
|
|
27855
|
+
})
|
|
27856
|
+
);
|
|
27857
|
+
for (const ap of list.AccessPoints ?? []) {
|
|
27858
|
+
if (!ap.AccessPointId)
|
|
27859
|
+
continue;
|
|
27860
|
+
if (matchesCdkPath(ap.Tags, input.cdkPath)) {
|
|
27861
|
+
return { physicalId: ap.AccessPointId, attributes: {} };
|
|
27862
|
+
}
|
|
27863
|
+
}
|
|
27864
|
+
nextToken = list.NextToken;
|
|
27865
|
+
} while (nextToken);
|
|
27866
|
+
return null;
|
|
27867
|
+
}
|
|
26740
27868
|
};
|
|
26741
27869
|
|
|
26742
27870
|
// src/provisioning/providers/firehose-provider.ts
|
|
@@ -26744,6 +27872,9 @@ import {
|
|
|
26744
27872
|
FirehoseClient,
|
|
26745
27873
|
CreateDeliveryStreamCommand,
|
|
26746
27874
|
DeleteDeliveryStreamCommand,
|
|
27875
|
+
DescribeDeliveryStreamCommand,
|
|
27876
|
+
ListDeliveryStreamsCommand,
|
|
27877
|
+
ListTagsForDeliveryStreamCommand,
|
|
26747
27878
|
ResourceNotFoundException as ResourceNotFoundException14
|
|
26748
27879
|
} from "@aws-sdk/client-firehose";
|
|
26749
27880
|
var FirehoseProvider = class {
|
|
@@ -27080,12 +28211,63 @@ var FirehoseProvider = class {
|
|
|
27080
28211
|
}
|
|
27081
28212
|
return result;
|
|
27082
28213
|
}
|
|
28214
|
+
/**
|
|
28215
|
+
* Adopt an existing Kinesis Firehose delivery stream into cdkd state.
|
|
28216
|
+
*
|
|
28217
|
+
* Lookup order:
|
|
28218
|
+
* 1. `--resource <id>=<name>` override or `Properties.DeliveryStreamName`
|
|
28219
|
+
* → verify with `DescribeDeliveryStream`.
|
|
28220
|
+
* 2. Walk `ListDeliveryStreams` (paged via `ExclusiveStartDeliveryStreamName`)
|
|
28221
|
+
* and match the `aws:cdk:path` tag via
|
|
28222
|
+
* `ListTagsForDeliveryStream(DeliveryStreamName)`.
|
|
28223
|
+
*
|
|
28224
|
+
* Firehose tags use the standard `Tag[]` array shape (`Key`/`Value`).
|
|
28225
|
+
*/
|
|
28226
|
+
async import(input) {
|
|
28227
|
+
const explicit = resolveExplicitPhysicalId(input, "DeliveryStreamName");
|
|
28228
|
+
if (explicit) {
|
|
28229
|
+
try {
|
|
28230
|
+
await this.getClient().send(
|
|
28231
|
+
new DescribeDeliveryStreamCommand({ DeliveryStreamName: explicit })
|
|
28232
|
+
);
|
|
28233
|
+
return { physicalId: explicit, attributes: {} };
|
|
28234
|
+
} catch (err) {
|
|
28235
|
+
if (err instanceof ResourceNotFoundException14)
|
|
28236
|
+
return null;
|
|
28237
|
+
throw err;
|
|
28238
|
+
}
|
|
28239
|
+
}
|
|
28240
|
+
if (!input.cdkPath)
|
|
28241
|
+
return null;
|
|
28242
|
+
let exclusiveStartDeliveryStreamName;
|
|
28243
|
+
while (true) {
|
|
28244
|
+
const list = await this.getClient().send(
|
|
28245
|
+
new ListDeliveryStreamsCommand({
|
|
28246
|
+
...exclusiveStartDeliveryStreamName && {
|
|
28247
|
+
ExclusiveStartDeliveryStreamName: exclusiveStartDeliveryStreamName
|
|
28248
|
+
}
|
|
28249
|
+
})
|
|
28250
|
+
);
|
|
28251
|
+
const names = list.DeliveryStreamNames ?? [];
|
|
28252
|
+
for (const name of names) {
|
|
28253
|
+
const tagsResp = await this.getClient().send(
|
|
28254
|
+
new ListTagsForDeliveryStreamCommand({ DeliveryStreamName: name })
|
|
28255
|
+
);
|
|
28256
|
+
if (matchesCdkPath(tagsResp.Tags, input.cdkPath)) {
|
|
28257
|
+
return { physicalId: name, attributes: {} };
|
|
28258
|
+
}
|
|
28259
|
+
}
|
|
28260
|
+
if (!list.HasMoreDeliveryStreams || names.length === 0)
|
|
28261
|
+
break;
|
|
28262
|
+
exclusiveStartDeliveryStreamName = names[names.length - 1];
|
|
28263
|
+
}
|
|
28264
|
+
return null;
|
|
28265
|
+
}
|
|
27083
28266
|
/**
|
|
27084
28267
|
* Wait for a delivery stream to become ACTIVE.
|
|
27085
28268
|
* Firehose CreateDeliveryStream returns immediately while the stream is still CREATING.
|
|
27086
28269
|
*/
|
|
27087
28270
|
async waitForActive(streamName, logicalId) {
|
|
27088
|
-
const { DescribeDeliveryStreamCommand } = await import("@aws-sdk/client-firehose");
|
|
27089
28271
|
const maxAttempts = 30;
|
|
27090
28272
|
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
27091
28273
|
const resp = await this.getClient().send(
|
|
@@ -27117,7 +28299,7 @@ import {
|
|
|
27117
28299
|
PutInsightSelectorsCommand,
|
|
27118
28300
|
GetTrailCommand,
|
|
27119
28301
|
ListTrailsCommand,
|
|
27120
|
-
ListTagsCommand as
|
|
28302
|
+
ListTagsCommand as ListTagsCommand3,
|
|
27121
28303
|
TrailNotFoundException
|
|
27122
28304
|
} from "@aws-sdk/client-cloudtrail";
|
|
27123
28305
|
var CloudTrailProvider = class {
|
|
@@ -27381,7 +28563,7 @@ var CloudTrailProvider = class {
|
|
|
27381
28563
|
continue;
|
|
27382
28564
|
try {
|
|
27383
28565
|
const tagsResp = await this.getClient().send(
|
|
27384
|
-
new
|
|
28566
|
+
new ListTagsCommand3({ ResourceIdList: [trail.TrailARN] })
|
|
27385
28567
|
);
|
|
27386
28568
|
const list2 = tagsResp.ResourceTagList?.[0];
|
|
27387
28569
|
if (matchesCdkPath(list2?.TagsList, input.cdkPath)) {
|
|
@@ -27720,7 +28902,10 @@ import {
|
|
|
27720
28902
|
S3VectorsClient,
|
|
27721
28903
|
CreateVectorBucketCommand,
|
|
27722
28904
|
DeleteVectorBucketCommand,
|
|
28905
|
+
GetVectorBucketCommand,
|
|
27723
28906
|
ListIndexesCommand,
|
|
28907
|
+
ListVectorBucketsCommand,
|
|
28908
|
+
ListTagsForResourceCommand as ListTagsForResourceCommand16,
|
|
27724
28909
|
DeleteIndexCommand
|
|
27725
28910
|
} from "@aws-sdk/client-s3vectors";
|
|
27726
28911
|
var S3VectorsProvider = class {
|
|
@@ -27877,6 +29062,54 @@ var S3VectorsProvider = class {
|
|
|
27877
29062
|
nextToken = listResult.nextToken;
|
|
27878
29063
|
} while (nextToken);
|
|
27879
29064
|
}
|
|
29065
|
+
/**
|
|
29066
|
+
* Adopt an existing S3 Vector Bucket into cdkd state.
|
|
29067
|
+
*
|
|
29068
|
+
* Lookup order:
|
|
29069
|
+
* 1. `--resource <id>=<name>` override or `Properties.VectorBucketName`
|
|
29070
|
+
* → verify via `GetVectorBucket`. The physical id is the bucket name.
|
|
29071
|
+
* 2. `ListVectorBuckets` paginator + `ListTagsForResource(resourceArn)`
|
|
29072
|
+
* (tags map keyed by tag name) and match `aws:cdk:path`.
|
|
29073
|
+
*/
|
|
29074
|
+
async import(input) {
|
|
29075
|
+
const explicit = input.knownPhysicalId ?? (typeof input.properties?.["VectorBucketName"] === "string" && input.properties["VectorBucketName"].length > 0 ? input.properties["VectorBucketName"] : void 0);
|
|
29076
|
+
if (explicit) {
|
|
29077
|
+
try {
|
|
29078
|
+
await this.getClient().send(new GetVectorBucketCommand({ vectorBucketName: explicit }));
|
|
29079
|
+
return { physicalId: explicit, attributes: {} };
|
|
29080
|
+
} catch (err) {
|
|
29081
|
+
if (this.isNotFoundError(err))
|
|
29082
|
+
return null;
|
|
29083
|
+
throw err;
|
|
29084
|
+
}
|
|
29085
|
+
}
|
|
29086
|
+
if (!input.cdkPath)
|
|
29087
|
+
return null;
|
|
29088
|
+
let token;
|
|
29089
|
+
do {
|
|
29090
|
+
const list = await this.getClient().send(
|
|
29091
|
+
new ListVectorBucketsCommand({ ...token && { nextToken: token } })
|
|
29092
|
+
);
|
|
29093
|
+
for (const bucket of list.vectorBuckets ?? []) {
|
|
29094
|
+
if (!bucket.vectorBucketName || !bucket.vectorBucketArn)
|
|
29095
|
+
continue;
|
|
29096
|
+
try {
|
|
29097
|
+
const tagsResp = await this.getClient().send(
|
|
29098
|
+
new ListTagsForResourceCommand16({ resourceArn: bucket.vectorBucketArn })
|
|
29099
|
+
);
|
|
29100
|
+
if (tagsResp.tags?.[CDK_PATH_TAG] === input.cdkPath) {
|
|
29101
|
+
return { physicalId: bucket.vectorBucketName, attributes: {} };
|
|
29102
|
+
}
|
|
29103
|
+
} catch (err) {
|
|
29104
|
+
if (this.isNotFoundError(err))
|
|
29105
|
+
continue;
|
|
29106
|
+
throw err;
|
|
29107
|
+
}
|
|
29108
|
+
}
|
|
29109
|
+
token = list.nextToken;
|
|
29110
|
+
} while (token);
|
|
29111
|
+
return null;
|
|
29112
|
+
}
|
|
27880
29113
|
isNotFoundError(error) {
|
|
27881
29114
|
if (error instanceof Error) {
|
|
27882
29115
|
const name = error.name;
|
|
@@ -27890,10 +29123,13 @@ var S3VectorsProvider = class {
|
|
|
27890
29123
|
import {
|
|
27891
29124
|
CreateBucketCommand as CreateBucketCommand3,
|
|
27892
29125
|
DeleteBucketCommand as DeleteBucketCommand2,
|
|
29126
|
+
HeadBucketCommand as HeadBucketCommand4,
|
|
29127
|
+
ListDirectoryBucketsCommand,
|
|
29128
|
+
GetBucketTaggingCommand as GetBucketTaggingCommand2,
|
|
27893
29129
|
ListObjectsV2Command as ListObjectsV2Command2,
|
|
27894
29130
|
DeleteObjectsCommand as DeleteObjectsCommand2
|
|
27895
29131
|
} from "@aws-sdk/client-s3";
|
|
27896
|
-
import { GetCallerIdentityCommand as
|
|
29132
|
+
import { GetCallerIdentityCommand as GetCallerIdentityCommand9 } from "@aws-sdk/client-sts";
|
|
27897
29133
|
import { EC2Client as EC2Client8, DescribeAvailabilityZonesCommand as DescribeAvailabilityZonesCommand3 } from "@aws-sdk/client-ec2";
|
|
27898
29134
|
init_aws_clients();
|
|
27899
29135
|
var S3DirectoryBucketProvider = class {
|
|
@@ -27949,7 +29185,7 @@ var S3DirectoryBucketProvider = class {
|
|
|
27949
29185
|
* Get the AWS account ID via STS
|
|
27950
29186
|
*/
|
|
27951
29187
|
async getAccountId() {
|
|
27952
|
-
const identity = await this.stsClient.send(new
|
|
29188
|
+
const identity = await this.stsClient.send(new GetCallerIdentityCommand9({}));
|
|
27953
29189
|
return identity.Account;
|
|
27954
29190
|
}
|
|
27955
29191
|
/**
|
|
@@ -28095,6 +29331,56 @@ var S3DirectoryBucketProvider = class {
|
|
|
28095
29331
|
continuationToken = listResponse.IsTruncated ? listResponse.NextContinuationToken : void 0;
|
|
28096
29332
|
} while (continuationToken);
|
|
28097
29333
|
}
|
|
29334
|
+
/**
|
|
29335
|
+
* Adopt an existing S3 Express Directory Bucket into cdkd state.
|
|
29336
|
+
*
|
|
29337
|
+
* Lookup order:
|
|
29338
|
+
* 1. `--resource <id>=<name>` override or `Properties.BucketName` →
|
|
29339
|
+
* verify via `HeadBucket`.
|
|
29340
|
+
* 2. `ListDirectoryBuckets` paginator + `GetBucketTagging` (TagSet:
|
|
29341
|
+
* Tag[]) and match `aws:cdk:path`. `GetBucketTagging` may surface
|
|
29342
|
+
* `NoSuchTagSet` / `AccessDenied` per-bucket — those are skipped
|
|
29343
|
+
* rather than fatal.
|
|
29344
|
+
*/
|
|
29345
|
+
async import(input) {
|
|
29346
|
+
const explicit = resolveExplicitPhysicalId(input, "BucketName");
|
|
29347
|
+
if (explicit) {
|
|
29348
|
+
try {
|
|
29349
|
+
await this.s3Client.send(new HeadBucketCommand4({ Bucket: explicit }));
|
|
29350
|
+
return { physicalId: explicit, attributes: {} };
|
|
29351
|
+
} catch (err) {
|
|
29352
|
+
const e = err;
|
|
29353
|
+
if (e.name === "NotFound" || e.name === "NoSuchBucket")
|
|
29354
|
+
return null;
|
|
29355
|
+
throw err;
|
|
29356
|
+
}
|
|
29357
|
+
}
|
|
29358
|
+
if (!input.cdkPath)
|
|
29359
|
+
return null;
|
|
29360
|
+
let token;
|
|
29361
|
+
do {
|
|
29362
|
+
const list = await this.s3Client.send(
|
|
29363
|
+
new ListDirectoryBucketsCommand({ ...token && { ContinuationToken: token } })
|
|
29364
|
+
);
|
|
29365
|
+
for (const b of list.Buckets ?? []) {
|
|
29366
|
+
if (!b.Name)
|
|
29367
|
+
continue;
|
|
29368
|
+
try {
|
|
29369
|
+
const tagging = await this.s3Client.send(new GetBucketTaggingCommand2({ Bucket: b.Name }));
|
|
29370
|
+
if (matchesCdkPath(tagging.TagSet, input.cdkPath)) {
|
|
29371
|
+
return { physicalId: b.Name, attributes: {} };
|
|
29372
|
+
}
|
|
29373
|
+
} catch (err) {
|
|
29374
|
+
const e = err;
|
|
29375
|
+
if (e.name === "NoSuchTagSet" || e.name === "AccessDenied")
|
|
29376
|
+
continue;
|
|
29377
|
+
throw err;
|
|
29378
|
+
}
|
|
29379
|
+
}
|
|
29380
|
+
token = list.ContinuationToken;
|
|
29381
|
+
} while (token);
|
|
29382
|
+
return null;
|
|
29383
|
+
}
|
|
28098
29384
|
};
|
|
28099
29385
|
|
|
28100
29386
|
// src/provisioning/providers/s3-tables-provider.ts
|
|
@@ -28106,8 +29392,12 @@ import {
|
|
|
28106
29392
|
DeleteNamespaceCommand as DeleteNamespaceCommand2,
|
|
28107
29393
|
CreateTableCommand as CreateTableCommand3,
|
|
28108
29394
|
DeleteTableCommand as DeleteTableCommand3,
|
|
28109
|
-
|
|
29395
|
+
GetTableBucketCommand,
|
|
29396
|
+
GetTableCommand as GetTableCommand2,
|
|
29397
|
+
ListNamespacesCommand as ListNamespacesCommand2,
|
|
28110
29398
|
ListTablesCommand as ListTablesCommand2,
|
|
29399
|
+
ListTableBucketsCommand,
|
|
29400
|
+
ListTagsForResourceCommand as ListTagsForResourceCommand17,
|
|
28111
29401
|
NotFoundException as NotFoundException6
|
|
28112
29402
|
} from "@aws-sdk/client-s3tables";
|
|
28113
29403
|
var S3TablesProvider = class {
|
|
@@ -28241,7 +29531,7 @@ var S3TablesProvider = class {
|
|
|
28241
29531
|
let namespaceContinuationToken;
|
|
28242
29532
|
do {
|
|
28243
29533
|
const namespacesResult = await this.getClient().send(
|
|
28244
|
-
new
|
|
29534
|
+
new ListNamespacesCommand2({
|
|
28245
29535
|
tableBucketARN,
|
|
28246
29536
|
continuationToken: namespaceContinuationToken
|
|
28247
29537
|
})
|
|
@@ -28445,6 +29735,165 @@ var S3TablesProvider = class {
|
|
|
28445
29735
|
);
|
|
28446
29736
|
}
|
|
28447
29737
|
}
|
|
29738
|
+
// ─── Import dispatch ──────────────────────────────────────────────
|
|
29739
|
+
/**
|
|
29740
|
+
* Adopt an existing S3 Tables resource into cdkd state.
|
|
29741
|
+
*
|
|
29742
|
+
* - **AWS::S3Tables::TableBucket**: tag-based auto-lookup via
|
|
29743
|
+
* `ListTableBuckets` + `ListTagsForResource(resourceArn)` (tags map).
|
|
29744
|
+
* Falls back to `--resource <id>=<arn>` or `Properties.TableBucketName`
|
|
29745
|
+
* (resolved by ARN suffix match against `ListTableBuckets`).
|
|
29746
|
+
* - **AWS::S3Tables::Table**: tag-based auto-lookup walks every
|
|
29747
|
+
* table bucket → namespace → table and calls `ListTagsForResource`
|
|
29748
|
+
* on each table ARN; matches `aws:cdk:path`.
|
|
29749
|
+
* - **AWS::S3Tables::Namespace**: explicit-override only. Namespaces
|
|
29750
|
+
* are not taggable in S3 Tables (`ListTagsForResource` accepts only
|
|
29751
|
+
* table-bucket or table ARNs), so auto-lookup is impossible.
|
|
29752
|
+
*/
|
|
29753
|
+
async import(input) {
|
|
29754
|
+
switch (input.resourceType) {
|
|
29755
|
+
case "AWS::S3Tables::TableBucket":
|
|
29756
|
+
return this.importTableBucket(input);
|
|
29757
|
+
case "AWS::S3Tables::Namespace":
|
|
29758
|
+
return this.importNamespace(input);
|
|
29759
|
+
case "AWS::S3Tables::Table":
|
|
29760
|
+
return this.importTable(input);
|
|
29761
|
+
default:
|
|
29762
|
+
return null;
|
|
29763
|
+
}
|
|
29764
|
+
}
|
|
29765
|
+
async importTableBucket(input) {
|
|
29766
|
+
if (input.knownPhysicalId) {
|
|
29767
|
+
try {
|
|
29768
|
+
await this.getClient().send(
|
|
29769
|
+
new GetTableBucketCommand({ tableBucketARN: input.knownPhysicalId })
|
|
29770
|
+
);
|
|
29771
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
29772
|
+
} catch (err) {
|
|
29773
|
+
if (err instanceof NotFoundException6)
|
|
29774
|
+
return null;
|
|
29775
|
+
throw err;
|
|
29776
|
+
}
|
|
29777
|
+
}
|
|
29778
|
+
const desiredName = typeof input.properties?.["TableBucketName"] === "string" ? input.properties["TableBucketName"] : void 0;
|
|
29779
|
+
let token;
|
|
29780
|
+
do {
|
|
29781
|
+
const list = await this.getClient().send(
|
|
29782
|
+
new ListTableBucketsCommand({ ...token && { continuationToken: token } })
|
|
29783
|
+
);
|
|
29784
|
+
for (const bucket of list.tableBuckets ?? []) {
|
|
29785
|
+
if (!bucket.arn)
|
|
29786
|
+
continue;
|
|
29787
|
+
if (desiredName && bucket.name === desiredName) {
|
|
29788
|
+
return { physicalId: bucket.arn, attributes: {} };
|
|
29789
|
+
}
|
|
29790
|
+
if (input.cdkPath) {
|
|
29791
|
+
try {
|
|
29792
|
+
const tagsResp = await this.getClient().send(
|
|
29793
|
+
new ListTagsForResourceCommand17({ resourceArn: bucket.arn })
|
|
29794
|
+
);
|
|
29795
|
+
if (tagsResp.tags?.[CDK_PATH_TAG] === input.cdkPath) {
|
|
29796
|
+
return { physicalId: bucket.arn, attributes: {} };
|
|
29797
|
+
}
|
|
29798
|
+
} catch (err) {
|
|
29799
|
+
if (err instanceof NotFoundException6)
|
|
29800
|
+
continue;
|
|
29801
|
+
throw err;
|
|
29802
|
+
}
|
|
29803
|
+
}
|
|
29804
|
+
}
|
|
29805
|
+
token = list.continuationToken;
|
|
29806
|
+
} while (token);
|
|
29807
|
+
return null;
|
|
29808
|
+
}
|
|
29809
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- explicit-override-only intentionally has no AWS calls
|
|
29810
|
+
async importNamespace(input) {
|
|
29811
|
+
if (input.knownPhysicalId) {
|
|
29812
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
29813
|
+
}
|
|
29814
|
+
return null;
|
|
29815
|
+
}
|
|
29816
|
+
async importTable(input) {
|
|
29817
|
+
if (input.knownPhysicalId) {
|
|
29818
|
+
const parts = input.knownPhysicalId.split("|");
|
|
29819
|
+
if (parts.length >= 3) {
|
|
29820
|
+
try {
|
|
29821
|
+
await this.getClient().send(
|
|
29822
|
+
new GetTableCommand2({
|
|
29823
|
+
tableBucketARN: parts[0],
|
|
29824
|
+
namespace: parts[1],
|
|
29825
|
+
name: parts[2]
|
|
29826
|
+
})
|
|
29827
|
+
);
|
|
29828
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
29829
|
+
} catch (err) {
|
|
29830
|
+
if (err instanceof NotFoundException6)
|
|
29831
|
+
return null;
|
|
29832
|
+
throw err;
|
|
29833
|
+
}
|
|
29834
|
+
}
|
|
29835
|
+
return { physicalId: input.knownPhysicalId, attributes: {} };
|
|
29836
|
+
}
|
|
29837
|
+
if (!input.cdkPath)
|
|
29838
|
+
return null;
|
|
29839
|
+
let bucketToken;
|
|
29840
|
+
do {
|
|
29841
|
+
const buckets = await this.getClient().send(
|
|
29842
|
+
new ListTableBucketsCommand({ ...bucketToken && { continuationToken: bucketToken } })
|
|
29843
|
+
);
|
|
29844
|
+
for (const bucket of buckets.tableBuckets ?? []) {
|
|
29845
|
+
if (!bucket.arn)
|
|
29846
|
+
continue;
|
|
29847
|
+
let nsToken;
|
|
29848
|
+
do {
|
|
29849
|
+
const namespaces = await this.getClient().send(
|
|
29850
|
+
new ListNamespacesCommand2({
|
|
29851
|
+
tableBucketARN: bucket.arn,
|
|
29852
|
+
...nsToken && { continuationToken: nsToken }
|
|
29853
|
+
})
|
|
29854
|
+
);
|
|
29855
|
+
for (const ns of namespaces.namespaces ?? []) {
|
|
29856
|
+
const namespaceName = ns.namespace?.[0];
|
|
29857
|
+
if (!namespaceName)
|
|
29858
|
+
continue;
|
|
29859
|
+
let tableToken;
|
|
29860
|
+
do {
|
|
29861
|
+
const tables = await this.getClient().send(
|
|
29862
|
+
new ListTablesCommand2({
|
|
29863
|
+
tableBucketARN: bucket.arn,
|
|
29864
|
+
namespace: namespaceName,
|
|
29865
|
+
...tableToken && { continuationToken: tableToken }
|
|
29866
|
+
})
|
|
29867
|
+
);
|
|
29868
|
+
for (const table of tables.tables ?? []) {
|
|
29869
|
+
if (!table.name || !table.tableARN)
|
|
29870
|
+
continue;
|
|
29871
|
+
try {
|
|
29872
|
+
const tagsResp = await this.getClient().send(
|
|
29873
|
+
new ListTagsForResourceCommand17({ resourceArn: table.tableARN })
|
|
29874
|
+
);
|
|
29875
|
+
if (tagsResp.tags?.[CDK_PATH_TAG] === input.cdkPath) {
|
|
29876
|
+
return {
|
|
29877
|
+
physicalId: `${bucket.arn}|${namespaceName}|${table.name}`,
|
|
29878
|
+
attributes: {}
|
|
29879
|
+
};
|
|
29880
|
+
}
|
|
29881
|
+
} catch (err) {
|
|
29882
|
+
if (err instanceof NotFoundException6)
|
|
29883
|
+
continue;
|
|
29884
|
+
throw err;
|
|
29885
|
+
}
|
|
29886
|
+
}
|
|
29887
|
+
tableToken = tables.continuationToken;
|
|
29888
|
+
} while (tableToken);
|
|
29889
|
+
}
|
|
29890
|
+
nsToken = namespaces.continuationToken;
|
|
29891
|
+
} while (nsToken);
|
|
29892
|
+
}
|
|
29893
|
+
bucketToken = buckets.continuationToken;
|
|
29894
|
+
} while (bucketToken);
|
|
29895
|
+
return null;
|
|
29896
|
+
}
|
|
28448
29897
|
async deleteTable(logicalId, physicalId, resourceType, context) {
|
|
28449
29898
|
this.logger.debug(`Deleting S3 Tables Table ${logicalId}: ${physicalId}`);
|
|
28450
29899
|
const parts = physicalId.split("|");
|
|
@@ -28504,7 +29953,7 @@ import {
|
|
|
28504
29953
|
PutImageScanningConfigurationCommand,
|
|
28505
29954
|
PutImageTagMutabilityCommand,
|
|
28506
29955
|
TagResourceCommand as TagResourceCommand7,
|
|
28507
|
-
ListTagsForResourceCommand as
|
|
29956
|
+
ListTagsForResourceCommand as ListTagsForResourceCommand18,
|
|
28508
29957
|
RepositoryNotFoundException
|
|
28509
29958
|
} from "@aws-sdk/client-ecr";
|
|
28510
29959
|
var ECRProvider = class {
|
|
@@ -28773,7 +30222,7 @@ var ECRProvider = class {
|
|
|
28773
30222
|
continue;
|
|
28774
30223
|
try {
|
|
28775
30224
|
const tagsResp = await this.getClient().send(
|
|
28776
|
-
new
|
|
30225
|
+
new ListTagsForResourceCommand18({ resourceArn: repo.repositoryArn })
|
|
28777
30226
|
);
|
|
28778
30227
|
if (matchesCdkPath(tagsResp.tags, input.cdkPath)) {
|
|
28779
30228
|
return { physicalId: repo.repositoryName, attributes: {} };
|
|
@@ -30301,11 +31750,11 @@ async function deployCommand(stacks, options) {
|
|
|
30301
31750
|
addDependencies(stack.stackName);
|
|
30302
31751
|
}
|
|
30303
31752
|
}
|
|
30304
|
-
const { STSClient:
|
|
30305
|
-
const stsClient = new
|
|
31753
|
+
const { STSClient: STSClient9, GetCallerIdentityCommand: GetCallerIdentityCommand11 } = await import("@aws-sdk/client-sts");
|
|
31754
|
+
const stsClient = new STSClient9({
|
|
30306
31755
|
region: options.region || process.env["AWS_REGION"] || "us-east-1"
|
|
30307
31756
|
});
|
|
30308
|
-
const callerIdentity = await stsClient.send(new
|
|
31757
|
+
const callerIdentity = await stsClient.send(new GetCallerIdentityCommand11({}));
|
|
30309
31758
|
const accountId = callerIdentity.Account;
|
|
30310
31759
|
stsClient.destroy();
|
|
30311
31760
|
const assetPublisher = new AssetPublisher();
|
|
@@ -31350,7 +32799,7 @@ import {
|
|
|
31350
32799
|
CreateBucketCommand as CreateBucketCommand4,
|
|
31351
32800
|
DeleteBucketCommand as DeleteBucketCommand3,
|
|
31352
32801
|
DeleteObjectsCommand as DeleteObjectsCommand3,
|
|
31353
|
-
HeadBucketCommand as
|
|
32802
|
+
HeadBucketCommand as HeadBucketCommand5,
|
|
31354
32803
|
ListObjectVersionsCommand as ListObjectVersionsCommand2,
|
|
31355
32804
|
ListObjectsV2Command as ListObjectsV2Command3,
|
|
31356
32805
|
PutBucketEncryptionCommand as PutBucketEncryptionCommand3,
|
|
@@ -31358,7 +32807,7 @@ import {
|
|
|
31358
32807
|
PutBucketVersioningCommand as PutBucketVersioningCommand3,
|
|
31359
32808
|
S3Client as S3Client10
|
|
31360
32809
|
} from "@aws-sdk/client-s3";
|
|
31361
|
-
import { GetCallerIdentityCommand as
|
|
32810
|
+
import { GetCallerIdentityCommand as GetCallerIdentityCommand10 } from "@aws-sdk/client-sts";
|
|
31362
32811
|
init_aws_clients();
|
|
31363
32812
|
async function stateMigrateCommand(options) {
|
|
31364
32813
|
const logger = getLogger();
|
|
@@ -31371,7 +32820,7 @@ async function stateMigrateCommand(options) {
|
|
|
31371
32820
|
});
|
|
31372
32821
|
setAwsClients(awsClients);
|
|
31373
32822
|
try {
|
|
31374
|
-
const identity = await awsClients.sts.send(new
|
|
32823
|
+
const identity = await awsClients.sts.send(new GetCallerIdentityCommand10({}));
|
|
31375
32824
|
const accountId = identity.Account;
|
|
31376
32825
|
if (!accountId) {
|
|
31377
32826
|
throw new Error("STS GetCallerIdentity returned no Account id.");
|
|
@@ -31473,7 +32922,7 @@ async function stateMigrateCommand(options) {
|
|
|
31473
32922
|
}
|
|
31474
32923
|
async function bucketExists2(s3, bucketName) {
|
|
31475
32924
|
try {
|
|
31476
|
-
await s3.send(new
|
|
32925
|
+
await s3.send(new HeadBucketCommand5({ Bucket: bucketName }));
|
|
31477
32926
|
return true;
|
|
31478
32927
|
} catch (error) {
|
|
31479
32928
|
const err = error;
|
|
@@ -32699,7 +34148,7 @@ function reorderArgs(argv) {
|
|
|
32699
34148
|
}
|
|
32700
34149
|
async function main() {
|
|
32701
34150
|
const program = new Command13();
|
|
32702
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
34151
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.21.0");
|
|
32703
34152
|
program.addCommand(createBootstrapCommand());
|
|
32704
34153
|
program.addCommand(createSynthCommand());
|
|
32705
34154
|
program.addCommand(createListCommand());
|