Documentation ¶
Index ¶
- Variables
- func Funcs(ctx *Context) template.FuncMap
- func Render(v string, ctx *Context) (rendered string, err error)
- func RenderInterface(v interface{}, ctx *Context) (interface{}, error)
- func RenderMap(v interface{}, ctx *Context, f *RenderFilter) (map[string]interface{}, error)
- func RenderOnce(v string, ctx *Context) (string, error)
- func RenderRegex(v string, ctx *Context, regex string) (string, error)
- func Validate(v string, ctx *Context) error
- func ValidateInterface(v interface{}, ctx *Context) error
- type Context
- type FuncGenerator
- type I
- type RenderFilter
Constants ¶
This section is empty.
Variables ¶
var ErrVariableNotSetString = "Error: variable not set:"
var FuncGens = map[string]interface{}{ "build_name": funcGenBuildName, "build_type": funcGenBuildType, "env": funcGenEnv, "isotime": funcGenIsotime, "strftime": funcGenStrftime, "pwd": funcGenPwd, "split": funcGenSplitter, "template_dir": funcGenTemplateDir, "timestamp": funcGenTimestamp, "uuid": funcGenUuid, "user": funcGenUser, "packer_version": funcGenPackerVersion, "consul_key": funcGenConsul, "vault": funcGenVault, "sed": funcGenSed, "build": funcGenBuild, "aws_secretsmanager": funcGenAwsSecrets, "replace": replace, "replace_all": replace_all, "upper": strings.ToUpper, "lower": strings.ToLower, }
Funcs are the interpolation funcs that are available within interpolations.
var InitTime time.Time
InitTime is the UTC time when this package was initialized. It is used as the timestamp for all configuration templates so that they match for a single build.
Functions ¶
func Render ¶
Render is shorthand for constructing an I and calling Render until all variables are rendered.
func RenderInterface ¶
RenderInterface renders any value and returns the resulting value.
func RenderMap ¶
func RenderMap(v interface{}, ctx *Context, f *RenderFilter) (map[string]interface{}, error)
RenderMap renders all the strings in the given interface. The interface must decode into a map[string]interface{}, but is left as an interface{} type to ease backwards compatibility with the way arguments are passed around in Packer.
func RenderOnce ¶ added in v1.5.3
RenderOnce is shorthand for constructing an I and calling Render one time.
func RenderRegex ¶ added in v1.5.2
Render is shorthand for constructing an I and calling Render. Use regex to filter variables that are not supposed to be interpolated now
func ValidateInterface ¶
ValidateInterface renders any value and returns the resulting value.
Types ¶
type Context ¶
type Context struct { // Data is the data for the template that is available Data interface{} // Funcs are extra functions available in the template Funcs map[string]interface{} // UserVariables is the mapping of user variables that the // "user" function reads from. UserVariables map[string]string // SensitiveVariables is a list of variables to sanitize. SensitiveVariables []string // EnableEnv enables the env function EnableEnv bool // All the fields below are used for built-in functions. // // BuildName and BuildType are the name and type, respectively, // of the builder being used. // // TemplatePath is the path to the template that this is being // rendered within. BuildName string BuildType string TemplatePath string }
Context is the context that an interpolation is done in. This defines things such as available variables.
func NewContext ¶ added in v1.4.4
func NewContext() *Context
NewContext returns an initialized empty context.
type FuncGenerator ¶
type FuncGenerator func(*Context) interface{}
FuncGenerator is a function that given a context generates a template function for the template.
type I ¶
type I struct {
Value string
}
I stands for "interpolation" and is the main interpolation struct in order to render values.
type RenderFilter ¶
type RenderFilter struct { Include []string Exclude []string // contains filtered or unexported fields }
RenderFilter is an option for filtering what gets rendered and doesn't within an interface.
Directories ¶
Path | Synopsis |
---|---|
aws
|
|
secretsmanager
Package secretsmanager provide methods to get data from AWS Secret Manager
|
Package secretsmanager provide methods to get data from AWS Secret Manager |