Documentation ¶
Index ¶
- Constants
- Variables
- func BcryptString(pwd []byte) (string, error)
- func BuildDep(m Unit, dep *DependencyOutput) error
- func BuildUnitsDeps(m Unit) error
- func ConvertToShellVar(name string) string
- func ConvertToShellVarName(name string) string
- func ConvertToTfVarName(name string) string
- func CreateMarker(markerPath, dataForHash string) string
- func NewStackTemplate(data []byte) (*stackTemplate, 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 ScanMarkers(data interface{}, procFunc MarkerScanner, unit Unit) error
- func StateOutputsScanner(data reflect.Value, unit Unit) (reflect.Value, error)
- type Backend
- type BackendsFactory
- type DependencyOutput
- 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) GetMarkers(ctName string, out interface{}) error
- func (p *Project) GetMarkersMap(ctName string, out 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) Plan() (hasChanges bool, err error)
- func (p *Project) PrintInfo() error
- func (p *Project) PrintOutputs() error
- func (p *Project) PrintSecretsList()
- func (p *Project) PullState() error
- func (p *Project) SaveState() error
- func (p *Project) TemplateMust(data []byte) (res []byte, err error)
- func (p *Project) TemplateTry(data []byte) (res []byte, warn bool, err error)
- func (p *Project) UnLockState() error
- type RuntimeData
- type Secret
- type SecretDriver
- type Stack
- type StateProject
- type TemplateDriver
- type Unit
- type UnitDriver
- type UnitFactory
- type UnitState
Constants ¶
const ConfigFileName = "project.yaml"
ConfigFileName name of required project config file.
const OutputMarkerCatName = "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 BuildDep ¶
func BuildDep(m Unit, dep *DependencyOutput) error
func BuildUnitsDeps ¶ added in v0.5.0
BuildunitDeps check all dependencies and add unit pointer.
func ConvertToShellVar ¶
func ConvertToShellVarName ¶
func ConvertToTfVarName ¶
func CreateMarker ¶
CreateMarker generate hash string for template markers.
func NewStackTemplate ¶ added in v0.5.0
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 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) State() map[string]interface{} 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 DependencyOutput ¶ added in v0.5.0
type DependencyOutput struct { Unit Unit `json:"-"` UnitName string StackName string Output string OutputData string }
DependencyOutput describe unit dependency.
type GlobalTemplateDriver ¶ added in v0.5.0
type GlobalTemplateDriver struct { }
func (*GlobalTemplateDriver) AddTemplateFunctions ¶ added in v0.5.0
func (d *GlobalTemplateDriver) AddTemplateFunctions(p *Project)
func (*GlobalTemplateDriver) Name ¶ added in v0.5.0
func (d *GlobalTemplateDriver) Name() string
type MarkerScanner ¶
MarkerScanner type witch describe function for scaning 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
TODO: // ProjectConfSpec type for project.yaml config.
type ProjectConfSpec struct { Name string `yaml:"name"` Kind string `yaml:"kind"` Backend string `yaml:"backend,omitempty"` Exports map[string]interface{} `yaml:"exports"` Variables map[string]interface{} `yaml:"variables"` }
type Project ¶
type Project struct { Units map[string]Unit Stacks map[string]*Stack TmplFunctionsMap template.FuncMap Backends map[string]Backend Markers map[string]interface{} CodeCacheDir string StateMutex sync.Mutex InitLock sync.Mutex RuntimeDataset RuntimeData StateBackendName string OwnState *StateProject // 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) GetMarkers ¶ added in v0.5.2
func (*Project) GetMarkersMap ¶ added in v0.5.2
func (*Project) LoadState ¶
func (p *Project) LoadState() (*StateProject, error)
func (*Project) MkBuildDir ¶
func (*Project) PrintOutputs ¶ added in v0.4.5
func (*Project) PrintSecretsList ¶
func (p *Project) PrintSecretsList()
func (*Project) TemplateMust ¶
TemplateMust do template
func (*Project) TemplateTry ¶
TemplateTry do template
func (*Project) UnLockState ¶ added in v0.4.5
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{} TmplFunctionsMap template.FuncMap }
Stack represent stack object.
func (*Stack) ReadTemplates ¶ added in v0.5.0
ReadTemplates 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(mod Unit)
type TemplateDriver ¶
type Unit ¶ added in v0.5.0
type Unit interface { Name() string Stack() *Stack Project() *Project Backend() Backend ReplaceMarkers() error Dependencies() *[]*DependencyOutput RequiredUnits() map[string]Unit Build() error Init() error Apply() error Plan() error Destroy() error Key() string ExpectedOutputs() map[string]*DependencyOutput GetState() interface{} GetDiffData() interface{} GetStateDiffData() interface{} LoadState(interface{}, string, *StateProject) error KindKey() string CodeDir() string UpdateProjectRuntimeData(p *Project) error WasApplied() bool FindDependency(stackName, unitName string) *DependencyOutput }
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 }