Documentation ¶
Index ¶
- Constants
- Variables
- func BcryptString(pwd []byte) (string, error)
- func ConvertToShellVar(name string) string
- func ConvertToShellVarName(name string) string
- func ConvertToTfVarName(name string) string
- func CreateMarker(link ULinkT) (string, error)
- func DependenciesRecursiveIterate(u Unit, f func(Unit) error) error
- func EscapeForMarkerStr(in string) (string, error)
- func InsertYaml(data interface{}) (string, error)
- func NewStackTemplate(data []byte) (*stackTemplate, error)
- func OutputsReplacer(data reflect.Value, unit Unit) (reflect.Value, error)
- func OutputsScanner(data reflect.Value, unit Unit) (reflect.Value, error)
- func ProjectsFilesExists() bool
- func RegisterBackendFactory(f BackendsFactory, provider string) error
- func RegisterSecretDriver(drv SecretDriver, key string) error
- func RegisterTemplateDriver(drv TemplateDriver)
- func RegisterUnitFactory(f UnitFactory, modType string) error
- func RenderUnitPlanningString(uStatus *UnitPlanningStatus) string
- func ScanMarkers(data interface{}, procFunc MarkerScanner, unit Unit) error
- func StateOutputsReplacer(data reflect.Value, unit Unit) (reflect.Value, error)
- type Backend
- type BackendsFactory
- type ExecSet
- func (e *ExecSet) AddUnit(u *UnitPlanningStatus)
- func (e *ExecSet) Delete(u Unit)
- func (e *ExecSet) Find(u Unit) *UnitPlanningStatus
- func (e *ExecSet) Front() *UnitPlanningStatus
- func (e *ExecSet) Index(u Unit) int
- func (e *ExecSet) IsEmpty() bool
- func (e *ExecSet) Len() int
- func (e *ExecSet) Slice() []*UnitPlanningStatus
- func (e *ExecSet) StatusFilter(statusList ...ExecutionStatus) *ExecSet
- type ExecutionStatus
- type ExtendedFuncMap
- type GlobalTemplateDriver
- type MarkerScanner
- type ObjectData
- type PrinterOutput
- type Project
- func (p *Project) Apply() error
- func (p *Project) BackupState() error
- func (p *Project) Build() error
- func (p *Project) CheckContainsMarkers(data string, kinds ...string) bool
- func (p *Project) ClearCacheDir() error
- func (p *Project) Destroy() error
- func (p *Project) Edit(name string) error
- func (p *Project) ExportEnvs(ex interface{}) error
- func (p *Project) GetState() ([]byte, error)
- func (p *Project) LoadState() (*StateProject, error)
- func (p *Project) LockState() error
- func (p *Project) MkBuildDir() error
- func (p *Project) Name() string
- func (p *Project) NewEmptyState() *StateProject
- func (p *Project) Plan() (*graph, error)
- func (p *Project) PrintInfo() error
- func (p *Project) PrintOutputs() (err error)
- func (p *Project) PrintSecretsList()
- func (p *Project) PullState() error
- func (p *Project) SaveState() error
- func (p *Project) StartSigTrap(stop chan struct{})
- func (p *Project) StopSigTrap()
- func (p *Project) TemplateMust(data []byte, fileName string) (res []byte, err error)
- func (p *Project) TemplateTry(data []byte, fileName string) (res []byte, warn bool, err error)
- func (p *Project) UnLockState() error
- func (p *Project) UnitsSlice() []Unit
- type ProjectPlanningStatus
- func (s *ProjectPlanningStatus) Add(u Unit, op UnitOperation, diff string, tainted bool)
- func (s *ProjectPlanningStatus) AddIfNotExists(u Unit, op UnitOperation, diff string, tainted bool)
- func (s *ProjectPlanningStatus) AddOrUpdate(u Unit, op UnitOperation, diff string, tainted bool)
- func (s *ProjectPlanningStatus) BuildGraph() (*graph, error)
- func (s *ProjectPlanningStatus) FindUnit(unit Unit) *UnitPlanningStatus
- func (s *ProjectPlanningStatus) FindUnitByKey(unit Unit) *UnitPlanningStatus
- func (s *ProjectPlanningStatus) HasChanges() bool
- func (s *ProjectPlanningStatus) Len() int
- func (s *ProjectPlanningStatus) OperationFilter(ops ...UnitOperation) *ProjectPlanningStatus
- func (s *ProjectPlanningStatus) Print()
- func (s *ProjectPlanningStatus) Slice() []*UnitPlanningStatus
- type RuntimeData
- type Secret
- type SecretDriver
- type Stack
- type StateProject
- type TemplateDriver
- type ULinkT
- type Unit
- type UnitDriver
- type UnitFactory
- type UnitLinksT
- func (o *UnitLinksT) ByLinkTypes(outputType ...string) (res *UnitLinksT)
- func (o *UnitLinksT) ByTargetUnit(unit Unit) (res *UnitLinksT)
- func (o *UnitLinksT) Delete(marker string) (err error)
- func (o *UnitLinksT) Get(key string) (res *ULinkT)
- func (o *UnitLinksT) Insert(key string, l *ULinkT)
- func (o *UnitLinksT) InsertTry(key string, l *ULinkT) error
- func (o *UnitLinksT) IsEmpty() bool
- func (o *UnitLinksT) Join(l *UnitLinksT) error
- func (o *UnitLinksT) JoinWithDataReplace(source *UnitLinksT) error
- func (o *UnitLinksT) Map() (res map[string]*ULinkT)
- func (o *UnitLinksT) Set(l *ULinkT) (string, error)
- func (o *UnitLinksT) Size() int
- func (o *UnitLinksT) Slice() (res []*ULinkT)
- func (o *UnitLinksT) UniqUnits() map[string]Unit
- type UnitOperation
- type UnitPlanningStatus
- type UnitState
Constants ¶
const ConfigFilePattern = "^project.y[a]{0,1}ml$"
ConfigFilePattern name of required project config file.
const OutputLinkType = "outputMarkers"
Variables ¶
var BackendsFactories = map[string]BackendsFactory{}
BackendsFactories map of backend providers factories. Use BackendsFactories["prov_name"].New() to create backend of provider 'prov_name'
var SecretDriversMap = map[string]SecretDriver{}
var TemplateDriversMap map[string]TemplateDriver = map[string]TemplateDriver{}
var UnitFactoriesMap = map[string]UnitFactory{}
Functions ¶
func BcryptString ¶
func ConvertToShellVar ¶
func ConvertToShellVarName ¶
func ConvertToTfVarName ¶
func CreateMarker ¶
CreateMarker generate hash string for template markers.
func DependenciesRecursiveIterate ¶ added in v0.9.0
func EscapeForMarkerStr ¶ added in v0.7.5
EscapeForMarkerStr convert URL to string which can be used as marker.
func InsertYaml ¶ added in v0.6.0
InsertYaml function for template. Insert data to yaml in json one line string (supported from a box by yaml unmarshal functions).
func NewStackTemplate ¶ added in v0.5.0
func OutputsReplacer ¶ added in v0.6.0
OutputsReplacer - project scanner function, witch process dependencies markers in unit data created by AddRemoteStateMarker template function.
func OutputsScanner ¶ added in v0.5.0
OutputsScanner - project scanner function, witch process dependencies markers in unit data setted by AddRemoteStateMarker template function.
func ProjectsFilesExists ¶
func ProjectsFilesExists() bool
func RegisterBackendFactory ¶
func RegisterBackendFactory(f BackendsFactory, provider string) error
RegisterBackendFactory - register factory of some provider (like s3) in map.
func RegisterSecretDriver ¶
func RegisterSecretDriver(drv SecretDriver, key string) error
func RegisterTemplateDriver ¶
func RegisterTemplateDriver(drv TemplateDriver)
RegisterTemplateDriver register unit template driver.
func RegisterUnitFactory ¶ added in v0.5.0
func RegisterUnitFactory(f UnitFactory, modType string) error
func RenderUnitPlanningString ¶ added in v0.9.0
func RenderUnitPlanningString(uStatus *UnitPlanningStatus) string
func ScanMarkers ¶
func ScanMarkers(data interface{}, procFunc MarkerScanner, unit Unit) error
ScanMarkers use marker scanner function to replace templated markers.
Types ¶
type Backend ¶
type Backend interface { Name() string Provider() string GetBackendHCL(string, string) (*hclwrite.File, error) GetBackendBytes(string, string) ([]byte, error) GetRemoteStateHCL(string, string) ([]byte, error) LockState() error UnlockState() error WriteState(stateData string) error ReadState() (string, error) }
Backend interface for backend provider.
type BackendsFactory ¶
BackendsFactory - interface for backend provider factory. New() creates backend.
type ExecSet ¶ added in v0.9.0
type ExecSet struct {
// contains filtered or unexported fields
}
func NewExecSet ¶ added in v0.9.0
func NewExecSet(planningStatus *ProjectPlanningStatus) *ExecSet
func (*ExecSet) AddUnit ¶ added in v0.9.0
func (e *ExecSet) AddUnit(u *UnitPlanningStatus)
func (*ExecSet) Find ¶ added in v0.9.0
func (e *ExecSet) Find(u Unit) *UnitPlanningStatus
func (*ExecSet) Front ¶ added in v0.9.0
func (e *ExecSet) Front() *UnitPlanningStatus
func (*ExecSet) Slice ¶ added in v0.9.0
func (e *ExecSet) Slice() []*UnitPlanningStatus
func (*ExecSet) StatusFilter ¶ added in v0.9.0
func (e *ExecSet) StatusFilter(statusList ...ExecutionStatus) *ExecSet
type ExecutionStatus ¶ added in v0.9.0
type ExecutionStatus uint16
const ( Backlog ExecutionStatus = iota + 1 ReadyForExec InProgress Finished )
type ExtendedFuncMap ¶ added in v0.7.14
Type for tmpl functions list with additional options, like set path to templated file.
type GlobalTemplateDriver ¶ added in v0.5.0
type GlobalTemplateDriver struct { }
func (*GlobalTemplateDriver) AddTemplateFunctions ¶ added in v0.5.0
func (d *GlobalTemplateDriver) AddTemplateFunctions(mp template.FuncMap, p *Project, s *Stack)
func (*GlobalTemplateDriver) Name ¶ added in v0.5.0
func (d *GlobalTemplateDriver) Name() string
type MarkerScanner ¶
MarkerScanner type witch describe function for scanning markers in templated and unmarshaled yaml data.
type ObjectData ¶
type ObjectData struct {
// contains filtered or unexported fields
}
ObjectData simple representation of project object.
type PrinterOutput ¶ added in v0.4.5
type Project ¶
type Project struct { SessionId string Units map[string]Unit Stacks map[string]*Stack Backends map[string]Backend UnitLinks *UnitLinksT CodeCacheDir string StateMutex sync.Mutex InitLock sync.Mutex RuntimeDataset RuntimeData StateBackendName string OwnState *StateProject UUID string ProcessedUnitsCount uint HupUnlockChan chan os.Signal NewVersionMessage string // contains filtered or unexported fields }
Project describes main config with user-defined variables.
func LoadProjectBase ¶
LoadProjectBase read project data in current directory, create base project, and load secrets. stacks, backends and other objects are not loads.
func LoadProjectFull ¶
LoadProjectFull read project data in current directory, create base project, load secrets and all project's objects.
func NewEmptyProject ¶
func NewEmptyProject() *Project
NewEmptyProject creates new empty project. The configuration will not be loaded.
func (*Project) BackupState ¶ added in v0.5.2
func (*Project) CheckContainsMarkers ¶
CheckContainsMarkers - check if string contains any template markers.
func (*Project) ClearCacheDir ¶ added in v0.4.5
func (*Project) ExportEnvs ¶
func (*Project) LoadState ¶
func (p *Project) LoadState() (*StateProject, error)
func (*Project) MkBuildDir ¶
func (*Project) NewEmptyState ¶ added in v0.9.0
func (p *Project) NewEmptyState() *StateProject
func (*Project) PrintOutputs ¶ added in v0.4.5
func (*Project) PrintSecretsList ¶
func (p *Project) PrintSecretsList()
func (*Project) StartSigTrap ¶ added in v0.9.2
func (p *Project) StartSigTrap(stop chan struct{})
func (*Project) StopSigTrap ¶ added in v0.9.2
func (p *Project) StopSigTrap()
func (*Project) TemplateMust ¶
TemplateMust do template
func (*Project) TemplateTry ¶
TemplateTry do template
func (*Project) UnLockState ¶ added in v0.4.5
func (*Project) UnitsSlice ¶ added in v0.9.0
type ProjectPlanningStatus ¶ added in v0.9.0
type ProjectPlanningStatus struct {
// contains filtered or unexported fields
}
func (*ProjectPlanningStatus) Add ¶ added in v0.9.0
func (s *ProjectPlanningStatus) Add(u Unit, op UnitOperation, diff string, tainted bool)
func (*ProjectPlanningStatus) AddIfNotExists ¶ added in v0.9.0
func (s *ProjectPlanningStatus) AddIfNotExists(u Unit, op UnitOperation, diff string, tainted bool)
func (*ProjectPlanningStatus) AddOrUpdate ¶ added in v0.9.0
func (s *ProjectPlanningStatus) AddOrUpdate(u Unit, op UnitOperation, diff string, tainted bool)
func (*ProjectPlanningStatus) BuildGraph ¶ added in v0.9.0
func (s *ProjectPlanningStatus) BuildGraph() (*graph, error)
func (*ProjectPlanningStatus) FindUnit ¶ added in v0.9.0
func (s *ProjectPlanningStatus) FindUnit(unit Unit) *UnitPlanningStatus
FindUnit searching unit by pointer, return *UnitPlanningStatus only for same unit
func (*ProjectPlanningStatus) FindUnitByKey ¶ added in v0.9.0
func (s *ProjectPlanningStatus) FindUnitByKey(unit Unit) *UnitPlanningStatus
FindUnit searching unit by pointer, return *UnitPlanningStatus if unit with same key exists (possible to have 2 different units ptr with same key - project/projectState)
func (*ProjectPlanningStatus) HasChanges ¶ added in v0.9.0
func (s *ProjectPlanningStatus) HasChanges() bool
func (*ProjectPlanningStatus) Len ¶ added in v0.9.0
func (s *ProjectPlanningStatus) Len() int
func (*ProjectPlanningStatus) OperationFilter ¶ added in v0.9.0
func (s *ProjectPlanningStatus) OperationFilter(ops ...UnitOperation) *ProjectPlanningStatus
func (*ProjectPlanningStatus) Print ¶ added in v0.9.0
func (s *ProjectPlanningStatus) Print()
func (*ProjectPlanningStatus) Slice ¶ added in v0.9.0
func (s *ProjectPlanningStatus) Slice() []*UnitPlanningStatus
type RuntimeData ¶ added in v0.4.5
type RuntimeData struct { UnitsOutputs map[string]interface{} PrintersOutputs []PrinterOutput }
type SecretDriver ¶
type SecretDriver interface { // Read secret from raw yaml data. Return secret name, parsed secret data (for project templateing) and error. Read([]byte) (string, interface{}, error) // Return secret driver key (sops ...) Key() string // Edit secret. Edit(Secret) error // Create secret from files list generated by ui.generator/ Create(map[string][]byte) error }
type Stack ¶ added in v0.5.0
type Stack struct { ProjectPtr *Project Backend Backend Name string BackendName string TemplateSrc string TemplateDir string Templates []stackTemplate Variables map[string]interface{} ConfigData map[string]interface{} }
Stack represent stack object.
func (*Stack) ReadTemplate ¶ added in v0.6.0
ReadTemplate read all templates in src.
func (*Stack) TemplateMust ¶ added in v0.5.0
TemplateMust apply stack variables to template data. If template has unresolved variables - function will return an error.
type StateProject ¶
func (*StateProject) CheckUnitChanges ¶ added in v0.5.0
func (sp *StateProject) CheckUnitChanges(unit Unit) (string, Unit)
func (*StateProject) DeleteUnit ¶ added in v0.5.0
func (sp *StateProject) DeleteUnit(mod Unit)
func (*StateProject) UpdateUnit ¶ added in v0.5.0
func (sp *StateProject) UpdateUnit(unit Unit)
type TemplateDriver ¶
type ULinkT ¶ added in v0.6.0
type ULinkT struct { Unit Unit `json:"-"` LinkType string `json:"link_type"` TargetUnitName string `json:"target_unit_name"` TargetStackName string `json:"target_stack_name"` OutputName string `json:"output_name"` OutputData interface{} `json:"output_data"` }
ULinkT describe unit link betwen one target unit and multiple cli units, which uses this unit (output or remote state, or custom unit dependency).
func (*ULinkT) InitUnitPtr ¶ added in v0.6.0
type Unit ¶ added in v0.5.0
type Unit interface { Name() string Stack() *Stack Project() *Project Backend() Backend Prepare() error // Prepare scan all markers in unit, and build project unit links, and unit dependencies. Dependencies() *UnitLinksT Build() error Init() error Apply() error Plan() error Destroy() error Key() string GetState() Unit GetDiffData() interface{} GetStateDiffData() interface{} LoadState(interface{}, string, *StateProject) error KindKey() string CodeDir() string UpdateProjectRuntimeData(p *Project) error WasApplied() bool ForceApply() bool Mux() *sync.Mutex IsTainted() bool SetTainted(newValue bool, err error) SetExecStatus(ExecutionStatus) GetExecStatus() ExecutionStatus ExecError() error }
Unit interface for unit drivers.
func NewUnitFromState ¶ added in v0.5.0
func NewUnitFromState(state map[string]interface{}, name string, p *StateProject) (Unit, error)
NewUnitFromState creates unit from saved state.
type UnitDriver ¶ added in v0.5.0
type UnitDriver interface { AddTemplateFunctions(projectPtr *Project) error GetScanners() []MarkerScanner }
type UnitFactory ¶ added in v0.5.0
type UnitLinksT ¶ added in v0.6.0
type UnitLinksT struct { LinksList map[string]*ULinkT `json:"unit_links_list,omitempty"` MapMutex sync.RWMutex }
UnitLinksT describe a set of links (dependencies) betwen units inside project.
func NewUnitLinksT ¶ added in v0.7.20
func NewUnitLinksT() *UnitLinksT
func (*UnitLinksT) ByLinkTypes ¶ added in v0.6.0
func (o *UnitLinksT) ByLinkTypes(outputType ...string) (res *UnitLinksT)
ByLinkTypes returns sublist with unit link types == any of outputType slice. Returns full list if outputType is empty.
func (*UnitLinksT) ByTargetUnit ¶ added in v0.6.0
func (o *UnitLinksT) ByTargetUnit(unit Unit) (res *UnitLinksT)
func (*UnitLinksT) Delete ¶ added in v0.6.0
func (o *UnitLinksT) Delete(marker string) (err error)
func (*UnitLinksT) Get ¶ added in v0.6.0
func (o *UnitLinksT) Get(key string) (res *ULinkT)
func (*UnitLinksT) Insert ¶ added in v0.7.20
func (o *UnitLinksT) Insert(key string, l *ULinkT)
Insert insert element to map, override if exists
func (*UnitLinksT) InsertTry ¶ added in v0.7.20
func (o *UnitLinksT) InsertTry(key string, l *ULinkT) error
Insert insert element to map, return error if exists
func (*UnitLinksT) IsEmpty ¶ added in v0.6.0
func (o *UnitLinksT) IsEmpty() bool
func (*UnitLinksT) Join ¶ added in v0.6.0
func (o *UnitLinksT) Join(l *UnitLinksT) error
func (*UnitLinksT) JoinWithDataReplace ¶ added in v0.6.1
func (o *UnitLinksT) JoinWithDataReplace(source *UnitLinksT) error
JoinWithDataReplace join source links into o. If link exists - only copy output data.
func (*UnitLinksT) Map ¶ added in v0.6.0
func (o *UnitLinksT) Map() (res map[string]*ULinkT)
func (*UnitLinksT) Size ¶ added in v0.6.0
func (o *UnitLinksT) Size() int
func (*UnitLinksT) Slice ¶ added in v0.6.0
func (o *UnitLinksT) Slice() (res []*ULinkT)
func (*UnitLinksT) UniqUnits ¶ added in v0.7.11
func (o *UnitLinksT) UniqUnits() map[string]Unit
UniqUnits return list of uniq links units.
type UnitOperation ¶ added in v0.9.0
type UnitOperation uint16
const ( Apply UnitOperation = iota + 1 Destroy Update NotChanged )
func (UnitOperation) HasChanges ¶ added in v0.9.0
func (u UnitOperation) HasChanges() bool
func (UnitOperation) String ¶ added in v0.9.0
func (u UnitOperation) String() string
type UnitPlanningStatus ¶ added in v0.9.0
type UnitPlanningStatus struct { UnitPtr Unit Diff string Operation UnitOperation IsTainted bool Index int }