Documentation ¶
Index ¶
- Constants
- Variables
- func CreateRuntimeContext(lC util.LaunchContext, cM component.Manager, aM ansible.Manager) *runtimeContext
- func NoCleanUpRequired(lC util.LaunchContext) error
- type Action
- type ActionID
- type Cleanup
- type DumpResult
- type ExecutionReport
- type Manager
- type ReportFailures
- type ReportFileContent
- type Result
- type StepResult
- type StepResults
- type ValidateResult
Constants ¶
const ( // NilActionID identifies no action, used to indicate that an action depends on nothing NilActionID ActionID = "NIL" // ValidateActionID identifies the action of validating an environment model. ValidateActionID = "VALIDATE" // CheckActionID identifies the action of returning the validation results of an environment model. CheckActionID = "CHECK" // FailOnErrorActionID identifies the action of failing if the environment model has validation errors. FailOnErrorActionID = "FAIL" // DumpActionID identifies the action of dumping the effective environment model. DumpActionID = "DUMP" // ApplyActionID identifies the action of applying a descriptor to reality ApplyActionID = "APPLY" )
const ( //ErrorParsingDescriptor indicates than an error occurred parsing the environment descriptor ErrorParsingDescriptor string = "Error parsing the descriptor %s, run the \"cli check\" command to get the details" //ErrorParsingEnvironment indicates than an error occurred parsing the environment ErrorParsingEnvironment string = "Error parsing the environment: %s" //ErrorCreatingReportFile indicates than an error occurred creating the execution report file ErrorCreatingReportFile string = "Error creating the report file %s" //ErrorCreatingDumpFile indicates than an error occurred creating the environment dump file ErrorCreatingDumpFile string = "Error creating the dump file %s" //ErrorAddingExchangeFolder indicates than an error occurred adding an exchange folder ErrorAddingExchangeFolder string = "An error occurred adding the exchange folder %s: %s" //ErrorCreatingExchangeFolder indicates than an error occurred creating an exchange folder ErrorCreatingExchangeFolder string = "An error occurred creating the exchange folder %s: %s" //ErrorReadingReport indicates than an error occurred reading the execution report file ErrorReadingReport string = "error reading the report file \"%s\", error \"%s\"" //ErrorUnmarshallingReport indicates than an error occurred unmarshalling the execution report file ErrorUnmarshallingReport string = "error Unmarshalling the report file \"%s\", error \"%s\"" //ErrorGeneric indicates than an error occurred ErrorGeneric string = "An error occurred %s:" //LogValidationSuccessful indicates that the descriptor validation was successful LogValidationSuccessful string = "The envinronment descriptor validation is successful!" //LogProcessingNode indicates that a node is being processed LogProcessingNode string = "Processing node: %s\n" //LogRunningSetupFor indicates that a setup step is being processes LogRunningSetupFor string = "Running setup for provider %s" //LogRunningAction indicates that an action is running LogRunningAction string = "Running %s action\n" //LogProcessingStackPlaybook indicates that a stack is being deploy using a playbook LogProcessingStackPlaybook string = "Processing playbook for stack: %s on node: %s" //LogProcessingStackCompose indicates that a stack is being deploy using a docker compose file LogProcessingStackCompose string = "Processing Docker Compose for stack: %s on node: %s" //LogReportWritten indicates where the execution report file has been written LogReportWritten string = "The execution report file has been written in %s\n" )
Variables ¶
var FailsOnCode = failOn(codeFailure)
FailsOnCode allows to create a failure on an execution step because of an error returned by ekara, other than errors generated by the processing of the descriptor of by a playbook execution
var FailsOnDescriptor = failOn(descriptorFailure)
FailsOnDescriptor allows to create a failure on an execution step because of an invalid descriptor
var FailsOnNotImplemented = failOn(notImplementedFailure)
FailsOnNotImplemented allows to create a failure on an execution step because of a missing implementation
var FailsOnPlaybook = failOn(playBookFailure)
FailsOnPlaybook allows to create a failure on an execution step because of an error return by a playbook execution
var InitCodeStepResult = initResult(stepContextCode)
InitCodeStepResult initializes a step result to run Ekara code
var InitDescriptorStepResult = initResult(stepContextDescriptor)
InitDescriptorStepResult initializes a step result to process the environment descriptor
var InitHookStepResult = initResult(stepContextHookPlaybook)
InitHookStepResult initializes a step results to execute a hook through an ansible playbook
var InitParameterStepResult = initResult(stepContextParameterFIle)
InitParameterStepResult initializes a step results to process the parameter file
var InitPlaybookStepResult = initResult(stepContextPlaybook)
InitPlaybookStepResult initializes a step results to execute an ansible playbook
Functions ¶
func CreateRuntimeContext ¶
func CreateRuntimeContext(lC util.LaunchContext, cM component.Manager, aM ansible.Manager) *runtimeContext
CreateRuntimeContext creates a new context for the runtime
func NoCleanUpRequired ¶
func NoCleanUpRequired(lC util.LaunchContext) error
NoCleanUpRequired is an predefined cleanup which can be used to indicate that no cleanup is required
Types ¶
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
Action represents an action available on an environment
type ActionID ¶
type ActionID string
ActionID represents the id of an action available on an environment
type Cleanup ¶
type Cleanup func(lC util.LaunchContext) error
Cleanup represents a cleanup method to rollback what has been done by a step
type DumpResult ¶
type DumpResult struct {
// contains filtered or unexported fields
}
DumpResult contains the built environment ready to be serialized
func (DumpResult) AsJson ¶
func (r DumpResult) AsJson() (string, error)
AsJson returns the dump content as JSON
func (DumpResult) AsPlainText ¶
func (r DumpResult) AsPlainText() ([]string, error)
AsPlainText returns the dump content as plain text
func (DumpResult) AsYaml ¶
func (r DumpResult) AsYaml() (string, error)
AsYaml returns the dump content as YAML
func (DumpResult) IsSuccess ¶
func (r DumpResult) IsSuccess() bool
IsSuccess returns true id the dump execution was successful
type ExecutionReport ¶
type ExecutionReport struct { //Error contains the error which stopped the engine execution or nil if everything was fine Error error //Steps represent the details of each step executed by the engine Steps StepResults }
ExecutionReport contains all the execution details of what has been executed by the engine.
func (ExecutionReport) Content ¶
func (er ExecutionReport) Content() (b []byte, e error)
Content returns the json representation of the report steps
type Manager ¶
Manager is the manager of all action available into the engine
func CreateActionManager ¶
CreateActionManager initializes the action manager and its content
type ReportFailures ¶
type ReportFailures struct {
// contains filtered or unexported fields
}
ReportFailures contains the steps who failed during the engine execution
type ReportFileContent ¶
type ReportFileContent struct {
Results []StepResult
}
ReportFileContent is used to marchal the execution report
type Result ¶
type Result interface { //IsSuccess returns true id the action execution was successful IsSuccess() bool //AsJson returns the action returned content as JSON AsJson() (string, error) //AsYaml returns the action returned content as YAML AsYaml() (string, error) //AsPlainText returns the action returned content as plain text AsPlainText() ([]string, error) }
Result represents the result of an action
type StepResult ¶
type StepResult struct { StepName string AppliedToType string `json:",omitempty"` AppliedToName string `json:",omitempty"` Status stepStatus Context stepInfo FailureCause failureCause `json:",omitempty"` ErrorMessage string `json:",omitempty"` ReadableMessage string `json:",omitempty"` RawContent interface{} `json:",omitempty"` ExecutionTime time.Duration // contains filtered or unexported fields }
StepResult represents an step execution results
func (StepResult) Build ¶
func (sr StepResult) Build() StepResults
Build initializes an array with the step result
func (*StepResult) MarshalJSON ¶
func (sr *StepResult) MarshalJSON() (b []byte, e error)
MarshalJSON returns the json representation of a report step
type StepResults ¶
type StepResults struct { Status []StepResult TotalExecutionTime time.Duration }
StepResults represents a chain of steps execution results It is used to marchal step results
func InitStepResults ¶
func InitStepResults() *StepResults
InitStepResults initializes an empty stepResults
func (*StepResults) Add ¶
func (sr *StepResults) Add(c StepResult)
Add adds the given stepResult to the results
func (*StepResults) MarshalJSON ¶
func (sr *StepResults) MarshalJSON() (b []byte, e error)
MarshalJSON returns the json representation of the report steps
type ValidateResult ¶
type ValidateResult struct {
// contains filtered or unexported fields
}
ValidateResult contains validation errors ready to be serialized
func (ValidateResult) AsJson ¶
func (v ValidateResult) AsJson() (string, error)
AsJson returns the validation content as JSON
func (ValidateResult) AsPlainText ¶
func (v ValidateResult) AsPlainText() ([]string, error)
AsPlainText returns the validation content as plain text
func (ValidateResult) AsYaml ¶
func (v ValidateResult) AsYaml() (string, error)
AsYaml returns the validation content as YAML
func (ValidateResult) IsSuccess ¶
func (v ValidateResult) IsSuccess() bool
IsSuccess returns true id the validate execution was successful