@go-to-k/cdkd 0.267.20 → 0.268.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/{asg-provider-BoZOIBd3.js → asg-provider-ZylgRJOY.js} +2 -2
- package/dist/{asg-provider-BoZOIBd3.js.map → asg-provider-ZylgRJOY.js.map} +1 -1
- package/dist/cli.js +234 -4
- package/dist/cli.js.map +1 -1
- package/dist/{deploy-engine-C94uMh13.js → deploy-engine-B5cRuFij.js} +7 -3
- package/dist/{deploy-engine-C94uMh13.js.map → deploy-engine-B5cRuFij.js.map} +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as WorkGraph, $t as MissingCdkCliError, A as slowCcOperationTimeoutMs, At as warnDeprecatedNoPrefixCliFlag, B as applyRoleArnIfSet, Bt as resolveBucketRegion, C as yellow, Ct as resolveAutoAssetStorage, D as ProviderRegistry, Dt as resolveStateBucketWithDefaultAndSource, E as clearOnUpdateRemoval, Et as resolveStateBucketWithDefault, F as refStateLookupFromResource, Ft as uploadCfnTemplate, G as DagBuilder, H as describeTypeWithThrottleRetry, Ht as getAwsClients, I as WAFv2WebACLProvider, It as expectedOwnerParam, J as S3StateBackend, K as TemplateParser, Kt as CdkdError, L as normalizeAwsTagsToCfn, Lt as AssemblyReader, M as isTerminationProtectionPropagationError, Mt as CFN_TEMPLATE_URL_LIMIT, N as IntrinsicFunctionResolver, Nt as MIGRATE_TMP_PREFIX, O as findActionableSilentDrops, Ot as resolveUseCdkBootstrapAssets, P as cfnRefValueFromPhysicalId, Pt as findLargeInlineResources, Q as stringifyValue, R as resolveExplicitPhysicalId, Rt as processStackMessages, S as red, St as resolveApp, T as collectInlinePolicyNamesManagedBySiblings, Tt as resolveSkipPrefix, U as withRetry, Ut as resetAwsClients, V as DiffCalculator, Vt as AwsClients, W as isRetryableTransientError, Wt as setAwsClients, X as shouldRetainResource, Xt as LocalMigrateError, Y as rebuildClientForBucketRegion, Yt as LocalInvokeBuildError$1, Z as AssetPublisher, Zt as LocalStartServiceError, _ as formatResourceLine, _t as getDockerImageBySourceHash, a as DeploymentEventsStore, an as StackHasActiveImportsError, at as BOOTSTRAP_MARKER_PREFIX, b as gray, bt as getDefaultStateBucketName, c as replayFailedOperations, ct as parseBootstrapMarker, d as IMPLICIT_DELETE_DEPENDENCIES, dn as normalizeAwsError, dt as buildDockerImage, en as NestedStackChildDirectDestroyError, et as buildAssetRedirectMap, f as computeImplicitDeleteEdges, fn as withErrorHandling, ft as formatDockerLoginError, g as renderStatefulReason, gt as AssetManifestLoader, h as isStatefulRecreateTargetSync, ht as runDockerStreaming, i as DeploymentEventsReader, in as ResourceUpdateNotSupportedError, it as AssetModeResolver, j as disableInstanceApiTermination, jt as CFN_TEMPLATE_BODY_LIMIT, k as CloudControlProvider, kt as stateBucketExistenceConfirmed, l as replayRollback, lt as validateAssetBucketName, m as MULTI_REGION_RECREATE_BLOCKED_TYPES, mt as runDockerForeground, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nn as ProvisioningError, nt as loadPublishableAssetManifest, o as planFailedOps, on as StackTerminationProtectionError, ot as ensureAssetStorage, p as extractDeploymentEventError, pt as getDockerCmd, q as LockManager, r as DeployEngine, rn as ResourceTimeoutError, rt as rewriteTemplateAssetReferences, s as planRollback, st as getBootstrapMarkerKey, t as DEFAULT_RESOURCE_TIMEOUT_MS, tn as PartialFailureError, tt as createAssetRedirectResolver, u as withResourceDeadline, ut as validateContainerRepoName, v as bold, vt as Synthesizer, w as IAMRoleProvider, wt as resolveCaptureObservedState, x as green, xt as getLegacyStateBucketName, y as cyan, yt as synthesisStatusMessage, z as assertRegionMatch } from "./deploy-engine-
|
|
2
|
+
import { $ as WorkGraph, $t as MissingCdkCliError, A as slowCcOperationTimeoutMs, At as warnDeprecatedNoPrefixCliFlag, B as applyRoleArnIfSet, Bt as resolveBucketRegion, C as yellow, Ct as resolveAutoAssetStorage, D as ProviderRegistry, Dt as resolveStateBucketWithDefaultAndSource, E as clearOnUpdateRemoval, Et as resolveStateBucketWithDefault, F as refStateLookupFromResource, Ft as uploadCfnTemplate, G as DagBuilder, H as describeTypeWithThrottleRetry, Ht as getAwsClients, I as WAFv2WebACLProvider, It as expectedOwnerParam, J as S3StateBackend, K as TemplateParser, Kt as CdkdError, L as normalizeAwsTagsToCfn, Lt as AssemblyReader, M as isTerminationProtectionPropagationError, Mt as CFN_TEMPLATE_URL_LIMIT, N as IntrinsicFunctionResolver, Nt as MIGRATE_TMP_PREFIX, O as findActionableSilentDrops, Ot as resolveUseCdkBootstrapAssets, P as cfnRefValueFromPhysicalId, Pt as findLargeInlineResources, Q as stringifyValue, R as resolveExplicitPhysicalId, Rt as processStackMessages, S as red, St as resolveApp, T as collectInlinePolicyNamesManagedBySiblings, Tt as resolveSkipPrefix, U as withRetry, Ut as resetAwsClients, V as DiffCalculator, Vt as AwsClients, W as isRetryableTransientError, Wt as setAwsClients, X as shouldRetainResource, Xt as LocalMigrateError, Y as rebuildClientForBucketRegion, Yt as LocalInvokeBuildError$1, Z as AssetPublisher, Zt as LocalStartServiceError, _ as formatResourceLine, _t as getDockerImageBySourceHash, a as DeploymentEventsStore, an as StackHasActiveImportsError, at as BOOTSTRAP_MARKER_PREFIX, b as gray, bt as getDefaultStateBucketName, c as replayFailedOperations, ct as parseBootstrapMarker, d as IMPLICIT_DELETE_DEPENDENCIES, dn as normalizeAwsError, dt as buildDockerImage, en as NestedStackChildDirectDestroyError, et as buildAssetRedirectMap, f as computeImplicitDeleteEdges, fn as withErrorHandling, ft as formatDockerLoginError, g as renderStatefulReason, gt as AssetManifestLoader, h as isStatefulRecreateTargetSync, ht as runDockerStreaming, i as DeploymentEventsReader, in as ResourceUpdateNotSupportedError, it as AssetModeResolver, j as disableInstanceApiTermination, jt as CFN_TEMPLATE_BODY_LIMIT, k as CloudControlProvider, kt as stateBucketExistenceConfirmed, l as replayRollback, lt as validateAssetBucketName, m as MULTI_REGION_RECREATE_BLOCKED_TYPES, mt as runDockerForeground, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nn as ProvisioningError, nt as loadPublishableAssetManifest, o as planFailedOps, on as StackTerminationProtectionError, ot as ensureAssetStorage, p as extractDeploymentEventError, pt as getDockerCmd, q as LockManager, r as DeployEngine, rn as ResourceTimeoutError, rt as rewriteTemplateAssetReferences, s as planRollback, st as getBootstrapMarkerKey, t as DEFAULT_RESOURCE_TIMEOUT_MS, tn as PartialFailureError, tt as createAssetRedirectResolver, u as withResourceDeadline, ut as validateContainerRepoName, v as bold, vt as Synthesizer, w as IAMRoleProvider, wt as resolveCaptureObservedState, x as green, xt as getLegacyStateBucketName, y as cyan, yt as synthesisStatusMessage, z as assertRegionMatch } from "./deploy-engine-B5cRuFij.js";
|
|
3
3
|
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-BYMEE-BS.js";
|
|
4
|
-
import { t as ASGProvider } from "./asg-provider-
|
|
4
|
+
import { t as ASGProvider } from "./asg-provider-ZylgRJOY.js";
|
|
5
5
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
6
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
7
7
|
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, 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";
|
|
@@ -17,7 +17,7 @@ import { APIGatewayClient, CreateAuthorizerCommand, CreateDeploymentCommand, Cre
|
|
|
17
17
|
import { CreateEventBusCommand, DeleteEventBusCommand, DeleteRuleCommand, DescribeEventBusCommand, DescribeRuleCommand, EventBridgeClient, ListRulesCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$1, ListTargetsByRuleCommand, PutRuleCommand, PutTargetsCommand, RemoveTargetsCommand, ResourceNotFoundException as ResourceNotFoundException$2, TagResourceCommand as TagResourceCommand$4, UntagResourceCommand as UntagResourceCommand$4, UpdateEventBusCommand } from "@aws-sdk/client-eventbridge";
|
|
18
18
|
import { CreateSecretCommand, DeleteSecretCommand, DescribeSecretCommand, GetSecretValueCommand, RemoveRegionsFromReplicationCommand, ReplicateSecretToRegionsCommand, ResourceNotFoundException as ResourceNotFoundException$3, SecretsManagerClient, TagResourceCommand as TagResourceCommand$5, UntagResourceCommand as UntagResourceCommand$5, UpdateSecretCommand } from "@aws-sdk/client-secrets-manager";
|
|
19
19
|
import { AddTagsToResourceCommand, DeleteParameterCommand, DescribeParametersCommand, GetParameterCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$2, ParameterNotFound, PutParameterCommand, RemoveTagsFromResourceCommand, SSMClient } from "@aws-sdk/client-ssm";
|
|
20
|
-
import { CloudFrontClient, CreateCloudFrontOriginAccessIdentityCommand, CreateDistributionCommand, CreateDistributionWithTagsCommand, DeleteCloudFrontOriginAccessIdentityCommand, DeleteDistributionCommand, GetCloudFrontOriginAccessIdentityCommand, GetDistributionCommand, GetDistributionConfigCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$3, NoSuchCloudFrontOriginAccessIdentity, NoSuchDistribution, TagResourceCommand as TagResourceCommand$6, UntagResourceCommand as UntagResourceCommand$6, UpdateCloudFrontOriginAccessIdentityCommand, UpdateDistributionCommand } from "@aws-sdk/client-cloudfront";
|
|
20
|
+
import { CloudFrontClient, CreateCloudFrontOriginAccessIdentityCommand, CreateDistributionCommand, CreateDistributionWithTagsCommand, CreateOriginAccessControlCommand, DeleteCloudFrontOriginAccessIdentityCommand, DeleteDistributionCommand, DeleteOriginAccessControlCommand, GetCloudFrontOriginAccessIdentityCommand, GetDistributionCommand, GetDistributionConfigCommand, GetOriginAccessControlCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$3, NoSuchCloudFrontOriginAccessIdentity, NoSuchDistribution, NoSuchOriginAccessControl, TagResourceCommand as TagResourceCommand$6, UntagResourceCommand as UntagResourceCommand$6, UpdateCloudFrontOriginAccessIdentityCommand, UpdateDistributionCommand, UpdateOriginAccessControlCommand } from "@aws-sdk/client-cloudfront";
|
|
21
21
|
import { CloudWatchClient, DeleteAlarmsCommand, DescribeAlarmsCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$4, PutMetricAlarmCommand, TagResourceCommand as TagResourceCommand$7, UntagResourceCommand as UntagResourceCommand$7 } from "@aws-sdk/client-cloudwatch";
|
|
22
22
|
import { AssociateKmsKeyCommand, CloudWatchLogsClient, CreateLogGroupCommand, DeleteDataProtectionPolicyCommand, DeleteIndexPolicyCommand, DeleteLogGroupCommand, DeleteRetentionPolicyCommand, DescribeIndexPoliciesCommand, DescribeLogGroupsCommand, DisassociateKmsKeyCommand, GetDataProtectionPolicyCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$5, PutBearerTokenAuthenticationCommand, PutDataProtectionPolicyCommand, PutIndexPolicyCommand, PutLogGroupDeletionProtectionCommand, PutRetentionPolicyCommand, ResourceAlreadyExistsException, ResourceNotFoundException as ResourceNotFoundException$4, TagResourceCommand as TagResourceCommand$8, UntagResourceCommand as UntagResourceCommand$8 } from "@aws-sdk/client-cloudwatch-logs";
|
|
23
23
|
import { BedrockAgentCoreControlClient, CreateAgentRuntimeCommand, CreateEvaluatorCommand, DeleteAgentRuntimeCommand, DeleteEvaluatorCommand, GetAgentRuntimeCommand, GetBrowserCommand, GetCodeInterpreterCommand, GetEvaluatorCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$6, ResourceNotFoundException as ResourceNotFoundException$5, TagResourceCommand as TagResourceCommand$9, UntagResourceCommand as UntagResourceCommand$9, UpdateAgentRuntimeCommand, UpdateEvaluatorCommand } from "@aws-sdk/client-bedrock-agentcore-control";
|
|
@@ -19903,6 +19903,235 @@ var CloudFrontOAIProvider = class {
|
|
|
19903
19903
|
}
|
|
19904
19904
|
};
|
|
19905
19905
|
|
|
19906
|
+
//#endregion
|
|
19907
|
+
//#region src/provisioning/providers/cloudfront-oac-provider.ts
|
|
19908
|
+
/**
|
|
19909
|
+
* SDK Provider for AWS::CloudFront::OriginAccessControl
|
|
19910
|
+
*
|
|
19911
|
+
* An Origin Access Control (OAC) is the modern replacement for an Origin
|
|
19912
|
+
* Access Identity and is what `S3BucketOrigin.withOriginAccessControl()`
|
|
19913
|
+
* synthesizes, so it appears in essentially every CloudFront + S3 CDK stack.
|
|
19914
|
+
* Before this provider it was the only resource in such a stack without an
|
|
19915
|
+
* SDK Provider and therefore routed through the Cloud Control API, paying
|
|
19916
|
+
* ProgressEvent polling (measured ~2.3s on the deploy critical path) for a
|
|
19917
|
+
* `CreateOriginAccessControl` call that returns synchronously. Because the
|
|
19918
|
+
* Distribution references the OAC, that latency delayed everything downstream.
|
|
19919
|
+
*
|
|
19920
|
+
* All four CloudFront OAC APIs are synchronous; `Update`/`Delete` additionally
|
|
19921
|
+
* require the resource's current `ETag` as `IfMatch`, fetched with
|
|
19922
|
+
* `GetOriginAccessControl`.
|
|
19923
|
+
*/
|
|
19924
|
+
var CloudFrontOACProvider = class {
|
|
19925
|
+
cloudFrontClient;
|
|
19926
|
+
logger = getLogger().child("CloudFrontOACProvider");
|
|
19927
|
+
handledProperties = /* @__PURE__ */ new Map([["AWS::CloudFront::OriginAccessControl", /* @__PURE__ */ new Set(["OriginAccessControlConfig"])]]);
|
|
19928
|
+
constructor() {
|
|
19929
|
+
const awsClients = getAwsClients();
|
|
19930
|
+
this.cloudFrontClient = awsClients.cloudFront;
|
|
19931
|
+
}
|
|
19932
|
+
/**
|
|
19933
|
+
* Create a CloudFront Origin Access Control.
|
|
19934
|
+
*
|
|
19935
|
+
* `CreateOriginAccessControl` is synchronous — the response already carries
|
|
19936
|
+
* the generated `Id`, so there is nothing to poll or wait for.
|
|
19937
|
+
*/
|
|
19938
|
+
async create(logicalId, resourceType, properties) {
|
|
19939
|
+
this.logger.debug(`Creating CloudFront Origin Access Control ${logicalId}`);
|
|
19940
|
+
try {
|
|
19941
|
+
const oacId = (await this.cloudFrontClient.send(new CreateOriginAccessControlCommand({ OriginAccessControlConfig: this.toSdkConfig(properties["OriginAccessControlConfig"], logicalId, resourceType) }))).OriginAccessControl?.Id;
|
|
19942
|
+
if (!oacId) throw new Error("CreateOriginAccessControl returned no OriginAccessControl.Id");
|
|
19943
|
+
this.logger.debug(`Created CloudFront Origin Access Control: ${oacId}`);
|
|
19944
|
+
return {
|
|
19945
|
+
physicalId: oacId,
|
|
19946
|
+
attributes: { Id: oacId }
|
|
19947
|
+
};
|
|
19948
|
+
} catch (error) {
|
|
19949
|
+
if (error instanceof CdkdError) throw error;
|
|
19950
|
+
const cause = error instanceof Error ? error : void 0;
|
|
19951
|
+
throw new ProvisioningError(`Failed to create CloudFront Origin Access Control ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, void 0, cause);
|
|
19952
|
+
}
|
|
19953
|
+
}
|
|
19954
|
+
/**
|
|
19955
|
+
* Update a CloudFront Origin Access Control.
|
|
19956
|
+
*
|
|
19957
|
+
* `UpdateOriginAccessControl` overwrites the whole
|
|
19958
|
+
* `OriginAccessControlConfig` and requires the resource's current `ETag` as
|
|
19959
|
+
* `IfMatch`, so the update is a `Get` (for the ETag) followed by the
|
|
19960
|
+
* `Update` itself. Every field of the config is mutable in place — an OAC
|
|
19961
|
+
* is never replaced by a property change.
|
|
19962
|
+
*/
|
|
19963
|
+
async update(logicalId, physicalId, resourceType, properties, _previousProperties) {
|
|
19964
|
+
this.logger.debug(`Updating CloudFront Origin Access Control ${logicalId}: ${physicalId}`);
|
|
19965
|
+
try {
|
|
19966
|
+
const etag = (await this.cloudFrontClient.send(new GetOriginAccessControlCommand({ Id: physicalId }))).ETag;
|
|
19967
|
+
if (!etag) throw new Error("GetOriginAccessControl did not return ETag");
|
|
19968
|
+
await this.cloudFrontClient.send(new UpdateOriginAccessControlCommand({
|
|
19969
|
+
Id: physicalId,
|
|
19970
|
+
IfMatch: etag,
|
|
19971
|
+
OriginAccessControlConfig: this.toSdkConfig(properties["OriginAccessControlConfig"], logicalId, resourceType, physicalId)
|
|
19972
|
+
}));
|
|
19973
|
+
this.logger.debug(`Successfully updated CloudFront Origin Access Control ${logicalId}`);
|
|
19974
|
+
return {
|
|
19975
|
+
physicalId,
|
|
19976
|
+
wasReplaced: false,
|
|
19977
|
+
attributes: { Id: physicalId }
|
|
19978
|
+
};
|
|
19979
|
+
} catch (error) {
|
|
19980
|
+
if (error instanceof CdkdError) throw error;
|
|
19981
|
+
const cause = error instanceof Error ? error : void 0;
|
|
19982
|
+
throw new ProvisioningError(`Failed to update CloudFront Origin Access Control ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
|
|
19983
|
+
}
|
|
19984
|
+
}
|
|
19985
|
+
/**
|
|
19986
|
+
* Delete a CloudFront Origin Access Control.
|
|
19987
|
+
*
|
|
19988
|
+
* `DeleteOriginAccessControl` requires the current `ETag` as `IfMatch`, so
|
|
19989
|
+
* the delete is a `Get` followed by the `Delete`. A `NoSuchOriginAccessControl`
|
|
19990
|
+
* from EITHER call is treated as idempotent success, but only after
|
|
19991
|
+
* `assertRegionMatch()` confirms the client is pointed at the region the
|
|
19992
|
+
* resource was created in (a region mismatch would otherwise silently
|
|
19993
|
+
* "succeed" while leaving the real resource behind).
|
|
19994
|
+
*/
|
|
19995
|
+
async delete(logicalId, physicalId, resourceType, _properties, context) {
|
|
19996
|
+
this.logger.debug(`Deleting CloudFront Origin Access Control ${logicalId}: ${physicalId}`);
|
|
19997
|
+
try {
|
|
19998
|
+
let etag;
|
|
19999
|
+
try {
|
|
20000
|
+
etag = (await this.cloudFrontClient.send(new GetOriginAccessControlCommand({ Id: physicalId }))).ETag;
|
|
20001
|
+
} catch (error) {
|
|
20002
|
+
if (error instanceof NoSuchOriginAccessControl) {
|
|
20003
|
+
await this.assertDeleteRegion(resourceType, logicalId, physicalId, context);
|
|
20004
|
+
this.logger.debug(`Origin Access Control ${physicalId} does not exist, skipping deletion`);
|
|
20005
|
+
return;
|
|
20006
|
+
}
|
|
20007
|
+
throw error;
|
|
20008
|
+
}
|
|
20009
|
+
await this.cloudFrontClient.send(new DeleteOriginAccessControlCommand({
|
|
20010
|
+
Id: physicalId,
|
|
20011
|
+
IfMatch: etag
|
|
20012
|
+
}));
|
|
20013
|
+
this.logger.debug(`Successfully deleted CloudFront Origin Access Control ${logicalId}`);
|
|
20014
|
+
} catch (error) {
|
|
20015
|
+
if (error instanceof NoSuchOriginAccessControl) {
|
|
20016
|
+
await this.assertDeleteRegion(resourceType, logicalId, physicalId, context);
|
|
20017
|
+
this.logger.debug(`Origin Access Control ${physicalId} does not exist, skipping deletion`);
|
|
20018
|
+
return;
|
|
20019
|
+
}
|
|
20020
|
+
if (error instanceof CdkdError) throw error;
|
|
20021
|
+
const cause = error instanceof Error ? error : void 0;
|
|
20022
|
+
throw new ProvisioningError(`Failed to delete CloudFront Origin Access Control ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, physicalId, cause);
|
|
20023
|
+
}
|
|
20024
|
+
}
|
|
20025
|
+
/**
|
|
20026
|
+
* Get resource attribute (for Fn::GetAtt resolution).
|
|
20027
|
+
*
|
|
20028
|
+
* `Id` is the type's only read-only attribute in the CFn schema, and it IS
|
|
20029
|
+
* the physical id, so no AWS call is needed.
|
|
20030
|
+
*/
|
|
20031
|
+
async getAttribute(physicalId, _resourceType, attributeName) {
|
|
20032
|
+
if (attributeName === "Id") return physicalId;
|
|
20033
|
+
throw new Error(`Unsupported attribute: ${attributeName} for AWS::CloudFront::OriginAccessControl`);
|
|
20034
|
+
}
|
|
20035
|
+
/**
|
|
20036
|
+
* Read the AWS-current OAC configuration in CFn-property shape.
|
|
20037
|
+
*
|
|
20038
|
+
* The CFn `OriginAccessControlConfig` field names and the SDK's are
|
|
20039
|
+
* identical, so the reverse mapping is a straight per-field copy.
|
|
20040
|
+
*
|
|
20041
|
+
* Every field is emitted unconditionally, with `?? ''` standing in for an
|
|
20042
|
+
* AWS response that omits it (docs/provider-development.md § 3b): the
|
|
20043
|
+
* optional `Description` is user-controllable and mutable, so dropping the
|
|
20044
|
+
* key when AWS returns nothing would leave it out of `observedProperties`
|
|
20045
|
+
* on a stack that never templated it — and the drift comparator's
|
|
20046
|
+
* keys-from-state walk would then never notice a console-side edit. The
|
|
20047
|
+
* `properties` fallback baseline is unaffected, since that walk only
|
|
20048
|
+
* descends into keys the template itself carries.
|
|
20049
|
+
*
|
|
20050
|
+
* Returns `undefined` when the OAC is gone (`NoSuchOriginAccessControl`).
|
|
20051
|
+
*/
|
|
20052
|
+
async readCurrentState(physicalId, _logicalId, resourceType) {
|
|
20053
|
+
if (resourceType !== "AWS::CloudFront::OriginAccessControl") return void 0;
|
|
20054
|
+
try {
|
|
20055
|
+
const config = (await this.cloudFrontClient.send(new GetOriginAccessControlCommand({ Id: physicalId }))).OriginAccessControl?.OriginAccessControlConfig;
|
|
20056
|
+
if (!config) return void 0;
|
|
20057
|
+
return { OriginAccessControlConfig: {
|
|
20058
|
+
Name: config.Name ?? "",
|
|
20059
|
+
Description: config.Description ?? "",
|
|
20060
|
+
OriginAccessControlOriginType: config.OriginAccessControlOriginType ?? "",
|
|
20061
|
+
SigningBehavior: config.SigningBehavior ?? "",
|
|
20062
|
+
SigningProtocol: config.SigningProtocol ?? ""
|
|
20063
|
+
} };
|
|
20064
|
+
} catch (error) {
|
|
20065
|
+
if (error instanceof NoSuchOriginAccessControl) return void 0;
|
|
20066
|
+
throw error;
|
|
20067
|
+
}
|
|
20068
|
+
}
|
|
20069
|
+
/**
|
|
20070
|
+
* Adopt an existing CloudFront Origin Access Control into cdkd state.
|
|
20071
|
+
*
|
|
20072
|
+
* **Explicit override only.** An OAC carries no tags (CloudFront's tagging
|
|
20073
|
+
* APIs cover distributions / streaming distributions, not OACs) and has no
|
|
20074
|
+
* template-supplied physical name — the physical id is the AWS-generated
|
|
20075
|
+
* `E...` id, while the config's `Name` is a display field that AWS does not
|
|
20076
|
+
* accept as a lookup key. Users adopting an existing OAC pass
|
|
20077
|
+
* `--resource <logicalId>=<oacId>`; the id is verified with a single
|
|
20078
|
+
* `GetOriginAccessControl` so a typo reports not-found instead of poisoning
|
|
20079
|
+
* state.
|
|
20080
|
+
*/
|
|
20081
|
+
async import(input) {
|
|
20082
|
+
if (!input.knownPhysicalId) return null;
|
|
20083
|
+
try {
|
|
20084
|
+
await this.cloudFrontClient.send(new GetOriginAccessControlCommand({ Id: input.knownPhysicalId }));
|
|
20085
|
+
return {
|
|
20086
|
+
physicalId: input.knownPhysicalId,
|
|
20087
|
+
attributes: { Id: input.knownPhysicalId }
|
|
20088
|
+
};
|
|
20089
|
+
} catch (error) {
|
|
20090
|
+
if (error instanceof NoSuchOriginAccessControl) return null;
|
|
20091
|
+
throw error;
|
|
20092
|
+
}
|
|
20093
|
+
}
|
|
20094
|
+
/**
|
|
20095
|
+
* Map the CFn `OriginAccessControlConfig` property onto the SDK's
|
|
20096
|
+
* `OriginAccessControlConfig` shape.
|
|
20097
|
+
*
|
|
20098
|
+
* The two shapes use identical field names, so this is a field-by-field
|
|
20099
|
+
* copy that exists to (a) fail loudly when a required field is missing
|
|
20100
|
+
* rather than letting the SDK reject with an opaque serialization error,
|
|
20101
|
+
* and (b) keep unknown extra keys out of the request.
|
|
20102
|
+
*/
|
|
20103
|
+
toSdkConfig(value, logicalId, resourceType, physicalId) {
|
|
20104
|
+
const config = value ?? {};
|
|
20105
|
+
const name = config["Name"];
|
|
20106
|
+
const originType = config["OriginAccessControlOriginType"];
|
|
20107
|
+
const signingBehavior = config["SigningBehavior"];
|
|
20108
|
+
const signingProtocol = config["SigningProtocol"];
|
|
20109
|
+
const missing = [
|
|
20110
|
+
typeof name === "string" && name.length > 0 ? void 0 : "Name",
|
|
20111
|
+
typeof originType === "string" ? void 0 : "OriginAccessControlOriginType",
|
|
20112
|
+
typeof signingBehavior === "string" ? void 0 : "SigningBehavior",
|
|
20113
|
+
typeof signingProtocol === "string" ? void 0 : "SigningProtocol"
|
|
20114
|
+
].filter((field) => field !== void 0);
|
|
20115
|
+
if (missing.length > 0) throw new ProvisioningError(`CloudFront Origin Access Control ${logicalId}: OriginAccessControlConfig is missing required field(s): ${missing.join(", ")}`, resourceType, logicalId, physicalId);
|
|
20116
|
+
const description = config["Description"];
|
|
20117
|
+
return {
|
|
20118
|
+
Name: name,
|
|
20119
|
+
OriginAccessControlOriginType: originType,
|
|
20120
|
+
SigningBehavior: signingBehavior,
|
|
20121
|
+
SigningProtocol: signingProtocol,
|
|
20122
|
+
...typeof description === "string" ? { Description: description } : {}
|
|
20123
|
+
};
|
|
20124
|
+
}
|
|
20125
|
+
/**
|
|
20126
|
+
* Shared region guard for the two delete-path not-found branches: a
|
|
20127
|
+
* `*NotFound` may only be treated as idempotent success when the client's
|
|
20128
|
+
* region matches the region the resource was recorded in.
|
|
20129
|
+
*/
|
|
20130
|
+
async assertDeleteRegion(resourceType, logicalId, physicalId, context) {
|
|
20131
|
+
assertRegionMatch(await this.cloudFrontClient.config.region(), context?.expectedRegion, resourceType, logicalId, physicalId);
|
|
20132
|
+
}
|
|
20133
|
+
};
|
|
20134
|
+
|
|
19906
20135
|
//#endregion
|
|
19907
20136
|
//#region src/provisioning/providers/cloudfront-distribution-provider.ts
|
|
19908
20137
|
/**
|
|
@@ -42505,6 +42734,7 @@ function registerAllProviders(registry) {
|
|
|
42505
42734
|
registry.register("AWS::ApiGatewayV2::Route", apigwV2Provider);
|
|
42506
42735
|
registry.register("AWS::ApiGatewayV2::Authorizer", apigwV2Provider);
|
|
42507
42736
|
registry.register("AWS::CloudFront::CloudFrontOriginAccessIdentity", new CloudFrontOAIProvider());
|
|
42737
|
+
registry.register("AWS::CloudFront::OriginAccessControl", new CloudFrontOACProvider());
|
|
42508
42738
|
registry.register("AWS::CloudFront::Distribution", new CloudFrontDistributionProvider());
|
|
42509
42739
|
registry.register("AWS::StepFunctions::StateMachine", new StepFunctionsProvider());
|
|
42510
42740
|
const ecsProvider = new ECSProvider();
|
|
@@ -62383,7 +62613,7 @@ function createMigrateCommand() {
|
|
|
62383
62613
|
*/
|
|
62384
62614
|
function buildProgram() {
|
|
62385
62615
|
const program = new Command();
|
|
62386
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
62616
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.268.0");
|
|
62387
62617
|
program.hook("preAction", (_thisCommand, actionCommand) => {
|
|
62388
62618
|
const { profile } = actionCommand.optsWithGlobals();
|
|
62389
62619
|
if (profile !== void 0) process.env["AWS_PROFILE"] = profile;
|