@go-to-k/cdkd 0.239.0 → 0.240.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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { a as getLiveRenderer, c as PATTERN_B_RESOURCE_TYPES, d as generateResourceNameWithFallback, f as withSkipPrefix, i as runStackBuffered, n as getLogger, o as PATTERN_B_NAME_OPTIONS, p as withStackName, s as PATTERN_B_NAME_PROPERTIES, u as generateResourceName } from "./logger-BzO-joNR.js";
|
|
3
3
|
import { A as withErrorHandling, C as StackHasActiveImportsError, S as ResourceUpdateNotSupportedError, _ as MissingCdkCliError, a as normalizeAwsTagsToCfn, b as ProvisioningError, f as LocalInvokeBuildError$1, i as matchesCdkPath, k as normalizeAwsError, l as CdkdError, m as LocalStartServiceError, n as isTerminationProtectionPropagationError, o as resolveExplicitPhysicalId, p as LocalMigrateError, r as CDK_PATH_TAG, s as assertRegionMatch, t as disableInstanceApiTermination, v as NestedStackChildDirectDestroyError, w as StackTerminationProtectionError, x as ResourceTimeoutError, y as PartialFailureError } from "./ec2-termination-protection-q-WGWgxa.js";
|
|
4
4
|
import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-B15NAPbL.js";
|
|
5
|
-
import { $ as getDockerCmd, A as DiffCalculator, B as buildAssetRedirectMap, C as findActionableSilentDrops, Ct as resolveBucketRegion, D as refStateLookupFromResource, E as cfnRefValueFromPhysicalId, F as rebuildClientForBucketRegion, G as BOOTSTRAP_MARKER_PREFIX, H as loadPublishableAssetManifest, I as shouldRetainResource, J as parseBootstrapMarker, K as ensureAssetStorage, L as AssetPublisher, M as TemplateParser, N as LockManager, O as WAFv2WebACLProvider, P as S3StateBackend, Q as formatDockerLoginError, R as stringifyValue, S as ProviderRegistry, T as IntrinsicFunctionResolver, U as rewriteTemplateAssetReferences, V as createAssetRedirectResolver, W as AssetModeResolver, X as validateContainerRepoName, Y as validateAssetBucketName, Z as buildDockerImage, _ as green, _t as CFN_TEMPLATE_URL_LIMIT, a as withRetry, at as synthesisStatusMessage, b as IAMRoleProvider, bt as uploadCfnTemplate, c as computeImplicitDeleteEdges, ct as resolveApp, d as isStatefulRecreateTargetSync, dt as resolveSkipPrefix, et as runDockerForeground, f as renderStatefulReason, ft as resolveStateBucketWithDefault, g as gray, gt as CFN_TEMPLATE_BODY_LIMIT, h as cyan, ht as warnDeprecatedNoPrefixCliFlag, i as withResourceDeadline, it as Synthesizer, j as DagBuilder, k as applyRoleArnIfSet, l as extractDeploymentEventError, lt as resolveAutoAssetStorage, m as bold, mt as resolveUseCdkBootstrapAssets, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as AssetManifestLoader, o as isRetryableTransientError, ot as getDefaultStateBucketName, p as formatResourceLine, pt as resolveStateBucketWithDefaultAndSource, q as getBootstrapMarkerKey, r as DeployEngine, rt as getDockerImageBySourceHash, s as IMPLICIT_DELETE_DEPENDENCIES, st as getLegacyStateBucketName, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as runDockerStreaming, u as MULTI_REGION_RECREATE_BLOCKED_TYPES, ut as resolveCaptureObservedState, v as red, vt as MIGRATE_TMP_PREFIX, w as CloudControlProvider, x as collectInlinePolicyNamesManagedBySiblings, xt as AssemblyReader, y as yellow, yt as findLargeInlineResources, z as WorkGraph } from "./deploy-engine-
|
|
5
|
+
import { $ as getDockerCmd, A as DiffCalculator, B as buildAssetRedirectMap, C as findActionableSilentDrops, Ct as resolveBucketRegion, D as refStateLookupFromResource, E as cfnRefValueFromPhysicalId, F as rebuildClientForBucketRegion, G as BOOTSTRAP_MARKER_PREFIX, H as loadPublishableAssetManifest, I as shouldRetainResource, J as parseBootstrapMarker, K as ensureAssetStorage, L as AssetPublisher, M as TemplateParser, N as LockManager, O as WAFv2WebACLProvider, P as S3StateBackend, Q as formatDockerLoginError, R as stringifyValue, S as ProviderRegistry, T as IntrinsicFunctionResolver, U as rewriteTemplateAssetReferences, V as createAssetRedirectResolver, W as AssetModeResolver, X as validateContainerRepoName, Y as validateAssetBucketName, Z as buildDockerImage, _ as green, _t as CFN_TEMPLATE_URL_LIMIT, a as withRetry, at as synthesisStatusMessage, b as IAMRoleProvider, bt as uploadCfnTemplate, c as computeImplicitDeleteEdges, ct as resolveApp, d as isStatefulRecreateTargetSync, dt as resolveSkipPrefix, et as runDockerForeground, f as renderStatefulReason, ft as resolveStateBucketWithDefault, g as gray, gt as CFN_TEMPLATE_BODY_LIMIT, h as cyan, ht as warnDeprecatedNoPrefixCliFlag, i as withResourceDeadline, it as Synthesizer, j as DagBuilder, k as applyRoleArnIfSet, l as extractDeploymentEventError, lt as resolveAutoAssetStorage, m as bold, mt as resolveUseCdkBootstrapAssets, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as AssetManifestLoader, o as isRetryableTransientError, ot as getDefaultStateBucketName, p as formatResourceLine, pt as resolveStateBucketWithDefaultAndSource, q as getBootstrapMarkerKey, r as DeployEngine, rt as getDockerImageBySourceHash, s as IMPLICIT_DELETE_DEPENDENCIES, st as getLegacyStateBucketName, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as runDockerStreaming, u as MULTI_REGION_RECREATE_BLOCKED_TYPES, ut as resolveCaptureObservedState, v as red, vt as MIGRATE_TMP_PREFIX, w as CloudControlProvider, x as collectInlinePolicyNamesManagedBySiblings, xt as AssemblyReader, y as yellow, yt as findLargeInlineResources, z as WorkGraph } from "./deploy-engine-D_OJrSGP.js";
|
|
6
6
|
import { t as expectedOwnerParam } from "./expected-bucket-owner-BjEfUnkA.js";
|
|
7
7
|
import { t as ASGProvider } from "./asg-provider-Dbl1_mwT.js";
|
|
8
8
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -61,9 +61,10 @@ import { AccessPointNotFound, CreateAccessPointCommand, CreateFileSystemCommand,
|
|
|
61
61
|
import { CreateDeliveryStreamCommand, DeleteDeliveryStreamCommand, DescribeDeliveryStreamCommand, FirehoseClient, ListDeliveryStreamsCommand, ListTagsForDeliveryStreamCommand, ResourceNotFoundException as ResourceNotFoundException$10, TagDeliveryStreamCommand, UntagDeliveryStreamCommand, UpdateDestinationCommand } from "@aws-sdk/client-firehose";
|
|
62
62
|
import { AddTagsCommand as AddTagsCommand$1, CloudTrailClient, CreateTrailCommand, DeleteTrailCommand, GetEventSelectorsCommand, GetInsightSelectorsCommand, GetTrailCommand, GetTrailStatusCommand, ListTagsCommand as ListTagsCommand$1, ListTrailsCommand, PutEventSelectorsCommand, PutInsightSelectorsCommand, RemoveTagsCommand as RemoveTagsCommand$1, StartLoggingCommand, StopLoggingCommand, TrailNotFoundException, UpdateTrailCommand } from "@aws-sdk/client-cloudtrail";
|
|
63
63
|
import { BatchGetProjectsCommand, CodeBuildClient, CreateProjectCommand, DeleteProjectCommand, ListProjectsCommand, ResourceNotFoundException as ResourceNotFoundException$11, UpdateProjectCommand } from "@aws-sdk/client-codebuild";
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
64
|
+
import { CodeCommitClient, CreateRepositoryCommand as CreateRepositoryCommand$1, DeleteRepositoryCommand as DeleteRepositoryCommand$1, GetRepositoryCommand, ListRepositoriesCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$17, RepositoryDoesNotExistException, TagResourceCommand as TagResourceCommand$15, UntagResourceCommand as UntagResourceCommand$15, UpdateRepositoryDescriptionCommand, UpdateRepositoryEncryptionKeyCommand, UpdateRepositoryNameCommand } from "@aws-sdk/client-codecommit";
|
|
65
|
+
import { CreateLifecyclePolicyCommand, DLMClient, DeleteLifecyclePolicyCommand as DeleteLifecyclePolicyCommand$1, GetLifecyclePoliciesCommand, GetLifecyclePolicyCommand as GetLifecyclePolicyCommand$1, ResourceNotFoundException as ResourceNotFoundException$12, TagResourceCommand as TagResourceCommand$16, UntagResourceCommand as UntagResourceCommand$16, UpdateLifecyclePolicyCommand } from "@aws-sdk/client-dlm";
|
|
66
|
+
import { CreateVectorBucketCommand, DeleteIndexCommand, DeleteVectorBucketCommand, GetVectorBucketCommand, ListIndexesCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$18, ListVectorBucketsCommand, S3VectorsClient, TagResourceCommand as TagResourceCommand$17, UntagResourceCommand as UntagResourceCommand$17 } from "@aws-sdk/client-s3vectors";
|
|
67
|
+
import { CreateNamespaceCommand, CreateTableBucketCommand, CreateTableCommand as CreateTableCommand$2, DeleteNamespaceCommand as DeleteNamespaceCommand$1, DeleteTableBucketCommand, DeleteTableCommand as DeleteTableCommand$2, GetTableBucketCommand, GetTableCommand as GetTableCommand$1, ListNamespacesCommand as ListNamespacesCommand$1, ListTableBucketsCommand, ListTablesCommand as ListTablesCommand$1, ListTagsForResourceCommand as ListTagsForResourceCommand$19, NotFoundException as NotFoundException$5, S3TablesClient, TagResourceCommand as TagResourceCommand$18, UntagResourceCommand as UntagResourceCommand$18 } from "@aws-sdk/client-s3tables";
|
|
67
68
|
import { Document, Pair, Scalar, YAMLMap, YAMLSeq, parse as parse$1, stringify } from "yaml";
|
|
68
69
|
import { createLocalStartAgentCoreCommand, createLocalStartCloudFrontCommand, createLocalStateProvider, getEmbedConfig, isCfnFlagPresent, listTargets, rejectExplicitCfnStackWithMultipleStacks, resolveCfnFallbackRegion, setEmbedConfig, substituteAgainstState, substituteAgainstStateAsync, substituteEnvVarsFromState, substituteEnvVarsFromStateAsync } from "cdk-local";
|
|
69
70
|
import { A2A_CONTAINER_PORT, A2A_PATH, AGENTCORE_A2A_PROTOCOL, AGENTCORE_AGUI_PROTOCOL, AGENTCORE_MCP_PROTOCOL, ConnectionRegistry, EcsTaskResolutionError, HOST_GATEWAY_MIN_VERSION, LocalInvokeBuildError, MCP_CONTAINER_PORT, MCP_PATH, a2aInvokeOnce, addAlbSpecificOptions, addCommonEcsServiceOptions, addStartServiceSpecificOptions, albStrategy, architectureToPlatform, attachAuthorizers, attachStageContext, availableApiIdentifiers, bufferToBody, buildAgentCoreCodeImage, buildCognitoJwksUrl, buildConnectEvent, buildContainerImage, buildCorsConfigByApiId, buildCorsConfigFromCloudFrontChain, buildDisconnectEvent, buildJwksUrlFromIssuer, buildMessageEvent, buildMgmtEndpointEnvUrl, buildStageMap, classifySourceChange, createAuthorizerCache, createFileWatcher, createFileWatcher as createFileWatcher$1, createJwksCache, createWatchPredicates, defaultCredentialsLoader, derivePseudoParametersFromRegion, discoverRoutes, discoverWebSocketApis, downloadAndExtractS3Bundle, filterRoutesByApiIdentifier, groupRoutesByServer, handleConnectionsRequest, invokeAgentCore, invokeAgentCoreWs, materializeLayerFromArn, mcpInvokeOnce, parseConnectionsPath, parseSelectionExpressionPath, pickAgentCoreCandidateStack, pickAgentCoreCandidateStack as pickAgentCoreCandidateStack$1, probeHostGatewaySupport, readMtlsMaterialsFromDisk, resolveAgentCoreTarget, resolveEnvVars, resolveHostGatewayExtraHosts, resolveRuntimeCodeMountPath, resolveRuntimeFileExtension, resolveRuntimeImage, resolveSingleTarget, resolveWatchConfig, runEcsServiceEmulator, signAgentCoreInvocation, startApiServer, substituteImagePlaceholders, tryResolveImageFnJoin, verifyJwtViaDiscovery, waitForAgentCorePing } from "cdk-local/internal";
|
|
@@ -1886,7 +1887,7 @@ const FLUSH_INTERVAL_MS = 2e3;
|
|
|
1886
1887
|
const FLUSH_EVENT_THRESHOLD = 50;
|
|
1887
1888
|
/** Build-time cdkd version, with a dev fallback for non-built contexts. */
|
|
1888
1889
|
function getCdkdVersion() {
|
|
1889
|
-
return "0.
|
|
1890
|
+
return "0.240.0";
|
|
1890
1891
|
}
|
|
1891
1892
|
/**
|
|
1892
1893
|
* Generate a time-sortable unique run id, e.g.
|
|
@@ -35163,6 +35164,293 @@ var CodeBuildProvider = class {
|
|
|
35163
35164
|
}
|
|
35164
35165
|
};
|
|
35165
35166
|
|
|
35167
|
+
//#endregion
|
|
35168
|
+
//#region src/provisioning/providers/codecommit-repository-provider.ts
|
|
35169
|
+
/**
|
|
35170
|
+
* Convert the CFn `Tags` list shape to CodeCommit's `Record<string, string>`
|
|
35171
|
+
* map. Entries without a string `Key` are skipped; non-string values are
|
|
35172
|
+
* stringified (post-intrinsic-resolution values can be numbers/booleans).
|
|
35173
|
+
* Returns `undefined` for an absent/empty list so callers can omit the field.
|
|
35174
|
+
*/
|
|
35175
|
+
function toSdkTagMap(tags) {
|
|
35176
|
+
if (!tags || tags.length === 0) return void 0;
|
|
35177
|
+
const out = {};
|
|
35178
|
+
for (const tag of tags) {
|
|
35179
|
+
if (typeof tag?.Key !== "string" || tag.Key.length === 0) continue;
|
|
35180
|
+
const value = tag.Value;
|
|
35181
|
+
out[tag.Key] = typeof value === "string" ? value : typeof value === "number" || typeof value === "boolean" ? String(value) : "";
|
|
35182
|
+
}
|
|
35183
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
35184
|
+
}
|
|
35185
|
+
/** Order-independent equality for two SDK tag maps. */
|
|
35186
|
+
function tagMapsEqual(a, b) {
|
|
35187
|
+
const aKeys = Object.keys(a);
|
|
35188
|
+
if (aKeys.length !== Object.keys(b).length) return false;
|
|
35189
|
+
return aKeys.every((k) => b[k] === a[k]);
|
|
35190
|
+
}
|
|
35191
|
+
/**
|
|
35192
|
+
* AWS CodeCommit Repository Provider
|
|
35193
|
+
*
|
|
35194
|
+
* Implements resource provisioning for AWS::CodeCommit::Repository using the
|
|
35195
|
+
* CodeCommit SDK. The type is `ProvisioningType: NON_PROVISIONABLE`, so the
|
|
35196
|
+
* Cloud Control fallback cannot handle it — without this SDK provider cdkd's
|
|
35197
|
+
* pre-flight rejects the type outright (issue #1045). CodeCommit returned to
|
|
35198
|
+
* full General Availability on 2025-11-24, so the service is fully usable for
|
|
35199
|
+
* new sign-ups again.
|
|
35200
|
+
*
|
|
35201
|
+
* Physical id: the repository NAME (every CodeCommit API is name-based;
|
|
35202
|
+
* there is no lookup-by-id API). CloudFormation's `Ref` returns the
|
|
35203
|
+
* repository ID (a GUID), so `create()` stores `RepositoryId` in attributes
|
|
35204
|
+
* and the intrinsic resolver's `cfnRefValueFromPhysicalId` recovers it via
|
|
35205
|
+
* `stateLookup` for CFn `Ref` parity.
|
|
35206
|
+
*/
|
|
35207
|
+
var CodeCommitRepositoryProvider = class {
|
|
35208
|
+
client;
|
|
35209
|
+
providerRegion = process.env["AWS_REGION"];
|
|
35210
|
+
logger = getLogger().child("CodeCommitRepositoryProvider");
|
|
35211
|
+
handledProperties = new Map([["AWS::CodeCommit::Repository", new Set([
|
|
35212
|
+
"RepositoryName",
|
|
35213
|
+
"RepositoryDescription",
|
|
35214
|
+
"KmsKeyId",
|
|
35215
|
+
"Tags"
|
|
35216
|
+
])]]);
|
|
35217
|
+
unhandledByDesign = new Map([["AWS::CodeCommit::Repository", new Map([["Code", "CFn-only seed-content orchestration (S3 zip unpacked into an initial commit on a chosen branch); not wired in v1 — pre-flight rejects templates carrying it so nothing is silently dropped; a follow-up could implement it via CreateCommit/PutFile"], ["Triggers", "repository trigger management not wired in v1 — pre-flight rejects templates carrying it so nothing is silently dropped; a follow-up could implement it via PutRepositoryTriggers"]])]]);
|
|
35218
|
+
getClient() {
|
|
35219
|
+
if (!this.client) this.client = new CodeCommitClient(this.providerRegion ? { region: this.providerRegion } : {});
|
|
35220
|
+
return this.client;
|
|
35221
|
+
}
|
|
35222
|
+
/**
|
|
35223
|
+
* Build the `Fn::GetAtt` attribute map from a `RepositoryMetadata`
|
|
35224
|
+
* response. `RepositoryId` is additionally stored so the intrinsic
|
|
35225
|
+
* resolver can recover CFn's `Ref` value (the repository ID) from state.
|
|
35226
|
+
*/
|
|
35227
|
+
toAttributes(metadata) {
|
|
35228
|
+
return {
|
|
35229
|
+
Arn: metadata?.Arn ?? "",
|
|
35230
|
+
CloneUrlHttp: metadata?.cloneUrlHttp ?? "",
|
|
35231
|
+
CloneUrlSsh: metadata?.cloneUrlSsh ?? "",
|
|
35232
|
+
Name: metadata?.repositoryName ?? "",
|
|
35233
|
+
KmsKeyId: metadata?.kmsKeyId ?? "",
|
|
35234
|
+
RepositoryId: metadata?.repositoryId ?? ""
|
|
35235
|
+
};
|
|
35236
|
+
}
|
|
35237
|
+
/**
|
|
35238
|
+
* Create a CodeCommit Repository
|
|
35239
|
+
*/
|
|
35240
|
+
async create(logicalId, resourceType, properties) {
|
|
35241
|
+
this.logger.debug(`Creating CodeCommit Repository ${logicalId}`);
|
|
35242
|
+
const repositoryName = properties["RepositoryName"] || generateResourceName(logicalId, { maxLength: 100 });
|
|
35243
|
+
try {
|
|
35244
|
+
const tags = toSdkTagMap(properties["Tags"]);
|
|
35245
|
+
const description = properties["RepositoryDescription"];
|
|
35246
|
+
const kmsKeyId = properties["KmsKeyId"];
|
|
35247
|
+
const metadata = (await this.getClient().send(new CreateRepositoryCommand$1({
|
|
35248
|
+
repositoryName,
|
|
35249
|
+
...description !== void 0 ? { repositoryDescription: description } : {},
|
|
35250
|
+
...kmsKeyId !== void 0 ? { kmsKeyId } : {},
|
|
35251
|
+
...tags ? { tags } : {}
|
|
35252
|
+
}))).repositoryMetadata;
|
|
35253
|
+
if (!metadata?.repositoryName) throw new Error("CreateRepository did not return repository metadata");
|
|
35254
|
+
this.logger.debug(`Successfully created CodeCommit Repository ${logicalId}: ${metadata.repositoryName}`);
|
|
35255
|
+
return {
|
|
35256
|
+
physicalId: metadata.repositoryName,
|
|
35257
|
+
attributes: this.toAttributes(metadata)
|
|
35258
|
+
};
|
|
35259
|
+
} catch (error) {
|
|
35260
|
+
const cause = error instanceof Error ? error : void 0;
|
|
35261
|
+
throw new ProvisioningError(`Failed to create CodeCommit Repository ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, repositoryName, cause);
|
|
35262
|
+
}
|
|
35263
|
+
}
|
|
35264
|
+
/**
|
|
35265
|
+
* Update a CodeCommit Repository
|
|
35266
|
+
*
|
|
35267
|
+
* Mutable properties: RepositoryName (UpdateRepositoryName — CFn's docs
|
|
35268
|
+
* mark the property "Update requires: No interruption" and the registry
|
|
35269
|
+
* schema's createOnlyProperties is empty, so CFn parity is an IN-PLACE
|
|
35270
|
+
* rename that preserves the repository's git history; the repository ID —
|
|
35271
|
+
* CFn's `Ref` value — survives the rename), RepositoryDescription
|
|
35272
|
+
* (UpdateRepositoryDescription), KmsKeyId (UpdateRepositoryEncryptionKey),
|
|
35273
|
+
* Tags (TagResource / UntagResource — full tag removal handled explicitly,
|
|
35274
|
+
* see the ECR Tags regression class in issue #981).
|
|
35275
|
+
*
|
|
35276
|
+
* A rename returns the NEW repository name as `physicalId` with
|
|
35277
|
+
* `wasReplaced: false`; the deploy engine persists the returned physical
|
|
35278
|
+
* id into state unconditionally.
|
|
35279
|
+
*/
|
|
35280
|
+
async update(logicalId, physicalId, _resourceType, properties, previousProperties) {
|
|
35281
|
+
this.logger.debug(`Updating CodeCommit Repository ${logicalId} (${physicalId})`);
|
|
35282
|
+
let currentName = physicalId;
|
|
35283
|
+
try {
|
|
35284
|
+
const newName = properties["RepositoryName"];
|
|
35285
|
+
if (newName && newName !== physicalId) {
|
|
35286
|
+
try {
|
|
35287
|
+
await this.getClient().send(new UpdateRepositoryNameCommand({
|
|
35288
|
+
oldName: physicalId,
|
|
35289
|
+
newName
|
|
35290
|
+
}));
|
|
35291
|
+
} catch (err) {
|
|
35292
|
+
if (!(err instanceof RepositoryDoesNotExistException)) throw err;
|
|
35293
|
+
await this.getRepositoryMetadata(newName);
|
|
35294
|
+
this.logger.debug(`Rename ${physicalId} -> ${newName} already applied by a previous attempt`);
|
|
35295
|
+
}
|
|
35296
|
+
currentName = newName;
|
|
35297
|
+
this.logger.debug(`Renamed CodeCommit Repository ${physicalId} -> ${newName}`);
|
|
35298
|
+
}
|
|
35299
|
+
const newDescription = properties["RepositoryDescription"];
|
|
35300
|
+
if (newDescription !== previousProperties["RepositoryDescription"]) {
|
|
35301
|
+
await this.getClient().send(new UpdateRepositoryDescriptionCommand({
|
|
35302
|
+
repositoryName: currentName,
|
|
35303
|
+
repositoryDescription: newDescription ?? ""
|
|
35304
|
+
}));
|
|
35305
|
+
this.logger.debug(`Updated description for ${currentName}`);
|
|
35306
|
+
}
|
|
35307
|
+
const newKmsKeyId = properties["KmsKeyId"];
|
|
35308
|
+
if (newKmsKeyId !== previousProperties["KmsKeyId"]) {
|
|
35309
|
+
await this.getClient().send(new UpdateRepositoryEncryptionKeyCommand({
|
|
35310
|
+
repositoryName: currentName,
|
|
35311
|
+
kmsKeyId: newKmsKeyId ?? "alias/aws/codecommit"
|
|
35312
|
+
}));
|
|
35313
|
+
this.logger.debug(`Updated encryption key for ${currentName}`);
|
|
35314
|
+
}
|
|
35315
|
+
const newTags = properties["Tags"];
|
|
35316
|
+
const oldTags = previousProperties["Tags"];
|
|
35317
|
+
const newTagMap = toSdkTagMap(newTags) ?? {};
|
|
35318
|
+
const oldTagMap = toSdkTagMap(oldTags) ?? {};
|
|
35319
|
+
let metadata;
|
|
35320
|
+
if (!tagMapsEqual(newTagMap, oldTagMap)) {
|
|
35321
|
+
metadata = await this.getRepositoryMetadata(currentName);
|
|
35322
|
+
const repoArn = metadata?.Arn;
|
|
35323
|
+
if (repoArn) {
|
|
35324
|
+
const removedKeys = Object.keys(oldTagMap).filter((k) => !(k in newTagMap));
|
|
35325
|
+
if (removedKeys.length > 0) await this.getClient().send(new UntagResourceCommand$15({
|
|
35326
|
+
resourceArn: repoArn,
|
|
35327
|
+
tagKeys: removedKeys
|
|
35328
|
+
}));
|
|
35329
|
+
if (Object.keys(newTagMap).length > 0) await this.getClient().send(new TagResourceCommand$15({
|
|
35330
|
+
resourceArn: repoArn,
|
|
35331
|
+
tags: newTagMap
|
|
35332
|
+
}));
|
|
35333
|
+
this.logger.debug(`Updated tags for ${currentName}`);
|
|
35334
|
+
} else this.logger.warn(`Could not resolve ARN for CodeCommit Repository ${currentName}; tag update skipped`);
|
|
35335
|
+
}
|
|
35336
|
+
metadata = await this.getRepositoryMetadata(currentName);
|
|
35337
|
+
return {
|
|
35338
|
+
physicalId: currentName,
|
|
35339
|
+
wasReplaced: false,
|
|
35340
|
+
attributes: this.toAttributes(metadata)
|
|
35341
|
+
};
|
|
35342
|
+
} catch (error) {
|
|
35343
|
+
const cause = error instanceof Error ? error : void 0;
|
|
35344
|
+
throw new ProvisioningError(`Failed to update CodeCommit Repository ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, _resourceType, logicalId, physicalId, cause);
|
|
35345
|
+
}
|
|
35346
|
+
}
|
|
35347
|
+
/**
|
|
35348
|
+
* Delete a CodeCommit Repository
|
|
35349
|
+
*
|
|
35350
|
+
* `DeleteRepository` is idempotent on the AWS side: for an
|
|
35351
|
+
* already-deleted repository it does NOT throw — it returns a null
|
|
35352
|
+
* `repositoryId`. That silent-success shape would bypass the shared
|
|
35353
|
+
* region check entirely (the exact scenario `assertRegionMatch` exists
|
|
35354
|
+
* for: a client pointed at region B while the state says the repo lives
|
|
35355
|
+
* in region A), so a null `repositoryId` runs the region check before
|
|
35356
|
+
* being treated as idempotent success. A
|
|
35357
|
+
* `RepositoryDoesNotExistException` is additionally handled (same
|
|
35358
|
+
* check) for defense in depth.
|
|
35359
|
+
*/
|
|
35360
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
35361
|
+
this.logger.debug(`Deleting CodeCommit Repository ${logicalId}: ${physicalId}`);
|
|
35362
|
+
let deletedRepositoryId;
|
|
35363
|
+
try {
|
|
35364
|
+
deletedRepositoryId = (await this.getClient().send(new DeleteRepositoryCommand$1({ repositoryName: physicalId }))).repositoryId;
|
|
35365
|
+
} catch (error) {
|
|
35366
|
+
if (error instanceof RepositoryDoesNotExistException) {
|
|
35367
|
+
assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
|
|
35368
|
+
this.logger.debug(`CodeCommit Repository ${physicalId} does not exist, skipping deletion`);
|
|
35369
|
+
return;
|
|
35370
|
+
}
|
|
35371
|
+
const cause = error instanceof Error ? error : void 0;
|
|
35372
|
+
throw new ProvisioningError(`Failed to delete CodeCommit Repository ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
|
|
35373
|
+
}
|
|
35374
|
+
if (!deletedRepositoryId) {
|
|
35375
|
+
assertRegionMatch(await this.getClient().config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
|
|
35376
|
+
this.logger.debug(`CodeCommit Repository ${physicalId} does not exist, skipping deletion`);
|
|
35377
|
+
return;
|
|
35378
|
+
}
|
|
35379
|
+
this.logger.debug(`Successfully deleted CodeCommit Repository ${logicalId}`);
|
|
35380
|
+
}
|
|
35381
|
+
/**
|
|
35382
|
+
* Get repository attributes for Fn::GetAtt resolution.
|
|
35383
|
+
*
|
|
35384
|
+
* Supported: `Arn`, `CloneUrlHttp`, `CloneUrlSsh`, `Name`, `KmsKeyId`
|
|
35385
|
+
* (the CFn-documented attribute set).
|
|
35386
|
+
*/
|
|
35387
|
+
async getAttribute(physicalId, _resourceType, attributeName) {
|
|
35388
|
+
switch (attributeName) {
|
|
35389
|
+
case "Name": return physicalId;
|
|
35390
|
+
case "Arn":
|
|
35391
|
+
case "CloneUrlHttp":
|
|
35392
|
+
case "CloneUrlSsh":
|
|
35393
|
+
case "KmsKeyId": {
|
|
35394
|
+
const metadata = await this.getRepositoryMetadata(physicalId);
|
|
35395
|
+
return this.toAttributes(metadata)[attributeName];
|
|
35396
|
+
}
|
|
35397
|
+
default: return;
|
|
35398
|
+
}
|
|
35399
|
+
}
|
|
35400
|
+
/**
|
|
35401
|
+
* Adopt an existing CodeCommit repository into cdkd state.
|
|
35402
|
+
*
|
|
35403
|
+
* Lookup order:
|
|
35404
|
+
* 1. `--resource` override or `Properties.RepositoryName` → verify via
|
|
35405
|
+
* `GetRepository`.
|
|
35406
|
+
* 2. `ListRepositories` paginated, then `ListTagsForResource(arn)` per
|
|
35407
|
+
* repository to match `aws:cdk:path` (CodeCommit uses the
|
|
35408
|
+
* `Record<string, string>` tag-map shape).
|
|
35409
|
+
*/
|
|
35410
|
+
async import(input) {
|
|
35411
|
+
const explicit = resolveExplicitPhysicalId(input, "RepositoryName");
|
|
35412
|
+
if (explicit) try {
|
|
35413
|
+
const resp = await this.getClient().send(new GetRepositoryCommand({ repositoryName: explicit }));
|
|
35414
|
+
return resp.repositoryMetadata?.repositoryName ? {
|
|
35415
|
+
physicalId: explicit,
|
|
35416
|
+
attributes: this.toAttributes(resp.repositoryMetadata)
|
|
35417
|
+
} : null;
|
|
35418
|
+
} catch (err) {
|
|
35419
|
+
if (err instanceof RepositoryDoesNotExistException) return null;
|
|
35420
|
+
throw err;
|
|
35421
|
+
}
|
|
35422
|
+
if (!input.cdkPath) return null;
|
|
35423
|
+
let nextToken;
|
|
35424
|
+
do {
|
|
35425
|
+
const list = await this.getClient().send(new ListRepositoriesCommand({ ...nextToken && { nextToken } }));
|
|
35426
|
+
for (const repo of list.repositories ?? []) {
|
|
35427
|
+
if (!repo.repositoryName) continue;
|
|
35428
|
+
let metadata;
|
|
35429
|
+
try {
|
|
35430
|
+
metadata = await this.getRepositoryMetadata(repo.repositoryName);
|
|
35431
|
+
} catch (err) {
|
|
35432
|
+
if (err instanceof RepositoryDoesNotExistException) continue;
|
|
35433
|
+
throw err;
|
|
35434
|
+
}
|
|
35435
|
+
if (!metadata?.Arn) continue;
|
|
35436
|
+
if ((await this.getClient().send(new ListTagsForResourceCommand$17({ resourceArn: metadata.Arn }))).tags?.["aws:cdk:path"] === input.cdkPath) return {
|
|
35437
|
+
physicalId: repo.repositoryName,
|
|
35438
|
+
attributes: this.toAttributes(metadata)
|
|
35439
|
+
};
|
|
35440
|
+
}
|
|
35441
|
+
nextToken = list.nextToken;
|
|
35442
|
+
} while (nextToken);
|
|
35443
|
+
return null;
|
|
35444
|
+
}
|
|
35445
|
+
/**
|
|
35446
|
+
* Fetch the repository's metadata via `GetRepository`. Throws
|
|
35447
|
+
* `RepositoryDoesNotExistException` through to the caller.
|
|
35448
|
+
*/
|
|
35449
|
+
async getRepositoryMetadata(repositoryName) {
|
|
35450
|
+
return (await this.getClient().send(new GetRepositoryCommand({ repositoryName }))).repositoryMetadata;
|
|
35451
|
+
}
|
|
35452
|
+
};
|
|
35453
|
+
|
|
35166
35454
|
//#endregion
|
|
35167
35455
|
//#region src/provisioning/providers/dlm-lifecycle-policy-provider.ts
|
|
35168
35456
|
/**
|
|
@@ -35295,7 +35583,7 @@ var DLMLifecyclePolicyProvider = class {
|
|
|
35295
35583
|
if (tagsChanged && arn) {
|
|
35296
35584
|
const removedKeys = Object.keys(oldTags).filter((k) => !(k in newTags));
|
|
35297
35585
|
if (removedKeys.length > 0) {
|
|
35298
|
-
await this.getClient().send(new UntagResourceCommand$
|
|
35586
|
+
await this.getClient().send(new UntagResourceCommand$16({
|
|
35299
35587
|
ResourceArn: arn,
|
|
35300
35588
|
TagKeys: removedKeys
|
|
35301
35589
|
}));
|
|
@@ -35304,7 +35592,7 @@ var DLMLifecyclePolicyProvider = class {
|
|
|
35304
35592
|
const tagsToAdd = {};
|
|
35305
35593
|
for (const [k, v] of Object.entries(newTags)) if (oldTags[k] !== v) tagsToAdd[k] = v;
|
|
35306
35594
|
if (Object.keys(tagsToAdd).length > 0) {
|
|
35307
|
-
await this.getClient().send(new TagResourceCommand$
|
|
35595
|
+
await this.getClient().send(new TagResourceCommand$16({
|
|
35308
35596
|
ResourceArn: arn,
|
|
35309
35597
|
Tags: tagsToAdd
|
|
35310
35598
|
}));
|
|
@@ -35507,11 +35795,11 @@ var S3VectorsProvider = class {
|
|
|
35507
35795
|
}
|
|
35508
35796
|
if (!resourceArn) throw new ProvisioningError(`Could not resolve ARN for S3 VectorBucket ${logicalId} (${physicalId}); cannot apply tag update.`, resourceType, logicalId, physicalId);
|
|
35509
35797
|
try {
|
|
35510
|
-
if (Object.keys(toSet).length > 0) await this.getClient().send(new TagResourceCommand$
|
|
35798
|
+
if (Object.keys(toSet).length > 0) await this.getClient().send(new TagResourceCommand$17({
|
|
35511
35799
|
resourceArn,
|
|
35512
35800
|
tags: toSet
|
|
35513
35801
|
}));
|
|
35514
|
-
if (toRemove.length > 0) await this.getClient().send(new UntagResourceCommand$
|
|
35802
|
+
if (toRemove.length > 0) await this.getClient().send(new UntagResourceCommand$17({
|
|
35515
35803
|
resourceArn,
|
|
35516
35804
|
tagKeys: toRemove
|
|
35517
35805
|
}));
|
|
@@ -35639,7 +35927,7 @@ var S3VectorsProvider = class {
|
|
|
35639
35927
|
if (Object.keys(enc).length > 0) result["EncryptionConfiguration"] = enc;
|
|
35640
35928
|
}
|
|
35641
35929
|
if (bucket?.vectorBucketArn) try {
|
|
35642
|
-
result["Tags"] = normalizeAwsTagsToCfn((await this.getClient().send(new ListTagsForResourceCommand$
|
|
35930
|
+
result["Tags"] = normalizeAwsTagsToCfn((await this.getClient().send(new ListTagsForResourceCommand$18({ resourceArn: bucket.vectorBucketArn }))).tags);
|
|
35643
35931
|
} catch (err) {
|
|
35644
35932
|
this.logger.debug(`S3Vectors ListTagsForResource(${bucket.vectorBucketArn}) failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
35645
35933
|
result["Tags"] = [];
|
|
@@ -35675,7 +35963,7 @@ var S3VectorsProvider = class {
|
|
|
35675
35963
|
for (const bucket of list.vectorBuckets ?? []) {
|
|
35676
35964
|
if (!bucket.vectorBucketName || !bucket.vectorBucketArn) continue;
|
|
35677
35965
|
try {
|
|
35678
|
-
if ((await this.getClient().send(new ListTagsForResourceCommand$
|
|
35966
|
+
if ((await this.getClient().send(new ListTagsForResourceCommand$18({ resourceArn: bucket.vectorBucketArn }))).tags?.["aws:cdk:path"] === input.cdkPath) return {
|
|
35679
35967
|
physicalId: bucket.vectorBucketName,
|
|
35680
35968
|
attributes: {}
|
|
35681
35969
|
};
|
|
@@ -36285,7 +36573,7 @@ var S3TablesProvider = class {
|
|
|
36285
36573
|
attributes: {}
|
|
36286
36574
|
};
|
|
36287
36575
|
if (input.cdkPath) try {
|
|
36288
|
-
if ((await this.getClient().send(new ListTagsForResourceCommand$
|
|
36576
|
+
if ((await this.getClient().send(new ListTagsForResourceCommand$19({ resourceArn: bucket.arn }))).tags?.["aws:cdk:path"] === input.cdkPath) return {
|
|
36289
36577
|
physicalId: bucket.arn,
|
|
36290
36578
|
attributes: {}
|
|
36291
36579
|
};
|
|
@@ -36352,7 +36640,7 @@ var S3TablesProvider = class {
|
|
|
36352
36640
|
for (const table of tables.tables ?? []) {
|
|
36353
36641
|
if (!table.name || !table.tableARN) continue;
|
|
36354
36642
|
try {
|
|
36355
|
-
if ((await this.getClient().send(new ListTagsForResourceCommand$
|
|
36643
|
+
if ((await this.getClient().send(new ListTagsForResourceCommand$19({ resourceArn: table.tableARN }))).tags?.["aws:cdk:path"] === input.cdkPath) return {
|
|
36356
36644
|
physicalId: `${bucket.arn}|${namespaceName}|${table.name}`,
|
|
36357
36645
|
attributes: {}
|
|
36358
36646
|
};
|
|
@@ -36448,7 +36736,7 @@ var S3TablesProvider = class {
|
|
|
36448
36736
|
*/
|
|
36449
36737
|
async readTagsBestEffort(resourceArn) {
|
|
36450
36738
|
try {
|
|
36451
|
-
const tags = (await this.getClient().send(new ListTagsForResourceCommand$
|
|
36739
|
+
const tags = (await this.getClient().send(new ListTagsForResourceCommand$19({ resourceArn }))).tags ?? {};
|
|
36452
36740
|
const out = [];
|
|
36453
36741
|
for (const [Key, Value] of Object.entries(tags)) out.push({
|
|
36454
36742
|
Key,
|
|
@@ -36502,7 +36790,7 @@ var S3TablesProvider = class {
|
|
|
36502
36790
|
const resourceArn = await this.lookupTableArn(tableBucketARN, namespace, name);
|
|
36503
36791
|
if (!resourceArn) throw new ProvisioningError(`applyTableTagsDiff: GetTable returned no tableARN for ${physicalId} — table is gone or state is out-of-sync. Refusing to silently drop the tag update (run 'cdkd state orphan ${logicalId}' to clean up if the table was deleted out-of-band).`, resourceType, logicalId, physicalId);
|
|
36504
36792
|
if (removedKeys.length > 0) try {
|
|
36505
|
-
await this.getClient().send(new UntagResourceCommand$
|
|
36793
|
+
await this.getClient().send(new UntagResourceCommand$18({
|
|
36506
36794
|
resourceArn,
|
|
36507
36795
|
tagKeys: removedKeys
|
|
36508
36796
|
}));
|
|
@@ -36511,7 +36799,7 @@ var S3TablesProvider = class {
|
|
|
36511
36799
|
throw new ProvisioningError(`applyTableTagsDiff: UntagResource failed for ${resourceArn} (keys: ${removedKeys.join(", ")}): ${err instanceof Error ? err.message : String(err)}. State has NOT been updated so the next deploy will retry the tag-diff.`, resourceType, logicalId, physicalId, cause);
|
|
36512
36800
|
}
|
|
36513
36801
|
if (Object.keys(upserts).length > 0) try {
|
|
36514
|
-
await this.getClient().send(new TagResourceCommand$
|
|
36802
|
+
await this.getClient().send(new TagResourceCommand$18({
|
|
36515
36803
|
resourceArn,
|
|
36516
36804
|
tags: upserts
|
|
36517
36805
|
}));
|
|
@@ -36543,7 +36831,7 @@ var S3TablesProvider = class {
|
|
|
36543
36831
|
if (removedKeys.length === 0 && Object.keys(upserts).length === 0) return;
|
|
36544
36832
|
const resourceArn = physicalId;
|
|
36545
36833
|
if (removedKeys.length > 0) try {
|
|
36546
|
-
await this.getClient().send(new UntagResourceCommand$
|
|
36834
|
+
await this.getClient().send(new UntagResourceCommand$18({
|
|
36547
36835
|
resourceArn,
|
|
36548
36836
|
tagKeys: removedKeys
|
|
36549
36837
|
}));
|
|
@@ -36552,7 +36840,7 @@ var S3TablesProvider = class {
|
|
|
36552
36840
|
throw new ProvisioningError(`applyTableBucketTagsDiff: UntagResource failed for ${resourceArn} (keys: ${removedKeys.join(", ")}): ${err instanceof Error ? err.message : String(err)}. State has NOT been updated so the next deploy will retry the tag-diff.`, resourceType, logicalId, physicalId, cause);
|
|
36553
36841
|
}
|
|
36554
36842
|
if (Object.keys(upserts).length > 0) try {
|
|
36555
|
-
await this.getClient().send(new TagResourceCommand$
|
|
36843
|
+
await this.getClient().send(new TagResourceCommand$18({
|
|
36556
36844
|
resourceArn,
|
|
36557
36845
|
tags: upserts
|
|
36558
36846
|
}));
|
|
@@ -38199,6 +38487,7 @@ function registerAllProviders(registry) {
|
|
|
38199
38487
|
registry.register("AWS::KinesisFirehose::DeliveryStream", new FirehoseProvider());
|
|
38200
38488
|
registry.register("AWS::CloudTrail::Trail", new CloudTrailProvider());
|
|
38201
38489
|
registry.register("AWS::CodeBuild::Project", new CodeBuildProvider());
|
|
38490
|
+
registry.register("AWS::CodeCommit::Repository", new CodeCommitRepositoryProvider());
|
|
38202
38491
|
registry.register("AWS::DLM::LifecyclePolicy", new DLMLifecyclePolicyProvider());
|
|
38203
38492
|
registry.register("AWS::S3Vectors::VectorBucket", new S3VectorsProvider());
|
|
38204
38493
|
registry.register("AWS::ECR::Repository", new ECRProvider());
|
|
@@ -57472,7 +57761,7 @@ function reorderArgs(argv) {
|
|
|
57472
57761
|
async function main() {
|
|
57473
57762
|
installPipeCloseHandler();
|
|
57474
57763
|
const program = new Command();
|
|
57475
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
57764
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.240.0");
|
|
57476
57765
|
program.addCommand(createBootstrapCommand());
|
|
57477
57766
|
program.addCommand(createSynthCommand());
|
|
57478
57767
|
program.addCommand(createListCommand());
|