@go-to-k/cdkd 0.107.0 → 0.108.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-CuHRHcyW.js";
|
|
3
|
-
import { A as resolveApp, B as CdkdError, C as AssetPublisher, D as Synthesizer, E as buildDockerImage, F as warnDeprecatedNoPrefixCliFlag, G as PartialFailureError, I as AssemblyReader, J as ResourceUpdateNotSupportedError, K as ProvisioningError, M as resolveSkipPrefix, N as resolveStateBucketWithDefault, O as getDefaultStateBucketName, P as resolveStateBucketWithDefaultAndSource, R as resolveBucketRegion, S as shouldRetainResource, T as WorkGraph, U as LocalInvokeBuildError, X as StackHasActiveImportsError, Y as RouteDiscoveryError, Z as StackTerminationProtectionError, _ as DiffCalculator, a as withRetry, at as getLogger, b as LockManager, c as collectInlinePolicyNamesManagedBySiblings, ct as getLiveRenderer, d as normalizeAwsTagsToCfn, dt as generateResourceName, f as resolveExplicitPhysicalId, ft as generateResourceNameWithFallback, g as IntrinsicFunctionResolver, h as assertRegionMatch, i as withResourceDeadline, j as resolveCaptureObservedState, k as getLegacyStateBucketName, l as CDK_PATH_TAG, lt as PATTERN_B_NAME_PROPERTIES, m as CloudControlProvider, mt as withStackName, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as normalizeAwsError, o as IMPLICIT_DELETE_DEPENDENCIES, p as ProviderRegistry, pt as withSkipPrefix, q as ResourceTimeoutError, r as DeployEngine, rt as withErrorHandling, s as IAMRoleProvider, st as runStackBuffered, t as DEFAULT_RESOURCE_TIMEOUT_MS, u as matchesCdkPath, ut as PATTERN_B_RESOURCE_TYPES, v as DagBuilder, w as stringifyValue, x as S3StateBackend, y as TemplateParser } from "./deploy-engine-
|
|
3
|
+
import { A as resolveApp, B as CdkdError, C as AssetPublisher, D as Synthesizer, E as buildDockerImage, F as warnDeprecatedNoPrefixCliFlag, G as PartialFailureError, I as AssemblyReader, J as ResourceUpdateNotSupportedError, K as ProvisioningError, M as resolveSkipPrefix, N as resolveStateBucketWithDefault, O as getDefaultStateBucketName, P as resolveStateBucketWithDefaultAndSource, R as resolveBucketRegion, S as shouldRetainResource, T as WorkGraph, U as LocalInvokeBuildError, X as StackHasActiveImportsError, Y as RouteDiscoveryError, Z as StackTerminationProtectionError, _ as DiffCalculator, a as withRetry, at as getLogger, b as LockManager, c as collectInlinePolicyNamesManagedBySiblings, ct as getLiveRenderer, d as normalizeAwsTagsToCfn, dt as generateResourceName, f as resolveExplicitPhysicalId, ft as generateResourceNameWithFallback, g as IntrinsicFunctionResolver, h as assertRegionMatch, i as withResourceDeadline, j as resolveCaptureObservedState, k as getLegacyStateBucketName, l as CDK_PATH_TAG, lt as PATTERN_B_NAME_PROPERTIES, m as CloudControlProvider, mt as withStackName, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as normalizeAwsError, o as IMPLICIT_DELETE_DEPENDENCIES, p as ProviderRegistry, pt as withSkipPrefix, q as ResourceTimeoutError, r as DeployEngine, rt as withErrorHandling, s as IAMRoleProvider, st as runStackBuffered, t as DEFAULT_RESOURCE_TIMEOUT_MS, u as matchesCdkPath, ut as PATTERN_B_RESOURCE_TYPES, v as DagBuilder, w as stringifyValue, x as S3StateBackend, y as TemplateParser } from "./deploy-engine-Br8DvrvB.js";
|
|
4
4
|
import { createHash, createPublicKey, createVerify, randomBytes, randomUUID } from "node:crypto";
|
|
5
5
|
import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListBucketsCommand, ListDirectoryBucketsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
|
|
6
6
|
import { AddRoleToInstanceProfileCommand, AddUserToGroupCommand, AttachGroupPolicyCommand, AttachUserPolicyCommand, CreateGroupCommand, CreateInstanceProfileCommand, CreateLoginProfileCommand, CreateUserCommand, DeleteAccessKeyCommand, DeleteGroupCommand, DeleteGroupPolicyCommand, DeleteInstanceProfileCommand, DeleteLoginProfileCommand, DeleteRolePolicyCommand, DeleteUserCommand, DeleteUserPermissionsBoundaryCommand, DeleteUserPolicyCommand, DetachGroupPolicyCommand, DetachUserPolicyCommand, GetGroupCommand, GetGroupPolicyCommand, GetInstanceProfileCommand, GetRolePolicyCommand, GetUserCommand, GetUserPolicyCommand, IAMClient, ListAccessKeysCommand, ListAttachedGroupPoliciesCommand, ListAttachedUserPoliciesCommand, ListGroupPoliciesCommand, ListGroupsForUserCommand, ListInstanceProfilesCommand, ListUserPoliciesCommand, ListUserTagsCommand, ListUsersCommand, NoSuchEntityException, PutGroupPolicyCommand, PutRolePolicyCommand, PutUserPermissionsBoundaryCommand, PutUserPolicyCommand, RemoveRoleFromInstanceProfileCommand, RemoveUserFromGroupCommand, TagUserCommand, UntagUserCommand, UpdateLoginProfileCommand } from "@aws-sdk/client-iam";
|
|
@@ -30,7 +30,7 @@ import { CreateAliasCommand, CreateKeyCommand, DeleteAliasCommand, DescribeKeyCo
|
|
|
30
30
|
import { promisify } from "node:util";
|
|
31
31
|
import { CreateRepositoryCommand, DeleteLifecyclePolicyCommand, DeleteRepositoryCommand, DeleteRepositoryPolicyCommand, DescribeRepositoriesCommand, ECRClient, GetAuthorizationTokenCommand, GetLifecyclePolicyCommand, LifecyclePolicyNotFoundException, ListTagsForResourceCommand as ListTagsForResourceCommand$7, PutImageScanningConfigurationCommand, PutImageTagMutabilityCommand, PutLifecyclePolicyCommand, RepositoryNotFoundException, SetRepositoryPolicyCommand, TagResourceCommand as TagResourceCommand$9 } from "@aws-sdk/client-ecr";
|
|
32
32
|
import graphlib from "graphlib";
|
|
33
|
-
import { AddTagsToResourceCommand as AddTagsToResourceCommand$1, CreateDBClusterCommand, CreateDBInstanceCommand, CreateDBProxyCommand, CreateDBSubnetGroupCommand, DBProxyNotFoundFault, DBProxyTargetGroupNotFoundFault, DBProxyTargetNotFoundFault, DeleteDBClusterCommand, DeleteDBInstanceCommand, DeleteDBProxyCommand, DeleteDBSubnetGroupCommand, DeregisterDBProxyTargetsCommand, DescribeDBClustersCommand, DescribeDBInstancesCommand, DescribeDBProxiesCommand, DescribeDBProxyTargetGroupsCommand, DescribeDBSubnetGroupsCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$8, ModifyDBClusterCommand, ModifyDBInstanceCommand, ModifyDBProxyCommand, ModifyDBProxyTargetGroupCommand, ModifyDBSubnetGroupCommand, RDSClient, RegisterDBProxyTargetsCommand, RemoveTagsFromResourceCommand as RemoveTagsFromResourceCommand$1 } from "@aws-sdk/client-rds";
|
|
33
|
+
import { AddTagsToResourceCommand as AddTagsToResourceCommand$1, CreateDBClusterCommand, CreateDBInstanceCommand, CreateDBProxyCommand, CreateDBProxyEndpointCommand, CreateDBSubnetGroupCommand, DBProxyEndpointNotFoundFault, DBProxyNotFoundFault, DBProxyTargetGroupNotFoundFault, DBProxyTargetNotFoundFault, DeleteDBClusterCommand, DeleteDBInstanceCommand, DeleteDBProxyCommand, DeleteDBProxyEndpointCommand, DeleteDBSubnetGroupCommand, DeregisterDBProxyTargetsCommand, DescribeDBClustersCommand, DescribeDBInstancesCommand, DescribeDBProxiesCommand, DescribeDBProxyEndpointsCommand, DescribeDBProxyTargetGroupsCommand, DescribeDBSubnetGroupsCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$8, ModifyDBClusterCommand, ModifyDBInstanceCommand, ModifyDBProxyCommand, ModifyDBProxyEndpointCommand, ModifyDBProxyTargetGroupCommand, ModifyDBSubnetGroupCommand, RDSClient, RegisterDBProxyTargetsCommand, RemoveTagsFromResourceCommand as RemoveTagsFromResourceCommand$1 } from "@aws-sdk/client-rds";
|
|
34
34
|
import { Command, Option } from "commander";
|
|
35
35
|
import { writeFileSync as writeFileSync$1 } from "fs";
|
|
36
36
|
import { join as join$1 } from "path";
|
|
@@ -18395,8 +18395,8 @@ var RDSProvider = class {
|
|
|
18395
18395
|
|
|
18396
18396
|
//#endregion
|
|
18397
18397
|
//#region src/provisioning/providers/rds-dbproxy-provider.ts
|
|
18398
|
-
const POLL_INTERVAL_MS = 5e3;
|
|
18399
|
-
const POLL_TIMEOUT_MS = 900 * 1e3;
|
|
18398
|
+
const POLL_INTERVAL_MS$1 = 5e3;
|
|
18399
|
+
const POLL_TIMEOUT_MS$1 = 900 * 1e3;
|
|
18400
18400
|
/**
|
|
18401
18401
|
* AWS RDS DBProxy Provider
|
|
18402
18402
|
*
|
|
@@ -18483,7 +18483,7 @@ var RDSDBProxyProvider = class {
|
|
|
18483
18483
|
let endpoint;
|
|
18484
18484
|
let dbProxyArn;
|
|
18485
18485
|
let vpcId;
|
|
18486
|
-
const deadline = Date.now() + POLL_TIMEOUT_MS;
|
|
18486
|
+
const deadline = Date.now() + POLL_TIMEOUT_MS$1;
|
|
18487
18487
|
let status;
|
|
18488
18488
|
while (Date.now() < deadline) {
|
|
18489
18489
|
try {
|
|
@@ -18500,7 +18500,7 @@ var RDSDBProxyProvider = class {
|
|
|
18500
18500
|
if (error instanceof DBProxyNotFoundFault) {} else if (error instanceof ProvisioningError) throw error;
|
|
18501
18501
|
else throw this.wrapError(error, "CREATE (poll)", resourceType, logicalId, dbProxyName);
|
|
18502
18502
|
}
|
|
18503
|
-
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
18503
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS$1));
|
|
18504
18504
|
}
|
|
18505
18505
|
if (!endpoint || !dbProxyArn) throw new ProvisioningError(`Timed out waiting for DBProxy ${dbProxyName} to become available (last status: ${status ?? "unknown"})`, resourceType, logicalId, dbProxyName);
|
|
18506
18506
|
return {
|
|
@@ -18514,6 +18514,11 @@ var RDSDBProxyProvider = class {
|
|
|
18514
18514
|
}
|
|
18515
18515
|
async update(logicalId, physicalId, resourceType, properties, previousProperties) {
|
|
18516
18516
|
const client = this.getClient();
|
|
18517
|
+
for (const field of [
|
|
18518
|
+
"DBProxyName",
|
|
18519
|
+
"EngineFamily",
|
|
18520
|
+
"VpcSubnetIds"
|
|
18521
|
+
]) if (JSON.stringify(properties[field]) !== JSON.stringify(previousProperties[field])) throw new ResourceUpdateNotSupportedError(resourceType, logicalId, `${field} is immutable on AWS::RDS::DBProxy — destroy + redeploy to change it`);
|
|
18517
18522
|
const input = { DBProxyName: physicalId };
|
|
18518
18523
|
let hasModify = false;
|
|
18519
18524
|
for (const key of [
|
|
@@ -18556,7 +18561,7 @@ var RDSDBProxyProvider = class {
|
|
|
18556
18561
|
}
|
|
18557
18562
|
throw this.wrapError(error, "DELETE", resourceType, logicalId, physicalId);
|
|
18558
18563
|
}
|
|
18559
|
-
const deadline = Date.now() + POLL_TIMEOUT_MS;
|
|
18564
|
+
const deadline = Date.now() + POLL_TIMEOUT_MS$1;
|
|
18560
18565
|
while (Date.now() < deadline) {
|
|
18561
18566
|
try {
|
|
18562
18567
|
await client.send(new DescribeDBProxiesCommand({ DBProxyName: physicalId }));
|
|
@@ -18567,7 +18572,7 @@ var RDSDBProxyProvider = class {
|
|
|
18567
18572
|
}
|
|
18568
18573
|
throw this.wrapError(error, "DELETE (poll)", resourceType, logicalId, physicalId);
|
|
18569
18574
|
}
|
|
18570
|
-
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
18575
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS$1));
|
|
18571
18576
|
}
|
|
18572
18577
|
throw new ProvisioningError(`Timed out waiting for DBProxy ${physicalId} to fully delete`, resourceType, logicalId, physicalId);
|
|
18573
18578
|
}
|
|
@@ -18742,6 +18747,337 @@ var RDSDBProxyProvider = class {
|
|
|
18742
18747
|
}
|
|
18743
18748
|
};
|
|
18744
18749
|
|
|
18750
|
+
//#endregion
|
|
18751
|
+
//#region src/provisioning/providers/rds-dbproxy-endpoint-provider.ts
|
|
18752
|
+
const POLL_INTERVAL_MS = 5e3;
|
|
18753
|
+
const POLL_TIMEOUT_MS = 900 * 1e3;
|
|
18754
|
+
/**
|
|
18755
|
+
* AWS RDS DBProxyEndpoint Provider
|
|
18756
|
+
*
|
|
18757
|
+
* Implements resource provisioning for `AWS::RDS::DBProxyEndpoint` — the
|
|
18758
|
+
* additional read/write or read-only endpoint that can be attached to a
|
|
18759
|
+
* parent DBProxy.
|
|
18760
|
+
*
|
|
18761
|
+
* **Why a dedicated SDK provider** (per `feedback_dedicated_provider_over_special_case.md`):
|
|
18762
|
+
* completes the RDS DBProxy family started in PR #387 (`DBProxyTargetGroup`)
|
|
18763
|
+
* and PR #394 (`DBProxy`). Keeps the whole family on one codebase so create /
|
|
18764
|
+
* update / delete handling stays consistent across the parent + endpoints +
|
|
18765
|
+
* target-group children.
|
|
18766
|
+
*
|
|
18767
|
+
* **Lifecycle**:
|
|
18768
|
+
* - `create`: validates required fields (`DBProxyName` / `VpcSubnetIds`),
|
|
18769
|
+
* issues `CreateDBProxyEndpointCommand`, then polls `DescribeDBProxyEndpoints`
|
|
18770
|
+
* until `Status === 'available'`. Returns `physicalId = DBProxyEndpointName`
|
|
18771
|
+
* plus `Endpoint` / `DBProxyEndpointArn` / `IsDefault` / `VpcId` in
|
|
18772
|
+
* `attributes`.
|
|
18773
|
+
* - `update`: `ModifyDBProxyEndpointCommand` for the mutable fields
|
|
18774
|
+
* (`VpcSecurityGroupIds` → SDK input `VpcSecurityGroupIds`,
|
|
18775
|
+
* `NewDBProxyEndpointName` via rename). Tags diff via separate
|
|
18776
|
+
* `AddTagsToResource` / `RemoveTagsFromResource` calls. DBProxyName /
|
|
18777
|
+
* VpcSubnetIds / TargetRole are immutable on AWS.
|
|
18778
|
+
* - `delete`: `DeleteDBProxyEndpointCommand`, then polls until
|
|
18779
|
+
* `DBProxyEndpointNotFoundFault`. Idempotent on NotFound (region-match
|
|
18780
|
+
* gated). `DBProxyNotFoundFault` also idempotent — if the parent DBProxy
|
|
18781
|
+
* is already gone via CASCADE, the endpoint is too.
|
|
18782
|
+
* - `getAttribute`: `Endpoint` / `DBProxyEndpointArn` / `IsDefault` / `VpcId`
|
|
18783
|
+
* via `DescribeDBProxyEndpoints`, cached per `(physicalId, attribute)`.
|
|
18784
|
+
* - `import`: explicit `--resource <id>=<DBProxyEndpointName>` first; falls
|
|
18785
|
+
* back to paginated auto-lookup via `DescribeDBProxyEndpoints` +
|
|
18786
|
+
* `ListTagsForResource` matching `aws:cdk:path`.
|
|
18787
|
+
*
|
|
18788
|
+
* **physicalId** = DBProxyEndpointName (matches CFn `primaryIdentifier`).
|
|
18789
|
+
*/
|
|
18790
|
+
var RDSDBProxyEndpointProvider = class {
|
|
18791
|
+
rdsClient;
|
|
18792
|
+
providerRegion = process.env["AWS_REGION"];
|
|
18793
|
+
logger = getLogger().child("RDSDBProxyEndpointProvider");
|
|
18794
|
+
attributeCache = /* @__PURE__ */ new Map();
|
|
18795
|
+
handledProperties = new Map([["AWS::RDS::DBProxyEndpoint", new Set([
|
|
18796
|
+
"DBProxyEndpointName",
|
|
18797
|
+
"DBProxyName",
|
|
18798
|
+
"VpcSubnetIds",
|
|
18799
|
+
"VpcSecurityGroupIds",
|
|
18800
|
+
"TargetRole",
|
|
18801
|
+
"Tags"
|
|
18802
|
+
])]]);
|
|
18803
|
+
getClient() {
|
|
18804
|
+
if (!this.rdsClient) this.rdsClient = new RDSClient(this.providerRegion ? { region: this.providerRegion } : {});
|
|
18805
|
+
return this.rdsClient;
|
|
18806
|
+
}
|
|
18807
|
+
async create(logicalId, resourceType, properties) {
|
|
18808
|
+
const dbProxyName = properties["DBProxyName"];
|
|
18809
|
+
if (!dbProxyName) throw new ProvisioningError(`DBProxyName is required for AWS::RDS::DBProxyEndpoint ${logicalId}`, resourceType, logicalId);
|
|
18810
|
+
const dbProxyEndpointName = properties["DBProxyEndpointName"] ?? generateResourceName(logicalId, { maxLength: 64 });
|
|
18811
|
+
const vpcSubnetIds = properties["VpcSubnetIds"];
|
|
18812
|
+
if (!vpcSubnetIds || vpcSubnetIds.length === 0) throw new ProvisioningError(`VpcSubnetIds (at least one) is required for AWS::RDS::DBProxyEndpoint ${logicalId}`, resourceType, logicalId);
|
|
18813
|
+
const client = this.getClient();
|
|
18814
|
+
this.logger.debug(`Creating DBProxyEndpoint ${dbProxyEndpointName} (proxy=${dbProxyName})`);
|
|
18815
|
+
try {
|
|
18816
|
+
await client.send(new CreateDBProxyEndpointCommand({
|
|
18817
|
+
DBProxyName: dbProxyName,
|
|
18818
|
+
DBProxyEndpointName: dbProxyEndpointName,
|
|
18819
|
+
VpcSubnetIds: vpcSubnetIds,
|
|
18820
|
+
VpcSecurityGroupIds: properties["VpcSecurityGroupIds"],
|
|
18821
|
+
TargetRole: properties["TargetRole"],
|
|
18822
|
+
Tags: this.toAwsTags(properties["Tags"])
|
|
18823
|
+
}));
|
|
18824
|
+
} catch (error) {
|
|
18825
|
+
throw this.wrapError(error, "CREATE", resourceType, logicalId, void 0);
|
|
18826
|
+
}
|
|
18827
|
+
let endpoint;
|
|
18828
|
+
let arn;
|
|
18829
|
+
let isDefault;
|
|
18830
|
+
let vpcId;
|
|
18831
|
+
const deadline = Date.now() + POLL_TIMEOUT_MS;
|
|
18832
|
+
let status;
|
|
18833
|
+
while (Date.now() < deadline) {
|
|
18834
|
+
try {
|
|
18835
|
+
const ep = (await client.send(new DescribeDBProxyEndpointsCommand({
|
|
18836
|
+
DBProxyName: dbProxyName,
|
|
18837
|
+
DBProxyEndpointName: dbProxyEndpointName
|
|
18838
|
+
}))).DBProxyEndpoints?.[0];
|
|
18839
|
+
status = ep?.Status;
|
|
18840
|
+
if (status === "available") {
|
|
18841
|
+
endpoint = ep?.Endpoint;
|
|
18842
|
+
arn = ep?.DBProxyEndpointArn;
|
|
18843
|
+
isDefault = ep?.IsDefault;
|
|
18844
|
+
vpcId = ep?.VpcId;
|
|
18845
|
+
break;
|
|
18846
|
+
}
|
|
18847
|
+
if (status === "incompatible-network" || status === "insufficient-resource-limits") throw new ProvisioningError(`DBProxyEndpoint ${dbProxyEndpointName} entered terminal failure state: ${status}`, resourceType, logicalId, dbProxyEndpointName);
|
|
18848
|
+
} catch (error) {
|
|
18849
|
+
if (error instanceof DBProxyEndpointNotFoundFault || error instanceof DBProxyNotFoundFault) {} else if (error instanceof ProvisioningError) throw error;
|
|
18850
|
+
else throw this.wrapError(error, "CREATE (poll)", resourceType, logicalId, dbProxyEndpointName);
|
|
18851
|
+
}
|
|
18852
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
18853
|
+
}
|
|
18854
|
+
if (!endpoint || !arn) throw new ProvisioningError(`Timed out waiting for DBProxyEndpoint ${dbProxyEndpointName} to become available (last status: ${status ?? "unknown"})`, resourceType, logicalId, dbProxyEndpointName);
|
|
18855
|
+
return {
|
|
18856
|
+
physicalId: dbProxyEndpointName,
|
|
18857
|
+
attributes: {
|
|
18858
|
+
Endpoint: endpoint,
|
|
18859
|
+
DBProxyEndpointArn: arn,
|
|
18860
|
+
IsDefault: isDefault ?? false,
|
|
18861
|
+
VpcId: vpcId ?? ""
|
|
18862
|
+
}
|
|
18863
|
+
};
|
|
18864
|
+
}
|
|
18865
|
+
async update(logicalId, physicalId, resourceType, properties, previousProperties) {
|
|
18866
|
+
const client = this.getClient();
|
|
18867
|
+
for (const field of [
|
|
18868
|
+
"DBProxyName",
|
|
18869
|
+
"DBProxyEndpointName",
|
|
18870
|
+
"VpcSubnetIds",
|
|
18871
|
+
"TargetRole"
|
|
18872
|
+
]) if (JSON.stringify(properties[field]) !== JSON.stringify(previousProperties[field])) throw new ResourceUpdateNotSupportedError(resourceType, logicalId, `${field} is immutable on AWS::RDS::DBProxyEndpoint — destroy + redeploy to change it`);
|
|
18873
|
+
const oldSG = previousProperties["VpcSecurityGroupIds"] ?? [];
|
|
18874
|
+
const newSG = properties["VpcSecurityGroupIds"] ?? [];
|
|
18875
|
+
if (JSON.stringify(oldSG) !== JSON.stringify(newSG)) {
|
|
18876
|
+
this.logger.debug(`Updating DBProxyEndpoint ${physicalId} security groups`);
|
|
18877
|
+
try {
|
|
18878
|
+
await client.send(new ModifyDBProxyEndpointCommand({
|
|
18879
|
+
DBProxyEndpointName: physicalId,
|
|
18880
|
+
VpcSecurityGroupIds: newSG
|
|
18881
|
+
}));
|
|
18882
|
+
} catch (error) {
|
|
18883
|
+
throw this.wrapError(error, "UPDATE", resourceType, logicalId, physicalId);
|
|
18884
|
+
}
|
|
18885
|
+
}
|
|
18886
|
+
await this.applyTagDiff(physicalId, previousProperties["Tags"], properties["Tags"], resourceType, logicalId);
|
|
18887
|
+
this.invalidateAttributeCache(physicalId);
|
|
18888
|
+
return {
|
|
18889
|
+
physicalId,
|
|
18890
|
+
wasReplaced: false
|
|
18891
|
+
};
|
|
18892
|
+
}
|
|
18893
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
18894
|
+
const client = this.getClient();
|
|
18895
|
+
this.logger.debug(`Deleting DBProxyEndpoint ${physicalId}`);
|
|
18896
|
+
try {
|
|
18897
|
+
await client.send(new DeleteDBProxyEndpointCommand({ DBProxyEndpointName: physicalId }));
|
|
18898
|
+
} catch (error) {
|
|
18899
|
+
if (error instanceof DBProxyEndpointNotFoundFault || error instanceof DBProxyNotFoundFault) {
|
|
18900
|
+
assertRegionMatch(await client.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
|
|
18901
|
+
this.logger.debug(`DBProxyEndpoint ${physicalId} or parent already gone, treating as success`);
|
|
18902
|
+
return;
|
|
18903
|
+
}
|
|
18904
|
+
throw this.wrapError(error, "DELETE", resourceType, logicalId, physicalId);
|
|
18905
|
+
}
|
|
18906
|
+
const deadline = Date.now() + POLL_TIMEOUT_MS;
|
|
18907
|
+
while (Date.now() < deadline) {
|
|
18908
|
+
try {
|
|
18909
|
+
await client.send(new DescribeDBProxyEndpointsCommand({ DBProxyEndpointName: physicalId }));
|
|
18910
|
+
} catch (error) {
|
|
18911
|
+
if (error instanceof DBProxyEndpointNotFoundFault || error instanceof DBProxyNotFoundFault) {
|
|
18912
|
+
this.logger.debug(`DBProxyEndpoint ${physicalId} fully deleted`);
|
|
18913
|
+
return;
|
|
18914
|
+
}
|
|
18915
|
+
throw this.wrapError(error, "DELETE (poll)", resourceType, logicalId, physicalId);
|
|
18916
|
+
}
|
|
18917
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
18918
|
+
}
|
|
18919
|
+
throw new ProvisioningError(`Timed out waiting for DBProxyEndpoint ${physicalId} to fully delete`, resourceType, logicalId, physicalId);
|
|
18920
|
+
}
|
|
18921
|
+
async getAttribute(physicalId, _resourceType, attributeName) {
|
|
18922
|
+
const cacheKey = `${physicalId}:${attributeName}`;
|
|
18923
|
+
const cached = this.attributeCache.get(cacheKey);
|
|
18924
|
+
if (cached !== void 0) return cached;
|
|
18925
|
+
if (attributeName !== "Endpoint" && attributeName !== "DBProxyEndpointArn" && attributeName !== "IsDefault" && attributeName !== "VpcId") {
|
|
18926
|
+
this.logger.warn(`Unknown attribute ${attributeName} for AWS::RDS::DBProxyEndpoint, returning undefined`);
|
|
18927
|
+
return;
|
|
18928
|
+
}
|
|
18929
|
+
try {
|
|
18930
|
+
const ep = (await this.getClient().send(new DescribeDBProxyEndpointsCommand({ DBProxyEndpointName: physicalId }))).DBProxyEndpoints?.[0];
|
|
18931
|
+
if (!ep) return void 0;
|
|
18932
|
+
const value = {
|
|
18933
|
+
Endpoint: ep.Endpoint,
|
|
18934
|
+
DBProxyEndpointArn: ep.DBProxyEndpointArn,
|
|
18935
|
+
IsDefault: ep.IsDefault ?? false,
|
|
18936
|
+
VpcId: ep.VpcId
|
|
18937
|
+
}[attributeName];
|
|
18938
|
+
if (value !== void 0) this.attributeCache.set(cacheKey, value);
|
|
18939
|
+
return value;
|
|
18940
|
+
} catch (error) {
|
|
18941
|
+
if (error instanceof DBProxyEndpointNotFoundFault || error instanceof DBProxyNotFoundFault) return;
|
|
18942
|
+
throw error;
|
|
18943
|
+
}
|
|
18944
|
+
}
|
|
18945
|
+
async import(input) {
|
|
18946
|
+
const explicit = resolveExplicitPhysicalId(input, "DBProxyEndpointName");
|
|
18947
|
+
if (explicit) return this.buildImportResult(explicit);
|
|
18948
|
+
const client = this.getClient();
|
|
18949
|
+
let marker;
|
|
18950
|
+
do {
|
|
18951
|
+
const describe = await client.send(new DescribeDBProxyEndpointsCommand({
|
|
18952
|
+
Marker: marker,
|
|
18953
|
+
MaxRecords: 100
|
|
18954
|
+
}));
|
|
18955
|
+
for (const ep of describe.DBProxyEndpoints ?? []) {
|
|
18956
|
+
if (!ep.DBProxyEndpointArn) continue;
|
|
18957
|
+
try {
|
|
18958
|
+
if (matchesCdkPath((await client.send(new ListTagsForResourceCommand$8({ ResourceName: ep.DBProxyEndpointArn }))).TagList ?? [], input.cdkPath)) return this.buildImportResult(ep.DBProxyEndpointName ?? "");
|
|
18959
|
+
} catch (error) {
|
|
18960
|
+
this.logger.debug(`ListTagsForResource failed for ${ep.DBProxyEndpointName}: ${error instanceof Error ? error.message : String(error)}`);
|
|
18961
|
+
}
|
|
18962
|
+
}
|
|
18963
|
+
marker = describe.Marker;
|
|
18964
|
+
} while (marker);
|
|
18965
|
+
return null;
|
|
18966
|
+
}
|
|
18967
|
+
async readCurrentState(physicalId) {
|
|
18968
|
+
const client = this.getClient();
|
|
18969
|
+
let ep;
|
|
18970
|
+
try {
|
|
18971
|
+
ep = (await client.send(new DescribeDBProxyEndpointsCommand({ DBProxyEndpointName: physicalId }))).DBProxyEndpoints?.[0];
|
|
18972
|
+
if (!ep) return void 0;
|
|
18973
|
+
} catch (error) {
|
|
18974
|
+
if (error instanceof DBProxyEndpointNotFoundFault || error instanceof DBProxyNotFoundFault) return;
|
|
18975
|
+
throw error;
|
|
18976
|
+
}
|
|
18977
|
+
const e = ep;
|
|
18978
|
+
const result = {
|
|
18979
|
+
DBProxyEndpointName: e.DBProxyEndpointName,
|
|
18980
|
+
DBProxyName: e.DBProxyName,
|
|
18981
|
+
VpcSubnetIds: e.VpcSubnetIds ?? [],
|
|
18982
|
+
VpcSecurityGroupIds: e.VpcSecurityGroupIds ?? [],
|
|
18983
|
+
TargetRole: e.TargetRole ?? "READ_WRITE"
|
|
18984
|
+
};
|
|
18985
|
+
if (e.DBProxyEndpointArn) try {
|
|
18986
|
+
result["Tags"] = normalizeAwsTagsToCfn((await client.send(new ListTagsForResourceCommand$8({ ResourceName: e.DBProxyEndpointArn }))).TagList ?? []);
|
|
18987
|
+
} catch (error) {
|
|
18988
|
+
this.logger.debug(`ListTagsForResource failed for ${physicalId}: ${error instanceof Error ? error.message : String(error)}`);
|
|
18989
|
+
result["Tags"] = [];
|
|
18990
|
+
}
|
|
18991
|
+
else result["Tags"] = [];
|
|
18992
|
+
return result;
|
|
18993
|
+
}
|
|
18994
|
+
async applyTagDiff(physicalId, oldTags, newTags, resourceType, logicalId) {
|
|
18995
|
+
const oldMap = this.toTagMap(oldTags);
|
|
18996
|
+
const newMap = this.toTagMap(newTags);
|
|
18997
|
+
if (oldMap.size === newMap.size && [...oldMap.keys()].every((k) => newMap.has(k)) && [...oldMap.entries()].every(([k, v]) => newMap.get(k) === v)) return;
|
|
18998
|
+
const client = this.getClient();
|
|
18999
|
+
const arnCacheKey = `${physicalId}:DBProxyEndpointArn`;
|
|
19000
|
+
let arn = this.attributeCache.get(arnCacheKey);
|
|
19001
|
+
if (!arn) try {
|
|
19002
|
+
arn = (await client.send(new DescribeDBProxyEndpointsCommand({ DBProxyEndpointName: physicalId }))).DBProxyEndpoints?.[0]?.DBProxyEndpointArn;
|
|
19003
|
+
if (arn) this.attributeCache.set(arnCacheKey, arn);
|
|
19004
|
+
} catch (error) {
|
|
19005
|
+
this.logger.debug(`Skipping tag diff for ${physicalId} (no ARN): ${error instanceof Error ? error.message : String(error)}`);
|
|
19006
|
+
return;
|
|
19007
|
+
}
|
|
19008
|
+
if (!arn) return;
|
|
19009
|
+
const toRemove = [];
|
|
19010
|
+
const toAdd = [];
|
|
19011
|
+
for (const k of oldMap.keys()) if (!newMap.has(k)) toRemove.push(k);
|
|
19012
|
+
for (const [k, v] of newMap.entries()) if (oldMap.get(k) !== v) toAdd.push({
|
|
19013
|
+
Key: k,
|
|
19014
|
+
Value: v
|
|
19015
|
+
});
|
|
19016
|
+
if (toRemove.length > 0) try {
|
|
19017
|
+
await client.send(new RemoveTagsFromResourceCommand$1({
|
|
19018
|
+
ResourceName: arn,
|
|
19019
|
+
TagKeys: toRemove
|
|
19020
|
+
}));
|
|
19021
|
+
} catch (error) {
|
|
19022
|
+
throw this.wrapError(error, "UPDATE (remove tags)", resourceType, logicalId, physicalId);
|
|
19023
|
+
}
|
|
19024
|
+
if (toAdd.length > 0) try {
|
|
19025
|
+
await client.send(new AddTagsToResourceCommand$1({
|
|
19026
|
+
ResourceName: arn,
|
|
19027
|
+
Tags: toAdd
|
|
19028
|
+
}));
|
|
19029
|
+
} catch (error) {
|
|
19030
|
+
throw this.wrapError(error, "UPDATE (add tags)", resourceType, logicalId, physicalId);
|
|
19031
|
+
}
|
|
19032
|
+
}
|
|
19033
|
+
toTagMap(tags) {
|
|
19034
|
+
const map = /* @__PURE__ */ new Map();
|
|
19035
|
+
if (Array.isArray(tags)) {
|
|
19036
|
+
for (const entry of tags) if (entry?.Key !== void 0) map.set(entry.Key, entry.Value ?? "");
|
|
19037
|
+
}
|
|
19038
|
+
return map;
|
|
19039
|
+
}
|
|
19040
|
+
toAwsTags(tags) {
|
|
19041
|
+
if (!Array.isArray(tags) || tags.length === 0) return void 0;
|
|
19042
|
+
return tags.filter((t) => t.Key !== void 0).map((t) => ({
|
|
19043
|
+
Key: t.Key,
|
|
19044
|
+
Value: t.Value ?? ""
|
|
19045
|
+
}));
|
|
19046
|
+
}
|
|
19047
|
+
async buildImportResult(physicalId) {
|
|
19048
|
+
try {
|
|
19049
|
+
const ep = (await this.getClient().send(new DescribeDBProxyEndpointsCommand({ DBProxyEndpointName: physicalId }))).DBProxyEndpoints?.[0];
|
|
19050
|
+
return {
|
|
19051
|
+
physicalId,
|
|
19052
|
+
attributes: {
|
|
19053
|
+
Endpoint: ep?.Endpoint ?? "",
|
|
19054
|
+
DBProxyEndpointArn: ep?.DBProxyEndpointArn ?? "",
|
|
19055
|
+
IsDefault: ep?.IsDefault ?? false,
|
|
19056
|
+
VpcId: ep?.VpcId ?? ""
|
|
19057
|
+
}
|
|
19058
|
+
};
|
|
19059
|
+
} catch {
|
|
19060
|
+
return {
|
|
19061
|
+
physicalId,
|
|
19062
|
+
attributes: {
|
|
19063
|
+
Endpoint: "",
|
|
19064
|
+
DBProxyEndpointArn: "",
|
|
19065
|
+
IsDefault: false,
|
|
19066
|
+
VpcId: ""
|
|
19067
|
+
}
|
|
19068
|
+
};
|
|
19069
|
+
}
|
|
19070
|
+
}
|
|
19071
|
+
invalidateAttributeCache(physicalId) {
|
|
19072
|
+
for (const key of this.attributeCache.keys()) if (key.startsWith(`${physicalId}:`)) this.attributeCache.delete(key);
|
|
19073
|
+
}
|
|
19074
|
+
wrapError(error, op, resourceType, logicalId, physicalId) {
|
|
19075
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
19076
|
+
const cause = error instanceof Error ? error : void 0;
|
|
19077
|
+
return new ProvisioningError(`${op} failed for ${logicalId}: ${message}`, resourceType, logicalId, physicalId, cause);
|
|
19078
|
+
}
|
|
19079
|
+
};
|
|
19080
|
+
|
|
18745
19081
|
//#endregion
|
|
18746
19082
|
//#region src/provisioning/providers/rds-dbproxy-targetgroup-provider.ts
|
|
18747
19083
|
/**
|
|
@@ -18861,6 +19197,12 @@ var RDSDBProxyTargetGroupProvider = class {
|
|
|
18861
19197
|
const dbProxyName = properties["DBProxyName"];
|
|
18862
19198
|
if (!dbProxyName) throw new ProvisioningError(`DBProxyName is required for AWS::RDS::DBProxyTargetGroup ${logicalId} update`, resourceType, logicalId, physicalId);
|
|
18863
19199
|
const targetGroupName = properties["TargetGroupName"] ?? "default";
|
|
19200
|
+
for (const field of ["DBProxyName", "TargetGroupName"]) {
|
|
19201
|
+
const oldVal = previousProperties[field];
|
|
19202
|
+
const newVal = properties[field];
|
|
19203
|
+
const normalize = (v) => field === "TargetGroupName" && (v === void 0 || v === "default") ? "default" : v;
|
|
19204
|
+
if (JSON.stringify(normalize(oldVal)) !== JSON.stringify(normalize(newVal))) throw new ResourceUpdateNotSupportedError(resourceType, logicalId, `${field} is immutable on AWS::RDS::DBProxyTargetGroup — destroy + redeploy to change it`);
|
|
19205
|
+
}
|
|
18864
19206
|
const client = this.getClient();
|
|
18865
19207
|
const oldPool = previousProperties["ConnectionPoolConfigurationInfo"];
|
|
18866
19208
|
const newPool = properties["ConnectionPoolConfigurationInfo"];
|
|
@@ -29703,6 +30045,7 @@ function registerAllProviders(registry) {
|
|
|
29703
30045
|
registry.register("AWS::RDS::DBCluster", rdsProvider);
|
|
29704
30046
|
registry.register("AWS::RDS::DBInstance", rdsProvider);
|
|
29705
30047
|
registry.register("AWS::RDS::DBProxy", new RDSDBProxyProvider());
|
|
30048
|
+
registry.register("AWS::RDS::DBProxyEndpoint", new RDSDBProxyEndpointProvider());
|
|
29706
30049
|
registry.register("AWS::RDS::DBProxyTargetGroup", new RDSDBProxyTargetGroupProvider());
|
|
29707
30050
|
const docdbProvider = new DocDBProvider();
|
|
29708
30051
|
registry.register("AWS::DocDB::DBSubnetGroup", docdbProvider);
|
|
@@ -44683,7 +45026,7 @@ function reorderArgs(argv) {
|
|
|
44683
45026
|
*/
|
|
44684
45027
|
async function main() {
|
|
44685
45028
|
const program = new Command();
|
|
44686
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
45029
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.108.0");
|
|
44687
45030
|
program.addCommand(createBootstrapCommand());
|
|
44688
45031
|
program.addCommand(createSynthCommand());
|
|
44689
45032
|
program.addCommand(createListCommand());
|