Documentation
¶
Index ¶
- Constants
- Variables
- func BuildEnv(base []string, account string) []string
- func CheckInstalled() error
- func Complete(ctx context.Context, args []string, toComplete string) ([]string, error)
- func CompleterPath() (string, error)
- func Exec(ctx context.Context, opts ExecOptions, stdout, stderr io.Writer, args []string) error
- func IsHelp(args []string) bool
- type ExecOptions
Constants ¶
const InstallURL = "https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html"
Variables ¶
var ErrCompleterNotFound = errors.New("aws_completer not found")
var ErrNotInstalled = errors.New("aws CLI not found in PATH")
Functions ¶
func BuildEnv ¶
BuildEnv seeds LocalStack-compatible credentials and region for a child aws CLI invocation that resolves no profile. A non-empty account overrides AWS_ACCESS_KEY_ID outright, since LocalStack derives the account from it; an empty account keeps the set-if-absent mock default. The secret and region are only defaults, so an explicit user value continues to win.
An ambient AWS_SESSION_TOKEN is dropped either way: lstk supplies the credentials itself, a token from an unrelated session cannot correspond to them, and the endpoint is always LocalStack. This matches the stripping the terraform and sam proxies already perform.
func CheckInstalled ¶ added in v0.13.0
func CheckInstalled() error
func Complete ¶ added in v0.21.0
Complete returns the aws CLI's own completion candidates for `aws <args...> <toComplete>`, where toComplete is the partial word under the cursor (empty when the cursor sits after a space).
Bounding how long a Tab press may block is the caller's call: pass a ctx with a deadline.
func CompleterPath ¶ added in v0.21.0
CompleterPath resolves the aws_completer binary. It is usually on PATH alongside aws, but some installs expose only aws, so fall back to a sibling of the (symlink-resolved) aws binary: the v2 installer puts /usr/local/bin/aws there as a symlink into an install dir that also holds aws_completer.
Types ¶
type ExecOptions ¶ added in v0.22.0
type ExecOptions struct {
// EndpointURL is injected as --endpoint-url. Empty skips it (the help path).
EndpointURL string
// Account is the resolved LocalStack account, written to AWS_ACCESS_KEY_ID
// wherever lstk supplies credentials. LocalStack derives the account from
// the access key id it receives.
Account string
// UseProfile selects the localstack AWS profile. See execEnv for why this
// happens through AWS_PROFILE rather than a --profile argument.
UseProfile bool
// AccountSelected reports that the user explicitly asked for Account (via
// --account, or a 12-digit AWS_ACCESS_KEY_ID) rather than it being the
// default. It only matters alongside UseProfile, where it decides whether
// the environment or the profile supplies credentials.
AccountSelected bool
// UsePTY runs the child under a pseudo-terminal.
UsePTY bool
}
ExecOptions configures a single `aws` invocation.