Documentation
¶
Overview ¶
Package automation defines the Go API shared by automation language adapters.
Index ¶
- type ExecutionPolicy
- type FileInfo
- type FileSystem
- type LocalFileSystem
- func (fs LocalFileSystem) Exists(ctx context.Context, path string) (bool, error)
- func (LocalFileSystem) Glob(ctx context.Context, pattern string) ([]string, error)
- func (LocalFileSystem) Readlink(ctx context.Context, path string) (string, error)
- func (LocalFileSystem) Stat(ctx context.Context, path string, followSymlinks bool) (FileInfo, error)
- type StepCall
- type StepLibrary
- type StepResult
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecutionPolicy ¶
ExecutionPolicy bounds an operation and its retry waits with one deadline. A nil Retry runs once. Clock is optional and controls retry backoff only.
type FileSystem ¶
type FileSystem interface {
Glob(context.Context, string) ([]string, error)
Stat(context.Context, string, bool) (FileInfo, error)
Exists(context.Context, string) (bool, error)
Readlink(context.Context, string) (string, error)
}
FileSystem supplies read-only filesystem operations to embedded interpreters. Paths are absolute when called by an interpreter. Implementations must be safe for concurrent use.
type LocalFileSystem ¶
type LocalFileSystem struct{}
LocalFileSystem implements read-only operations using the operating system.
func (LocalFileSystem) Exists ¶
Exists follows symlinks. Missing paths and dangling links return false; other failures are errors.
func (LocalFileSystem) Glob ¶
Glob returns sorted matches using filepath glob syntax. It does not support recursive ** matching.
type StepCall ¶
type StepCall struct {
Type string
Configuration map[string]any
WorkingDirectory string
ProcessEnv []string
Stdout, Stderr io.Writer
Parallel bool
}
StepCall contains native Go step configuration. Writers and process settings belong to the calling script thread.
type StepLibrary ¶
type StepLibrary interface {
Names() []string
Fork() StepLibrary
Validate(*StepCall) error
Run(context.Context, *StepCall) (*StepResult, error)
}
StepLibrary dispatches registered Atmos steps. Each invocation and parallel branch owns a fork, so step outputs and environment changes remain local.
Example ¶
package main
import (
"context"
"fmt"
"github.com/cloudposse/atmos/pkg/automation"
"github.com/cloudposse/atmos/pkg/runner/step"
)
func main() {
library := step.NewAutomationLibrary(nil, nil)
result, err := library.Run(context.Background(), &automation.StepCall{
Type: "join",
Configuration: map[string]any{"options": []string{"api", "worker"}, "separator": ","},
})
if err != nil {
panic(err)
}
fmt.Println(result.Value)
}
Output: api,worker
type StepResult ¶
type StepResult struct {
Value string `json:"value"`
Values []string `json:"values"`
Metadata map[string]any `json:"metadata"`
Outputs map[string]string `json:"outputs"`
Skipped bool `json:"skipped"`
Error string `json:"error"`
}
StepResult exposes the same value, selections, metadata, and named outputs returned by the step registry. Engines convert these into immutable values.