Documentation ¶
Index ¶
- type CreateFileRepresentation
- type Factory
- type FilesListT
- func (l *FilesListT) Add(fileName string, content string, mode fs.FileMode) error
- func (l *FilesListT) Delete(fileName string)
- func (l *FilesListT) Find(fileName string) int
- func (l *FilesListT) IsEmpty() bool
- func (l *FilesListT) Len() int
- func (l *FilesListT) ReadDir(path, baseDir string, pattern ...string) (err error)
- func (l *FilesListT) ReadFile(path, baseDir string) (err error)
- func (l *FilesListT) SPrintLs() string
- func (l *FilesListT) WriteFiles(path string) (err error)
- type HookSpec
- type OperationConfig
- type OutputParser
- type OutputsConfigSpec
- type OutputsT
- type Unit
- func (u *Unit) Apply() error
- func (u *Unit) ApplyOutput() []byte
- func (u *Unit) Backend() project.Backend
- func (u *Unit) Build() error
- func (u *Unit) CodeDir() string
- func (u *Unit) Dependencies() *project.UnitLinksT
- func (u *Unit) Destroy() error
- func (u *Unit) EnvSlice() []string
- func (u *Unit) ForceApply() bool
- func (u *Unit) GetDiffData() interface{}
- func (u *Unit) GetState() interface{}
- func (u *Unit) GetStateDiffData() interface{}
- func (u *Unit) GetStateUnit() *Unit
- func (u *Unit) GetUnitDiff() UnitDiffSpec
- func (u *Unit) Init() error
- func (u *Unit) JSONOutputParser(in string, out *project.UnitLinksT) error
- func (u *Unit) Key() string
- func (u *Unit) KindKey() string
- func (u *Unit) LoadState(spec interface{}, modKey string, p *project.StateProject) error
- func (u *Unit) Mux() *sync.Mutex
- func (u *Unit) Name() string
- func (u *Unit) Plan() error
- func (u *Unit) Prepare() error
- func (u *Unit) Project() *project.Project
- func (u *Unit) ReadConfig(spec map[string]interface{}, stack *project.Stack) error
- func (u *Unit) RegexOutputParser(in string, out *project.UnitLinksT) error
- func (u *Unit) ReplaceOutputsForDiff(in, out interface{}) error
- func (u *Unit) ScanData(scanner project.MarkerScanner) error
- func (u *Unit) SeparatorOutputParser(in string, out *project.UnitLinksT) error
- func (u *Unit) Stack() *project.Stack
- func (u *Unit) StackName() string
- func (u *Unit) UpdateProjectRuntimeData(p *project.Project) error
- func (u *Unit) WasApplied() bool
- type UnitDiffSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateFileRepresentation ¶
type CreateFileRepresentation struct { FileName string `yaml:"file"` FileMode fs.FileMode `yaml:"file_mode,omitempty"` Content string `yaml:"content"` }
CreateFileRepresentation describes the unit's file that will be saved in the unit's working directory when building.
type Factory ¶
type Factory struct { }
Factory factory for s3 backends.
func (*Factory) NewFromState ¶
func (f *Factory) NewFromState(spec map[string]interface{}, modKey string, p *project.StateProject) (project.Unit, error)
NewFromState creates new units from state data.
type FilesListT ¶
type FilesListT []*CreateFileRepresentation
FilesListT describes all unit's files will be write to the unit's working directory when building.
func (*FilesListT) Add ¶
Add insert the new file with name fileName, returns error if file with this name already exists.
func (*FilesListT) Delete ¶
func (l *FilesListT) Delete(fileName string)
Delete delete file with name fileName, do nothing if not found.
func (*FilesListT) Find ¶
func (l *FilesListT) Find(fileName string) int
Find searchs file and returns a pointer to it or nil if not found.
func (*FilesListT) IsEmpty ¶
func (l *FilesListT) IsEmpty() bool
func (*FilesListT) Len ¶
func (l *FilesListT) Len() int
func (*FilesListT) ReadDir ¶
func (l *FilesListT) ReadDir(path, baseDir string, pattern ...string) (err error)
ReadDir recursively reads files in path, saving relative pathes from baseDir.
func (*FilesListT) ReadFile ¶
func (l *FilesListT) ReadFile(path, baseDir string) (err error)
ReadFile reads file to list.
func (*FilesListT) SPrintLs ¶
func (l *FilesListT) SPrintLs() string
func (*FilesListT) WriteFiles ¶
func (l *FilesListT) WriteFiles(path string) (err error)
WriteFiles write all files to path.
type HookSpec ¶
type HookSpec struct { Command string `json:"command"` OnDestroy bool `yaml:"on_destroy,omitempty" json:"on_destroy,omitempty"` OnApply bool `yaml:"on_apply,omitempty" json:"on_apply,omitempty"` OnPlan bool `yaml:"on_plan,omitempty" json:"on_plan,omitempty"` }
HookSpec describes pre/post hooks configuration in unit YAML.
type OperationConfig ¶
type OperationConfig struct {
Commands []interface{} `yaml:"commands" json:"commands"`
}
OperationConfig type that describe apply, plan and destroy operations.
type OutputParser ¶
type OutputParser func(string, *project.UnitLinksT) error
OutputParser represents function for parsing unit output.
type OutputsConfigSpec ¶
type OutputsConfigSpec struct { Command string `yaml:"command,omitempty" json:"command,omitempty"` Type string `yaml:"type" json:"type"` Regexp string `yaml:"regexp,omitempty" json:"regexp,omitempty"` Separator string `yaml:"separator,omitempty" json:"separator,omitempty"` }
OutputsConfigSpec describe how to retrive parse unit outputs.
type Unit ¶
type Unit struct { StackPtr *project.Stack `yaml:"-" json:"-"` ProjectPtr *project.Project `yaml:"-" json:"-"` DependenciesList *project.UnitLinksT `yaml:"-" json:"-"` SpecRaw map[string]interface{} `yaml:"-" json:"-"` OutputRaw []byte `yaml:"-" json:"-"` CacheDir string `yaml:"-" json:"-"` MyName string `yaml:"name" json:"name"` WorkDir string `yaml:"work_dir,omitempty" json:"work_dir,omitempty"` Env map[string]string `yaml:"env,omitempty" json:"env,omitempty"` CreateFiles *FilesListT `yaml:"create_files,omitempty" json:"create_files,omitempty"` InitConf *OperationConfig `yaml:"init,omitempty" json:"init,omitempty"` ApplyConf *OperationConfig `yaml:"apply,omitempty" json:"apply,omitempty"` PlanConf *OperationConfig `yaml:"plan,omitempty" json:"plan,omitempty"` DestroyConf *OperationConfig `yaml:"destroy,omitempty" json:"destroy,omitempty"` GetOutputsConf *OutputsConfigSpec `yaml:"outputs,omitempty" json:"outputs_config,omitempty"` OutputParsers map[string]OutputParser `yaml:"-" json:"-"` Applied bool `yaml:"-" json:"-"` PreHook *HookSpec `yaml:"-" json:"pre_hook,omitempty"` PostHook *HookSpec `yaml:"-" json:"post_hook,omitempty"` UnitKind string `yaml:"type" json:"type"` BackendPtr *project.Backend `yaml:"-" json:"-"` BackendName string `yaml:"-" json:"backend_name"` SavedState interface{} `yaml:"-" json:"-"` DependsOn interface{} `yaml:"depends_on,omitempty" json:"depends_on,omitempty"` FApply bool `yaml:"force_apply" json:"force_apply"` // contains filtered or unexported fields }
Unit describe cluster.dev shell unit.
func (*Unit) ApplyOutput ¶
ApplyOutput return output of unit applying.
func (*Unit) Dependencies ¶
func (u *Unit) Dependencies() *project.UnitLinksT
Dependencies return slice of unit dependencies.
func (*Unit) EnvSlice ¶ added in v0.7.1
EnvSlice returns the list of unit environment variables as slice in a format ENV_NAME=ENV_VALUE
func (*Unit) ForceApply ¶
ForceApply return true if unit need apply regardless of state.
func (*Unit) GetDiffData ¶
func (u *Unit) GetDiffData() interface{}
GetDiffData return unit representation as a data set for diff and reapply.
func (*Unit) GetStateDiffData ¶
func (u *Unit) GetStateDiffData() interface{}
GetStateDiffData return unit representation as a data set for diff only update state.
func (*Unit) GetStateUnit ¶
func (*Unit) GetUnitDiff ¶
func (u *Unit) GetUnitDiff() UnitDiffSpec
func (*Unit) JSONOutputParser ¶
func (u *Unit) JSONOutputParser(in string, out *project.UnitLinksT) error
JSONOutputParser parse in (expected JSON string) and stores it in the value pointed to by out.
func (*Unit) LoadState ¶
func (u *Unit) LoadState(spec interface{}, modKey string, p *project.StateProject) error
func (*Unit) Prepare ¶
Prepare scan all markers in unit, and build project unit links, and unit dependencies.
func (*Unit) ReadConfig ¶
ReadConfig reads unit spec (unmarshaled YAML) and init the unit.
func (*Unit) RegexOutputParser ¶
func (u *Unit) RegexOutputParser(in string, out *project.UnitLinksT) error
RegexOutputParser parse each line od in string with key/value regexp and stores result as a map in the value pointed to by out.
func (*Unit) ReplaceOutputsForDiff ¶
ReplaceOutputsForDiff replace remote state markers in struct to <remote state stack.mod.output> to show in diff.
func (*Unit) SeparatorOutputParser ¶
func (u *Unit) SeparatorOutputParser(in string, out *project.UnitLinksT) error
SeparatorOutputParser split each line of in string with using separator and stores result as a map in the value pointed to by out.
func (*Unit) UpdateProjectRuntimeData ¶
UpdateProjectRuntimeData update project runtime dataset, adds unit outputs. TODO: get unit outputs and write to project runtime dataset. Now this function is only for printer's unit interface.
func (*Unit) WasApplied ¶
WasApplied return true if unit's method Apply was runned.
type UnitDiffSpec ¶
type UnitDiffSpec struct { Outputs map[string]string `json:"outputs,omitempty"` // CreateFiles *FilesListT `json:"create_files,omitempty"` CreateFilesDiff map[string][]string `json:"-"` ApplyConf *OperationConfig `json:"apply,omitempty"` Env map[string]interface{} `json:"env,omitempty"` OutputsConfig *OutputsConfigSpec `json:"outputs_config,omitempty"` PreHook *HookSpec `json:"pre_hook,omitempty"` PostHook *HookSpec `json:"post_hook,omitempty"` }
UnitDiffSpec describe the pieces of StateSpec data, that will be compered in "plan" diff and should affect the unit redeployment.