templatefuncs

package
v1.11.0-RC2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2020 License: Apache-2.0 Imports: 22 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllCustomFuncs

func AllCustomFuncs() template.FuncMap

AllCustomFuncs returns the set of template functions supported in this library

func IsVersionMismatch

func IsVersionMismatch(err error) (match bool)

IsVersionMismatch flags if the error is a version mismatch error

func ToYaml

func ToYaml(v interface{}) (yamlstr string)

ToYaml takes an interface, marshals it to yaml, and returns a string. It will always return a string, even on marshal error (empty string).

This is designed to be called from a template.

NOTE: Borrowed from a similar function in helm

https://github.com/kubernetes/helm/blob/master/pkg/chartutil/files.go

Types

type JsonQuery

type JsonQuery struct {
	// contains filtered or unexported fields
}

JsonQuery contains parameters to describe a Query.

func NewJsonQuery

func NewJsonQuery(name string, jsondoc []byte, path string) *JsonQuery

NewJsonQuery takes json query operation name, json doc, json path and returns a struct of type JsonQuery.

func (*JsonQuery) Query

func (m *JsonQuery) Query() (output string, err error)

Query will run jsonpath against the json document and return the value at the specified path

type NotFoundError

type NotFoundError struct {
	ErrMsg string
}

NotFoundError represents an error due to a missing object

NOTE: This is meant to be used as a template function

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type Query

type Query interface {
	Query() (string, error)
}

Query represents a templating interface which provides Execute method that is implemented by specific templating implementations

type QueryType

type QueryType string

QueryType is a typed string to indicate the type of query to use to extract data from a taskresult

const (
	// JsonQT represents the json query to extract data, mostly from a json doc
	JsonQT QueryType = "jsonpath"
	// GoQT represents the go template function used to extract data, mostly
	// from a yaml doc
	GoQT QueryType = "go-template"
)

type VerifyError

type VerifyError struct {
	// contains filtered or unexported fields
}

VerifyError represents an error due to a failure in verification

NOTE: This is meant to be used as a template function

func (*VerifyError) Error

func (e *VerifyError) Error() string

type VersionMismatchError

type VersionMismatchError struct {
	// contains filtered or unexported fields
}

VersionMismatchError represents an error due to version mismatch

func (*VersionMismatchError) Error

func (e *VersionMismatchError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL