Documentation
¶
Index ¶
- Constants
- Variables
- func SnapshotFiles(base string, paths ...string) map[string]string
- func StrPtr(s string) *string
- func VerifySnapshot(base string, snapshot map[string]string) error
- type Actor
- type Change
- type DriftError
- type ListFilter
- type Plan
- type RequestEnvelope
- type Resource
- type Snapshot
- type Store
- func (s *Store) Delete(id string) error
- func (s *Store) Get(id string) (*Plan, error)
- func (s *Store) List(filter ListFilter) ([]*Plan, error)
- func (s *Store) LockResource(r Resource) func()
- func (s *Store) PruneOnce(now time.Time, retention time.Duration) int
- func (s *Store) Root() string
- func (s *Store) Save(p *Plan) error
- func (s *Store) StartPruneLoop(ctx context.Context, interval, retention time.Duration)
- type Summary
Constants ¶
View Source
const ( StatusAvailable = "available" StatusApplying = "applying" StatusApplied = "applied" StatusFailed = "failed" StatusObsolete = "obsolete" StatusExpired = "expired" )
View Source
const ( ActionCreate = "create" ActionUpdate = "update" ActionDelete = "delete" ActionNoOp = "no-op" )
View Source
const FormatVersion = 1
View Source
const RedactedPlaceholder = "[redacted]"
Variables ¶
View Source
var ErrNotFound = fmt.Errorf("plan not found")
Functions ¶
func SnapshotFiles ¶
SnapshotFiles hashes the given paths. Relative paths are resolved against base and stored relative; absolute paths are stored as-is. Missing files hash to the literal "absent" so creation is detectable.
Types ¶
type DriftError ¶
type DriftError struct {
Paths []string
}
func (*DriftError) Error ¶
func (e *DriftError) Error() string
type ListFilter ¶
type Plan ¶
type Plan struct {
FormatVersion int `json:"format_version"`
ID string `json:"id"`
Action string `json:"action"`
Status string `json:"status"`
Resource Resource `json:"resource"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt time.Time `json:"expires_at"`
CreatedBy Actor `json:"created_by"`
AppliedAt *time.Time `json:"applied_at,omitempty"`
AppliedBy *Actor `json:"applied_by,omitempty"`
ApplyError string `json:"apply_error,omitempty"`
Request RequestEnvelope `json:"request"`
Snapshot Snapshot `json:"snapshot"`
Changes []Change `json:"changes"`
Summary Summary `json:"summary"`
}
type RequestEnvelope ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) LockResource ¶
LockResource serializes applies on the same resource. Returns the unlock function.
func (*Store) PruneOnce ¶
PruneOnce expires available plans past their TTL, deletes applied and failed plans older than retention, and deletes expired and obsolete plans older than a week. Returns how many files were touched.
Click to show internal directories.
Click to hide internal directories.