cli

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildEnv

func BuildEnv(base []string, endpointURL, s3Endpoint, region string) []string

BuildEnv returns the environment for the cdk subprocess: base with ambient AWS configuration stripped and the LocalStack-pointing values set (overriding any pre-existing entries). Empty endpoint values are not set, so they never clobber a meaningful inherited value with "".

AWS_ACCESS_KEY_ID is fixed to the mock value "test" (never an account id), so CDK always resolves the default LocalStack account 000000000000. This unconditionally overrides any ambient AWS_ACCESS_KEY_ID — including a 12-digit value that LocalStack would otherwise treat as a custom account.

func CheckVersion

func CheckVersion(ctx context.Context, cdkBin string) error

CheckVersion runs `<cdkBin> --version` and returns an error if the reported version is below the minimum lstk supports, or if the output cannot be parsed. lstk points CDK at LocalStack purely through environment variables, which only CDK >= minCDKVersionString honors; on an older (or unparseable) version lstk must refuse to run so it cannot silently target real AWS.

func IsHelp added in v0.18.0

func IsHelp(args []string) bool

IsHelp reports whether args requests cdk's help output. cdk answers this without needing a running emulator, same as the other offline commands.

func IsOffline

func IsOffline(args []string) bool

IsOffline reports whether the CDK invocation described by args is one of the offline subcommands that need no running emulator, or a help request.

func Run

func Run(ctx context.Context, endpointURL, region string, sink output.Sink, logger log.Logger, args []string) error

Run proxies an AWS CDK invocation against LocalStack. It locates the cdk binary, verifies its version, builds a subprocess environment that points CDK at the resolved LocalStack endpoint (and strips ambient AWS config that could redirect it at real AWS), then runs cdk with stdio wired through.

endpointURL is the resolved LocalStack endpoint (http://host:port). region is encoded into the subprocess environment as AWS_REGION. CDK has no account selection: it always targets the default LocalStack account via a fixed mock AWS_ACCESS_KEY_ID. CDK output is streamed unobstructed (no spinner); a non-zero exit is wrapped as a silent error so lstk does not reprint it.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL