templateprocessing

package
v3.11.17-1+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeprecatedGetParameterByNameInternal

func DeprecatedGetParameterByNameInternal(t *templateapi.Template, name string) *templateapi.Parameter

TODO: remove once consumers are switched to deal with external versions DeprecatedGetParameterByNameInternal searches for a Parameter in the Template based on its name.

func GetParameterByName

func GetParameterByName(t *templatev1.Template, name string) *templatev1.Parameter

GetParameterByName searches for a Parameter in the Template based on its name.

Types

type Processor

type Processor struct {
	Generators map[string]Generator
}

Processor process the Template into the List with substituted parameters

func NewProcessor

func NewProcessor(generators map[string]Generator) *Processor

NewProcessor creates new Processor and initializes its set of generators.

func (*Processor) EvaluateParameterSubstitution

func (p *Processor) EvaluateParameterSubstitution(params map[string]templateapi.Parameter, in string) (string, bool)

EvaluateParameterSubstitution replaces escaped parameters in a string with values from the provided map. Returns the substituted value (if any substitution applied) and a boolean indicating if the resulting value should be treated as a string(true) or a non-string value(false) for purposes of json encoding.

func (*Processor) GenerateParameterValues

func (p *Processor) GenerateParameterValues(t *templateapi.Template) field.ErrorList

GenerateParameterValues generates Value for each Parameter of the given Template that has Generate field specified where Value is not already supplied.

Examples:

from | value ----------------------------- "test[0-9]{1}x" | "test7x" "[0-1]{8}" | "01001100" "0x[A-F0-9]{4}" | "0xB3AF" "[a-zA-Z0-9]{8}" | "hW4yQU5i" If an error occurs, the parameter that caused the error is returned along with the error message.

func (*Processor) Process

func (p *Processor) Process(template *templateapi.Template) field.ErrorList

Process transforms Template object into List object. It generates Parameter values using the defined set of generators first, and then it substitutes all Parameter expression occurrences with their corresponding values (currently in the containers' Environment variables only).

func (*Processor) SubstituteParameters

func (p *Processor) SubstituteParameters(params map[string]templateapi.Parameter, item runtime.Object) (runtime.Object, error)

SubstituteParameters loops over all values defined in structured and unstructured types that are children of item.

Example of Parameter expression:

  • ${PARAMETER_NAME}

Jump to

Keyboard shortcuts

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