Documentation
¶
Overview ¶
Package emulator implements the `emulator` component kind: a stack-scoped, long-running cloud-API emulator container (Floci, MiniStack, k3s, OpenBao, …). It reuses the container component lifecycle (ComponentType "emulator") and the emulator driver/profile registry in pkg/emulator.
Index ¶
- func ExecuteDown(ctx context.Context, info *schema.ConfigAndStacksInfo) error
- func ExecuteExec(ctx context.Context, info *schema.ConfigAndStacksInfo, command []string) error
- func ExecuteList(ctx context.Context, info *schema.ConfigAndStacksInfo) error
- func ExecuteLogs(ctx context.Context, info *schema.ConfigAndStacksInfo) error
- func ExecutePs(ctx context.Context, info *schema.ConfigAndStacksInfo) error
- func ExecuteReset(ctx context.Context, info *schema.ConfigAndStacksInfo, force bool) error
- func ExecuteUp(ctx context.Context, info *schema.ConfigAndStacksInfo) error
- func ExecuteUpEphemeral(ctx context.Context, info *schema.ConfigAndStacksInfo) error
- type Config
- type EmulatorComponentProvider
- func (p *EmulatorComponentProvider) Execute(execCtx *component.ExecutionContext) error
- func (p *EmulatorComponentProvider) GenerateArtifacts(_ *component.ExecutionContext) error
- func (p *EmulatorComponentProvider) GetAvailableCommands() []string
- func (p *EmulatorComponentProvider) GetBasePath(atmosConfig *schema.AtmosConfiguration) string
- func (p *EmulatorComponentProvider) GetGroup() string
- func (p *EmulatorComponentProvider) GetType() string
- func (p *EmulatorComponentProvider) ListComponents(_ context.Context, _ string, stackConfig map[string]any) ([]string, error)
- func (p *EmulatorComponentProvider) ValidateComponent(config map[string]any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteDown ¶
func ExecuteDown(ctx context.Context, info *schema.ConfigAndStacksInfo) error
ExecuteDown stops and removes the emulator's container.
func ExecuteExec ¶
ExecuteExec runs a command in the emulator's container. Args after `--` form the command; defaults to a shell.
func ExecuteList ¶
func ExecuteList(ctx context.Context, info *schema.ConfigAndStacksInfo) error
ExecuteList lists emulators in a clean, theme-aware table with a status dot. Unlike ExecutePs it does not require a component: it builds the manager from the container-runtime config alone and lists every emulator discovered by label (scoped to info.Stack when `--stack` is set, otherwise all stacks).
func ExecuteLogs ¶
func ExecuteLogs(ctx context.Context, info *schema.ConfigAndStacksInfo) error
ExecuteLogs streams the emulator container's logs.
func ExecutePs ¶
func ExecutePs(ctx context.Context, info *schema.ConfigAndStacksInfo) error
ExecutePs lists running emulators in the component's stack.
func ExecuteReset ¶
ExecuteReset stops and removes the emulator's container and wipes its persisted state. Unless force is set, it prompts for confirmation first.
func ExecuteUp ¶
func ExecuteUp(ctx context.Context, info *schema.ConfigAndStacksInfo) error
ExecuteUp starts (or reuses) the emulator's long-running container.
func ExecuteUpEphemeral ¶
func ExecuteUpEphemeral(ctx context.Context, info *schema.ConfigAndStacksInfo) error
ExecuteUpEphemeral starts the emulator without persistence for this run, overriding the component's `ephemeral:` config (mirrors the `--ephemeral` flag).
Types ¶
type Config ¶
type Config struct {
// BasePath is the base directory for emulator component assets.
BasePath string `mapstructure:"base_path"`
}
Config is the global configuration for the emulator component kind, stored under `components.emulator` in atmos.yaml and read via the Plugins map.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default global emulator component configuration.
type EmulatorComponentProvider ¶
type EmulatorComponentProvider struct{}
EmulatorComponentProvider implements component.ComponentProvider for the emulator component kind: a stack-scoped, long-running cloud-API emulator whose lifecycle is discovered by labels derived from the canonical instance address.
func (*EmulatorComponentProvider) Execute ¶
func (p *EmulatorComponentProvider) Execute(execCtx *component.ExecutionContext) error
Execute dispatches an emulator subcommand to the matching executor.
func (*EmulatorComponentProvider) GenerateArtifacts ¶
func (p *EmulatorComponentProvider) GenerateArtifacts(_ *component.ExecutionContext) error
GenerateArtifacts is a no-op for emulator components (no generated files).
func (*EmulatorComponentProvider) GetAvailableCommands ¶
func (p *EmulatorComponentProvider) GetAvailableCommands() []string
GetAvailableCommands returns the lifecycle verbs supported by emulator components.
func (*EmulatorComponentProvider) GetBasePath ¶
func (p *EmulatorComponentProvider) GetBasePath(atmosConfig *schema.AtmosConfiguration) string
GetBasePath returns the base directory path for emulator components.
func (*EmulatorComponentProvider) GetGroup ¶
func (p *EmulatorComponentProvider) GetGroup() string
GetGroup returns the component group for categorization.
func (*EmulatorComponentProvider) GetType ¶
func (p *EmulatorComponentProvider) GetType() string
GetType returns the component type identifier.
func (*EmulatorComponentProvider) ListComponents ¶
func (p *EmulatorComponentProvider) ListComponents(_ context.Context, _ string, stackConfig map[string]any) ([]string, error)
ListComponents discovers all emulator components in a stack.
func (*EmulatorComponentProvider) ValidateComponent ¶
func (p *EmulatorComponentProvider) ValidateComponent(config map[string]any) error
ValidateComponent validates emulator component configuration. A real (non-abstract) component must declare a driver.