substitution

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: Apache-2.0 Imports: 6 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyArrayReplacements

func ApplyArrayReplacements(in string, stringReplacements map[string]string, arrayReplacements map[string][]string) []string

ApplyArrayReplacements takes an input string, and output an array of strings related to possible arrayReplacements. If there aren't any areas where the input can be split up via arrayReplacements, then just return an array with a single element, which is ApplyReplacements(in, replacements).

func ApplyReplacements

func ApplyReplacements(in string, replacements map[string]string) string

ApplyReplacements applies string replacements

func ExtractIndex added in v0.38.0

func ExtractIndex(s string) (int, error)

ExtractIndex will extract int from `[int]`

func ExtractIndexString added in v0.38.0

func ExtractIndexString(s string) string

ExtractIndexString will find the leftmost match of `[int]`

func ExtractParamsExpressions added in v0.38.0

func ExtractParamsExpressions(s string) []string

ExtractParamsExpressions will find all `$(params.paramName[int])` expressions

func ExtractVariablesFromString added in v0.40.0

func ExtractVariablesFromString(s, prefix string) ([]string, bool, string)

ExtractVariablesFromString extracts variables from an input string s with the given prefix via regex matching. It returns a slice of strings which contains the extracted variables, a bool flag to indicate if matches were found and the error string if the referencing of parameters is invalid. If the string does not contain the input prefix then the output will contain an empty slice of strings.

func StripStarVarSubExpression added in v0.38.0

func StripStarVarSubExpression(s string) string

StripStarVarSubExpression strips "$(target[*])"" to get "target"

func TrimArrayIndex added in v0.38.0

func TrimArrayIndex(s string) string

TrimArrayIndex replaces all `[i]` and `[*]` to "".

func ValidateEntireVariableProhibitedP added in v0.37.0

func ValidateEntireVariableProhibitedP(value, prefix string, vars sets.String) *apis.FieldError

ValidateEntireVariableProhibitedP verifies that values of object type are not used as whole.

func ValidateVariable

func ValidateVariable(name, value, prefix, locationName, path string, vars sets.String) *apis.FieldError

ValidateVariable makes sure all variables in the provided string are known

func ValidateVariableIsolated

func ValidateVariableIsolated(name, value, prefix, locationName, path string, vars sets.String) *apis.FieldError

ValidateVariableIsolated verifies that variables matching the relevant string expressions are completely isolated if present.

func ValidateVariableIsolatedP added in v0.17.0

func ValidateVariableIsolatedP(value, prefix string, vars sets.String) *apis.FieldError

ValidateVariableIsolatedP verifies that variables matching the relevant string expressions are completely isolated if present.

func ValidateVariableP added in v0.17.0

func ValidateVariableP(value, prefix string, vars sets.String) *apis.FieldError

ValidateVariableP makes sure all variables for a parameter in the provided string are known

func ValidateVariableProhibited

func ValidateVariableProhibited(name, value, prefix, locationName, path string, vars sets.String) *apis.FieldError

ValidateVariableProhibited verifies that variables matching the relevant string expressions do not reference any of the names present in vars.

func ValidateVariableProhibitedP added in v0.17.0

func ValidateVariableProhibitedP(value, prefix string, vars sets.String) *apis.FieldError

ValidateVariableProhibitedP verifies that variables for a parameter matching the relevant string expressions do not reference any of the names present in vars.

func ValidateWholeArrayOrObjectRefInStringVariable added in v0.38.0

func ValidateWholeArrayOrObjectRefInStringVariable(name, value, prefix string, vars sets.String) (isIsolated bool, errs *apis.FieldError)

ValidateWholeArrayOrObjectRefInStringVariable validates if a single string field uses references to the whole array/object appropriately valid example: "$(params.myObject[*])" invalid example: "$(params.name-not-exist[*])"

Types

This section is empty.

Jump to

Keyboard shortcuts

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