@go-to-k/cdkd 0.198.0 → 0.200.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 uploadCfnTemplate, A as S3StateBackend, At as PATTERN_B_NAME_PROPERTIES, B as Synthesizer, C as assertRegionMatch, Ct as normalizeAwsError, D as DagBuilder, E as DiffCalculator, Et as getLogger, F as buildDockerImage, Ft as withStackName, G as resolveSkipPrefix, H as getLegacyStateBucketName, I as formatDockerLoginError, J as warnDeprecatedNoPrefixCliFlag, K as resolveStateBucketWithDefault, L as getDockerCmd, M as AssetPublisher, Mt as generateResourceName, N as stringifyValue, Nt as generateResourceNameWithFallback, O as TemplateParser, Ot as runStackBuffered, P as WorkGraph, Pt as withSkipPrefix, Q as findLargeInlineResources, R as runDockerForeground, S as CloudControlProvider, T as applyRoleArnIfSet, U as resolveApp, V as getDefaultStateBucketName, W as resolveCaptureObservedState, X as CFN_TEMPLATE_URL_LIMIT, Y as CFN_TEMPLATE_BODY_LIMIT, Z as MIGRATE_TMP_PREFIX, _ as matchesCdkPath, _t as StackHasActiveImportsError, a as withRetry, b as ProviderRegistry, c as bold, ct as LocalMigrateError, d as green, dt as MissingCdkCliError, et as AssemblyReader, f as red, ft as NestedStackChildDirectDestroyError, g as CDK_PATH_TAG, gt as ResourceUpdateNotSupportedError, h as collectInlinePolicyNamesManagedBySiblings, ht as ResourceTimeoutError, i as withResourceDeadline, it as CdkdError, j as shouldRetainResource, jt as PATTERN_B_RESOURCE_TYPES, k as LockManager, kt as getLiveRenderer, l as cyan, lt as LocalStartServiceError, m as IAMRoleProvider, mt as ProvisioningError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as resolveBucketRegion, o as IMPLICIT_DELETE_DEPENDENCIES, p as yellow, pt as PartialFailureError, q as resolveStateBucketWithDefaultAndSource, r as DeployEngine, s as formatResourceLine, st as LocalInvokeBuildError$1, t as DEFAULT_RESOURCE_TIMEOUT_MS, u as gray, v as normalizeAwsTagsToCfn, vt as StackTerminationProtectionError, w as IntrinsicFunctionResolver, wt as withErrorHandling, x as findActionableSilentDrops, y as resolveExplicitPhysicalId, z as runDockerStreaming } from "./deploy-engine-
|
|
3
|
+
import { $ as uploadCfnTemplate, A as S3StateBackend, At as PATTERN_B_NAME_PROPERTIES, B as Synthesizer, C as assertRegionMatch, Ct as normalizeAwsError, D as DagBuilder, E as DiffCalculator, Et as getLogger, F as buildDockerImage, Ft as withStackName, G as resolveSkipPrefix, H as getLegacyStateBucketName, I as formatDockerLoginError, J as warnDeprecatedNoPrefixCliFlag, K as resolveStateBucketWithDefault, L as getDockerCmd, M as AssetPublisher, Mt as generateResourceName, N as stringifyValue, Nt as generateResourceNameWithFallback, O as TemplateParser, Ot as runStackBuffered, P as WorkGraph, Pt as withSkipPrefix, Q as findLargeInlineResources, R as runDockerForeground, S as CloudControlProvider, T as applyRoleArnIfSet, U as resolveApp, V as getDefaultStateBucketName, W as resolveCaptureObservedState, X as CFN_TEMPLATE_URL_LIMIT, Y as CFN_TEMPLATE_BODY_LIMIT, Z as MIGRATE_TMP_PREFIX, _ as matchesCdkPath, _t as StackHasActiveImportsError, a as withRetry, b as ProviderRegistry, c as bold, ct as LocalMigrateError, d as green, dt as MissingCdkCliError, et as AssemblyReader, f as red, ft as NestedStackChildDirectDestroyError, g as CDK_PATH_TAG, gt as ResourceUpdateNotSupportedError, h as collectInlinePolicyNamesManagedBySiblings, ht as ResourceTimeoutError, i as withResourceDeadline, it as CdkdError, j as shouldRetainResource, jt as PATTERN_B_RESOURCE_TYPES, k as LockManager, kt as getLiveRenderer, l as cyan, lt as LocalStartServiceError, m as IAMRoleProvider, mt as ProvisioningError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as resolveBucketRegion, o as IMPLICIT_DELETE_DEPENDENCIES, p as yellow, pt as PartialFailureError, q as resolveStateBucketWithDefaultAndSource, r as DeployEngine, s as formatResourceLine, st as LocalInvokeBuildError$1, t as DEFAULT_RESOURCE_TIMEOUT_MS, u as gray, v as normalizeAwsTagsToCfn, vt as StackTerminationProtectionError, w as IntrinsicFunctionResolver, wt as withErrorHandling, x as findActionableSilentDrops, y as resolveExplicitPhysicalId, z as runDockerStreaming } from "./deploy-engine-DAPAdI1e.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";
|
|
@@ -62,7 +62,7 @@ import { CreateNamespaceCommand, CreateTableBucketCommand, CreateTableCommand as
|
|
|
62
62
|
import { AttachLoadBalancerTargetGroupsCommand, AttachLoadBalancersCommand, AttachTrafficSourcesCommand, AutoScalingClient, CreateAutoScalingGroupCommand, CreateOrUpdateTagsCommand, DeleteAutoScalingGroupCommand, DeleteLifecycleHookCommand, DeleteNotificationConfigurationCommand, DeleteTagsCommand as DeleteTagsCommand$1, DescribeAutoScalingGroupsCommand, DescribeLifecycleHooksCommand, DescribeNotificationConfigurationsCommand, DescribeTrafficSourcesCommand, DetachLoadBalancerTargetGroupsCommand, DetachLoadBalancersCommand, DetachTrafficSourcesCommand, DisableMetricsCollectionCommand, EnableMetricsCollectionCommand, PutLifecycleHookCommand, PutNotificationConfigurationCommand, UpdateAutoScalingGroupCommand } from "@aws-sdk/client-auto-scaling";
|
|
63
63
|
import { Document, Pair, Scalar, YAMLMap, YAMLSeq, parse as parse$1, stringify } from "yaml";
|
|
64
64
|
import { createLocalStateProvider, getEmbedConfig, isCfnFlagPresent, listTargets, rejectExplicitCfnStackWithMultipleStacks, resolveCfnFallbackRegion, setEmbedConfig, substituteAgainstState, substituteAgainstStateAsync, substituteEnvVarsFromState, substituteEnvVarsFromStateAsync } from "cdk-local";
|
|
65
|
-
import { A2A_CONTAINER_PORT, A2A_PATH, AGENTCORE_A2A_PROTOCOL, AGENTCORE_AGUI_PROTOCOL, AGENTCORE_MCP_PROTOCOL, ConnectionRegistry, EcsTaskResolutionError, HOST_GATEWAY_MIN_VERSION, LocalInvokeBuildError, MCP_CONTAINER_PORT, MCP_PATH, a2aInvokeOnce, addCommonEcsServiceOptions, architectureToPlatform, attachAuthorizers, attachStageContext, availableApiIdentifiers, bufferToBody, buildAgentCoreCodeImage, buildCognitoJwksUrl, buildConnectEvent, buildContainerImage, buildCorsConfigByApiId, buildCorsConfigFromCloudFrontChain, buildDisconnectEvent, buildJwksUrlFromIssuer, buildMessageEvent, buildMgmtEndpointEnvUrl, buildStageMap, createAuthorizerCache, createFileWatcher, createJwksCache, createWatchPredicates, defaultCredentialsLoader, derivePseudoParametersFromRegion, discoverRoutes, discoverWebSocketApis, downloadAndExtractS3Bundle, filterRoutesByApiIdentifier, groupRoutesByServer, handleConnectionsRequest, invokeAgentCore, invokeAgentCoreWs,
|
|
65
|
+
import { A2A_CONTAINER_PORT, A2A_PATH, AGENTCORE_A2A_PROTOCOL, AGENTCORE_AGUI_PROTOCOL, AGENTCORE_MCP_PROTOCOL, ConnectionRegistry, EcsTaskResolutionError, HOST_GATEWAY_MIN_VERSION, LocalInvokeBuildError, MCP_CONTAINER_PORT, MCP_PATH, a2aInvokeOnce, addAlbSpecificOptions, addCommonEcsServiceOptions, albStrategy, architectureToPlatform, attachAuthorizers, attachStageContext, availableApiIdentifiers, bufferToBody, buildAgentCoreCodeImage, buildCognitoJwksUrl, buildConnectEvent, buildContainerImage, buildCorsConfigByApiId, buildCorsConfigFromCloudFrontChain, buildDisconnectEvent, buildJwksUrlFromIssuer, buildMessageEvent, buildMgmtEndpointEnvUrl, buildStageMap, createAuthorizerCache, createFileWatcher, createJwksCache, createWatchPredicates, defaultCredentialsLoader, derivePseudoParametersFromRegion, discoverRoutes, discoverWebSocketApis, downloadAndExtractS3Bundle, filterRoutesByApiIdentifier, groupRoutesByServer, handleConnectionsRequest, invokeAgentCore, invokeAgentCoreWs, materializeLayerFromArn, mcpInvokeOnce, parseConnectionsPath, parseSelectionExpressionPath, pickAgentCoreCandidateStack, probeHostGatewaySupport, readMtlsMaterialsFromDisk, resolveAgentCoreTarget, resolveEnvVars, resolveRuntimeCodeMountPath, resolveRuntimeFileExtension, resolveRuntimeImage, resolveSingleTarget, resolveWatchConfig, runEcsServiceEmulator, signAgentCoreInvocation, startApiServer, substituteImagePlaceholders, tryResolveImageFnJoin, verifyJwtViaDiscovery, waitForAgentCorePing } from "cdk-local/internal";
|
|
66
66
|
import { createServer } from "node:net";
|
|
67
67
|
import { promisify } from "node:util";
|
|
68
68
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
@@ -8360,7 +8360,14 @@ var LambdaEventSourceMappingProvider = class {
|
|
|
8360
8360
|
"AmazonManagedKafkaEventSourceConfig",
|
|
8361
8361
|
"DocumentDBEventSourceConfig",
|
|
8362
8362
|
"ScalingConfig",
|
|
8363
|
-
"Tags"
|
|
8363
|
+
"Tags",
|
|
8364
|
+
"KmsKeyArn",
|
|
8365
|
+
"LoggingConfig",
|
|
8366
|
+
"MetricsConfig",
|
|
8367
|
+
"ProvisionedPollerConfig",
|
|
8368
|
+
"Queues",
|
|
8369
|
+
"Topics",
|
|
8370
|
+
"StartingPositionTimestamp"
|
|
8364
8371
|
])]]);
|
|
8365
8372
|
constructor() {
|
|
8366
8373
|
const awsClients = getAwsClients();
|
|
@@ -8398,6 +8405,16 @@ var LambdaEventSourceMappingProvider = class {
|
|
|
8398
8405
|
const cfnTags = properties["Tags"];
|
|
8399
8406
|
params.Tags = Object.fromEntries(cfnTags.map((t) => [t.Key, t.Value]));
|
|
8400
8407
|
}
|
|
8408
|
+
if (properties["KmsKeyArn"] !== void 0) params.KMSKeyArn = properties["KmsKeyArn"];
|
|
8409
|
+
if (properties["LoggingConfig"] !== void 0) params.LoggingConfig = properties["LoggingConfig"];
|
|
8410
|
+
if (properties["MetricsConfig"] !== void 0) params.MetricsConfig = properties["MetricsConfig"];
|
|
8411
|
+
if (properties["ProvisionedPollerConfig"] !== void 0) params.ProvisionedPollerConfig = properties["ProvisionedPollerConfig"];
|
|
8412
|
+
if (properties["Queues"]) params.Queues = properties["Queues"];
|
|
8413
|
+
if (properties["Topics"]) params.Topics = properties["Topics"];
|
|
8414
|
+
if (properties["StartingPositionTimestamp"] !== void 0) {
|
|
8415
|
+
const raw = properties["StartingPositionTimestamp"];
|
|
8416
|
+
params.StartingPositionTimestamp = typeof raw === "number" ? /* @__PURE__ */ new Date(raw * 1e3) : raw instanceof Date ? raw : new Date(raw);
|
|
8417
|
+
}
|
|
8401
8418
|
const uuid = (await this.lambdaClient.send(new CreateEventSourceMappingCommand(params))).UUID;
|
|
8402
8419
|
if (!uuid) throw new Error("CreateEventSourceMapping did not return UUID");
|
|
8403
8420
|
this.logger.debug(`Successfully created event source mapping ${logicalId}: ${uuid}`);
|
|
@@ -8433,6 +8450,10 @@ var LambdaEventSourceMappingProvider = class {
|
|
|
8433
8450
|
if (properties["SourceAccessConfigurations"] !== void 0) updateParams.SourceAccessConfigurations = properties["SourceAccessConfigurations"];
|
|
8434
8451
|
if (properties["ScalingConfig"] !== void 0) updateParams.ScalingConfig = properties["ScalingConfig"];
|
|
8435
8452
|
if (properties["DocumentDBEventSourceConfig"] !== void 0) updateParams.DocumentDBEventSourceConfig = properties["DocumentDBEventSourceConfig"];
|
|
8453
|
+
if (properties["KmsKeyArn"] !== void 0) updateParams.KMSKeyArn = properties["KmsKeyArn"];
|
|
8454
|
+
if (properties["LoggingConfig"] !== void 0) updateParams.LoggingConfig = properties["LoggingConfig"];
|
|
8455
|
+
if (properties["MetricsConfig"] !== void 0) updateParams.MetricsConfig = properties["MetricsConfig"];
|
|
8456
|
+
if (properties["ProvisionedPollerConfig"] !== void 0) updateParams.ProvisionedPollerConfig = properties["ProvisionedPollerConfig"];
|
|
8436
8457
|
const eventSourceMappingArn = (await this.lambdaClient.send(new UpdateEventSourceMappingCommand(updateParams))).EventSourceMappingArn;
|
|
8437
8458
|
if (eventSourceMappingArn) await this.applyTagDiff(eventSourceMappingArn, previousProperties["Tags"], properties["Tags"]);
|
|
8438
8459
|
this.logger.debug(`Successfully updated event source mapping ${logicalId}`);
|
|
@@ -8565,6 +8586,17 @@ var LambdaEventSourceMappingProvider = class {
|
|
|
8565
8586
|
if (resp.AmazonManagedKafkaEventSourceConfig !== void 0) result["AmazonManagedKafkaEventSourceConfig"] = resp.AmazonManagedKafkaEventSourceConfig;
|
|
8566
8587
|
if (resp.DocumentDBEventSourceConfig !== void 0) result["DocumentDBEventSourceConfig"] = resp.DocumentDBEventSourceConfig;
|
|
8567
8588
|
if (resp.ScalingConfig !== void 0) result["ScalingConfig"] = resp.ScalingConfig;
|
|
8589
|
+
if (resp.KMSKeyArn !== void 0) result["KmsKeyArn"] = resp.KMSKeyArn;
|
|
8590
|
+
if (resp.LoggingConfig !== void 0) result["LoggingConfig"] = resp.LoggingConfig;
|
|
8591
|
+
if (resp.MetricsConfig !== void 0) result["MetricsConfig"] = resp.MetricsConfig;
|
|
8592
|
+
if (resp.ProvisionedPollerConfig !== void 0) result["ProvisionedPollerConfig"] = resp.ProvisionedPollerConfig;
|
|
8593
|
+
if (resp.Queues !== void 0) result["Queues"] = [...resp.Queues];
|
|
8594
|
+
if (resp.Topics !== void 0) result["Topics"] = [...resp.Topics];
|
|
8595
|
+
if (resp.StartingPositionTimestamp !== void 0) {
|
|
8596
|
+
const raw = resp.StartingPositionTimestamp;
|
|
8597
|
+
const date = raw instanceof Date ? raw : new Date(raw);
|
|
8598
|
+
result["StartingPositionTimestamp"] = Math.floor(date.getTime() / 1e3);
|
|
8599
|
+
}
|
|
8568
8600
|
if (resp.State !== void 0) result["Enabled"] = resp.State === "Enabled" || resp.State === "Enabling" || resp.State === "Updating";
|
|
8569
8601
|
let tags = [];
|
|
8570
8602
|
if (resp.EventSourceMappingArn) try {
|
|
@@ -19791,7 +19823,15 @@ var RDSProvider = class {
|
|
|
19791
19823
|
"DBClusterIdentifier",
|
|
19792
19824
|
"DBSubnetGroupName",
|
|
19793
19825
|
"PubliclyAccessible",
|
|
19794
|
-
"Tags"
|
|
19826
|
+
"Tags",
|
|
19827
|
+
"AllocatedStorage",
|
|
19828
|
+
"DeletionProtection",
|
|
19829
|
+
"EngineVersion",
|
|
19830
|
+
"MasterUsername",
|
|
19831
|
+
"MasterUserPassword",
|
|
19832
|
+
"Port",
|
|
19833
|
+
"StorageEncrypted",
|
|
19834
|
+
"VPCSecurityGroups"
|
|
19795
19835
|
])]
|
|
19796
19836
|
]);
|
|
19797
19837
|
unhandledByDesign = new Map([["AWS::RDS::DBCluster", new Map([["DeleteAutomatedBackups", "cdkd hardcodes SkipFinalSnapshot=true on destroy; this CFn lifecycle flag has no equivalent on the runtime path"]])], ["AWS::RDS::DBInstance", new Map([
|
|
@@ -20045,6 +20085,14 @@ var RDSProvider = class {
|
|
|
20045
20085
|
DBClusterIdentifier: properties["DBClusterIdentifier"],
|
|
20046
20086
|
DBSubnetGroupName: properties["DBSubnetGroupName"],
|
|
20047
20087
|
PubliclyAccessible: properties["PubliclyAccessible"],
|
|
20088
|
+
...properties["AllocatedStorage"] !== void 0 && { AllocatedStorage: Number(properties["AllocatedStorage"]) },
|
|
20089
|
+
...properties["MasterUsername"] !== void 0 && { MasterUsername: properties["MasterUsername"] },
|
|
20090
|
+
...properties["DeletionProtection"] !== void 0 && { DeletionProtection: properties["DeletionProtection"] },
|
|
20091
|
+
...properties["EngineVersion"] !== void 0 && { EngineVersion: properties["EngineVersion"] },
|
|
20092
|
+
...properties["Port"] !== void 0 && { Port: Number(properties["Port"]) },
|
|
20093
|
+
...properties["MasterUserPassword"] !== void 0 && { MasterUserPassword: properties["MasterUserPassword"] },
|
|
20094
|
+
...properties["StorageEncrypted"] !== void 0 && { StorageEncrypted: properties["StorageEncrypted"] },
|
|
20095
|
+
...properties["VPCSecurityGroups"] !== void 0 && { VpcSecurityGroupIds: properties["VPCSecurityGroups"] },
|
|
20048
20096
|
...tags.length > 0 && { Tags: tags }
|
|
20049
20097
|
}))).DBInstance) throw new Error("CreateDBInstance did not return DBInstance");
|
|
20050
20098
|
this.logger.debug(`Successfully created DBInstance ${logicalId}: ${dbInstanceIdentifier}`);
|
|
@@ -20067,11 +20115,23 @@ var RDSProvider = class {
|
|
|
20067
20115
|
async updateDBInstance(logicalId, physicalId, resourceType, properties, previousProperties) {
|
|
20068
20116
|
this.logger.debug(`Updating DBInstance ${logicalId}: ${physicalId}`);
|
|
20069
20117
|
try {
|
|
20118
|
+
const newEngineVersion = properties["EngineVersion"];
|
|
20119
|
+
const prevEngineVersion = previousProperties["EngineVersion"];
|
|
20120
|
+
const allowMajorVersionUpgrade = newEngineVersion !== void 0 && newEngineVersion !== prevEngineVersion && prevEngineVersion !== void 0 && newEngineVersion.split(".")[0] !== prevEngineVersion.split(".")[0];
|
|
20070
20121
|
await this.getClient().send(new ModifyDBInstanceCommand({
|
|
20071
20122
|
DBInstanceIdentifier: physicalId,
|
|
20072
20123
|
DBInstanceClass: properties["DBInstanceClass"],
|
|
20073
20124
|
PubliclyAccessible: properties["PubliclyAccessible"],
|
|
20074
|
-
ApplyImmediately: true
|
|
20125
|
+
ApplyImmediately: true,
|
|
20126
|
+
...properties["AllocatedStorage"] !== void 0 && { AllocatedStorage: Number(properties["AllocatedStorage"]) },
|
|
20127
|
+
...properties["DeletionProtection"] !== void 0 && { DeletionProtection: properties["DeletionProtection"] },
|
|
20128
|
+
...newEngineVersion !== void 0 && {
|
|
20129
|
+
EngineVersion: newEngineVersion,
|
|
20130
|
+
...allowMajorVersionUpgrade && { AllowMajorVersionUpgrade: true }
|
|
20131
|
+
},
|
|
20132
|
+
...properties["Port"] !== void 0 && { DBPortNumber: Number(properties["Port"]) },
|
|
20133
|
+
...properties["MasterUserPassword"] !== void 0 && { MasterUserPassword: properties["MasterUserPassword"] },
|
|
20134
|
+
...properties["VPCSecurityGroups"] !== void 0 && { VpcSecurityGroupIds: properties["VPCSecurityGroups"] }
|
|
20075
20135
|
}));
|
|
20076
20136
|
this.logger.debug(`Successfully updated DBInstance ${logicalId}`);
|
|
20077
20137
|
const described = await this.describeDBInstance(physicalId);
|
|
@@ -20304,6 +20364,14 @@ var RDSProvider = class {
|
|
|
20304
20364
|
if (inst.DBClusterIdentifier !== void 0) result["DBClusterIdentifier"] = inst.DBClusterIdentifier;
|
|
20305
20365
|
if (inst.DBSubnetGroup?.DBSubnetGroupName !== void 0) result["DBSubnetGroupName"] = inst.DBSubnetGroup.DBSubnetGroupName;
|
|
20306
20366
|
if (inst.PubliclyAccessible !== void 0) result["PubliclyAccessible"] = inst.PubliclyAccessible;
|
|
20367
|
+
if (inst.AllocatedStorage !== void 0) result["AllocatedStorage"] = inst.AllocatedStorage;
|
|
20368
|
+
if (inst.MasterUsername !== void 0) result["MasterUsername"] = inst.MasterUsername;
|
|
20369
|
+
if (inst.DeletionProtection !== void 0) result["DeletionProtection"] = inst.DeletionProtection;
|
|
20370
|
+
if (inst.EngineVersion !== void 0) result["EngineVersion"] = inst.EngineVersion;
|
|
20371
|
+
if (inst.Endpoint?.Port !== void 0) result["Port"] = inst.Endpoint.Port;
|
|
20372
|
+
if (inst.StorageEncrypted !== void 0) result["StorageEncrypted"] = inst.StorageEncrypted;
|
|
20373
|
+
const sgIds = (inst.VpcSecurityGroups ?? []).map((sg) => sg.VpcSecurityGroupId).filter((id) => !!id);
|
|
20374
|
+
if (sgIds.length > 0) result["VPCSecurityGroups"] = sgIds;
|
|
20307
20375
|
if (inst.DBInstanceArn) await this.attachTags(result, inst.DBInstanceArn);
|
|
20308
20376
|
return result;
|
|
20309
20377
|
}
|
|
@@ -43276,7 +43344,7 @@ function parseTarget(target) {
|
|
|
43276
43344
|
function resolveLambdaTarget(target, stacks) {
|
|
43277
43345
|
if (stacks.length === 0) throw new LocalInvokeResolutionError("No stacks found in the synthesized assembly.");
|
|
43278
43346
|
const parsed = parseTarget(target);
|
|
43279
|
-
const stack = pickStack$
|
|
43347
|
+
const stack = pickStack$1(parsed, stacks);
|
|
43280
43348
|
const template = stack.template;
|
|
43281
43349
|
const resources = template.Resources ?? {};
|
|
43282
43350
|
let match;
|
|
@@ -43310,7 +43378,7 @@ function resolveLambdaTarget(target, stacks) {
|
|
|
43310
43378
|
* user may omit the stack prefix. Otherwise an explicit stack pattern is
|
|
43311
43379
|
* required.
|
|
43312
43380
|
*/
|
|
43313
|
-
function pickStack$
|
|
43381
|
+
function pickStack$1(parsed, stacks) {
|
|
43314
43382
|
if (parsed.stackPattern === null) {
|
|
43315
43383
|
if (stacks.length === 1) return stacks[0];
|
|
43316
43384
|
throw new LocalInvokeResolutionError(`Multiple stacks in app, target '${parsed.pathOrId}' is missing a stack prefix. Use 'StackName:${parsed.pathOrId}' or 'StackName/...' (path form). Available stacks: ${stacks.map((s) => s.stackName).join(", ")}.`);
|
|
@@ -43933,7 +44001,7 @@ function parseEcsTarget(target) {
|
|
|
43933
44001
|
function resolveEcsTaskTarget(target, stacks, context) {
|
|
43934
44002
|
if (stacks.length === 0) throw new EcsTaskResolutionError("No stacks found in the synthesized assembly.");
|
|
43935
44003
|
const parsed = parseEcsTarget(target);
|
|
43936
|
-
const stack = pickStack
|
|
44004
|
+
const stack = pickStack(parsed, stacks);
|
|
43937
44005
|
const resources = stack.template.Resources ?? {};
|
|
43938
44006
|
let logicalId;
|
|
43939
44007
|
let resource;
|
|
@@ -43954,7 +44022,7 @@ function resolveEcsTaskTarget(target, stacks, context) {
|
|
|
43954
44022
|
if (resource.Type !== "AWS::ECS::TaskDefinition") throw new EcsTaskResolutionError(`Resource '${logicalId}' in ${stack.stackName} is ${resource.Type}, not an AWS::ECS::TaskDefinition.`);
|
|
43955
44023
|
return extractTaskDefinitionProperties(stack, logicalId, resource, context);
|
|
43956
44024
|
}
|
|
43957
|
-
function pickStack
|
|
44025
|
+
function pickStack(parsed, stacks) {
|
|
43958
44026
|
if (parsed.stackPattern === null) {
|
|
43959
44027
|
if (stacks.length === 1) return stacks[0];
|
|
43960
44028
|
throw new EcsTaskResolutionError(`Multiple stacks in app, target '${parsed.pathOrId}' is missing a stack prefix. Use 'StackName:${parsed.pathOrId}' or 'StackName/...' (path form). Available stacks: ${stacks.map((s) => s.stackName).join(", ")}.`);
|
|
@@ -46548,7 +46616,7 @@ async function localStartApiCommand(target, options) {
|
|
|
46548
46616
|
jwksWarnedUrls,
|
|
46549
46617
|
sigV4CredentialsLoader,
|
|
46550
46618
|
sigV4WarnedForeignIds,
|
|
46551
|
-
sigV4Strict: options.
|
|
46619
|
+
sigV4Strict: options.strictSigv4 === true,
|
|
46552
46620
|
...defaultRegion && { defaultRegion }
|
|
46553
46621
|
});
|
|
46554
46622
|
servers.push({
|
|
@@ -46594,7 +46662,7 @@ async function localStartApiCommand(target, options) {
|
|
|
46594
46662
|
jwksCache,
|
|
46595
46663
|
jwksWarnedUrls,
|
|
46596
46664
|
sigV4WarnedForeignIds,
|
|
46597
|
-
sigV4Strict: options.
|
|
46665
|
+
sigV4Strict: options.strictSigv4 === true,
|
|
46598
46666
|
preDispatch: async (req, res) => {
|
|
46599
46667
|
if (!registryRef) return false;
|
|
46600
46668
|
return handleManagementRequest(req, res, registryRef.registry);
|
|
@@ -47755,7 +47823,7 @@ function resolveMtlsConfig(options) {
|
|
|
47755
47823
|
* Builder for the `start-api` subcommand. Wired up by `local.ts`.
|
|
47756
47824
|
*/
|
|
47757
47825
|
function createLocalStartApiCommand() {
|
|
47758
|
-
const startApi = new Command("start-api").description("Run a long-running local HTTP server that maps API Gateway routes (REST v1, HTTP API, Function URL) to Lambda invocations against the AWS Lambda Runtime Interface Emulator (Docker required). Supports Lambda TOKEN/REQUEST authorizers, Cognito User Pool / HTTP v2 JWT authorizers, and AWS_IAM auth (REST v1 `AuthorizationType: AWS_IAM` and Function URL `AuthType: AWS_IAM` — SigV4 signature verification only; IAM policy evaluation is NOT emulated; see https://github.com/go-to-k/cdkd/blob/main/docs/local-emulation.md). When JWKS is unreachable, JWT authorizers fall back to pass-through (every token accepted) with a warn line — local dev fallback. VPC-config Lambdas run locally and surface a warn line at startup; their containers do NOT get attached to the deployed VPC subnets, so calls to private RDS / ElastiCache will fail.").argument("[target]", "Optional API filter. Accepts the bare CDK logical id ('MyHttpApi'; single-stack apps only), stack-qualified logical id ('MyStack:MyHttpApi'), full CDK Construct path ('MyStack/MyHttpApi/Resource'), or an ancestor Construct path that prefix-matches ('MyStack/MyHttpApi'). When omitted, every discovered API gets its own server. Mirrors `cdkd local invoke` / `cdkd local run-task` target syntax.").addOption(new Option("--port <port>", "HTTP server port (default: auto-allocate)").default("0")).addOption(new Option("--host <host>", "Bind address").default("127.0.0.1")).addOption(new Option("--stack <name>", "Stack to start (single-stack apps auto-detect)")).addOption(new Option("--warm", "Pre-start one container per Lambda at server boot").default(false)).addOption(new Option("--per-lambda-concurrency <n>", "Pool size cap per Lambda (default 2, max 4)").default("2")).addOption(new Option("--no-pull", "Skip docker pull (cached image)")).addOption(new Option("--container-host <host>", "IP the host uses to bind/probe the RIE port (must be a numeric IP — `docker run -p <ip>:<port>:8080` rejects hostnames). Defaults to 127.0.0.1.").default("127.0.0.1")).addOption(new Option("--debug-port-base <port>", "Reserve a contiguous --debug-port range (one per Lambda)")).addOption(new Option("--env-vars <file>", "JSON env-var overrides (SAM-compatible: {\"LogicalId\":{\"KEY\":\"VALUE\"}, \"Parameters\": {...}})")).addOption(new Option("--assume-role <arn-or-pair>", "Assume the Lambda's execution role and forward STS-issued temp creds. Bare <arn> = global default; <LogicalId>=<arn> = per-Lambda override (repeatable). Per-Lambda > global > unset (developer creds passed through).").argParser((raw, prev) => parseAssumeRoleToken(raw, prev))).addOption(new Option("--watch", "Hot-reload: watch the CDK app source tree and re-synth + re-discover routes on a source edit (cdk.out / node_modules / .git excluded; honors cdk.json watch.include / watch.exclude). Off by default; the server keeps the previous version serving when synth fails mid-reload.").default(false)).addOption(new Option("--stage <name>", "Select an API Gateway Stage by its 'StageName'. Default: the first Stage attached to each API. Drives event.stageVariables for both REST v1 and HTTP API v2. NOTE: For HTTP API v2 routes, requestContext.stage is always '$default' regardless of this flag (AWS-side limitation — HTTP API only exposes one stage to the integration event); only event.stageVariables is affected for v2 routes. For REST v1 routes the selected StageName is also threaded into requestContext.stage.")).addOption(new Option("--api <id>", "DEPRECATED — use the positional <target> argument instead. Same accepted forms (bare logical id, stack-qualified, Construct path, ancestor prefix). Will be removed in a future major release.")).addOption(new Option("--layer-role-arn <arn>", "Role to sts:AssumeRole before calling lambda:GetLayerVersion on every literal-ARN entry in Properties.Layers (issue #448). Use only when the dev credentials cannot read the layer — typically cross-account layers. AWS-published public layers (e.g. Lambda Powertools) are readable from every account and need no role.")).addOption(new Option("--from-state", "Read cdkd S3 state for every routed stack and substitute Ref / Fn::GetAtt / Fn::Sub / Fn::Join (and AWS pseudo parameters) in Lambda env vars with the deployed physical IDs / attributes. Off by default — pre-PR warn-and-drop semantics are preserved. Turn on for stacks already deployed via cdkd deploy. Mirrors `cdkd local invoke --from-state` / `cdkd local run-task --from-state`. Re-runs against fresh state on every hot-reload firing (--watch).").default(false)).addOption(new Option("--from-cfn-stack [cfn-stack-name]", "Read a deployed CloudFormation stack via DescribeStackResources and substitute Ref / Fn::ImportValue in Lambda env vars with the deployed physical IDs / exports. Use for CDK apps deployed via the upstream CDK CLI (`cdk deploy`). Bare form uses the cdkd stack name per routed stack; pass an explicit value when a single CFn stack should serve every routed stack. Mutually exclusive with --from-state. Fn::GetAtt is warn-and-dropped in v1 (CFn DescribeStackResources does not return per-attribute values).")).addOption(new Option("--stack-region <region>", "Region of the state record to read. Used with --from-state when the same stack name has state in multiple regions, and with --from-cfn-stack as the CFn client region (cdkd does not have a separate --cfn-stack-region flag).")).addOption(new Option("--mtls-truststore <path>", "PEM-encoded CA bundle for client-certificate verification (mutual TLS). When set, the local server switches from HTTP to HTTPS and the TLS handshake rejects clients whose certificate doesn't chain to one of these CAs. Verified certs are surfaced on the Lambda event under requestContext.identity.clientCert (REST v1) / requestContext.authentication.clientCert (HTTP API v2). Must be set together with --mtls-cert + --mtls-key; partial flag sets are rejected. Generate a CA + server + client cert for local dev: openssl req -x509 -newkey rsa:2048 -nodes -keyout ca-key.pem -out ca.pem -subj \"/CN=cdkd-local-ca\" -days 365; openssl req -newkey rsa:2048 -nodes -keyout server-key.pem -out server-csr.pem -subj \"/CN=localhost\"; openssl x509 -req -in server-csr.pem -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out server-cert.pem -days 365; openssl req -newkey rsa:2048 -nodes -keyout client-key.pem -out client-csr.pem -subj \"/CN=client\"; openssl x509 -req -in client-csr.pem -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out client-cert.pem -days 365; curl --cacert ca.pem --cert client-cert.pem --key client-key.pem https://localhost:<port>/...")).addOption(new Option("--mtls-cert <path>", "PEM-encoded server certificate for mutual TLS. Self-signed is fine for local dev. Must be set together with --mtls-truststore + --mtls-key.")).addOption(new Option("--mtls-key <path>", "PEM-encoded server private key matching --mtls-cert. Must be set together with --mtls-truststore + --mtls-cert.")).addOption(new Option("--
|
|
47826
|
+
const startApi = new Command("start-api").description("Run a long-running local HTTP server that maps API Gateway routes (REST v1, HTTP API, Function URL) to Lambda invocations against the AWS Lambda Runtime Interface Emulator (Docker required). Supports Lambda TOKEN/REQUEST authorizers, Cognito User Pool / HTTP v2 JWT authorizers, and AWS_IAM auth (REST v1 `AuthorizationType: AWS_IAM` and Function URL `AuthType: AWS_IAM` — SigV4 signature verification only; IAM policy evaluation is NOT emulated; see https://github.com/go-to-k/cdkd/blob/main/docs/local-emulation.md). When JWKS is unreachable, JWT authorizers fall back to pass-through (every token accepted) with a warn line — local dev fallback. VPC-config Lambdas run locally and surface a warn line at startup; their containers do NOT get attached to the deployed VPC subnets, so calls to private RDS / ElastiCache will fail.").argument("[target]", "Optional API filter. Accepts the bare CDK logical id ('MyHttpApi'; single-stack apps only), stack-qualified logical id ('MyStack:MyHttpApi'), full CDK Construct path ('MyStack/MyHttpApi/Resource'), or an ancestor Construct path that prefix-matches ('MyStack/MyHttpApi'). When omitted, every discovered API gets its own server. Mirrors `cdkd local invoke` / `cdkd local run-task` target syntax.").addOption(new Option("--port <port>", "HTTP server port (default: auto-allocate)").default("0")).addOption(new Option("--host <host>", "Bind address").default("127.0.0.1")).addOption(new Option("--stack <name>", "Stack to start (single-stack apps auto-detect)")).addOption(new Option("--warm", "Pre-start one container per Lambda at server boot").default(false)).addOption(new Option("--per-lambda-concurrency <n>", "Pool size cap per Lambda (default 2, max 4)").default("2")).addOption(new Option("--no-pull", "Skip docker pull (cached image)")).addOption(new Option("--container-host <host>", "IP the host uses to bind/probe the RIE port (must be a numeric IP — `docker run -p <ip>:<port>:8080` rejects hostnames). Defaults to 127.0.0.1.").default("127.0.0.1")).addOption(new Option("--debug-port-base <port>", "Reserve a contiguous --debug-port range (one per Lambda)")).addOption(new Option("--env-vars <file>", "JSON env-var overrides (SAM-compatible: {\"LogicalId\":{\"KEY\":\"VALUE\"}, \"Parameters\": {...}})")).addOption(new Option("--assume-role <arn-or-pair>", "Assume the Lambda's execution role and forward STS-issued temp creds. Bare <arn> = global default; <LogicalId>=<arn> = per-Lambda override (repeatable). Per-Lambda > global > unset (developer creds passed through).").argParser((raw, prev) => parseAssumeRoleToken(raw, prev))).addOption(new Option("--watch", "Hot-reload: watch the CDK app source tree and re-synth + re-discover routes on a source edit (cdk.out / node_modules / .git excluded; honors cdk.json watch.include / watch.exclude). Off by default; the server keeps the previous version serving when synth fails mid-reload.").default(false)).addOption(new Option("--stage <name>", "Select an API Gateway Stage by its 'StageName'. Default: the first Stage attached to each API. Drives event.stageVariables for both REST v1 and HTTP API v2. NOTE: For HTTP API v2 routes, requestContext.stage is always '$default' regardless of this flag (AWS-side limitation — HTTP API only exposes one stage to the integration event); only event.stageVariables is affected for v2 routes. For REST v1 routes the selected StageName is also threaded into requestContext.stage.")).addOption(new Option("--api <id>", "DEPRECATED — use the positional <target> argument instead. Same accepted forms (bare logical id, stack-qualified, Construct path, ancestor prefix). Will be removed in a future major release.")).addOption(new Option("--layer-role-arn <arn>", "Role to sts:AssumeRole before calling lambda:GetLayerVersion on every literal-ARN entry in Properties.Layers (issue #448). Use only when the dev credentials cannot read the layer — typically cross-account layers. AWS-published public layers (e.g. Lambda Powertools) are readable from every account and need no role.")).addOption(new Option("--from-state", "Read cdkd S3 state for every routed stack and substitute Ref / Fn::GetAtt / Fn::Sub / Fn::Join (and AWS pseudo parameters) in Lambda env vars with the deployed physical IDs / attributes. Off by default — pre-PR warn-and-drop semantics are preserved. Turn on for stacks already deployed via cdkd deploy. Mirrors `cdkd local invoke --from-state` / `cdkd local run-task --from-state`. Re-runs against fresh state on every hot-reload firing (--watch).").default(false)).addOption(new Option("--from-cfn-stack [cfn-stack-name]", "Read a deployed CloudFormation stack via DescribeStackResources and substitute Ref / Fn::ImportValue in Lambda env vars with the deployed physical IDs / exports. Use for CDK apps deployed via the upstream CDK CLI (`cdk deploy`). Bare form uses the cdkd stack name per routed stack; pass an explicit value when a single CFn stack should serve every routed stack. Mutually exclusive with --from-state. Fn::GetAtt is warn-and-dropped in v1 (CFn DescribeStackResources does not return per-attribute values).")).addOption(new Option("--stack-region <region>", "Region of the state record to read. Used with --from-state when the same stack name has state in multiple regions, and with --from-cfn-stack as the CFn client region (cdkd does not have a separate --cfn-stack-region flag).")).addOption(new Option("--mtls-truststore <path>", "PEM-encoded CA bundle for client-certificate verification (mutual TLS). When set, the local server switches from HTTP to HTTPS and the TLS handshake rejects clients whose certificate doesn't chain to one of these CAs. Verified certs are surfaced on the Lambda event under requestContext.identity.clientCert (REST v1) / requestContext.authentication.clientCert (HTTP API v2). Must be set together with --mtls-cert + --mtls-key; partial flag sets are rejected. Generate a CA + server + client cert for local dev: openssl req -x509 -newkey rsa:2048 -nodes -keyout ca-key.pem -out ca.pem -subj \"/CN=cdkd-local-ca\" -days 365; openssl req -newkey rsa:2048 -nodes -keyout server-key.pem -out server-csr.pem -subj \"/CN=localhost\"; openssl x509 -req -in server-csr.pem -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out server-cert.pem -days 365; openssl req -newkey rsa:2048 -nodes -keyout client-key.pem -out client-csr.pem -subj \"/CN=client\"; openssl x509 -req -in client-csr.pem -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out client-cert.pem -days 365; curl --cacert ca.pem --cert client-cert.pem --key client-key.pem https://localhost:<port>/...")).addOption(new Option("--mtls-cert <path>", "PEM-encoded server certificate for mutual TLS. Self-signed is fine for local dev. Must be set together with --mtls-truststore + --mtls-key.")).addOption(new Option("--mtls-key <path>", "PEM-encoded server private key matching --mtls-cert. Must be set together with --mtls-truststore + --mtls-cert.")).addOption(new Option("--strict-sigv4", "Opt-in: enforce strict AWS_IAM SigV4 verification. When set, requests whose signature cannot be cryptographically verified (foreign access-key-id, OR no local AWS credentials configured) are denied. DEFAULT off — warn-and-pass with a placeholder principalId, matching cdk-local's `cdkl start-api`. Enable this when you want local parity with the deployed API Gateway's signature enforcement.").default(false)).action(withErrorHandling(localStartApiCommand));
|
|
47759
47827
|
[
|
|
47760
47828
|
...commonOptions,
|
|
47761
47829
|
...appOptions,
|
|
@@ -49728,174 +49796,6 @@ function createLocalInvokeAgentCoreCommand() {
|
|
|
49728
49796
|
//#endregion
|
|
49729
49797
|
//#region src/cli/commands/local-start-alb.ts
|
|
49730
49798
|
/**
|
|
49731
|
-
* Issue #86 v1 — parse `--lb-port <listenerPort>=<hostPort>` overrides into a
|
|
49732
|
-
* `listenerPort -> hostPort` map. The local ALB front-door binds the listener
|
|
49733
|
-
* port on the host by default, but a privileged listener port (e.g. 80 / 443)
|
|
49734
|
-
* fails to bind as non-root on macOS, so the user opts in to a non-privileged
|
|
49735
|
-
* host port (e.g. `--lb-port 80=8080`). Repeatable; each value is
|
|
49736
|
-
* `<listenerPort>=<hostPort>` with both in 1-65535.
|
|
49737
|
-
*/
|
|
49738
|
-
function parseLbPortOverrides(values) {
|
|
49739
|
-
const out = {};
|
|
49740
|
-
for (const raw of values ?? []) {
|
|
49741
|
-
const m = /^(\d+)=(\d+)$/.exec(raw.trim());
|
|
49742
|
-
if (!m) throw new LocalStartServiceError(`Invalid --lb-port '${raw}'. Expected <listenerPort>=<hostPort> (e.g. 80=8080).`);
|
|
49743
|
-
const listenerPort = Number(m[1]);
|
|
49744
|
-
const hostPort = Number(m[2]);
|
|
49745
|
-
for (const [label, p] of [["listener", listenerPort], ["host", hostPort]]) if (p < 1 || p > 65535) throw new LocalStartServiceError(`Invalid --lb-port '${raw}': ${label} port must be 1-65535.`);
|
|
49746
|
-
out[listenerPort] = hostPort;
|
|
49747
|
-
}
|
|
49748
|
-
return out;
|
|
49749
|
-
}
|
|
49750
|
-
/**
|
|
49751
|
-
* Resolve an ALB target string (`Stack/Path` display path or `Stack:LogicalId`)
|
|
49752
|
-
* to its stack + `AWS::ElasticLoadBalancingV2::LoadBalancer` logical id. Mirrors
|
|
49753
|
-
* the ECS service resolver's target grammar.
|
|
49754
|
-
*/
|
|
49755
|
-
function resolveAlbTarget(target, stacks) {
|
|
49756
|
-
if (stacks.length === 0) throw new LocalStartServiceError("No stacks found in the synthesized assembly.");
|
|
49757
|
-
const parsed = parseEcsTarget(target);
|
|
49758
|
-
const stack = pickStack(parsed.stackPattern, stacks, target);
|
|
49759
|
-
const resources = stack.template.Resources ?? {};
|
|
49760
|
-
if (parsed.isPath) {
|
|
49761
|
-
const index = buildCdkPathIndex(stack.template);
|
|
49762
|
-
const albs = resolveCdkPathToLogicalIds(parsed.pathOrId, index).filter(({ logicalId }) => {
|
|
49763
|
-
const r = resources[logicalId];
|
|
49764
|
-
return r !== void 0 && isApplicationLoadBalancer(r);
|
|
49765
|
-
});
|
|
49766
|
-
if (albs.length === 0) throw notFound(target, stack, resources);
|
|
49767
|
-
if (albs.length > 1) throw new LocalStartServiceError(`Target '${target}' matches ${albs.length} load balancers in ${stack.stackName}: ${albs.map((a) => a.logicalId).join(", ")}. Refine the path or use the stack:LogicalId form.`);
|
|
49768
|
-
return {
|
|
49769
|
-
stack,
|
|
49770
|
-
albLogicalId: albs[0].logicalId
|
|
49771
|
-
};
|
|
49772
|
-
}
|
|
49773
|
-
const res = resources[parsed.pathOrId];
|
|
49774
|
-
if (!res || !isApplicationLoadBalancer(res)) throw notFound(target, stack, resources);
|
|
49775
|
-
return {
|
|
49776
|
-
stack,
|
|
49777
|
-
albLogicalId: parsed.pathOrId
|
|
49778
|
-
};
|
|
49779
|
-
}
|
|
49780
|
-
function pickStack(stackPattern, stacks, target) {
|
|
49781
|
-
if (stackPattern === null) {
|
|
49782
|
-
if (stacks.length === 1) return stacks[0];
|
|
49783
|
-
throw new LocalStartServiceError(`Target '${target}' has no stack prefix, and the assembly contains ${stacks.length} stacks: ${stacks.map((s) => s.stackName).join(", ")}. Pass it as 'Stack/Path' or 'Stack:LogicalId'.`);
|
|
49784
|
-
}
|
|
49785
|
-
const matched = matchStacks(stacks, [stackPattern]);
|
|
49786
|
-
if (matched.length === 0) throw new LocalStartServiceError(`No stack matches '${stackPattern}'. Available stacks: ${stacks.map((s) => s.stackName).join(", ")}.`);
|
|
49787
|
-
if (matched.length > 1) throw new LocalStartServiceError(`Multiple stacks match '${stackPattern}': ${matched.map((s) => s.stackName).join(", ")}. Refine the pattern.`);
|
|
49788
|
-
return matched[0];
|
|
49789
|
-
}
|
|
49790
|
-
function notFound(target, stack, resources) {
|
|
49791
|
-
const albs = Object.entries(resources).filter(([, r]) => r.Type === "AWS::ElasticLoadBalancingV2::LoadBalancer").map(([logicalId]) => logicalId);
|
|
49792
|
-
const available = albs.length > 0 ? ` Available load balancers in ${stack.stackName}: ${albs.join(", ")}.` : ` ${stack.stackName} declares no AWS::ElasticLoadBalancingV2::LoadBalancer resources.`;
|
|
49793
|
-
return new LocalStartServiceError(`Target '${target}' did not match an application Load Balancer in ${stack.stackName}.${available}`);
|
|
49794
|
-
}
|
|
49795
|
-
/**
|
|
49796
|
-
* `cdkl start-alb` strategy — name the ALB, boot the ECS service(s) behind it,
|
|
49797
|
-
* and expose each listener via a local front-door. Mirrors how `start-api`
|
|
49798
|
-
* names the API and serves its backing Lambdas.
|
|
49799
|
-
*/
|
|
49800
|
-
function albStrategy(options) {
|
|
49801
|
-
const lbPortOverrides = parseLbPortOverrides(options.lbPort);
|
|
49802
|
-
return {
|
|
49803
|
-
pickEntries: (stacks) => listTargets(stacks).loadBalancers,
|
|
49804
|
-
pickerMessage: "Select one or more Application Load Balancers to run",
|
|
49805
|
-
pickerNoun: "Application Load Balancers",
|
|
49806
|
-
onMissing: () => new LocalStartServiceError(`${getEmbedConfig().cliName} start-alb requires at least one <target>. Pass one or more ALB paths like 'Stack/MyAlb', or run it in a TTY to pick interactively.`),
|
|
49807
|
-
resolveBoots: (stacks, chosenTargets) => {
|
|
49808
|
-
const warnings = [];
|
|
49809
|
-
const serviceTargets = /* @__PURE__ */ new Set();
|
|
49810
|
-
const listeners = [];
|
|
49811
|
-
const claimedHostPorts = /* @__PURE__ */ new Map();
|
|
49812
|
-
for (const albTarget of chosenTargets) {
|
|
49813
|
-
const { stack, albLogicalId } = resolveAlbTarget(albTarget, stacks);
|
|
49814
|
-
const resolution = resolveAlbFrontDoor(stack, albLogicalId);
|
|
49815
|
-
warnings.push(...resolution.warnings);
|
|
49816
|
-
const qualifyTarget = (t) => {
|
|
49817
|
-
if (t.kind === "lambda") return {
|
|
49818
|
-
kind: "lambda",
|
|
49819
|
-
lambda: resolveLambdaTarget(`${stack.stackName}:${t.lambdaLogicalId}`, stacks),
|
|
49820
|
-
targetGroupArn: `${stack.stackName}:${t.targetGroupLogicalId}`,
|
|
49821
|
-
multiValueHeaders: t.multiValueHeaders,
|
|
49822
|
-
weight: t.weight
|
|
49823
|
-
};
|
|
49824
|
-
const serviceTarget = `${stack.stackName}:${t.serviceLogicalId}`;
|
|
49825
|
-
serviceTargets.add(serviceTarget);
|
|
49826
|
-
return {
|
|
49827
|
-
kind: "ecs",
|
|
49828
|
-
serviceTarget,
|
|
49829
|
-
targetContainerName: t.targetContainerName,
|
|
49830
|
-
targetContainerPort: t.targetContainerPort,
|
|
49831
|
-
weight: t.weight
|
|
49832
|
-
};
|
|
49833
|
-
};
|
|
49834
|
-
const qualify = (action) => {
|
|
49835
|
-
if (action.kind === "forward") return {
|
|
49836
|
-
kind: "forward",
|
|
49837
|
-
targets: action.targets.map(qualifyTarget)
|
|
49838
|
-
};
|
|
49839
|
-
if (action.kind === "redirect") return {
|
|
49840
|
-
kind: "redirect",
|
|
49841
|
-
statusCode: action.statusCode,
|
|
49842
|
-
...action.protocol !== void 0 && { protocol: action.protocol },
|
|
49843
|
-
...action.host !== void 0 && { host: action.host },
|
|
49844
|
-
...action.port !== void 0 && { port: action.port },
|
|
49845
|
-
...action.path !== void 0 && { path: action.path },
|
|
49846
|
-
...action.query !== void 0 && { query: action.query }
|
|
49847
|
-
};
|
|
49848
|
-
return {
|
|
49849
|
-
kind: "fixed-response",
|
|
49850
|
-
statusCode: action.statusCode,
|
|
49851
|
-
...action.contentType !== void 0 && { contentType: action.contentType },
|
|
49852
|
-
...action.messageBody !== void 0 && { messageBody: action.messageBody }
|
|
49853
|
-
};
|
|
49854
|
-
};
|
|
49855
|
-
for (const listener of resolution.listeners) {
|
|
49856
|
-
const hostPort = lbPortOverrides[listener.listenerPort] ?? listener.listenerPort;
|
|
49857
|
-
const claimedBy = claimedHostPorts.get(hostPort);
|
|
49858
|
-
if (claimedBy !== void 0) {
|
|
49859
|
-
warnings.push(`Listener port ${listener.listenerPort} would bind host port ${hostPort}, already claimed by listener port ${claimedBy}; the local front-door fronts only the first. Use --lb-port to remap one of them.`);
|
|
49860
|
-
continue;
|
|
49861
|
-
}
|
|
49862
|
-
claimedHostPorts.set(hostPort, listener.listenerPort);
|
|
49863
|
-
listeners.push({
|
|
49864
|
-
listenerPort: listener.listenerPort,
|
|
49865
|
-
hostPort,
|
|
49866
|
-
protocol: listener.listenerProtocol,
|
|
49867
|
-
...listener.defaultAction ? { defaultAction: qualify(listener.defaultAction) } : {},
|
|
49868
|
-
...listener.defaultAuthGuard ? { defaultAuthGuard: listener.defaultAuthGuard } : {},
|
|
49869
|
-
rules: listener.rules.map((r) => ({
|
|
49870
|
-
priority: r.priority,
|
|
49871
|
-
pathPatterns: r.pathPatterns,
|
|
49872
|
-
hostPatterns: r.hostPatterns,
|
|
49873
|
-
httpHeaderConditions: r.httpHeaderConditions,
|
|
49874
|
-
httpRequestMethods: r.httpRequestMethods,
|
|
49875
|
-
queryStringConditions: r.queryStringConditions,
|
|
49876
|
-
sourceIpCidrs: r.sourceIpCidrs,
|
|
49877
|
-
action: qualify(r.action),
|
|
49878
|
-
...r.authGuard ? { authGuard: r.authGuard } : {}
|
|
49879
|
-
}))
|
|
49880
|
-
});
|
|
49881
|
-
}
|
|
49882
|
-
}
|
|
49883
|
-
const boots = [...serviceTargets].map((target) => ({ target }));
|
|
49884
|
-
const resolvedPorts = new Set(listeners.map((l) => l.listenerPort));
|
|
49885
|
-
for (const portStr of Object.keys(lbPortOverrides)) {
|
|
49886
|
-
const port = Number(portStr);
|
|
49887
|
-
if (!resolvedPorts.has(port)) warnings.push(`--lb-port override for listener port ${port} matched no ALB listener resolved for the named target(s); it was ignored.`);
|
|
49888
|
-
}
|
|
49889
|
-
return {
|
|
49890
|
-
boots,
|
|
49891
|
-
...listeners.length > 0 ? { frontDoor: { listeners } } : {},
|
|
49892
|
-
warnings
|
|
49893
|
-
};
|
|
49894
|
-
},
|
|
49895
|
-
lbPortOverrides
|
|
49896
|
-
};
|
|
49897
|
-
}
|
|
49898
|
-
/**
|
|
49899
49799
|
* `cdkl start-alb <Stack/Alb>` — Issue #86 v1. Names an
|
|
49900
49800
|
* `AWS::ElasticLoadBalancingV2::LoadBalancer`, discovers the ECS service(s)
|
|
49901
49801
|
* behind its HTTP `forward` listeners, boots their replicas, and stands up a
|
|
@@ -49903,9 +49803,11 @@ function albStrategy(options) {
|
|
|
49903
49803
|
* The symmetric ALB counterpart of `start-api`.
|
|
49904
49804
|
*/
|
|
49905
49805
|
function createLocalStartAlbCommand() {
|
|
49906
|
-
|
|
49806
|
+
const cmd = new Command("start-alb").description("Run an Application Load Balancer locally: name the ALB, and cdk-local boots the ECS service(s) behind its listeners and stands up a local front-door on each listener port that round-robins across the running replicas and routes its listener rules across the backing services — a stable host endpoint, like behind a real load balancer. The symmetric ALB counterpart of `start-api`. Each <target> accepts a CDK display path (MyStack/MyAlb) or stack-qualified logical ID; single-stack apps may omit the stack prefix. Supports HTTP and HTTPS listeners — by default a cloud-HTTPS listener is served over plain HTTP locally (with X-Forwarded-Proto: https preserved). Pass --tls (or --tls-cert / --tls-key) to terminate TLS locally with a self-signed or user-supplied cert. All six ALB rule-condition fields are honored (path-pattern / host-header / http-header / http-request-method / query-string / source-ip); forward (single and weighted), redirect, and fixed-response actions; and ECS or Lambda targets (a Lambda target group is invoked locally via the Lambda RIE). authenticate-cognito / authenticate-oidc actions enforce a local Bearer-JWT check (or AWSELBAuthSessionCookie pass-through) against the same JWKS / OIDC discovery URL the deployed ALB would; use --bearer-token <jwt> to inject a default token or --no-verify-auth to disable the guard. Omit <targets> in an interactive terminal to multi-select the load balancers from a list.").argument("[targets...]", "One or more CDK display paths or stack-qualified logical IDs of the AWS::ElasticLoadBalancingV2::LoadBalancer resources to run (omit to multi-select interactively in a TTY)").addOption(new Option("--from-state", "Read cdkd's S3 state for the target stack and substitute Ref / Fn::GetAtt / Fn::Sub / Fn::ImportValue / Fn::GetStackOutput intrinsics in container images, environment variables, secrets, role ARNs, and volumes of the ECS services behind the ALB. Mutually exclusive with --from-cfn-stack.").default(false)).addOption(new Option("--state-bucket <bucket>", "S3 bucket for --from-state. Falls back to CDKD_STATE_BUCKET env or cdk.json context.cdkd.stateBucket.")).addOption(new Option("--state-prefix <prefix>", "S3 key prefix for --from-state state files.").default("cdkd")).action(withErrorHandling(async (targets, options) => {
|
|
49907
49807
|
await runEcsServiceEmulator(targets, options, albStrategy(options), cdkdExtraStateProviders);
|
|
49908
|
-
}))
|
|
49808
|
+
}));
|
|
49809
|
+
addAlbSpecificOptions(cmd);
|
|
49810
|
+
return addCommonEcsServiceOptions(cmd);
|
|
49909
49811
|
}
|
|
49910
49812
|
|
|
49911
49813
|
//#endregion
|
|
@@ -49926,8 +49828,8 @@ const CDKD_EMBED_CONFIG = {
|
|
|
49926
49828
|
resourceNamePrefix: "cdkd-local",
|
|
49927
49829
|
awsBindMountPath: "/cdkd-aws",
|
|
49928
49830
|
envPrefix: "CDKD",
|
|
49929
|
-
sigV4StrictByDefault:
|
|
49930
|
-
sigV4OptFlag: "--
|
|
49831
|
+
sigV4StrictByDefault: false,
|
|
49832
|
+
sigV4OptFlag: "--strict-sigv4"
|
|
49931
49833
|
};
|
|
49932
49834
|
/**
|
|
49933
49835
|
* `cdkd local invoke <target>` — run a Lambda function locally inside a
|
|
@@ -51824,7 +51726,7 @@ function reorderArgs(argv) {
|
|
|
51824
51726
|
*/
|
|
51825
51727
|
async function main() {
|
|
51826
51728
|
const program = new Command();
|
|
51827
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
51729
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.200.0");
|
|
51828
51730
|
program.addCommand(createBootstrapCommand());
|
|
51829
51731
|
program.addCommand(createSynthCommand());
|
|
51830
51732
|
program.addCommand(createListCommand());
|