@go-to-k/cdkd 0.214.0 → 0.216.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-hq-5c3kO.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";
|
|
@@ -46,14 +46,14 @@ import { CreateClusterCommand, CreateServiceCommand, DeleteClusterCommand, Delet
|
|
|
46
46
|
import { AddTagsToResourceCommand as AddTagsToResourceCommand$2, CreateDBClusterCommand as CreateDBClusterCommand$1, CreateDBInstanceCommand as CreateDBInstanceCommand$1, CreateDBSubnetGroupCommand as CreateDBSubnetGroupCommand$1, DeleteDBClusterCommand as DeleteDBClusterCommand$1, DeleteDBInstanceCommand as DeleteDBInstanceCommand$1, DeleteDBSubnetGroupCommand as DeleteDBSubnetGroupCommand$1, DescribeDBClustersCommand as DescribeDBClustersCommand$1, DescribeDBInstancesCommand as DescribeDBInstancesCommand$1, DescribeDBSubnetGroupsCommand as DescribeDBSubnetGroupsCommand$1, DocDBClient, ListTagsForResourceCommand as ListTagsForResourceCommand$11, ModifyDBClusterCommand as ModifyDBClusterCommand$1, ModifyDBInstanceCommand as ModifyDBInstanceCommand$1, ModifyDBSubnetGroupCommand as ModifyDBSubnetGroupCommand$1, RemoveTagsFromResourceCommand as RemoveTagsFromResourceCommand$2 } from "@aws-sdk/client-docdb";
|
|
47
47
|
import { AddTagsToResourceCommand as AddTagsToResourceCommand$3, CreateDBClusterCommand as CreateDBClusterCommand$2, CreateDBInstanceCommand as CreateDBInstanceCommand$2, CreateDBSubnetGroupCommand as CreateDBSubnetGroupCommand$2, DeleteDBClusterCommand as DeleteDBClusterCommand$2, DeleteDBInstanceCommand as DeleteDBInstanceCommand$2, DeleteDBSubnetGroupCommand as DeleteDBSubnetGroupCommand$2, DescribeDBClustersCommand as DescribeDBClustersCommand$2, DescribeDBInstancesCommand as DescribeDBInstancesCommand$2, DescribeDBSubnetGroupsCommand as DescribeDBSubnetGroupsCommand$2, ListTagsForResourceCommand as ListTagsForResourceCommand$12, ModifyDBClusterCommand as ModifyDBClusterCommand$2, ModifyDBInstanceCommand as ModifyDBInstanceCommand$2, ModifyDBSubnetGroupCommand as ModifyDBSubnetGroupCommand$2, NeptuneClient, RemoveTagsFromResourceCommand as RemoveTagsFromResourceCommand$3 } from "@aws-sdk/client-neptune";
|
|
48
48
|
import { CreateWebACLCommand, DeleteWebACLCommand, GetWebACLCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$13, ListWebACLsCommand, TagResourceCommand as TagResourceCommand$13, UntagResourceCommand as UntagResourceCommand$12, UpdateWebACLCommand, WAFNonexistentItemException, WAFV2Client } from "@aws-sdk/client-wafv2";
|
|
49
|
-
import { CognitoIdentityProviderClient, CreateUserPoolCommand, DeleteUserPoolCommand, DescribeUserPoolCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$14, ListUserPoolsCommand, ResourceNotFoundException as ResourceNotFoundException$7, UpdateUserPoolCommand } from "@aws-sdk/client-cognito-identity-provider";
|
|
49
|
+
import { CognitoIdentityProviderClient, CreateUserPoolCommand, DeleteUserPoolCommand, DescribeUserPoolCommand, GetUserPoolMfaConfigCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$14, ListUserPoolsCommand, ResourceNotFoundException as ResourceNotFoundException$7, SetUserPoolMfaConfigCommand, UpdateUserPoolCommand } from "@aws-sdk/client-cognito-identity-provider";
|
|
50
50
|
import { AddTagsToResourceCommand as AddTagsToResourceCommand$4, CreateCacheClusterCommand, CreateCacheSubnetGroupCommand, DeleteCacheClusterCommand, DeleteCacheSubnetGroupCommand, DescribeCacheClustersCommand, DescribeCacheSubnetGroupsCommand, ElastiCacheClient, ListTagsForResourceCommand as ListTagsForResourceCommand$15, ModifyCacheClusterCommand, ModifyCacheSubnetGroupCommand, RemoveTagsFromResourceCommand as RemoveTagsFromResourceCommand$4 } from "@aws-sdk/client-elasticache";
|
|
51
51
|
import { CreatePrivateDnsNamespaceCommand, CreateServiceCommand as CreateServiceCommand$1, DeleteNamespaceCommand, DeleteServiceCommand as DeleteServiceCommand$1, GetNamespaceCommand, GetOperationCommand, GetServiceCommand, ListNamespacesCommand, ListServicesCommand as ListServicesCommand$1, ListTagsForResourceCommand as ListTagsForResourceCommand$16, NamespaceNotFound, ServiceDiscoveryClient, ServiceNotFound, UpdatePrivateDnsNamespaceCommand, UpdateServiceCommand as UpdateServiceCommand$1 } from "@aws-sdk/client-servicediscovery";
|
|
52
52
|
import { AppSyncClient, CreateApiKeyCommand, CreateDataSourceCommand, CreateGraphqlApiCommand, CreateResolverCommand, DeleteApiKeyCommand, DeleteDataSourceCommand, DeleteGraphqlApiCommand, DeleteResolverCommand, GetDataSourceCommand, GetGraphqlApiCommand, GetIntrospectionSchemaCommand, GetResolverCommand, ListApiKeysCommand, ListGraphqlApisCommand, NotFoundException as NotFoundException$4, StartSchemaCreationCommand, TagResourceCommand as TagResourceCommand$14, UntagResourceCommand as UntagResourceCommand$13, UpdateApiKeyCommand, UpdateDataSourceCommand, UpdateGraphqlApiCommand, UpdateResolverCommand } from "@aws-sdk/client-appsync";
|
|
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";
|
|
@@ -24112,6 +24112,83 @@ function isEmptyObjectPlaceholder(value) {
|
|
|
24112
24112
|
return value !== null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0;
|
|
24113
24113
|
}
|
|
24114
24114
|
/**
|
|
24115
|
+
* The CFn `EnabledMfas` factor names AND their MFA-config-API meaning.
|
|
24116
|
+
*
|
|
24117
|
+
* `EnabledMfas` is a CFn-level `Array of String`, but Cognito has no
|
|
24118
|
+
* `EnabledMfas` field on `CreateUserPool` / `UpdateUserPool`. The factors are
|
|
24119
|
+
* activated via the separate `SetUserPoolMfaConfig` control-plane API, one
|
|
24120
|
+
* sub-block per factor:
|
|
24121
|
+
*
|
|
24122
|
+
* - `SMS_MFA` -> `SmsMfaConfiguration` (needs the pool's
|
|
24123
|
+
* `SmsConfiguration` SNS-caller ARN to be set too)
|
|
24124
|
+
* - `SOFTWARE_TOKEN_MFA` -> `SoftwareTokenMfaConfiguration.Enabled = true`
|
|
24125
|
+
* - `EMAIL_OTP` -> `EmailMfaConfiguration` (carries the email-OTP
|
|
24126
|
+
* message/subject template — i.e. CFn's
|
|
24127
|
+
* `EmailAuthenticationMessage` / `Subject`)
|
|
24128
|
+
*/
|
|
24129
|
+
const MFA_FACTOR_SMS = "SMS_MFA";
|
|
24130
|
+
const MFA_FACTOR_SOFTWARE_TOKEN = "SOFTWARE_TOKEN_MFA";
|
|
24131
|
+
const MFA_FACTOR_EMAIL_OTP = "EMAIL_OTP";
|
|
24132
|
+
/**
|
|
24133
|
+
* Build the `SetUserPoolMfaConfig` request from the CFn-level MFA properties,
|
|
24134
|
+
* or return `undefined` when none of the MFA-config-API-routed properties are
|
|
24135
|
+
* present (so the caller skips the extra control-plane call entirely).
|
|
24136
|
+
*
|
|
24137
|
+
* The properties that route through `SetUserPoolMfaConfig` (NOT CreateUserPool):
|
|
24138
|
+
* - `EnabledMfas` -> per-factor sub-blocks (see constants above)
|
|
24139
|
+
* - `EmailAuthenticationMessage`/`EmailAuthenticationSubject` -> the
|
|
24140
|
+
* `EmailMfaConfiguration` message/subject (email-OTP template)
|
|
24141
|
+
* - `WebAuthnRelyingPartyID`/`WebAuthnUserVerification` -> `WebAuthnConfiguration`
|
|
24142
|
+
*
|
|
24143
|
+
* `MfaConfiguration` (ON/OFF/OPTIONAL) MUST be threaded into this request:
|
|
24144
|
+
* `SetUserPoolMfaConfig` is a full-replace of the pool's MFA state, and an
|
|
24145
|
+
* omitted `MfaConfiguration` defaults to OFF on the wire — which resets the
|
|
24146
|
+
* pool to MFA-disabled and makes AWS reject (or silently drop) the per-factor
|
|
24147
|
+
* sub-blocks we are trying to enable. Use the template's `MfaConfiguration`
|
|
24148
|
+
* when present; default to `OPTIONAL` when factors are present but the template
|
|
24149
|
+
* omitted it (factors are meaningless under OFF, and OPTIONAL enables them
|
|
24150
|
+
* without forcing MFA on every user).
|
|
24151
|
+
*/
|
|
24152
|
+
/**
|
|
24153
|
+
* True when any MFA-config-API-routed property is present, i.e. a
|
|
24154
|
+
* `SetUserPoolMfaConfig` call will run post-create. When true, `create()` must
|
|
24155
|
+
* NOT forward `MfaConfiguration` to `CreateUserPool`: AWS rejects
|
|
24156
|
+
* `CreateUserPool` with `MfaConfiguration: ON/OPTIONAL` unless the pool already
|
|
24157
|
+
* has SMS configured (+ phone_number auto-verification) OR software-token MFA
|
|
24158
|
+
* enabled — but software-token / email-OTP MFA can only be enabled via the
|
|
24159
|
+
* post-create `SetUserPoolMfaConfig` call, not on `CreateUserPool`. So the
|
|
24160
|
+
* correct sequence is: `CreateUserPool` WITHOUT `MfaConfiguration` (defaults
|
|
24161
|
+
* OFF) -> `SetUserPoolMfaConfig` sets `MfaConfiguration` + the factor blocks
|
|
24162
|
+
* together (the factor satisfies the MFA requirement, no SMS needed). This
|
|
24163
|
+
* mirrors how CloudFormation/CDK sequence the two calls.
|
|
24164
|
+
*/
|
|
24165
|
+
function hasMfaConfigProps(properties) {
|
|
24166
|
+
const enabledMfas = Array.isArray(properties["EnabledMfas"]) ? properties["EnabledMfas"] : void 0;
|
|
24167
|
+
return enabledMfas !== void 0 && enabledMfas.length > 0 || !!properties["EmailAuthenticationMessage"] || !!properties["EmailAuthenticationSubject"] || !!properties["WebAuthnRelyingPartyID"] || !!properties["WebAuthnUserVerification"];
|
|
24168
|
+
}
|
|
24169
|
+
function buildMfaConfigRequest(physicalId, properties) {
|
|
24170
|
+
const enabledMfas = Array.isArray(properties["EnabledMfas"]) ? properties["EnabledMfas"] : void 0;
|
|
24171
|
+
const emailMessage = properties["EmailAuthenticationMessage"] || void 0;
|
|
24172
|
+
const emailSubject = properties["EmailAuthenticationSubject"] || void 0;
|
|
24173
|
+
const webAuthnRpId = properties["WebAuthnRelyingPartyID"] || void 0;
|
|
24174
|
+
const webAuthnUserVerification = properties["WebAuthnUserVerification"] || void 0;
|
|
24175
|
+
if (!hasMfaConfigProps(properties)) return void 0;
|
|
24176
|
+
const request = { UserPoolId: physicalId };
|
|
24177
|
+
request.MfaConfiguration = properties["MfaConfiguration"] ?? "OPTIONAL";
|
|
24178
|
+
const factors = new Set(enabledMfas ?? []);
|
|
24179
|
+
if (factors.has(MFA_FACTOR_SOFTWARE_TOKEN)) request.SoftwareTokenMfaConfiguration = { Enabled: true };
|
|
24180
|
+
if (factors.has(MFA_FACTOR_SMS)) request.SmsMfaConfiguration = { ...properties["SmsConfiguration"] ? { SmsConfiguration: properties["SmsConfiguration"] } : {} };
|
|
24181
|
+
if (factors.has(MFA_FACTOR_EMAIL_OTP) || emailMessage !== void 0 || emailSubject !== void 0) request.EmailMfaConfiguration = {
|
|
24182
|
+
...emailMessage !== void 0 ? { Message: emailMessage } : {},
|
|
24183
|
+
...emailSubject !== void 0 ? { Subject: emailSubject } : {}
|
|
24184
|
+
};
|
|
24185
|
+
if (webAuthnRpId !== void 0 || webAuthnUserVerification !== void 0) request.WebAuthnConfiguration = {
|
|
24186
|
+
...webAuthnRpId !== void 0 ? { RelyingPartyId: webAuthnRpId } : {},
|
|
24187
|
+
...webAuthnUserVerification !== void 0 ? { UserVerification: webAuthnUserVerification } : {}
|
|
24188
|
+
};
|
|
24189
|
+
return request;
|
|
24190
|
+
}
|
|
24191
|
+
/**
|
|
24115
24192
|
* AWS Cognito User Pool Provider
|
|
24116
24193
|
*
|
|
24117
24194
|
* Implements resource provisioning for AWS::Cognito::UserPool using the Cognito SDK.
|
|
@@ -24146,8 +24223,15 @@ var CognitoUserPoolProvider = class {
|
|
|
24146
24223
|
"EmailVerificationMessage",
|
|
24147
24224
|
"EmailVerificationSubject",
|
|
24148
24225
|
"SmsAuthenticationMessage",
|
|
24149
|
-
"SmsVerificationMessage"
|
|
24226
|
+
"SmsVerificationMessage",
|
|
24227
|
+
"UserPoolTier",
|
|
24228
|
+
"EnabledMfas",
|
|
24229
|
+
"EmailAuthenticationMessage",
|
|
24230
|
+
"EmailAuthenticationSubject",
|
|
24231
|
+
"WebAuthnRelyingPartyID",
|
|
24232
|
+
"WebAuthnUserVerification"
|
|
24150
24233
|
])]]);
|
|
24234
|
+
unhandledByDesign = new Map([["AWS::Cognito::UserPool", new Map([["WebAuthnFactorConfiguration", "No SDK wire path: @aws-sdk/client-cognito-identity-provider has no field accepting SINGLE_FACTOR | MULTI_FACTOR_WITH_USER_VERIFICATION (not on CreateUserPool/UpdateUserPool, nor SetUserPoolMfaConfig.WebAuthnConfiguration which only carries RelyingPartyId/UserVerification); CC-API-registry-only property"]])]]);
|
|
24151
24235
|
getClient() {
|
|
24152
24236
|
if (!this.cognitoClient) this.cognitoClient = new CognitoIdentityProviderClient(this.providerRegion ? { region: this.providerRegion } : {});
|
|
24153
24237
|
return this.cognitoClient;
|
|
@@ -24158,6 +24242,7 @@ var CognitoUserPoolProvider = class {
|
|
|
24158
24242
|
async create(logicalId, resourceType, properties) {
|
|
24159
24243
|
this.logger.debug(`Creating Cognito User Pool ${logicalId}`);
|
|
24160
24244
|
const poolName = properties["UserPoolName"] || generateResourceName(logicalId, { maxLength: 128 });
|
|
24245
|
+
let createdUserPoolId;
|
|
24161
24246
|
try {
|
|
24162
24247
|
const createParams = { PoolName: poolName };
|
|
24163
24248
|
if (properties["AutoVerifiedAttributes"]) createParams.AutoVerifiedAttributes = properties["AutoVerifiedAttributes"];
|
|
@@ -24168,7 +24253,7 @@ var CognitoUserPoolProvider = class {
|
|
|
24168
24253
|
}
|
|
24169
24254
|
if (properties["Schema"]) createParams.Schema = properties["Schema"];
|
|
24170
24255
|
if (properties["LambdaConfig"]) createParams.LambdaConfig = properties["LambdaConfig"];
|
|
24171
|
-
if (properties["MfaConfiguration"]) createParams.MfaConfiguration = properties["MfaConfiguration"];
|
|
24256
|
+
if (properties["MfaConfiguration"] && !hasMfaConfigProps(properties)) createParams.MfaConfiguration = properties["MfaConfiguration"];
|
|
24172
24257
|
if (properties["UserPoolTags"]) createParams.UserPoolTags = properties["UserPoolTags"];
|
|
24173
24258
|
if (properties["AdminCreateUserConfig"]) createParams.AdminCreateUserConfig = properties["AdminCreateUserConfig"];
|
|
24174
24259
|
if (properties["AccountRecoverySetting"]) createParams.AccountRecoverySetting = properties["AccountRecoverySetting"];
|
|
@@ -24185,13 +24270,16 @@ var CognitoUserPoolProvider = class {
|
|
|
24185
24270
|
if (properties["EmailVerificationSubject"]) createParams.EmailVerificationSubject = properties["EmailVerificationSubject"];
|
|
24186
24271
|
if (properties["SmsAuthenticationMessage"]) createParams.SmsAuthenticationMessage = properties["SmsAuthenticationMessage"];
|
|
24187
24272
|
if (properties["SmsVerificationMessage"]) createParams.SmsVerificationMessage = properties["SmsVerificationMessage"];
|
|
24273
|
+
if (properties["UserPoolTier"]) createParams.UserPoolTier = properties["UserPoolTier"];
|
|
24188
24274
|
const userPool = (await this.getClient().send(new CreateUserPoolCommand(createParams))).UserPool;
|
|
24189
24275
|
if (!userPool?.Id) throw new Error("CreateUserPool did not return UserPool.Id");
|
|
24190
24276
|
const userPoolId = userPool.Id;
|
|
24277
|
+
createdUserPoolId = userPoolId;
|
|
24191
24278
|
const userPoolArn = userPool.Arn;
|
|
24192
24279
|
const region = await this.getClient().config.region();
|
|
24193
24280
|
const providerName = `cognito-idp.${region}.amazonaws.com/${userPoolId}`;
|
|
24194
24281
|
const providerUrl = `https://cognito-idp.${region}.amazonaws.com/${userPoolId}`;
|
|
24282
|
+
await this.applyMfaConfig(userPoolId, properties);
|
|
24195
24283
|
this.logger.debug(`Successfully created Cognito User Pool ${logicalId}: ${userPoolId}`);
|
|
24196
24284
|
return {
|
|
24197
24285
|
physicalId: userPoolId,
|
|
@@ -24203,11 +24291,46 @@ var CognitoUserPoolProvider = class {
|
|
|
24203
24291
|
}
|
|
24204
24292
|
};
|
|
24205
24293
|
} catch (error) {
|
|
24294
|
+
if (createdUserPoolId) try {
|
|
24295
|
+
await this.getClient().send(new DeleteUserPoolCommand({ UserPoolId: createdUserPoolId }));
|
|
24296
|
+
this.logger.debug(`Rolled back partially-created Cognito User Pool ${createdUserPoolId}`);
|
|
24297
|
+
} catch (rollbackError) {
|
|
24298
|
+
this.logger.warn(`Failed to roll back partially-created Cognito User Pool ${createdUserPoolId}: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`);
|
|
24299
|
+
}
|
|
24206
24300
|
const cause = error instanceof Error ? error : void 0;
|
|
24207
24301
|
throw new ProvisioningError(`Failed to create Cognito User Pool ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, poolName, cause);
|
|
24208
24302
|
}
|
|
24209
24303
|
}
|
|
24210
24304
|
/**
|
|
24305
|
+
* Apply the MFA-config-API-routed properties (EnabledMfas / email-OTP
|
|
24306
|
+
* message+subject / WebAuthn) via SetUserPoolMfaConfig. No-op when none are
|
|
24307
|
+
* present. Wrapped in a transient-error retry because back-to-back
|
|
24308
|
+
* control-plane writes on a freshly-created pool can briefly conflict
|
|
24309
|
+
* (mirrors DynamoDBTableProvider.retryOnTransientControlPlane).
|
|
24310
|
+
*/
|
|
24311
|
+
async applyMfaConfig(physicalId, properties) {
|
|
24312
|
+
const request = buildMfaConfigRequest(physicalId, properties);
|
|
24313
|
+
if (!request) return;
|
|
24314
|
+
await this.retryOnTransientControlPlane(() => this.getClient().send(new SetUserPoolMfaConfigCommand(request)), `SetUserPoolMfaConfig(${physicalId})`);
|
|
24315
|
+
}
|
|
24316
|
+
/**
|
|
24317
|
+
* Retry a Cognito control-plane call on transient "settling" errors. A
|
|
24318
|
+
* SetUserPoolMfaConfig issued immediately after CreateUserPool (or another
|
|
24319
|
+
* control-plane write) can briefly hit `ConcurrentModificationException` /
|
|
24320
|
+
* "please retry". Backoff 1s -> 2s -> 4s, default 3 attempts.
|
|
24321
|
+
*/
|
|
24322
|
+
async retryOnTransientControlPlane(fn, label, maxAttempts = 3) {
|
|
24323
|
+
for (let attempt = 1;; attempt++) try {
|
|
24324
|
+
return await fn();
|
|
24325
|
+
} catch (error) {
|
|
24326
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
24327
|
+
if (!((error instanceof Error ? error.name : "") === "ConcurrentModificationException" || /concurrent modification|please retry|try again|in progress/i.test(msg)) || attempt >= maxAttempts) throw error;
|
|
24328
|
+
const delayMs = Math.min(1e3 * 2 ** (attempt - 1), 4e3);
|
|
24329
|
+
this.logger.debug(`Transient error on "${label}" (attempt ${attempt}/${maxAttempts}): ${msg} — retrying in ${delayMs}ms`);
|
|
24330
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
24331
|
+
}
|
|
24332
|
+
}
|
|
24333
|
+
/**
|
|
24211
24334
|
* Update a Cognito User Pool
|
|
24212
24335
|
*
|
|
24213
24336
|
* Note: PoolName (UserPoolName) and Schema are immutable and cannot be changed after creation.
|
|
@@ -24238,7 +24361,9 @@ var CognitoUserPoolProvider = class {
|
|
|
24238
24361
|
if (properties["EmailVerificationSubject"] !== void 0) updateParams.EmailVerificationSubject = properties["EmailVerificationSubject"];
|
|
24239
24362
|
if (properties["SmsAuthenticationMessage"] !== void 0) updateParams.SmsAuthenticationMessage = properties["SmsAuthenticationMessage"];
|
|
24240
24363
|
if (properties["SmsVerificationMessage"] !== void 0) updateParams.SmsVerificationMessage = properties["SmsVerificationMessage"];
|
|
24364
|
+
if (properties["UserPoolTier"]) updateParams.UserPoolTier = properties["UserPoolTier"];
|
|
24241
24365
|
await this.getClient().send(new UpdateUserPoolCommand(updateParams));
|
|
24366
|
+
await this.applyMfaConfig(physicalId, properties);
|
|
24242
24367
|
this.logger.debug(`Successfully updated Cognito User Pool ${logicalId}`);
|
|
24243
24368
|
const userPool = (await this.getClient().send(new DescribeUserPoolCommand({ UserPoolId: physicalId }))).UserPool;
|
|
24244
24369
|
const region = await this.getClient().config.region();
|
|
@@ -24372,6 +24497,21 @@ var CognitoUserPoolProvider = class {
|
|
|
24372
24497
|
for (const [k, v] of Object.entries(pool.UserPoolTags)) if (!k.startsWith("aws:")) userTags[k] = v;
|
|
24373
24498
|
}
|
|
24374
24499
|
result["UserPoolTags"] = userTags;
|
|
24500
|
+
result["UserPoolTier"] = pool.UserPoolTier ?? "ESSENTIALS";
|
|
24501
|
+
try {
|
|
24502
|
+
const mfa = await this.getClient().send(new GetUserPoolMfaConfigCommand({ UserPoolId: physicalId }));
|
|
24503
|
+
const enabledMfas = [];
|
|
24504
|
+
if (mfa.SmsMfaConfiguration) enabledMfas.push(MFA_FACTOR_SMS);
|
|
24505
|
+
if (mfa.SoftwareTokenMfaConfiguration?.Enabled) enabledMfas.push(MFA_FACTOR_SOFTWARE_TOKEN);
|
|
24506
|
+
if (mfa.EmailMfaConfiguration) enabledMfas.push(MFA_FACTOR_EMAIL_OTP);
|
|
24507
|
+
result["EnabledMfas"] = enabledMfas;
|
|
24508
|
+
result["EmailAuthenticationMessage"] = mfa.EmailMfaConfiguration?.Message ?? "";
|
|
24509
|
+
result["EmailAuthenticationSubject"] = mfa.EmailMfaConfiguration?.Subject ?? "";
|
|
24510
|
+
result["WebAuthnRelyingPartyID"] = mfa.WebAuthnConfiguration?.RelyingPartyId ?? "";
|
|
24511
|
+
result["WebAuthnUserVerification"] = mfa.WebAuthnConfiguration?.UserVerification ?? "";
|
|
24512
|
+
} catch (mfaErr) {
|
|
24513
|
+
this.logger.debug(`GetUserPoolMfaConfig failed for ${physicalId}, skipping MFA-derived drift keys: ${mfaErr instanceof Error ? mfaErr.message : String(mfaErr)}`);
|
|
24514
|
+
}
|
|
24375
24515
|
return result;
|
|
24376
24516
|
}
|
|
24377
24517
|
/**
|
|
@@ -29112,7 +29252,13 @@ var EFSProvider = class {
|
|
|
29112
29252
|
"KmsKeyId",
|
|
29113
29253
|
"PerformanceMode",
|
|
29114
29254
|
"ThroughputMode",
|
|
29115
|
-
"ProvisionedThroughputInMibps"
|
|
29255
|
+
"ProvisionedThroughputInMibps",
|
|
29256
|
+
"AvailabilityZoneName",
|
|
29257
|
+
"LifecyclePolicies",
|
|
29258
|
+
"BackupPolicy",
|
|
29259
|
+
"FileSystemPolicy",
|
|
29260
|
+
"BypassPolicyLockoutSafetyCheck",
|
|
29261
|
+
"FileSystemProtection"
|
|
29116
29262
|
])],
|
|
29117
29263
|
["AWS::EFS::MountTarget", new Set([
|
|
29118
29264
|
"FileSystemId",
|
|
@@ -29126,7 +29272,7 @@ var EFSProvider = class {
|
|
|
29126
29272
|
"AccessPointTags"
|
|
29127
29273
|
])]
|
|
29128
29274
|
]);
|
|
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"]])]]);
|
|
29275
|
+
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
29276
|
getClient() {
|
|
29131
29277
|
if (!this.client) this.client = new EFSClient(this.providerRegion ? { region: this.providerRegion } : {});
|
|
29132
29278
|
return this.client;
|
|
@@ -29165,7 +29311,8 @@ var EFSProvider = class {
|
|
|
29165
29311
|
for (const key of [
|
|
29166
29312
|
"Encrypted",
|
|
29167
29313
|
"KmsKeyId",
|
|
29168
|
-
"PerformanceMode"
|
|
29314
|
+
"PerformanceMode",
|
|
29315
|
+
"AvailabilityZoneName"
|
|
29169
29316
|
]) {
|
|
29170
29317
|
const next = properties[key];
|
|
29171
29318
|
const prev = previousProperties[key];
|
|
@@ -29177,7 +29324,12 @@ var EFSProvider = class {
|
|
|
29177
29324
|
const oldProvisioned = previousProperties["ProvisionedThroughputInMibps"];
|
|
29178
29325
|
const throughputModeChanged = newThroughputMode !== void 0 && newThroughputMode !== oldThroughputMode;
|
|
29179
29326
|
const provisionedChanged = newProvisioned !== void 0 && newProvisioned !== oldProvisioned;
|
|
29180
|
-
|
|
29327
|
+
const changed = (key) => JSON.stringify(properties[key]) !== JSON.stringify(previousProperties[key]);
|
|
29328
|
+
const lifecycleChanged = changed("LifecyclePolicies");
|
|
29329
|
+
const backupChanged = changed("BackupPolicy");
|
|
29330
|
+
const policyChanged = changed("FileSystemPolicy") || changed("BypassPolicyLockoutSafetyCheck");
|
|
29331
|
+
const protectionChanged = changed("FileSystemProtection");
|
|
29332
|
+
if (!throughputModeChanged && !provisionedChanged && !lifecycleChanged && !backupChanged && !policyChanged && !protectionChanged) {
|
|
29181
29333
|
this.logger.debug(`No mutable diff for EFS FileSystem ${logicalId}, skipping update`);
|
|
29182
29334
|
return {
|
|
29183
29335
|
physicalId,
|
|
@@ -29186,12 +29338,18 @@ var EFSProvider = class {
|
|
|
29186
29338
|
}
|
|
29187
29339
|
this.logger.debug(`Updating EFS FileSystem ${logicalId}: ${physicalId}`);
|
|
29188
29340
|
try {
|
|
29189
|
-
|
|
29190
|
-
|
|
29191
|
-
|
|
29192
|
-
|
|
29193
|
-
|
|
29194
|
-
|
|
29341
|
+
if (throughputModeChanged || provisionedChanged) {
|
|
29342
|
+
await this.getClient().send(new UpdateFileSystemCommand({
|
|
29343
|
+
FileSystemId: physicalId,
|
|
29344
|
+
...throughputModeChanged && { ThroughputMode: newThroughputMode },
|
|
29345
|
+
...provisionedChanged && { ProvisionedThroughputInMibps: newProvisioned }
|
|
29346
|
+
}));
|
|
29347
|
+
await this.waitForFileSystemAvailable(physicalId, logicalId, resourceType);
|
|
29348
|
+
}
|
|
29349
|
+
if (lifecycleChanged) await this.applyLifecyclePolicies(physicalId, properties["LifecyclePolicies"], previousProperties["LifecyclePolicies"]);
|
|
29350
|
+
if (backupChanged) await this.applyBackupPolicy(physicalId, properties["BackupPolicy"]);
|
|
29351
|
+
if (policyChanged) await this.applyFileSystemPolicy(physicalId, properties["FileSystemPolicy"], properties["BypassPolicyLockoutSafetyCheck"]);
|
|
29352
|
+
if (protectionChanged) await this.applyFileSystemProtection(physicalId, properties["FileSystemProtection"]);
|
|
29195
29353
|
this.logger.debug(`Successfully updated EFS FileSystem ${logicalId}`);
|
|
29196
29354
|
return {
|
|
29197
29355
|
physicalId,
|
|
@@ -29240,6 +29398,7 @@ var EFSProvider = class {
|
|
|
29240
29398
|
this.logger.debug(`Creating EFS FileSystem ${logicalId}`);
|
|
29241
29399
|
const creationToken = `cdkd-${logicalId}`;
|
|
29242
29400
|
const tags = properties["FileSystemTags"];
|
|
29401
|
+
let fileSystemId;
|
|
29243
29402
|
try {
|
|
29244
29403
|
const response = await this.getClient().send(new CreateFileSystemCommand({
|
|
29245
29404
|
CreationToken: creationToken,
|
|
@@ -29248,14 +29407,19 @@ var EFSProvider = class {
|
|
|
29248
29407
|
PerformanceMode: properties["PerformanceMode"],
|
|
29249
29408
|
ThroughputMode: properties["ThroughputMode"],
|
|
29250
29409
|
ProvisionedThroughputInMibps: properties["ProvisionedThroughputInMibps"],
|
|
29410
|
+
AvailabilityZoneName: properties["AvailabilityZoneName"],
|
|
29251
29411
|
Tags: tags?.map((t) => ({
|
|
29252
29412
|
Key: t.Key,
|
|
29253
29413
|
Value: t.Value
|
|
29254
29414
|
}))
|
|
29255
29415
|
}));
|
|
29256
|
-
|
|
29416
|
+
fileSystemId = response.FileSystemId;
|
|
29257
29417
|
const arn = response.FileSystemArn;
|
|
29258
29418
|
await this.waitForFileSystemAvailable(fileSystemId, logicalId, resourceType);
|
|
29419
|
+
await this.applyLifecyclePolicies(fileSystemId, properties["LifecyclePolicies"]);
|
|
29420
|
+
await this.applyBackupPolicy(fileSystemId, properties["BackupPolicy"]);
|
|
29421
|
+
await this.applyFileSystemPolicy(fileSystemId, properties["FileSystemPolicy"], properties["BypassPolicyLockoutSafetyCheck"]);
|
|
29422
|
+
await this.applyFileSystemProtection(fileSystemId, properties["FileSystemProtection"]);
|
|
29259
29423
|
this.logger.debug(`Successfully created EFS FileSystem ${logicalId}: ${fileSystemId}`);
|
|
29260
29424
|
return {
|
|
29261
29425
|
physicalId: fileSystemId,
|
|
@@ -29265,10 +29429,100 @@ var EFSProvider = class {
|
|
|
29265
29429
|
}
|
|
29266
29430
|
};
|
|
29267
29431
|
} catch (error) {
|
|
29432
|
+
if (fileSystemId !== void 0) try {
|
|
29433
|
+
await this.getClient().send(new DeleteFileSystemCommand({ FileSystemId: fileSystemId }));
|
|
29434
|
+
this.logger.debug(`Rolled back partially-created EFS FileSystem ${fileSystemId}`);
|
|
29435
|
+
} catch (cleanupError) {
|
|
29436
|
+
this.logger.warn(`Failed to roll back partially-created EFS FileSystem ${fileSystemId}: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`);
|
|
29437
|
+
}
|
|
29438
|
+
if (error instanceof ProvisioningError) throw error;
|
|
29268
29439
|
const cause = error instanceof Error ? error : void 0;
|
|
29269
29440
|
throw new ProvisioningError(`Failed to create EFS FileSystem ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, cause);
|
|
29270
29441
|
}
|
|
29271
29442
|
}
|
|
29443
|
+
/**
|
|
29444
|
+
* Apply `LifecyclePolicies` via `PutLifecycleConfiguration`. CFn shape is an
|
|
29445
|
+
* array of `{ TransitionToIA?, TransitionToPrimaryStorageClass?,
|
|
29446
|
+
* TransitionToArchive? }`. An empty / dropped array clears all lifecycle
|
|
29447
|
+
* policies (PutLifecycleConfiguration with `LifecyclePolicies: []`).
|
|
29448
|
+
*/
|
|
29449
|
+
async applyLifecyclePolicies(fileSystemId, spec, previousSpec) {
|
|
29450
|
+
if (spec === void 0) {
|
|
29451
|
+
if (previousSpec === void 0) return;
|
|
29452
|
+
}
|
|
29453
|
+
const policies = spec ?? [];
|
|
29454
|
+
await this.retryOnTransientControlPlane(() => this.getClient().send(new PutLifecycleConfigurationCommand({
|
|
29455
|
+
FileSystemId: fileSystemId,
|
|
29456
|
+
LifecyclePolicies: policies
|
|
29457
|
+
})), `set LifecyclePolicies on ${fileSystemId}`);
|
|
29458
|
+
this.logger.debug(`Set ${policies.length} LifecyclePolicy entry(ies) on EFS FileSystem ${fileSystemId}`);
|
|
29459
|
+
}
|
|
29460
|
+
/**
|
|
29461
|
+
* Apply `BackupPolicy` via `PutBackupPolicy`. CFn shape is
|
|
29462
|
+
* `{ Status: 'ENABLED' | 'DISABLED' }`.
|
|
29463
|
+
*/
|
|
29464
|
+
async applyBackupPolicy(fileSystemId, spec) {
|
|
29465
|
+
if (spec === void 0 || spec === null) return;
|
|
29466
|
+
const status = spec.Status;
|
|
29467
|
+
if (status === void 0) return;
|
|
29468
|
+
await this.retryOnTransientControlPlane(() => this.getClient().send(new PutBackupPolicyCommand({
|
|
29469
|
+
FileSystemId: fileSystemId,
|
|
29470
|
+
BackupPolicy: { Status: status }
|
|
29471
|
+
})), `set BackupPolicy on ${fileSystemId}`);
|
|
29472
|
+
this.logger.debug(`Set BackupPolicy Status=${status} on EFS FileSystem ${fileSystemId}`);
|
|
29473
|
+
}
|
|
29474
|
+
/**
|
|
29475
|
+
* Apply `FileSystemPolicy` via `PutFileSystemPolicy`. The CFn `FileSystemPolicy`
|
|
29476
|
+
* property is a JSON policy *object* but the SDK's `Policy` field is a JSON
|
|
29477
|
+
* *string*, so an object value is `JSON.stringify`'d. `BypassPolicyLockoutSafetyCheck`
|
|
29478
|
+
* is a field ON `PutFileSystemPolicy` (not a standalone resource property), so
|
|
29479
|
+
* the two wire together.
|
|
29480
|
+
*/
|
|
29481
|
+
async applyFileSystemPolicy(fileSystemId, policy, bypass) {
|
|
29482
|
+
if (policy === void 0 || policy === null) return;
|
|
29483
|
+
const policyString = typeof policy === "string" ? policy : JSON.stringify(policy);
|
|
29484
|
+
await this.retryOnTransientControlPlane(() => this.getClient().send(new PutFileSystemPolicyCommand({
|
|
29485
|
+
FileSystemId: fileSystemId,
|
|
29486
|
+
Policy: policyString,
|
|
29487
|
+
BypassPolicyLockoutSafetyCheck: bypass === void 0 ? void 0 : Boolean(bypass)
|
|
29488
|
+
})), `set FileSystemPolicy on ${fileSystemId}`);
|
|
29489
|
+
this.logger.debug(`Set FileSystemPolicy on EFS FileSystem ${fileSystemId}`);
|
|
29490
|
+
}
|
|
29491
|
+
/**
|
|
29492
|
+
* Apply `FileSystemProtection` via `UpdateFileSystemProtection`. CFn shape is
|
|
29493
|
+
* `{ ReplicationOverwriteProtection: 'ENABLED' | 'DISABLED' | 'REPLICATING' }`.
|
|
29494
|
+
*/
|
|
29495
|
+
async applyFileSystemProtection(fileSystemId, spec) {
|
|
29496
|
+
if (spec === void 0 || spec === null) return;
|
|
29497
|
+
const protection = spec.ReplicationOverwriteProtection;
|
|
29498
|
+
if (protection === void 0) return;
|
|
29499
|
+
await this.retryOnTransientControlPlane(() => this.getClient().send(new UpdateFileSystemProtectionCommand({
|
|
29500
|
+
FileSystemId: fileSystemId,
|
|
29501
|
+
ReplicationOverwriteProtection: protection
|
|
29502
|
+
})), `set FileSystemProtection on ${fileSystemId}`);
|
|
29503
|
+
this.logger.debug(`Set ReplicationOverwriteProtection=${protection} on EFS FileSystem ${fileSystemId}`);
|
|
29504
|
+
}
|
|
29505
|
+
/**
|
|
29506
|
+
* Retry an EFS control-plane call on the transient "settling" errors AWS
|
|
29507
|
+
* returns when two file-system-modifying operations land back-to-back (e.g.
|
|
29508
|
+
* a `PutLifecycleConfiguration` immediately followed by a `PutBackupPolicy`).
|
|
29509
|
+
* `IncorrectFileSystemLifeCycleState` / `ThrottlingException` /
|
|
29510
|
+
* `ConflictException` and the message-pattern set below are the same class.
|
|
29511
|
+
* Backoff: ~2s,4s,8s,16s,30s,30s... bounded to ~2min total.
|
|
29512
|
+
*/
|
|
29513
|
+
async retryOnTransientControlPlane(op, label, maxAttempts = 8) {
|
|
29514
|
+
let delayMs = 2e3;
|
|
29515
|
+
for (let attempt = 1;; attempt++) try {
|
|
29516
|
+
return await op();
|
|
29517
|
+
} catch (error) {
|
|
29518
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
29519
|
+
const name = error instanceof Error ? error.name : "";
|
|
29520
|
+
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;
|
|
29521
|
+
this.logger.debug(`Transient error on "${label}" (attempt ${attempt}/${maxAttempts}): ${msg} — retrying in ${delayMs}ms`);
|
|
29522
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
29523
|
+
delayMs = Math.min(delayMs * 2, 3e4);
|
|
29524
|
+
}
|
|
29525
|
+
}
|
|
29272
29526
|
async deleteFileSystem(logicalId, physicalId, resourceType, context) {
|
|
29273
29527
|
this.logger.debug(`Deleting EFS FileSystem ${logicalId}: ${physicalId}`);
|
|
29274
29528
|
try {
|
|
@@ -29430,10 +29684,11 @@ var EFSProvider = class {
|
|
|
29430
29684
|
*
|
|
29431
29685
|
* Dispatch per resource type:
|
|
29432
29686
|
* - `FileSystem` → `DescribeFileSystems` filtered by id (PerformanceMode,
|
|
29433
|
-
* ThroughputMode, Encrypted, KmsKeyId, ProvisionedThroughputInMibps
|
|
29434
|
-
* plus optional
|
|
29435
|
-
* `DescribeBackupPolicy
|
|
29436
|
-
*
|
|
29687
|
+
* ThroughputMode, Encrypted, KmsKeyId, ProvisionedThroughputInMibps,
|
|
29688
|
+
* AvailabilityZoneName, FileSystemProtection), plus optional
|
|
29689
|
+
* `DescribeLifecycleConfiguration`, `DescribeBackupPolicy`, and
|
|
29690
|
+
* `DescribeFileSystemPolicy` enrichment. Each enrichment call is wrapped
|
|
29691
|
+
* in its own try/catch so a "not configured" error on any of them omits
|
|
29437
29692
|
* the corresponding key without failing the whole snapshot.
|
|
29438
29693
|
* - `AccessPoint` → `DescribeAccessPoints` filtered by id (PosixUser,
|
|
29439
29694
|
* RootDirectory).
|
|
@@ -29473,8 +29728,11 @@ var EFSProvider = class {
|
|
|
29473
29728
|
if (fs.Encrypted !== void 0) result["Encrypted"] = fs.Encrypted;
|
|
29474
29729
|
if (fs.KmsKeyId !== void 0) result["KmsKeyId"] = fs.KmsKeyId;
|
|
29475
29730
|
if (fs.ProvisionedThroughputInMibps !== void 0) result["ProvisionedThroughputInMibps"] = fs.ProvisionedThroughputInMibps;
|
|
29731
|
+
if (fs.AvailabilityZoneName !== void 0) result["AvailabilityZoneName"] = fs.AvailabilityZoneName;
|
|
29732
|
+
if (fs.FileSystemProtection?.ReplicationOverwriteProtection !== void 0) result["FileSystemProtection"] = { ReplicationOverwriteProtection: fs.FileSystemProtection.ReplicationOverwriteProtection };
|
|
29476
29733
|
try {
|
|
29477
|
-
|
|
29734
|
+
const policies = (await this.getClient().send(new DescribeLifecycleConfigurationCommand({ FileSystemId: physicalId }))).LifecyclePolicies ?? [];
|
|
29735
|
+
if (policies.length > 0) result["LifecyclePolicies"] = policies.map((p) => {
|
|
29478
29736
|
const out = {};
|
|
29479
29737
|
if (p.TransitionToIA !== void 0) out["TransitionToIA"] = p.TransitionToIA;
|
|
29480
29738
|
if (p.TransitionToPrimaryStorageClass !== void 0) out["TransitionToPrimaryStorageClass"] = p.TransitionToPrimaryStorageClass;
|
|
@@ -29491,6 +29749,16 @@ var EFSProvider = class {
|
|
|
29491
29749
|
} catch (err) {
|
|
29492
29750
|
if (err instanceof FileSystemNotFound) return void 0;
|
|
29493
29751
|
}
|
|
29752
|
+
try {
|
|
29753
|
+
const resp = await this.getClient().send(new DescribeFileSystemPolicyCommand({ FileSystemId: physicalId }));
|
|
29754
|
+
if (resp.Policy !== void 0) try {
|
|
29755
|
+
result["FileSystemPolicy"] = JSON.parse(resp.Policy);
|
|
29756
|
+
} catch {
|
|
29757
|
+
result["FileSystemPolicy"] = resp.Policy;
|
|
29758
|
+
}
|
|
29759
|
+
} catch (err) {
|
|
29760
|
+
if (err instanceof FileSystemNotFound) return void 0;
|
|
29761
|
+
}
|
|
29494
29762
|
result["FileSystemTags"] = normalizeAwsTagsToCfn(fs.Tags);
|
|
29495
29763
|
return result;
|
|
29496
29764
|
}
|
|
@@ -52905,7 +53173,7 @@ function reorderArgs(argv) {
|
|
|
52905
53173
|
async function main() {
|
|
52906
53174
|
installPipeCloseHandler();
|
|
52907
53175
|
const program = new Command();
|
|
52908
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
53176
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.216.0");
|
|
52909
53177
|
program.addCommand(createBootstrapCommand());
|
|
52910
53178
|
program.addCommand(createSynthCommand());
|
|
52911
53179
|
program.addCommand(createListCommand());
|