state

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffOutputs

func DiffOutputs(curr, prev []parameters.CapturedOutput) []parameters.CapturedOutput

func Explain

func Explain(elaborateManifests, stateFilenames []string, opLog, global bool, componentName string, rawOutputs bool,
	format string, color bool)

func InitWriter

func InitWriter(stateFiles *storage.Files, atWrite func(*StateManifest)) func(interface{})

func MergeParsedState

func MergeParsedState(state *StateManifest,
	componentName string, depends []string, order []string, isDeploy bool,
	parameters parameters.LockedParameters, outputs parameters.CapturedOutputs, provides map[string][]string)

func MergeParsedStateOutputs

func MergeParsedStateOutputs(state *StateManifest,
	componentName string, depends []string, order []string, isDeploy bool,
	outputs parameters.CapturedOutputs)

func MergeParsedStateParametersAndProvides

func MergeParsedStateParametersAndProvides(state *StateManifest,
	parameters parameters.LockedParameters, provides map[string][]string)

func WriteState

func WriteState(manifest *StateManifest, stateFiles *storage.Files) error

Types

type BackupManifest

type BackupManifest struct {
	Version    int                        `json:"version"`
	Kind       string                     `json:"kind"`
	Timestamp  time.Time                  `json:"timestamp"`
	Status     string                     `json:"status"`
	Components map[string]ComponentBackup `json:"components"`

	// not present in backup bundle, used for diagnostic in `backup unbundle`
	Source string `yaml:",omitempty" json:"source,omitempty"`
}

func MustParseBackupBundles

func MustParseBackupBundles(backupBundles []string) *BackupManifest

func ParseBackupBundle

func ParseBackupBundle(files *storage.Files) (*BackupManifest, error)

type ComponentBackup

type ComponentBackup struct {
	Timestamp time.Time                   `json:"timestamp"`
	Status    string                      `json:"status"`
	Kind      string                      `json:"kind"`
	Outputs   []parameters.CapturedOutput `yaml:",omitempty" json:"outputs,omitempty"`

	// not present in backup bundle, used for diagnostic in `backup unbundle`
	Source    string `yaml:",omitempty" json:"source,omitempty"`
	FileIndex int    `yaml:",omitempty" json:"fileIndex,omitempty"`
}

type ComponentMetadata

type ComponentMetadata struct {
	Origin      string `yaml:",omitempty"`
	Kind        string `yaml:",omitempty"`
	Title       string `yaml:",omitempty"`
	Brief       string `yaml:",omitempty"`
	Description string `yaml:",omitempty"`
	Version     string `yaml:",omitempty"`
	Maturity    string `yaml:",omitempty"`
	Icon        string `yaml:",omitempty"`
}

type ExplainedComponent

type ExplainedComponent struct {
	Timestamp  time.Time         `yaml:",omitempty" json:"timestamp,omitempty"`
	Timestamps Timestamps        `yaml:",omitempty" json:"timestamps,omitempty"`
	Status     string            `yaml:",omitempty" json:"status,omitempty"`
	Message    string            `yaml:",omitempty" json:"message,omitempty"`
	Parameters map[string]string `yaml:",omitempty" json:"parameters,omitempty"`
	Outputs    map[string]string `yaml:",omitempty" json:"outputs,omitempty"`
	RawOutputs map[string]string `yaml:"rawOutputs,omitempty" json:"rawOutputs,omitempty"`
}

type ExplainedState

type ExplainedState struct {
	Meta            Metadata                      `yaml:",omitempty" json:"meta,omitempty"`
	Timestamp       time.Time                     `yaml:",omitempty" json:"timestamp,omitempty"`
	Status          string                        `yaml:",omitempty" json:"status,omitempty"`
	Message         string                        `yaml:",omitempty" json:"message,omitempty"`
	StackParameters map[string]string             `yaml:"stackParameters,omitempty" json:"stackParameters,omitempty"`
	StackOutputs    map[string]string             `yaml:"stackOutputs,omitempty" json:"stackOutputs,omitempty"`
	Provides        map[string][]string           `yaml:",omitempty" json:"provides,omitempty"`
	Components      map[string]ExplainedComponent `yaml:",omitempty" json:"components,omitempty"`
}

type Lifecycle

type Lifecycle struct {
	Order []string `yaml:",omitempty"`
}

