common

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateFileRepresentation

type CreateFileRepresentation struct {
	File    string `yaml:"file"`
	Content string `yaml:"content"`
}

type Factory

type Factory struct {
}

Factory factory for s3 backends.

func (*Factory) New

func (f *Factory) New(spec map[string]interface{}, stack *project.Stack) (project.Unit, error)

New creates new units driver factory.

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 OperationConfig

type OperationConfig struct {
	Commands []interface{} `yaml:"commands" json:"commands"`
}

OperationConfig type that describe apply, plan and destroy operations.

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"`
}

type StateConfigFileSpec

type StateConfigFileSpec struct {
	Mask      string `yaml:"mask"`
	Dir       string `yaml:"dir"`
	Recursive bool   `yaml:"recursive"`
}

type StateConfigSpec

type StateConfigSpec struct {
	SaveFiles    []StateConfigFileSpec `yaml:"files"`
	SaveApplyCmd bool                  `yaml:"apply_cmd"`
	SaveEnv      bool                  `yaml:"env"`
}

type StateSpec

type StateSpec struct {
	WorkDir         string                               `json:"work_dir"`
	BackendName     string                               `json:"backend_name"`
	Markers         map[string]interface{}               `json:"markers,omitempty"`
	Dependencies    []*project.DependencyOutput          `json:"dependencies,omitempty"`
	CustomStateData map[string]interface{}               `json:"custom_state_data,omitempty"`
	CreateFiles     []CreateFileRepresentation           `json:"create_files,omitempty"`
	ModType         string                               `json:"type"`
	ApplyConf       OperationConfig                      `json:"apply"`
	Env             map[string]interface{}               `json:"env"`
	Outputs         map[string]*project.DependencyOutput `json:"outputs,omitempty"`
	OutputsConfig   OutputsConfigSpec                    `json:"outputs_config,omitempty"`
}

StateSpec the unit's data to

type StateSpecDiff

type StateSpecDiff struct {
	Outputs         map[string]string          `json:"outputs,omitempty"`
	CustomStateData map[string]interface{}     `json:"custom_state_data,omitempty"`
	CreateFiles     []CreateFileRepresentation `json:"create_files,omitempty"`
	ApplyConf       OperationConfig            `json:"apply"`
	Env             map[string]interface{}     `json:"env"`
	OutputsConfig   OutputsConfigSpec          `json:"outputs_config,omitempty"`
}

StateSpecDiff describe the pieces of StateSpec data, that will be comered in "plan" diff and should affect the unit redeployment.

type Unit

type Unit struct {
	MyName         string                     `yaml:"name"`
	WorkDir        string                     `yaml:"work_dir,omitempty"`
	Env            interface{}                `yaml:"env,omitempty"`
	CreateFiles    []CreateFileRepresentation `yaml:"create_files,omitempty"`
	ApplyConf      OperationConfig            `yaml:"apply"`
	PlanConf       OperationConfig            `yaml:"plan,omitempty"`
	DestroyConf    OperationConfig            `yaml:"destroy"`
	GetOutputsConf OutputsConfigSpec          `yaml:"outputs,omitempty"`
	StateConf      StateConfigSpec            `yaml:"state,omitempty"`
	// contains filtered or unexported fields
}

Unit describe cluster.dev shell unit.

func (*Unit) Apply

func (m *Unit) Apply() error

Apply run unit apply procedure.

func (*Unit) ApplyOutput

func (m *Unit) ApplyOutput() []byte

ApplyOutput return output of unit applying.

func (*Unit) Backend

func (m *Unit) Backend() project.Backend

Backend return unit backend.

func (*Unit) Build

func (m *Unit) Build() error

func (*Unit) CodeDir

func (m *Unit) CodeDir() string

CodeDir return path to unit code directory.

func (*Unit) CreateCodeDir

func (m *Unit) CreateCodeDir() error

CreateCodeDir generate all terraform code for project.

func (*Unit) Dependencies

func (m *Unit) Dependencies() *[]*project.DependencyOutput

Dependencies return slice of unit dependencies.

func (*Unit) Destroy

func (m *Unit) Destroy() error

Destroy unit.

func (*Unit) ExpectedOutputs

func (m *Unit) ExpectedOutputs() map[string]*project.DependencyOutput

func (*Unit) FilesList

func (m *Unit) FilesList() map[string][]byte

func (*Unit) GetDiffData

func (m *Unit) GetDiffData() interface{}

func (*Unit) GetState

func (m *Unit) GetState() interface{}

func (*Unit) GetStateDiff

func (m *Unit) GetStateDiff() StateSpecDiff

func (*Unit) Init

func (m *Unit) Init() error

func (*Unit) JSONOutputParser

func (m *Unit) JSONOutputParser(in string, out interface{}) error

JSONOutputParser parse in (expected JSON string) and stores it in the value pointed to by out.

func (*Unit) Key

func (m *Unit) Key() string

Key return uniq unit index (string key for maps).

func (*Unit) KindKey

func (m *Unit) KindKey() string

func (*Unit) LoadState

func (m *Unit) LoadState(spec interface{}, modKey string, p *project.StateProject) error

func (*Unit) Markers

func (m *Unit) Markers() map[string]interface{}

func (*Unit) Name

func (m *Unit) Name() string

Name return unit name.

func (*Unit) Plan

func (m *Unit) Plan() error

Plan unit.

func (*Unit) ProjectPtr

func (m *Unit) ProjectPtr() *project.Project

ProjectPtr return ptr to unit project.

func (*Unit) ReadConfig

func (m *Unit) ReadConfig(spec map[string]interface{}, stack *project.Stack) error

func (*Unit) RegexOutputParser

func (m *Unit) RegexOutputParser(in string, out interface{}) 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) ReplaceMarkers

func (m *Unit) ReplaceMarkers() error

ReplaceMarkers replace all templated markers with values.

func (*Unit) SeparatorOutputParser

func (m *Unit) SeparatorOutputParser(in string, out interface{}) 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) StackName

func (m *Unit) StackName() string

StackName return unit stack name.

func (*Unit) StackPtr

func (m *Unit) StackPtr() *project.Stack

StackPtr return ptr to unit stack.

func (*Unit) UpdateProjectRuntimeData

func (m *Unit) UpdateProjectRuntimeData(p *project.Project) error

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

func (m *Unit) WasApplied() bool

WasApplied return true if unit's method Apply was runned.

Jump to

Keyboard shortcuts

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