Documentation
¶
Index ¶
- Constants
- Variables
- func List(ctx context.Context, lister CloudPodLister, authToken, creator string, ...) error
- func LoadLocal(ctx context.Context, rt runtime.Runtime, containers []config.ContainerConfig, ...) error
- func LoadPod(ctx context.Context, rt runtime.Runtime, containers []config.ContainerConfig, ...) error
- func Remove(ctx context.Context, rt runtime.Runtime, containers []config.ContainerConfig, ...) error
- func SaveLocal(ctx context.Context, rt runtime.Runtime, containers []config.ContainerConfig, ...) error
- func SavePod(ctx context.Context, rt runtime.Runtime, containers []config.ContainerConfig, ...) error
- func ValidateMergeStrategy(strategy string) error
- type CloudPodLister
- type Destination
- type DestinationKind
- type LocalLoadClient
- type PodLoader
- type PodRemover
- type PodSaveResult
- type PodSaver
- type Starter
- type StateExporter
Constants ¶
const ( MergeStrategyAccountRegion = "account-region-merge" MergeStrategyOverwrite = "overwrite" MergeStrategyService = "service-merge" )
Variables ¶
var ( // ErrRemoteNotSupported is returned for known remote schemes (s3://, oras://). ErrRemoteNotSupported = errors.New("remote destinations are not yet supported — coming soon") // ErrUnknownScheme is returned for unrecognized URL schemes. ErrUnknownScheme = errors.New("unrecognized destination scheme") )
var ErrHomeNotSet = errors.New("home directory is not set")
ErrHomeNotSet is returned when a path needs "~" expansion but no home directory was provided.
var ErrIncompatibleSnapshot = errors.New("snapshot is incompatible with the running LocalStack version")
var ErrPodNotFound = errors.New("cloud pod not found")
ErrPodNotFound is returned when the cloud pod does not exist on the platform.
Functions ¶
func Remove ¶ added in v0.12.0
func Remove(ctx context.Context, rt runtime.Runtime, containers []config.ContainerConfig, podName, authToken string, remover PodRemover, host string, force bool, sink output.Sink) error
Remove deletes a remote pod snapshot, prompting for confirmation unless force is true.
func ValidateMergeStrategy ¶ added in v0.10.0
Types ¶
type CloudPodLister ¶ added in v0.12.0
type Destination ¶ added in v0.9.0
type Destination struct {
Kind DestinationKind
Value string
}
Destination is the parsed result of a user-supplied snapshot destination. For KindLocal, Value is an absolute local file path with a .zip extension. For KindPod, Value is the validated pod name (without the "pod:" prefix).
func ParseDestination ¶
func ParseDestination(dest, home string, now time.Time) (Destination, error)
ParseDestination resolves a user-supplied destination to a local path (KindLocal) or validated pod name (KindPod). home is used to expand a leading "~" or "~/"; pass "" to disable tilde expansion.
func ParseRemovable ¶ added in v0.12.0
func ParseRemovable(ref, cwd, home string) (Destination, error)
ParseRemovable parses a ref for snapshot remove. Only cloud (pod:) refs are accepted; local file paths are rejected because the CLI cannot delete local files. cwd and home are used to produce a human-readable path in error messages.
func ParseSource ¶ added in v0.10.0
func ParseSource(ref, home string) (Destination, error)
ParseSource resolves a user-supplied source REF for loading a snapshot. Unlike ParseDestination it never auto-generates a name: REF is required. For local paths, the file must exist; if no extension is given, .zip is tried as a fallback. home is used to expand a leading "~" or "~/"; pass "" to disable tilde expansion.
type DestinationKind ¶ added in v0.9.0
type DestinationKind int
DestinationKind distinguishes local file paths from remote pod destinations.
const ( KindLocal DestinationKind = iota KindPod )
type LocalLoadClient ¶ added in v0.10.0
type LocalLoadClient interface {
// ImportState posts a zip to /_localstack/pods[?merge=strategy] and streams
// the NDJSON response. strategy is passed as-is; empty means server default.
ImportState(ctx context.Context, host string, src io.Reader, strategy string) error
// ResetState wipes all running state via POST /_localstack/state/reset.
// Used to implement overwrite client-side before importing.
ResetState(ctx context.Context, host string) error
}
LocalLoadClient is satisfied by aws.Client.
type PodLoader ¶ added in v0.10.0
type PodLoader interface {
// LoadPodSnapshot issues PUT /_localstack/pods/{name}?merge=strategy and
// streams the NDJSON response.
LoadPodSnapshot(ctx context.Context, host, podName, authToken, strategy string) ([]string, error)
}
PodLoader is satisfied by aws.Client.
type PodRemover ¶ added in v0.12.0
type PodRemover interface {
RemovePodSnapshot(ctx context.Context, host, podName, authToken string) error
}
PodRemover deletes a remote pod snapshot on the LocalStack platform.
type PodSaveResult ¶ added in v0.9.0
PodSaveResult holds the metadata returned by the platform after a successful pod save.
type PodSaver ¶ added in v0.9.0
type PodSaver interface {
SavePodSnapshot(ctx context.Context, host, podName, authToken string) (PodSaveResult, error)
}
PodSaver triggers a remote pod snapshot save on the running LocalStack instance.