type LifecycleOperation

type LifecycleOperation struct {
	Id          string
	Operation   string
	Timestamp   time.Time
	Status      string                 `yaml:",omitempty"`
	Options     map[string]interface{} `yaml:",omitempty"`
	Description string                 `yaml:",omitempty"`
	Initiator   string                 `yaml:",omitempty"`
	Logs        string                 `yaml:",omitempty"`
	Phases      []LifecyclePhase       `yaml:",omitempty"`
}

type LifecyclePhase

type LifecyclePhase struct {
	Phase  string `yaml:",omitempty"`
	Status string `yaml:",omitempty"`
}

type Metadata

type Metadata struct {
	Kind string `yaml:",omitempty" json:"kind,omitempty"`
	Name string `yaml:",omitempty" json:"name,omitempty"`
}

type StateManifest

type StateManifest struct {
	Version         int
	Kind            string
	Timestamp       time.Time
	Status          string                       `yaml:",omitempty"`
	Message         string                       `yaml:",omitempty"`
	Meta            Metadata                     `yaml:",omitempty"`
	Lifecycle       Lifecycle                    `yaml:",omitempty"`
	StackParameters []parameters.LockedParameter `yaml:"stackParameters,omitempty"`
	CapturedOutputs []parameters.CapturedOutput  `yaml:"capturedOutputs,omitempty"`
	StackOutputs    []parameters.ExpandedOutput  `yaml:"stackOutputs,omitempty"`
	Provides        map[string][]string          `yaml:",omitempty"`
	Components      map[string]*StateStep        `yaml:",omitempty"`
	Operations      []LifecycleOperation         `yaml:",omitempty"`
}

func AppendOperationLog

func AppendOperationLog(manifest *StateManifest, id, logAdd string) *StateManifest

func EraseComponentEmptyState

func EraseComponentEmptyState(manifest *StateManifest, name string) *StateManifest

func MergeState

func MergeState(stateFiles *storage.Files,
	componentName string, depends []string, order []string, isDeploy bool,
	parameters parameters.LockedParameters, outputs parameters.CapturedOutputs, provides map[string][]string) (*StateManifest, error)

func MustParseStateFiles

func MustParseStateFiles(stateManifests []string) *StateManifest

func ParseState

func ParseState(files *storage.Files) (*StateManifest, error)

func UpdateComponentStartTimestamp

func UpdateComponentStartTimestamp(manifest *StateManifest, name string) *StateManifest

func UpdateComponentStatus

func UpdateComponentStatus(manifest *StateManifest, name string, meta *manifest.Metadata, status, message string) *StateManifest

func UpdateOperation

func UpdateOperation(manifest *StateManifest, id, operation, status string, options map[string]interface{}) *StateManifest

func UpdatePhase

func UpdatePhase(manifest *StateManifest, opId, name, status string) *StateManifest

func UpdateStackStatus

func UpdateStackStatus(manifest *StateManifest, status, message string) *StateManifest

func UpdateState

func UpdateState(manifest *StateManifest, componentName string,
	stackParameters parameters.LockedParameters, componentParameters []parameters.LockedParameter,
	rawOutputs parameters.RawOutputs, outputs parameters.CapturedOutputs,
	requestedOutputs []manifest.Output,
	provides map[string][]string,
	final bool) *StateManifest

type StateStep

type StateStep struct {
	Timestamp       time.Time                    `yaml:",omitempty"`
	Timestamps      Timestamps                   `yaml:",omitempty"`
	Status          string                       `yaml:",omitempty"`
	Version         string                       `yaml:",omitempty"` // TODO deprecate in favor of Meta
	Meta            ComponentMetadata            `yaml:",omitempty"`
	Message         string                       `yaml:",omitempty"`
	Parameters      []parameters.LockedParameter `yaml:",omitempty"`
	RawOutputs      []parameters.RawOutput       `yaml:"rawOutputs,omitempty"`
	CapturedOutputs []parameters.CapturedOutput  `yaml:"capturedOutputs,omitempty"`
}

type Timestamps

type Timestamps struct {
	Start time.Time `yaml:",omitempty" json:"start,omitempty"`
	End   time.Time `yaml:",omitempty" json:"end,omitempty"`
}

Jump to

Keyboard shortcuts

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