Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildEnv ¶
BuildEnv returns the environment for the sam 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 "".
account is written to AWS_ACCESS_KEY_ID: SAM passes it through and LocalStack derives the account id from it (the Terraform model). The region is written to both AWS_REGION and AWS_DEFAULT_REGION because SAM reads AWS_DEFAULT_REGION (not AWS_REGION); setting both is harmless and overwrites any stale ambient AWS_REGION.
Unlike the CDK proxy, no S3-specific endpoint is set: SAM's botocore auto-selects path-style addressing against a localhost/IP endpoint, so plain AWS_ENDPOINT_URL suffices. AWS_ENDPOINT_URL_S3 is deliberately neither set nor stripped — a user who needs to override S3 addressing for an exotic case can set it and botocore honors it.
func CheckVersion ¶
CheckVersion runs `<samBin> --version` and returns an error if the reported version is below the minimum lstk supports, or if the output cannot be parsed. lstk points SAM at LocalStack purely through environment variables, which only SAM >= minSAMVersionString 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
IsHelp reports whether args requests sam's help output. sam answers this without needing a running emulator, same as the other offline commands.
func IsOffline ¶
IsOffline reports whether the SAM 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, account, region string, sink output.Sink, logger log.Logger, args []string) error
Run proxies an AWS SAM CLI invocation against LocalStack. It locates the sam binary, verifies its version, builds a subprocess environment that points SAM at the resolved LocalStack endpoint (and strips ambient AWS config that could redirect it at real AWS), then runs sam with stdio wired through.
endpointURL is the resolved LocalStack endpoint (http://host:port). account is written to AWS_ACCESS_KEY_ID (LocalStack derives the account from it) and region to AWS_REGION/AWS_DEFAULT_REGION. SAM 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.