Documentation
¶
Index ¶
- Constants
- func ApplyEmulatorType(ctx context.Context, rt runtime.Runtime, sink output.Sink, ...) ([]config.ContainerConfig, error)
- func HandleNoRunningContainer(sink output.Sink, c config.ContainerConfig) error
- func Logs(ctx context.Context, rt runtime.Runtime, sink output.Sink, ...) error
- func ResolveAndCacheLabel(ctx context.Context, opts StartOptions, resolvedVersion string, ...)
- func ResolveEmulatorLabel(ctx context.Context, client api.PlatformAPI, ...) (string, bool)
- func ResolveRunningContainerName(ctx context.Context, rt runtime.Runtime, c config.ContainerConfig) (string, error)
- func Restart(ctx context.Context, rt runtime.Runtime, sink output.Sink, ...) error
- func RunningEmulators(ctx context.Context, rt runtime.Runtime, containers []config.ContainerConfig) ([]config.ContainerConfig, error)
- func SelectEmulator(ctx context.Context, sink output.Sink, configPath string) ([]config.ContainerConfig, error)
- func Start(ctx context.Context, rt runtime.Runtime, sink output.Sink, opts StartOptions, ...) (string, error)
- func Status(ctx context.Context, rt runtime.Runtime, containers []config.ContainerConfig, ...) error
- func StillRunningMessage(running []config.ContainerConfig) string
- func Stop(ctx context.Context, rt runtime.Runtime, sink output.Sink, ...) error
- type StartOptions
- type StopOptions
Constants ¶
const NoLicenseLabel = "LocalStack (No license)"
Variables ¶
This section is empty.
Functions ¶
func ApplyEmulatorType ¶ added in v0.18.0
func ApplyEmulatorType(ctx context.Context, rt runtime.Runtime, sink output.Sink, requested config.EmulatorType, containers []config.ContainerConfig, firstRun bool, configPath string) ([]config.ContainerConfig, error)
ApplyEmulatorType applies a non-interactive emulator selection (the --type flag) to the config before start, returning the resulting containers.
It is the scripted counterpart to the interactive picker (SelectEmulator):
- First run (no config file yet): create the config and record the requested type, reusing the same path the picker writes.
- Config already matches: no-op.
- Config differs: switch the type in place via the surgical type-line rewrite (comments/formatting preserved), keeping the other block fields. A custom image is a hard error — it pins a specific product that cannot be reinterpreted under a different emulator type. A non-default tag or any volume mounts are kept with a warning, since they are often product-specific.
Messages are emitted through sink; configPath is the friendly config path used in those messages so a switch against a checked-in file is visible.
Before writing anything, it checks whether a different emulator type is already running on the port the requested type would use: rewriting the config to a type that is doomed to fail the port-conflict check in selectContainersToStart would leave the config pointing at an emulator that isn't running while the one that IS running becomes invisible to `status`, `stop`, and `logs` (which resolve from the configured type). The check degrades gracefully (like the offline/enterprise paths in start.go) when the runtime can't be queried, so an unreachable Docker daemon here doesn't block a switch — the real connectivity problem still surfaces later, from the start attempt itself.
func HandleNoRunningContainer ¶ added in v0.18.0
func HandleNoRunningContainer(sink output.Sink, c config.ContainerConfig) error
HandleNoRunningContainer emits the standard "not running" error for c through sink (naming it and pointing the user at how to start it), then returns a silent error for the caller to propagate. Callers that already resolved ResolveRunningContainerName to "" should use this instead of duplicating the ErrorEvent/Actions boilerplate.
func ResolveAndCacheLabel ¶ added in v0.7.1
func ResolveAndCacheLabel(ctx context.Context, opts StartOptions, resolvedVersion string, labelCh chan<- string)
ResolveAndCacheLabel resolves the plan label using the version returned by Start and caches it for subsequent runs. resolvedVersion is the version extracted from image inspection; it may be empty if Start returned early (e.g. already running).
func ResolveEmulatorLabel ¶ added in v0.5.7
func ResolveEmulatorLabel(ctx context.Context, client api.PlatformAPI, containers []config.ContainerConfig, token, resolvedVersion string, logger log.Logger) (string, bool)
ResolveEmulatorLabel tries to fetch the plan name from the license API to build a label like "LocalStack Ultimate". Falls back to NoLicenseLabel when the plan cannot be determined. The returned bool is true only when a real plan was resolved (i.e. the result is worth caching). resolvedVersion is the version from post-pull image inspection for "latest" containers.
func ResolveRunningContainerName ¶ added in v0.7.1
func Restart ¶ added in v0.5.8
func Restart(ctx context.Context, rt runtime.Runtime, sink output.Sink, stopOpts StopOptions, startOpts StartOptions, interactive bool) error
func RunningEmulators ¶ added in v0.7.0
func RunningEmulators(ctx context.Context, rt runtime.Runtime, containers []config.ContainerConfig) ([]config.ContainerConfig, error)
func SelectEmulator ¶ added in v0.7.1
func StillRunningMessage ¶ added in v0.7.0
func StillRunningMessage(running []config.ContainerConfig) string
Types ¶
type StartOptions ¶ added in v0.4.0
type StartOptions struct {
PlatformClient api.PlatformAPI
AuthToken string
ForceFileKeyring bool
WebAppURL string
LocalStackHost string
Containers []config.ContainerConfig
Env map[string]map[string]string
Persist bool
StartupTimeout time.Duration // zero uses the per-mode default (resolveStartupTimeout)
Logger log.Logger
Telemetry *telemetry.Client
}
StartOptions groups the user-provided options for starting an emulator.
type StopOptions ¶ added in v0.5.2
StopOptions carries optional telemetry context for the stop command.