Documentation
¶
Index ¶
- Constants
- func Exec(command string, args ...any) (string, error)
- func FromYamlAll(str string) ([]any, error)
- func FromYamlArray(str string) ([]any, error)
- func Get(path string, varArgs ...any) (any, error)
- func HasKey(path string, varArgs ...any) (bool, error)
- func NewSOPSDecodeError(err error) error
- func ReadFile(file string) (string, error)
- func Required(warn string, val any) (any, error)
- func RequiredEnv(name string) (string, error)
- func ToYaml(v any) (string, error)
- func Tpl2yml(ctx context.Context, tpl, yml string, data any, templaterName string, ...) error
- type SOPSDecodeError
- type Templater
- type TemplaterOptions
- type Values
Constants ¶
const (
TemplaterGomplate = "gomplate"
)
const (
TemplaterNone = "copy"
)
const (
TemplaterSOPS = "sops"
)
const (
TemplaterSprig = "sprig"
)
Variables ¶
This section is empty.
Functions ¶
func Exec ¶
Exec runs external binary and returns its standard output. Used as custom template function.
Can be called in 4 ways: {{ exec "command arg1 arg2" }} - command string with arguments, split by shell-like rules {{ exec "command" (list "arg1" "arg2") }} - command with explicit argument list {{ "input" | exec "command arg1 arg2" }} - piped input with command string {{ "input" | exec "command" (list "arg1" "arg2") }} - piped input with explicit argument list.
func FromYamlAll ¶ added in v0.42.3
FromYamlAll parses multiple YAML documents separated by `---`. Returns an array of all documents. Used as custom template function.
func FromYamlArray ¶ added in v0.42.3
FromYamlArray parses YAML array string into data. Used as custom template function.
func Get ¶
Get returns value in map by dot-separated key path. First argument is dot-separated key path. Second argument is default value if key not found and is optional. Third argument is map to search in. Used as custom template function.
func HasKey ¶
HasKey searches for any value by dot-separated key path in map. Used as custom template function.
func NewSOPSDecodeError ¶ added in v0.32.0
func ReadFile ¶
ReadFile reads file and returns its contents as string. Used as custom template function.
func Required ¶
Required returns error if val is nil of empty string. Otherwise it returns the same val. Used as custom template function.
func RequiredEnv ¶
RequiredEnv returns environment variable by name and errors if it is not defined. Used as custom template function.
Types ¶
type SOPSDecodeError ¶ added in v0.32.0
type SOPSDecodeError struct {
Err error
}
func (SOPSDecodeError) Error ¶ added in v0.32.0
func (err SOPSDecodeError) Error() string
func (SOPSDecodeError) Unwrap ¶ added in v0.32.0
func (err SOPSDecodeError) Unwrap() error
type Templater ¶ added in v0.17.0
type Templater interface {
Name() string
Delims(string, string)
Render(context.Context, string, any) ([]byte, error)
AddOutput(io.Writer)
AddFunc(string, any)
}
Templater is interface for using different template function groups.
type TemplaterOptions ¶ added in v0.24.0
type TemplaterOptions func(Templater)
TemplaterOptions is a function that changes templater options.
func AddFunc ¶ added in v0.36.0
func AddFunc(name string, f any) TemplaterOptions
func CopyOutput ¶ added in v0.36.0
func CopyOutput(output io.Writer) TemplaterOptions
func SetDelimiters ¶ added in v0.24.0
func SetDelimiters(left, right string) TemplaterOptions