@go-to-k/cdkd 0.214.0 → 0.215.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-DWUnLza1.js";
|
|
3
|
-
import { $ as CFN_TEMPLATE_URL_LIMIT, A as DagBuilder, B as getDockerCmd, C as CloudControlProvider, D as IntrinsicFunctionResolver, Dt as withErrorHandling, E as isTerminationProtectionPropagationError, Et as normalizeAwsError, F as AssetPublisher, Ft as generateResourceName, G as getLegacyStateBucketName, H as runDockerStreaming, I as stringifyValue, It as generateResourceNameWithFallback, J as resolveSkipPrefix, K as resolveApp, L as WorkGraph, Lt as withSkipPrefix, M as LockManager, Mt as getLiveRenderer, N as S3StateBackend, Nt as PATTERN_B_NAME_PROPERTIES, O as applyRoleArnIfSet, P as shouldRetainResource, Pt as PATTERN_B_RESOURCE_TYPES, Q as CFN_TEMPLATE_BODY_LIMIT, R as buildDockerImage, Rt as withStackName, S as findActionableSilentDrops, T as disableInstanceApiTermination, U as Synthesizer, V as runDockerForeground, W as getDefaultStateBucketName, X as resolveStateBucketWithDefaultAndSource, Y as resolveStateBucketWithDefault, Z as warnDeprecatedNoPrefixCliFlag, _ as CDK_PATH_TAG, _t as ProvisioningError, a as withRetry, at as resolveBucketRegion, b as resolveExplicitPhysicalId, bt as StackHasActiveImportsError, c as formatResourceLine, d as gray, dt as LocalMigrateError, et as MIGRATE_TMP_PREFIX, f as green, ft as LocalStartServiceError, g as collectInlinePolicyNamesManagedBySiblings, gt as PartialFailureError, h as IAMRoleProvider, ht as NestedStackChildDirectDestroyError, i as withResourceDeadline, j as TemplateParser, jt as runStackBuffered, k as DiffCalculator, kt as getLogger, l as bold, m as yellow, mt as MissingCdkCliError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as uploadCfnTemplate, o as isRetryableTransientError, p as red, q as resolveCaptureObservedState, r as DeployEngine, rt as AssemblyReader, s as IMPLICIT_DELETE_DEPENDENCIES, st as CdkdError, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as findLargeInlineResources, u as cyan, ut as LocalInvokeBuildError$1, v as matchesCdkPath, vt as ResourceTimeoutError, w as assertRegionMatch, x as ProviderRegistry, xt as StackTerminationProtectionError, y as normalizeAwsTagsToCfn, yt as ResourceUpdateNotSupportedError, z as formatDockerLoginError } from "./deploy-engine-
|
|
3
|
+
import { $ as CFN_TEMPLATE_URL_LIMIT, A as DagBuilder, B as getDockerCmd, C as CloudControlProvider, D as IntrinsicFunctionResolver, Dt as withErrorHandling, E as isTerminationProtectionPropagationError, Et as normalizeAwsError, F as AssetPublisher, Ft as generateResourceName, G as getLegacyStateBucketName, H as runDockerStreaming, I as stringifyValue, It as generateResourceNameWithFallback, J as resolveSkipPrefix, K as resolveApp, L as WorkGraph, Lt as withSkipPrefix, M as LockManager, Mt as getLiveRenderer, N as S3StateBackend, Nt as PATTERN_B_NAME_PROPERTIES, O as applyRoleArnIfSet, P as shouldRetainResource, Pt as PATTERN_B_RESOURCE_TYPES, Q as CFN_TEMPLATE_BODY_LIMIT, R as buildDockerImage, Rt as withStackName, S as findActionableSilentDrops, T as disableInstanceApiTermination, U as Synthesizer, V as runDockerForeground, W as getDefaultStateBucketName, X as resolveStateBucketWithDefaultAndSource, Y as resolveStateBucketWithDefault, Z as warnDeprecatedNoPrefixCliFlag, _ as CDK_PATH_TAG, _t as ProvisioningError, a as withRetry, at as resolveBucketRegion, b as resolveExplicitPhysicalId, bt as StackHasActiveImportsError, c as formatResourceLine, d as gray, dt as LocalMigrateError, et as MIGRATE_TMP_PREFIX, f as green, ft as LocalStartServiceError, g as collectInlinePolicyNamesManagedBySiblings, gt as PartialFailureError, h as IAMRoleProvider, ht as NestedStackChildDirectDestroyError, i as withResourceDeadline, j as TemplateParser, jt as runStackBuffered, k as DiffCalculator, kt as getLogger, l as bold, m as yellow, mt as MissingCdkCliError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as uploadCfnTemplate, o as isRetryableTransientError, p as red, q as resolveCaptureObservedState, r as DeployEngine, rt as AssemblyReader, s as IMPLICIT_DELETE_DEPENDENCIES, st as CdkdError, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as findLargeInlineResources, u as cyan, ut as LocalInvokeBuildError$1, v as matchesCdkPath, vt as ResourceTimeoutError, w as assertRegionMatch, x as ProviderRegistry, xt as StackTerminationProtectionError, y as normalizeAwsTagsToCfn, yt as ResourceUpdateNotSupportedError, z as formatDockerLoginError } from "./deploy-engine-C9fD8IOo.js";
|
|
4
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
5
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
6
6
|
import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, 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";
|
|
@@ -53,7 +53,7 @@ import { AppSyncClient, CreateApiKeyCommand, CreateDataSourceCommand, CreateGrap
|
|
|
53
53
|
import { parse, print } from "graphql";
|
|
54
54
|
import { CreateConnectionCommand, CreateCrawlerCommand, CreateDatabaseCommand, CreateJobCommand, CreateSecurityConfigurationCommand, CreateTableCommand as CreateTableCommand$1, CreateTriggerCommand, CreateWorkflowCommand, DeleteConnectionCommand, DeleteCrawlerCommand, DeleteDatabaseCommand, DeleteJobCommand, DeleteSecurityConfigurationCommand, DeleteTableCommand as DeleteTableCommand$1, DeleteTriggerCommand, DeleteWorkflowCommand, EntityNotFoundException, GetConnectionCommand, GetCrawlerCommand, GetDatabaseCommand, GetDatabasesCommand, GetJobCommand, GetSecurityConfigurationCommand, GetSecurityConfigurationsCommand, GetTableCommand, GetTablesCommand, GetTagsCommand, GetTriggerCommand, GetWorkflowCommand, GlueClient, ListWorkflowsCommand, StartCrawlerScheduleCommand, StartTriggerCommand, StopCrawlerScheduleCommand, StopTriggerCommand, UpdateConnectionCommand, UpdateCrawlerCommand, UpdateDatabaseCommand, UpdateJobCommand, UpdateTableCommand as UpdateTableCommand$1, UpdateTriggerCommand, UpdateWorkflowCommand } from "@aws-sdk/client-glue";
|
|
55
55
|
import { AddTagsToStreamCommand, CreateStreamCommand, DecreaseStreamRetentionPeriodCommand, DeleteStreamCommand, DeregisterStreamConsumerCommand, DescribeStreamCommand, DescribeStreamConsumerCommand, IncreaseStreamRetentionPeriodCommand, KinesisClient, ListStreamsCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$17, ListTagsForStreamCommand, RegisterStreamConsumerCommand, RemoveTagsFromStreamCommand, ResourceNotFoundException as ResourceNotFoundException$8, StartStreamEncryptionCommand, StopStreamEncryptionCommand, TagResourceCommand as TagResourceCommand$15, UntagResourceCommand as UntagResourceCommand$14, UpdateShardCountCommand } from "@aws-sdk/client-kinesis";
|
|
56
|
-
import { AccessPointNotFound, CreateAccessPointCommand, CreateFileSystemCommand, CreateMountTargetCommand, DeleteAccessPointCommand, DeleteFileSystemCommand, DeleteMountTargetCommand, DescribeAccessPointsCommand, DescribeBackupPolicyCommand, DescribeFileSystemsCommand, DescribeLifecycleConfigurationCommand, DescribeMountTargetSecurityGroupsCommand, DescribeMountTargetsCommand, EFSClient, FileSystemNotFound, ModifyMountTargetSecurityGroupsCommand, MountTargetNotFound, UpdateFileSystemCommand } from "@aws-sdk/client-efs";
|
|
56
|
+
import { AccessPointNotFound, CreateAccessPointCommand, CreateFileSystemCommand, CreateMountTargetCommand, DeleteAccessPointCommand, DeleteFileSystemCommand, DeleteMountTargetCommand, DescribeAccessPointsCommand, DescribeBackupPolicyCommand, DescribeFileSystemPolicyCommand, DescribeFileSystemsCommand, DescribeLifecycleConfigurationCommand, DescribeMountTargetSecurityGroupsCommand, DescribeMountTargetsCommand, EFSClient, FileSystemNotFound, ModifyMountTargetSecurityGroupsCommand, MountTargetNotFound, PutBackupPolicyCommand, PutFileSystemPolicyCommand, PutLifecycleConfigurationCommand, UpdateFileSystemCommand, UpdateFileSystemProtectionCommand } from "@aws-sdk/client-efs";
|
|
57
57
|
import { CreateDeliveryStreamCommand, DeleteDeliveryStreamCommand, DescribeDeliveryStreamCommand, FirehoseClient, ListDeliveryStreamsCommand, ListTagsForDeliveryStreamCommand, ResourceNotFoundException as ResourceNotFoundException$9, TagDeliveryStreamCommand, UntagDeliveryStreamCommand, UpdateDestinationCommand } from "@aws-sdk/client-firehose";
|
|
58
58
|
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";
|
|
59
59
|
import { BatchGetProjectsCommand, CodeBuildClient, CreateProjectCommand, DeleteProjectCommand, ListProjectsCommand, ResourceNotFoundException as ResourceNotFoundException$10, UpdateProjectCommand } from "@aws-sdk/client-codebuild";
|
|
@@ -29112,7 +29112,13 @@ var EFSProvider = class {
|
|
|
29112
29112
|
"KmsKeyId",
|
|
29113
29113
|
"PerformanceMode",
|
|
29114
29114
|
"ThroughputMode",
|
|
29115
|
-
"ProvisionedThroughputInMibps"
|
|
29115
|
+
"ProvisionedThroughputInMibps",
|
|
29116
|
+
"AvailabilityZoneName",
|
|
29117
|
+
"LifecyclePolicies",
|
|
29118
|
+
"BackupPolicy",
|
|
29119
|
+
"FileSystemPolicy",
|
|
29120
|
+
"BypassPolicyLockoutSafetyCheck",
|
|
29121
|
+
"FileSystemProtection"
|
|
29116
29122
|
])],
|
|
29117
29123
|
["AWS::EFS::MountTarget", new Set([
|
|
29118
29124
|
"FileSystemId",
|
|
@@ -29126,7 +29132,7 @@ var EFSProvider = class {
|
|
|
29126
29132
|
"AccessPointTags"
|
|
29127
29133
|
])]
|
|
29128
29134
|
]);
|
|
29129
|
-
unhandledByDesign = new Map([["AWS::EFS::AccessPoint", new Map([["ClientToken", "AWS SDK manages this idempotency token internally on CreateAccessPoint; no user-supplied value is honored"]])]]);
|
|
29135
|
+
unhandledByDesign = new Map([["AWS::EFS::FileSystem", new Map([["ReplicationConfiguration", "Cross-region EFS replication (CreateReplicationConfiguration) provisions a separate destination file system in another region with its own lifecycle, KMS key, and availability-zone placement; replicating + then tearing down the destination on destroy is a multi-resource, cross-region orchestration that is out of scope for the single-resource SDK provider. Tracked as a follow-up to issue #609."]])], ["AWS::EFS::AccessPoint", new Map([["ClientToken", "AWS SDK manages this idempotency token internally on CreateAccessPoint; no user-supplied value is honored"]])]]);
|
|
29130
29136
|
getClient() {
|
|
29131
29137
|
if (!this.client) this.client = new EFSClient(this.providerRegion ? { region: this.providerRegion } : {});
|
|
29132
29138
|
return this.client;
|
|
@@ -29165,7 +29171,8 @@ var EFSProvider = class {
|
|
|
29165
29171
|
for (const key of [
|
|
29166
29172
|
"Encrypted",
|
|
29167
29173
|
"KmsKeyId",
|
|
29168
|
-
"PerformanceMode"
|
|
29174
|
+
"PerformanceMode",
|
|
29175
|
+
"AvailabilityZoneName"
|
|
29169
29176
|
]) {
|
|
29170
29177
|
const next = properties[key];
|
|
29171
29178
|
const prev = previousProperties[key];
|
|
@@ -29177,7 +29184,12 @@ var EFSProvider = class {
|
|
|
29177
29184
|
const oldProvisioned = previousProperties["ProvisionedThroughputInMibps"];
|
|
29178
29185
|
const throughputModeChanged = newThroughputMode !== void 0 && newThroughputMode !== oldThroughputMode;
|
|
29179
29186
|
const provisionedChanged = newProvisioned !== void 0 && newProvisioned !== oldProvisioned;
|
|
29180
|
-
|
|
29187
|
+
const changed = (key) => JSON.stringify(properties[key]) !== JSON.stringify(previousProperties[key]);
|
|
29188
|
+
const lifecycleChanged = changed("LifecyclePolicies");
|
|
29189
|
+
const backupChanged = changed("BackupPolicy");
|
|
29190
|
+
const policyChanged = changed("FileSystemPolicy") || changed("BypassPolicyLockoutSafetyCheck");
|
|
29191
|
+
const protectionChanged = changed("FileSystemProtection");
|
|
29192
|
+
if (!throughputModeChanged && !provisionedChanged && !lifecycleChanged && !backupChanged && !policyChanged && !protectionChanged) {
|
|
29181
29193
|
this.logger.debug(`No mutable diff for EFS FileSystem ${logicalId}, skipping update`);
|
|
29182
29194
|
return {
|
|
29183
29195
|
physicalId,
|
|
@@ -29186,12 +29198,18 @@ var EFSProvider = class {
|
|
|
29186
29198
|
}
|
|
29187
29199
|
this.logger.debug(`Updating EFS FileSystem ${logicalId}: ${physicalId}`);
|
|
29188
29200
|
try {
|
|
29189
|
-
|
|
29190
|
-
|
|
29191
|
-
|
|
29192
|
-
|
|
29193
|
-
|
|
29194
|
-
|
|
29201
|
+
if (throughputModeChanged || provisionedChanged) {
|
|
29202
|
+
await this.getClient().send(new UpdateFileSystemCommand({
|
|
29203
|
+
FileSystemId: physicalId,
|
|
29204
|
+
...throughputModeChanged && { ThroughputMode: newThroughputMode },
|
|
29205
|
+
...provisionedChanged && { ProvisionedThroughputInMibps: newProvisioned }
|
|
29206
|
+
}));
|
|
29207
|
+
await this.waitForFileSystemAvailable(physicalId, logicalId, resourceType);
|
|
29208
|
+
}
|
|
29209
|
+
if (lifecycleChanged) await this.applyLifecyclePolicies(physicalId, properties["LifecyclePolicies"], previousProperties["LifecyclePolicies"]);
|
|
29210
|
+
if (backupChanged) await this.applyBackupPolicy(physicalId, properties["BackupPolicy"]);
|
|
29211
|
+
if (policyChanged) await this.applyFileSystemPolicy(physicalId, properties["FileSystemPolicy"], properties["BypassPolicyLockoutSafetyCheck"]);
|
|
29212
|
+
if (protectionChanged) await this.applyFileSystemProtection(physicalId, properties["FileSystemProtection"]);
|
|
29195
29213
|
this.logger.debug(`Successfully updated EFS FileSystem ${logicalId}`);
|
|
29196
29214
|
return {
|
|
29197
29215
|
physicalId,
|
|
@@ -29240,6 +29258,7 @@ var EFSProvider = class {
|
|
|
29240
29258
|
this.logger.debug(`Creating EFS FileSystem ${logicalId}`);
|
|
29241
29259
|
const creationToken = `cdkd-${logicalId}`;
|
|
29242
29260
|
const tags = properties["FileSystemTags"];
|
|
29261
|
+
let fileSystemId;
|
|
29243
29262
|
try {
|
|
29244
29263
|
const response = await this.getClient().send(new CreateFileSystemCommand({
|
|
29245
29264
|
CreationToken: creationToken,
|
|
@@ -29248,14 +29267,19 @@ var EFSProvider = class {
|
|
|
29248
29267
|
PerformanceMode: properties["PerformanceMode"],
|
|
29249
29268
|
ThroughputMode: properties["ThroughputMode"],
|
|
29250
29269
|
ProvisionedThroughputInMibps: properties["ProvisionedThroughputInMibps"],
|
|
29270
|
+
AvailabilityZoneName: properties["AvailabilityZoneName"],
|
|
29251
29271
|
Tags: tags?.map((t) => ({
|
|
29252
29272
|
Key: t.Key,
|
|
29253
29273
|
Value: t.Value
|
|
29254
29274
|
}))
|
|
29255
29275
|
}));
|
|
29256
|
-
|
|
29276
|
+
fileSystemId = response.FileSystemId;
|
|
29257
29277
|
const arn = response.FileSystemArn;
|
|
29258
29278
|
await this.waitForFileSystemAvailable(fileSystemId, logicalId, resourceType);
|
|
29279
|
+
await this.applyLifecyclePolicies(fileSystemId, properties["LifecyclePolicies"]);
|
|
29280
|
+
await this.applyBackupPolicy(fileSystemId, properties["BackupPolicy"]);
|
|
29281
|
+
await this.applyFileSystemPolicy(fileSystemId, properties["FileSystemPolicy"], properties["BypassPolicyLockoutSafetyCheck"]);
|
|
29282
|
+
await this.applyFileSystemProtection(fileSystemId, properties["FileSystemProtection"]);
|
|
29259
29283
|
this.logger.debug(`Successfully created EFS FileSystem ${logicalId}: ${fileSystemId}`);
|
|
29260
29284
|
return {
|
|
29261
29285
|
physicalId: fileSystemId,
|
|
@@ -29265,10 +29289,100 @@ var EFSProvider = class {
|
|
|
29265
29289
|
}
|
|
29266
29290
|
};
|
|
29267
29291
|
} catch (error) {
|
|
29292
|
+
if (fileSystemId !== void 0) try {
|
|
29293
|
+
await this.getClient().send(new DeleteFileSystemCommand({ FileSystemId: fileSystemId }));
|
|
29294
|
+
this.logger.debug(`Rolled back partially-created EFS FileSystem ${fileSystemId}`);
|
|
29295
|
+
} catch (cleanupError) {
|
|
29296
|
+
this.logger.warn(`Failed to roll back partially-created EFS FileSystem ${fileSystemId}: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`);
|
|
29297
|
+
}
|
|
29298
|
+
if (error instanceof ProvisioningError) throw error;
|
|
29268
29299
|
const cause = error instanceof Error ? error : void 0;
|
|
29269
29300
|
throw new ProvisioningError(`Failed to create EFS FileSystem ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, cause);
|
|
29270
29301
|
}
|
|
29271
29302
|
}
|
|
29303
|
+
/**
|
|
29304
|
+
* Apply `LifecyclePolicies` via `PutLifecycleConfiguration`. CFn shape is an
|
|
29305
|
+
* array of `{ TransitionToIA?, TransitionToPrimaryStorageClass?,
|
|
29306
|
+
* TransitionToArchive? }`. An empty / dropped array clears all lifecycle
|
|
29307
|
+
* policies (PutLifecycleConfiguration with `LifecyclePolicies: []`).
|
|
29308
|
+
*/
|
|
29309
|
+
async applyLifecyclePolicies(fileSystemId, spec, previousSpec) {
|
|
29310
|
+
if (spec === void 0) {
|
|
29311
|
+
if (previousSpec === void 0) return;
|
|
29312
|
+
}
|
|
29313
|
+
const policies = spec ?? [];
|
|
29314
|
+
await this.retryOnTransientControlPlane(() => this.getClient().send(new PutLifecycleConfigurationCommand({
|
|
29315
|
+
FileSystemId: fileSystemId,
|
|
29316
|
+
LifecyclePolicies: policies
|
|
29317
|
+
})), `set LifecyclePolicies on ${fileSystemId}`);
|
|
29318
|
+
this.logger.debug(`Set ${policies.length} LifecyclePolicy entry(ies) on EFS FileSystem ${fileSystemId}`);
|
|
29319
|
+
}
|
|
29320
|
+
/**
|
|
29321
|
+
* Apply `BackupPolicy` via `PutBackupPolicy`. CFn shape is
|
|
29322
|
+
* `{ Status: 'ENABLED' | 'DISABLED' }`.
|
|
29323
|
+
*/
|
|
29324
|
+
async applyBackupPolicy(fileSystemId, spec) {
|
|
29325
|
+
if (spec === void 0 || spec === null) return;
|
|
29326
|
+
const status = spec.Status;
|
|
29327
|
+
if (status === void 0) return;
|
|
29328
|
+
await this.retryOnTransientControlPlane(() => this.getClient().send(new PutBackupPolicyCommand({
|
|
29329
|
+
FileSystemId: fileSystemId,
|
|
29330
|
+
BackupPolicy: { Status: status }
|
|
29331
|
+
})), `set BackupPolicy on ${fileSystemId}`);
|
|
29332
|
+
this.logger.debug(`Set BackupPolicy Status=${status} on EFS FileSystem ${fileSystemId}`);
|
|
29333
|
+
}
|
|
29334
|
+
/**
|
|
29335
|
+
* Apply `FileSystemPolicy` via `PutFileSystemPolicy`. The CFn `FileSystemPolicy`
|
|
29336
|
+
* property is a JSON policy *object* but the SDK's `Policy` field is a JSON
|
|
29337
|
+
* *string*, so an object value is `JSON.stringify`'d. `BypassPolicyLockoutSafetyCheck`
|
|
29338
|
+
* is a field ON `PutFileSystemPolicy` (not a standalone resource property), so
|
|
29339
|
+
* the two wire together.
|
|
29340
|
+
*/
|
|
29341
|
+
async applyFileSystemPolicy(fileSystemId, policy, bypass) {
|
|
29342
|
+
if (policy === void 0 || policy === null) return;
|
|
29343
|
+
const policyString = typeof policy === "string" ? policy : JSON.stringify(policy);
|
|
29344
|
+
await this.retryOnTransientControlPlane(() => this.getClient().send(new PutFileSystemPolicyCommand({
|
|
29345
|
+
FileSystemId: fileSystemId,
|
|
29346
|
+
Policy: policyString,
|
|
29347
|
+
BypassPolicyLockoutSafetyCheck: bypass === void 0 ? void 0 : Boolean(bypass)
|
|
29348
|
+
})), `set FileSystemPolicy on ${fileSystemId}`);
|
|
29349
|
+
this.logger.debug(`Set FileSystemPolicy on EFS FileSystem ${fileSystemId}`);
|
|
29350
|
+
}
|
|
29351
|
+
/**
|
|
29352
|
+
* Apply `FileSystemProtection` via `UpdateFileSystemProtection`. CFn shape is
|
|
29353
|
+
* `{ ReplicationOverwriteProtection: 'ENABLED' | 'DISABLED' | 'REPLICATING' }`.
|
|
29354
|
+
*/
|
|
29355
|
+
async applyFileSystemProtection(fileSystemId, spec) {
|
|
29356
|
+
if (spec === void 0 || spec === null) return;
|
|
29357
|
+
const protection = spec.ReplicationOverwriteProtection;
|
|
29358
|
+
if (protection === void 0) return;
|
|
29359
|
+
await this.retryOnTransientControlPlane(() => this.getClient().send(new UpdateFileSystemProtectionCommand({
|
|
29360
|
+
FileSystemId: fileSystemId,
|
|
29361
|
+
ReplicationOverwriteProtection: protection
|
|
29362
|
+
})), `set FileSystemProtection on ${fileSystemId}`);
|
|
29363
|
+
this.logger.debug(`Set ReplicationOverwriteProtection=${protection} on EFS FileSystem ${fileSystemId}`);
|
|
29364
|
+
}
|
|
29365
|
+
/**
|
|
29366
|
+
* Retry an EFS control-plane call on the transient "settling" errors AWS
|
|
29367
|
+
* returns when two file-system-modifying operations land back-to-back (e.g.
|
|
29368
|
+
* a `PutLifecycleConfiguration` immediately followed by a `PutBackupPolicy`).
|
|
29369
|
+
* `IncorrectFileSystemLifeCycleState` / `ThrottlingException` /
|
|
29370
|
+
* `ConflictException` and the message-pattern set below are the same class.
|
|
29371
|
+
* Backoff: ~2s,4s,8s,16s,30s,30s... bounded to ~2min total.
|
|
29372
|
+
*/
|
|
29373
|
+
async retryOnTransientControlPlane(op, label, maxAttempts = 8) {
|
|
29374
|
+
let delayMs = 2e3;
|
|
29375
|
+
for (let attempt = 1;; attempt++) try {
|
|
29376
|
+
return await op();
|
|
29377
|
+
} catch (error) {
|
|
29378
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
29379
|
+
const name = error instanceof Error ? error.name : "";
|
|
29380
|
+
if (!(/in progress|please retry|incorrect file system life ?cycle state|being (updated|modified)|try again/i.test(msg) || name === "IncorrectFileSystemLifeCycleState" || name === "ConflictException" || name === "ThrottlingException") || attempt >= maxAttempts) throw error;
|
|
29381
|
+
this.logger.debug(`Transient error on "${label}" (attempt ${attempt}/${maxAttempts}): ${msg} — retrying in ${delayMs}ms`);
|
|
29382
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
29383
|
+
delayMs = Math.min(delayMs * 2, 3e4);
|
|
29384
|
+
}
|
|
29385
|
+
}
|
|
29272
29386
|
async deleteFileSystem(logicalId, physicalId, resourceType, context) {
|
|
29273
29387
|
this.logger.debug(`Deleting EFS FileSystem ${logicalId}: ${physicalId}`);
|
|
29274
29388
|
try {
|
|
@@ -29430,10 +29544,11 @@ var EFSProvider = class {
|
|
|
29430
29544
|
*
|
|
29431
29545
|
* Dispatch per resource type:
|
|
29432
29546
|
* - `FileSystem` → `DescribeFileSystems` filtered by id (PerformanceMode,
|
|
29433
|
-
* ThroughputMode, Encrypted, KmsKeyId, ProvisionedThroughputInMibps
|
|
29434
|
-
* plus optional
|
|
29435
|
-
* `DescribeBackupPolicy
|
|
29436
|
-
*
|
|
29547
|
+
* ThroughputMode, Encrypted, KmsKeyId, ProvisionedThroughputInMibps,
|
|
29548
|
+
* AvailabilityZoneName, FileSystemProtection), plus optional
|
|
29549
|
+
* `DescribeLifecycleConfiguration`, `DescribeBackupPolicy`, and
|
|
29550
|
+
* `DescribeFileSystemPolicy` enrichment. Each enrichment call is wrapped
|
|
29551
|
+
* in its own try/catch so a "not configured" error on any of them omits
|
|
29437
29552
|
* the corresponding key without failing the whole snapshot.
|
|
29438
29553
|
* - `AccessPoint` → `DescribeAccessPoints` filtered by id (PosixUser,
|
|
29439
29554
|
* RootDirectory).
|
|
@@ -29473,8 +29588,11 @@ var EFSProvider = class {
|
|
|
29473
29588
|
if (fs.Encrypted !== void 0) result["Encrypted"] = fs.Encrypted;
|
|
29474
29589
|
if (fs.KmsKeyId !== void 0) result["KmsKeyId"] = fs.KmsKeyId;
|
|
29475
29590
|
if (fs.ProvisionedThroughputInMibps !== void 0) result["ProvisionedThroughputInMibps"] = fs.ProvisionedThroughputInMibps;
|
|
29591
|
+
if (fs.AvailabilityZoneName !== void 0) result["AvailabilityZoneName"] = fs.AvailabilityZoneName;
|
|
29592
|
+
if (fs.FileSystemProtection?.ReplicationOverwriteProtection !== void 0) result["FileSystemProtection"] = { ReplicationOverwriteProtection: fs.FileSystemProtection.ReplicationOverwriteProtection };
|
|
29476
29593
|
try {
|
|
29477
|
-
|
|
29594
|
+
const policies = (await this.getClient().send(new DescribeLifecycleConfigurationCommand({ FileSystemId: physicalId }))).LifecyclePolicies ?? [];
|
|
29595
|
+
if (policies.length > 0) result["LifecyclePolicies"] = policies.map((p) => {
|
|
29478
29596
|
const out = {};
|
|
29479
29597
|
if (p.TransitionToIA !== void 0) out["TransitionToIA"] = p.TransitionToIA;
|
|
29480
29598
|
if (p.TransitionToPrimaryStorageClass !== void 0) out["TransitionToPrimaryStorageClass"] = p.TransitionToPrimaryStorageClass;
|
|
@@ -29491,6 +29609,16 @@ var EFSProvider = class {
|
|
|
29491
29609
|
} catch (err) {
|
|
29492
29610
|
if (err instanceof FileSystemNotFound) return void 0;
|
|
29493
29611
|
}
|
|
29612
|
+
try {
|
|
29613
|
+
const resp = await this.getClient().send(new DescribeFileSystemPolicyCommand({ FileSystemId: physicalId }));
|
|
29614
|
+
if (resp.Policy !== void 0) try {
|
|
29615
|
+
result["FileSystemPolicy"] = JSON.parse(resp.Policy);
|
|
29616
|
+
} catch {
|
|
29617
|
+
result["FileSystemPolicy"] = resp.Policy;
|
|
29618
|
+
}
|
|
29619
|
+
} catch (err) {
|
|
29620
|
+
if (err instanceof FileSystemNotFound) return void 0;
|
|
29621
|
+
}
|
|
29494
29622
|
result["FileSystemTags"] = normalizeAwsTagsToCfn(fs.Tags);
|
|
29495
29623
|
return result;
|
|
29496
29624
|
}
|
|
@@ -52905,7 +53033,7 @@ function reorderArgs(argv) {
|
|
|
52905
53033
|
async function main() {
|
|
52906
53034
|
installPipeCloseHandler();
|
|
52907
53035
|
const program = new Command();
|
|
52908
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
53036
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.215.0");
|
|
52909
53037
|
program.addCommand(createBootstrapCommand());
|
|
52910
53038
|
program.addCommand(createSynthCommand());
|
|
52911
53039
|
program.addCommand(createListCommand());
|