Documentation ¶
Index ¶
- func CreateSourceSnippet(errorLine, errorColumn int, source []string) string
- func LandscaperSprigFuncMap() gotmpl.FuncMap
- func LandscaperTplFuncMap(blueprint *blueprints.Blueprint, componentVersion model.ComponentVersion, ...) (map[string]interface{}, error)
- type NoValueError
- type StateTemplateResult
- type TemplateError
- type TemplateExecution
- type Templater
- func (t *Templater) TemplateDeployExecutions(tmplExec lsv1alpha1.TemplateExecutor, blueprint *blueprints.Blueprint, ...) (*lstmpl.DeployExecutorOutput, error)
- func (t *Templater) TemplateExecution(rawTemplate string, blueprint *blueprints.Blueprint, cd model.ComponentVersion, ...) ([]byte, error)
- func (t *Templater) TemplateExportExecutions(tmplExec lsv1alpha1.TemplateExecutor, blueprint *blueprints.Blueprint, ...) (*lstmpl.ExportExecutorOutput, error)
- func (t *Templater) TemplateImportExecutions(tmplExec lsv1alpha1.TemplateExecutor, blueprint *blueprints.Blueprint, ...) (*lstmpl.ImportExecutorOutput, error)
- func (t *Templater) TemplateSubinstallationExecutions(tmplExec lsv1alpha1.TemplateExecutor, blueprint *blueprints.Blueprint, ...) (*lstmpl.SubinstallationExecutorOutput, error)
- func (t Templater) Type() lsv1alpha1.TemplateType
- func (t *Templater) WithInputFormatter(inputFormatter *lstmpl.TemplateInputFormatter) *Templater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateSourceSnippet ¶
CreateSourceSnippet creates an excerpt of lines of source code, containing some lines before and after the error line. The error line and column will be highlighted and looks like this: 14: updateStrategy: patch 15: 16: name: test 17: namespace: {{ .imports.namaspace }}
ˆ≈≈≈≈≈≈≈
18: 19: exportsFromManifests: 20: - key: ingressClass
func LandscaperSprigFuncMap ¶
LandscaperSprigFuncMap returns the sanitized spring function map.
func LandscaperTplFuncMap ¶
func LandscaperTplFuncMap(blueprint *blueprints.Blueprint, componentVersion model.ComponentVersion, componentVersions *model.ComponentVersionList, targetResolver targetresolver.TargetResolver) (map[string]interface{}, error)
LandscaperTplFuncMap contains all additional landscaper functions that are available in the executors templates.
Types ¶
type NoValueError ¶
type NoValueError struct {
// contains filtered or unexported fields
}
NoValueError is used for when an executed template result contains fields with "no value".
func CreateErrorIfContainsNoValue ¶
func CreateErrorIfContainsNoValue(templateResult, templateName string, input map[string]interface{}, inputFormatter *template.TemplateInputFormatter) *NoValueError
CreateErrorIfContainsNoValue creates a NoValueError when the template result contains the "no value" string, otherwise nil is returned.
type StateTemplateResult ¶
type StateTemplateResult struct {
State json.RawMessage `json:"state"`
}
StateTemplateResult describes the result of go templating.
type TemplateError ¶
type TemplateError struct {
// contains filtered or unexported fields
}
TemplateError wraps a go templating error and adds more human-readable information.
func TemplateErrorBuilder ¶
func TemplateErrorBuilder(err error) *TemplateError
TemplateErrorBuilder creates a new TemplateError.
func (*TemplateError) Build ¶
func (e *TemplateError) Build() *TemplateError
Build builds the error message.
func (*TemplateError) Error ¶
func (e *TemplateError) Error() string
Error returns the error message.
func (*TemplateError) WithInput ¶
func (e *TemplateError) WithInput(input map[string]interface{}, inputFormatter *template.TemplateInputFormatter) *TemplateError
WithInput adds the template input with a formatter to the error.
func (*TemplateError) WithSource ¶
func (e *TemplateError) WithSource(source *string) *TemplateError
WithSource adds the template source code to the error.
type TemplateExecution ¶
type TemplateExecution struct {
// contains filtered or unexported fields
}
func NewTemplateExecution ¶
func NewTemplateExecution(blueprint *blueprints.Blueprint, cd model.ComponentVersion, cdList *model.ComponentVersionList, targetResolver targetresolver.TargetResolver) (*TemplateExecution, error)
type Templater ¶
type Templater struct {
// contains filtered or unexported fields
}
Templater is the go template implementation for landscaper templating.
func New ¶
func New(state lstmpl.GenericStateHandler, targetResolver targetresolver.TargetResolver) *Templater
New creates a new go template execution templater.
func (*Templater) TemplateDeployExecutions ¶
func (t *Templater) TemplateDeployExecutions(tmplExec lsv1alpha1.TemplateExecutor, blueprint *blueprints.Blueprint, descriptor model.ComponentVersion, cdList *model.ComponentVersionList, values map[string]interface{}) (*lstmpl.DeployExecutorOutput, error)
TemplateDeployExecutions is the GoTemplate executor for a deploy execution.
func (*Templater) TemplateExecution ¶
func (t *Templater) TemplateExecution(rawTemplate string, blueprint *blueprints.Blueprint, cd model.ComponentVersion, cdList *model.ComponentVersionList, values map[string]interface{}) ([]byte, error)
func (*Templater) TemplateExportExecutions ¶
func (t *Templater) TemplateExportExecutions(tmplExec lsv1alpha1.TemplateExecutor, blueprint *blueprints.Blueprint, descriptor model.ComponentVersion, cdList *model.ComponentVersionList, values map[string]interface{}) (*lstmpl.ExportExecutorOutput, error)
func (*Templater) TemplateImportExecutions ¶
func (t *Templater) TemplateImportExecutions(tmplExec lsv1alpha1.TemplateExecutor, blueprint *blueprints.Blueprint, descriptor model.ComponentVersion, cdList *model.ComponentVersionList, values map[string]interface{}) (*lstmpl.ImportExecutorOutput, error)
TemplateImportExecutions is the GoTemplate executor for an import execution.
func (*Templater) TemplateSubinstallationExecutions ¶
func (t *Templater) TemplateSubinstallationExecutions(tmplExec lsv1alpha1.TemplateExecutor, blueprint *blueprints.Blueprint, cd model.ComponentVersion, cdList *model.ComponentVersionList, values map[string]interface{}) (*lstmpl.SubinstallationExecutorOutput, error)
func (Templater) Type ¶
func (t Templater) Type() lsv1alpha1.TemplateType
func (*Templater) WithInputFormatter ¶
func (t *Templater) WithInputFormatter(inputFormatter *lstmpl.TemplateInputFormatter) *Templater
WithInputFormatter ads a custom input formatter to this templater used for error messages.