Documentation
¶
Overview ¶
Package template provides functions for applying go-templates within Zarf.
Index ¶
- func Apply(ctx context.Context, s string, objs Objects) (string, error)
- func ApplyToFile(ctx context.Context, src, dst string, objs Objects) error
- type Objects
- func (o Objects) WithBuild(build v1alpha1.ZarfBuildData) Objects
- func (o Objects) WithConstants(constants []v1alpha1.Constant) Objects
- func (o Objects) WithMetadata(meta v1alpha1.ZarfMetadata) Objects
- func (o Objects) WithPackage(pkg v1alpha1.ZarfPackage) Objects
- func (o Objects) WithValues(values value.Values) Objects
- func (o Objects) WithVariables(vars variables.SetVariableMap) Objects
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Objects ¶
Objects provides a map of arbitrary data to be used in the template. By convention, top level keys are capitalized so users can see what fields are set by the system and which are set by user input. Example: Within a template, a user can access the Values from Object{ "Values": { "app": { "name": "foo" }}} With {{ .Values.app.name }} => "foo"
func NewObjects ¶
NewObjects instantiates an Objects map, which provides templating context. The "with" options below allow for additional template Objects to be included.
func (Objects) WithBuild ¶
func (o Objects) WithBuild(build v1alpha1.ZarfBuildData) Objects
WithBuild takes the v1alpha1.ZarfBuildData section of a created package and makes it available in templating Objects.
func (Objects) WithConstants ¶
WithConstants Takes a slice of v1alpha1.Constants and unwraps it into the templating Objects map so constants can be accessed in templates by their key name.
func (Objects) WithMetadata ¶
func (o Objects) WithMetadata(meta v1alpha1.ZarfMetadata) Objects
WithMetadata takes the v1alpha1.ZarfMetadata section of a created package and makes it available in templating Objects.
func (Objects) WithPackage ¶
func (o Objects) WithPackage(pkg v1alpha1.ZarfPackage) Objects
WithPackage takes a v1alpha1.ZarfPackage and makes Metadata, Constants, and Build available on the Objects map.
func (Objects) WithValues ¶
WithValues takes a value.Values and makes it available in templating Objects.
func (Objects) WithVariables ¶
func (o Objects) WithVariables(vars variables.SetVariableMap) Objects
WithVariables takes a variables.SetVariableMap and unwraps it into the templating Objects map so variables can be accessed by their key name.