Documentation ¶
Index ¶
- Variables
- func IsRevertible(t *Template) bool
- func MatchStringParamValue(s string) bool
- func NewEnv() *envBuilder
- func NewRunEnv(cenv env.Compiling, context ...map[string]interface{}) env.Running
- func ParseParams(text string) (map[string]interface{}, error)
- type Errors
- type Execution
- type ExecutionStats
- type LookupGraphFunc
- type Mode
- type ParamIsSetValidator
- type Runner
- type Template
- func (s *Template) CommandNodesIterator() (nodes []*ast.CommandNode)
- func (s *Template) CommandNodesReverseIterator() (nodes []*ast.CommandNode)
- func (t *Template) DryRun(renv env.Running) (tpl *Template, err error)
- func (t *Template) HasErrors() bool
- func (temp *Template) Revert() (*Template, error)
- func (s *Template) Run(renv env.Running) (*Template, error)
- func (t *Template) UniqueDefinitions(apis map[string]string) (res []string)
- func (t *Template) Validate(rules ...Validator) (all []error)
- type UniqueNameValidator
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // TestCompileMode is a standard template compilation Mode. TestCompileMode = []compileFunc{ injectCommandsInNodesPass, failOnDeclarationWithNoResultPass, processAndValidateParamsPass, checkInvalidReferenceDeclarationsPass, resolveHolesPass, resolveMissingHolesPass, removeOptionalHolesPass, resolveAliasPass, inlineVariableValuePass, resolveParamsAndExtractRefsPass, } // PreRevertCompileMode is a compilation Mode for reverting templates. PreRevertCompileMode = []compileFunc{ resolveParamsAndExtractRefsPass, } // NewRunnerCompileMode is a compilation Mode for new runners. NewRunnerCompileMode = []compileFunc{ injectCommandsInNodesPass, failOnDeclarationWithNoResultPass, processAndValidateParamsPass, checkInvalidReferenceDeclarationsPass, resolveHolesPass, resolveMissingHolesPass, removeOptionalHolesPass, resolveAliasPass, inlineVariableValuePass, failOnUnresolvedHolesPass, failOnUnresolvedAliasPass, resolveParamsAndExtractRefsPass, convertParamsPass, validateCommandsPass, } )
Functions ¶
func IsRevertible ¶
func MatchStringParamValue ¶
func ParseParams ¶
Types ¶
type Execution ¶
type Execution struct { *Template Author, Source, Locale string Profile, Path, Message string Fillers map[string]interface{} }
Execution allows template execution serialization with context for JSON storage without altering the template.Template model
func (*Execution) IsOneLiner ¶
func (*Execution) MarshalJSON ¶
func (*Execution) SetMessage ¶
SetMessage set the value of Message, truncating it if exceeds max len
func (*Execution) Stats ¶
func (t *Execution) Stats() *ExecutionStats
func (*Execution) UnmarshalJSON ¶
type ExecutionStats ¶
type ExecutionStats struct {
KOCount, OKCount, CmdCount int
ActionEntityCount map[string]int
Oneliner string
}
ExecutionStats holds template execution statistics.
func (*ExecutionStats) AllKO ¶
func (te *ExecutionStats) AllKO() bool
type ParamIsSetValidator ¶
type ParamIsSetValidator struct {
Entity, Action, Param, WarningMessage string
}
func (*ParamIsSetValidator) Execute ¶
func (v *ParamIsSetValidator) Execute(t *Template) (errs []error)
type Runner ¶
type Runner struct { Template *Template Locale, Profile, Message, TemplatePath string Log *logger.Logger Fillers []map[string]interface{} AliasFunc func(paramPath, alias string) string MissingHolesFunc func(string, []string, bool) string CmdLookuper func(tokens ...string) interface{} Validators []Validator ParamsSuggested int BeforeRun func(*Execution) (bool, error) AfterRun func(*Execution) error }
type Template ¶
Template is an awless template definition.
func (*Template) CommandNodesIterator ¶
func (s *Template) CommandNodesIterator() (nodes []*ast.CommandNode)
func (*Template) CommandNodesReverseIterator ¶
func (s *Template) CommandNodesReverseIterator() (nodes []*ast.CommandNode)
func (*Template) UniqueDefinitions ¶
type UniqueNameValidator ¶
type UniqueNameValidator struct {
LookupGraph LookupGraphFunc
}
func (*UniqueNameValidator) Execute ¶
func (v *UniqueNameValidator) Execute(t *Template) (errs []error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.