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 ¶
FromYamlAll parses multiple YAML documents separated by `---`. Returns an array of all documents. Used as custom template function.
func FromYamlArray ¶
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 ¶
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 ¶
type SOPSDecodeError struct {
Err error
}
func (SOPSDecodeError) Error ¶
func (err SOPSDecodeError) Error() string
func (SOPSDecodeError) Unwrap ¶
func (err SOPSDecodeError) Unwrap() error
type Templater ¶
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 ¶
type TemplaterOptions func(Templater)
TemplaterOptions is a function that changes templater options.
func AddFunc ¶
func AddFunc(name string, f any) TemplaterOptions
func CopyOutput ¶
func CopyOutput(output io.Writer) TemplaterOptions
func SetDelimiters ¶
func SetDelimiters(left, right string) TemplaterOptions