engine

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package engine resolves and synchronizes direct secret mappings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Resolve

func Resolve(ctx context.Context, p *Plan) (map[string]secret.Value, error)

Resolve reads every source before returning any values. It never writes.

Types

type Change

type Change struct {
	Environment string     `json:"environment"`
	Kind        ChangeKind `json:"kind"`
}

Change describes what would happen to a single mapping's destination.

type ChangeKind

type ChangeKind string

ChangeKind classifies how a mapping's destination compares to its resolved source value.

const (
	// Unchanged means the destination already holds the resolved value.
	Unchanged ChangeKind = "unchanged"
	// Create means the destination binding could not be read back — it (or
	// its container) doesn't exist yet.
	Create ChangeKind = "create"
	// Update means the destination exists but holds a different value.
	Update ChangeKind = "update"
)

type Error

type Error struct {
	Message   string
	Completed []string
	Cause     error
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type Mapping

type Mapping struct {
	Environment         string
	Source, Destination provider.Reference
}

type Plan

type Plan struct {
	Mappings []Mapping
	Registry *provider.Registry
}

func Bind

func Bind(file *tpl.File, registry *provider.Registry) (*Plan, error)

type Receipt

type Receipt struct{ Completed []string }

type RollbackResult

type RollbackResult struct {
	Environment string         `json:"environment"`
	Status      RollbackStatus `json:"status"`
	Detail      string         `json:"detail,omitempty"`
}

RollbackResult reports what happened when rolling back one mapping's destination.

func Rollback

func Rollback(ctx context.Context, p *Plan) ([]RollbackResult, error)

Rollback reverts every mapping's destination container to its previous value, one call per distinct container (mirroring how writes are grouped). It never reads or writes a source, and never contacts a provider that doesn't implement provider.Rollbacker for the mapping's destination scheme — those mappings are reported Unsupported rather than attempted. Rollback returns its per-mapping results even when some containers fail; it only returns a non-nil error for a failure that prevents reporting at all (there is none today, but the signature stays symmetric with Sync).

type RollbackStatus

type RollbackStatus string

RollbackStatus classifies the outcome of reverting one mapping's destination.

const (
	// Reverted means the destination's container was successfully rolled
	// back to its previous value.
	Reverted RollbackStatus = "reverted"
	// Unsupported means the destination's provider adapter doesn't
	// implement provider.Rollbacker — nothing was attempted.
	Unsupported RollbackStatus = "unsupported"
	// Failed means a rollback was attempted and the provider rejected it
	// (e.g. there is no distinct previous value to revert to).
	Failed RollbackStatus = "failed"
)

type SyncOptions

type SyncOptions struct {
	DryRun  bool
	Confirm func([]Change) (bool, error)
}

type SyncResult

type SyncResult struct {
	DryRun    bool     `json:"dryRun"`
	Changes   []Change `json:"changes"`
	Completed []string `json:"completed"`
}

func Sync

func Sync(ctx context.Context, p *Plan, options SyncOptions) (SyncResult, error)

Sync resolves all sources, inspects every destination container once, and writes only changed mappings. No confirmation or write occurs unless every source and destination snapshot was read successfully.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL