options

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvaluateOption

func EvaluateOption(value interface{}, option execution.Option, fldPath *field.Path) (string, *field.Error)

EvaluateOption will evaluate the value of the option against the given Option configuration.

func EvaluateOptionBool added in v0.1.0

func EvaluateOptionBool(
	value interface{}, cfg *execution.BoolOptionConfig, fldPath *field.Path,
) (string, *field.Error)

EvaluateOptionBool evaluates the value of the Bool option.

func EvaluateOptionDate added in v0.1.0

func EvaluateOptionDate(
	value interface{},
	option execution.Option,
	cfg *execution.DateOptionConfig,
	fldPath *field.Path,
) (string, *field.Error)

EvaluateOptionDate evaluates the value of the Date option.

func EvaluateOptionDefault

func EvaluateOptionDefault(option execution.Option) (string, error)

EvaluateOptionDefault evaluates the default value of the option.

func EvaluateOptionDefaultBool added in v0.1.0

func EvaluateOptionDefaultBool(cfg *execution.BoolOptionConfig) (string, error)

EvaluateOptionDefaultBool evaluates the default value of the Bool option.

func EvaluateOptionDefaultMulti added in v0.1.0

func EvaluateOptionDefaultMulti(cfg *execution.MultiOptionConfig) (string, error)

EvaluateOptionDefaultMulti evaluates the default value of the Multi option.

func EvaluateOptionDefaultSelect added in v0.1.0

func EvaluateOptionDefaultSelect(cfg *execution.SelectOptionConfig) (string, error)

EvaluateOptionDefaultSelect evaluates the default value of the Select option.

func EvaluateOptionDefaultString added in v0.1.0

func EvaluateOptionDefaultString(cfg *execution.StringOptionConfig) (string, error)

EvaluateOptionDefaultString evaluates the default value of the String option.

func EvaluateOptionMulti added in v0.1.0

func EvaluateOptionMulti(
	value interface{}, option execution.Option, cfg *execution.MultiOptionConfig, fldPath *field.Path,
) (string, *field.Error)

EvaluateOptionMulti evaluates the value of the Multi option.

func EvaluateOptionSelect added in v0.1.0

func EvaluateOptionSelect(
	value interface{}, option execution.Option, cfg *execution.SelectOptionConfig, fldPath *field.Path,
) (string, *field.Error)

EvaluateOptionSelect evaluates the value of the Select option.

func EvaluateOptionString added in v0.1.0

func EvaluateOptionString(
	value interface{}, option execution.Option, cfg *execution.StringOptionConfig, fldPath *field.Path,
) (string, *field.Error)

EvaluateOptionString evaluates the value of the String option.

func EvaluateOptions

func EvaluateOptions(
	options map[string]interface{},
	cfg *execution.OptionSpec,
	fldPath *field.Path,
) (map[string]string, field.ErrorList)

EvaluateOptions will evaluate all options in the given map.

func FilterParametersWithPrefix

func FilterParametersWithPrefix(parameters map[string]string, prefix string) map[string]string

FilterParametersWithPrefix filters in keys from the given parameter map which have the provided prefix.

func FilterParametersWithPrefixes

func FilterParametersWithPrefixes(parameters map[string]string, prefixes ...string) map[string]string

FilterParametersWithPrefixes filters in keys from the given parameter map which have any of the provided prefixes.

func FormatAsMoment

func FormatAsMoment(ts time.Time, format string) (string, error)

FormatAsMoment formats the given time.Time with the moment.js format. The time.Location of ts will be used for formatting the given time.

func GetDefaultingOption added in v0.1.0

func GetDefaultingOption(option execution.Option) execution.Option

GetDefaultingOption returns an option with default fields populated.

func GetDefaultingOptionBool added in v0.1.0

func GetDefaultingOptionBool(option execution.Option) execution.Option

GetDefaultingOptionBool returns a Bool option with default fields populated.

func GetOptionDefaultBoolValue added in v0.1.0

func GetOptionDefaultBoolValue(cfg *execution.BoolOptionConfig) bool

GetOptionDefaultBoolValue returns the default value of the Bool option.

func GetOptionDefaultDateValue added in v0.1.0

func GetOptionDefaultDateValue(_ *execution.DateOptionConfig) string

GetOptionDefaultDateValue returns the default value of the Date option.

func GetOptionDefaultMultiValue added in v0.1.0

func GetOptionDefaultMultiValue(cfg *execution.MultiOptionConfig) []string

GetOptionDefaultMultiValue returns the default value of the Multi option.

func GetOptionDefaultSelectValue added in v0.1.0

func GetOptionDefaultSelectValue(cfg *execution.SelectOptionConfig) string

GetOptionDefaultSelectValue returns the default value of the Select option.

func GetOptionDefaultStringValue added in v0.1.0

func GetOptionDefaultStringValue(cfg *execution.StringOptionConfig) string

GetOptionDefaultStringValue returns the default value of the String option.

func GetOptionDefaultValue added in v0.1.0

func GetOptionDefaultValue(option execution.Option) (interface{}, error)

GetOptionDefaultValue returns the default option value prior to evaluation.

func HasAnyPrefix

func HasAnyPrefix(s string, prefixes []string) bool

HasAnyPrefix tests whether the string s begins with at least one prefix in prefixes.

func HashOptionSpec

func HashOptionSpec(spec *execution.OptionSpec) (string, error)

HashOptionSpec returns a deterministic hash of the given OptionSpec. This can be used to easily determine if two Specs are equal or not.

func MakeDefaultOptions

func MakeDefaultOptions(cfg *execution.OptionSpec) (map[string]string, error)

MakeDefaultOptions returns a substitution map containing default values for all options in the given OptionSpec.

func MakeOptionVariableName

func MakeOptionVariableName(option execution.Option) string

MakeOptionVariableName returns the variable name for an option.

func MergeSubstitutions

func MergeSubstitutions(paramMaps ...map[string]string) map[string]string

MergeSubstitutions merges the substitution maps, with the lowest priority first. Does not modify the maps in-place.

func MutateDefaultingOptionSpec added in v0.1.0

func MutateDefaultingOptionSpec(spec *execution.OptionSpec) *execution.OptionSpec

MutateDefaultingOptionSpec populates default fields for an OptionSpec in-place.

func NewForbiddenOptionConfigError

func NewForbiddenOptionConfigError(fldPath *field.Path, optionType execution.OptionType) *field.Error

NewForbiddenOptionConfigError returns a validation error for an OptionType which contains config values other than its own Type.

func SubstituteEmptyStringForPrefixes

func SubstituteEmptyStringForPrefixes(target string, prefixes []string) string

SubstituteEmptyStringForPrefixes will perform substitution of any variables beginning with any of the given prefixes with an empty string. This should be performed as the last step of the substitution pipeline, since it would completely remove any variables that are not yet substituted. Example: SubstituteEmptyStringForPrefixes("echo ${job.unknown_variable};", []string{"job."}) => "echo ;"

func SubstituteVariableMaps

func SubstituteVariableMaps(target string, submaps []map[string]string, prefixes []string) string

SubstituteVariableMaps will perform variable substitution according to a list of substitution maps, in order of priority, most important substitution map first. Finally, it will substitute empty string for all the given prefixes.

func SubstituteVariables

func SubstituteVariables(target string, submap map[string]string) string

SubstituteVariables will perform variable substitution according to a substitution map. Example: SubstituteVariables("echo ${job.name}", map[string]string{"job.name": "jobconfig-sample.1650645000"})

func ValidateBoolOptionConfig

func ValidateBoolOptionConfig(cfg *execution.BoolOptionConfig, fldPath *field.Path) field.ErrorList

ValidateBoolOptionConfig validates the BoolOptionConfig and returns a list of errors.

func ValidateMultiOptionConfig

func ValidateMultiOptionConfig(cfg *execution.MultiOptionConfig, fldPath *field.Path) field.ErrorList

ValidateMultiOptionConfig validates the MultiOptionConfig and returns a list of errors.

func ValidateOption added in v0.1.0

func ValidateOption(option execution.Option, fldPath *field.Path) field.ErrorList

ValidateOption validates the option and returns a list of errors.

func ValidateOptionBool added in v0.1.0

func ValidateOptionBool(option execution.Option, fldPath *field.Path) field.ErrorList

ValidateOptionBool validates the Bool option and returns a list of errors.

func ValidateOptionDate added in v0.1.0

func ValidateOptionDate(option execution.Option, fldPath *field.Path) field.ErrorList

ValidateOptionDate validates the Date option and returns a list of errors.

func ValidateOptionMulti added in v0.1.0

func ValidateOptionMulti(option execution.Option, fldPath *field.Path) field.ErrorList

ValidateOptionMulti validates the Multi option and returns a list of errors.

func ValidateOptionName added in v0.1.0

func ValidateOptionName(name string, fldPath *field.Path) field.ErrorList

ValidateOptionName validates the option's name and returns a list of errors.

func ValidateOptionSelect added in v0.1.0

func ValidateOptionSelect(option execution.Option, fldPath *field.Path) field.ErrorList

ValidateOptionSelect validates the Select option and returns a list of errors.

func ValidateOptionSpec

func ValidateOptionSpec(spec *execution.OptionSpec, fldPath *field.Path) field.ErrorList

ValidateOptionSpec validates the OptionSpec and returns a list of errors.

func ValidateOptionString added in v0.1.0

func ValidateOptionString(option execution.Option, fldPath *field.Path) field.ErrorList

ValidateOptionString validates the String option and returns a list of errors.

func ValidateOptionType added in v0.1.0

func ValidateOptionType(optionType execution.OptionType, fldPath *field.Path) field.ErrorList

ValidateOptionType validates the OptionType and returns a list of errors.

func ValidateSelectOptionConfig

func ValidateSelectOptionConfig(cfg *execution.SelectOptionConfig, fldPath *field.Path) field.ErrorList

ValidateSelectOptionConfig validates the SelectOptionConfig and returns a list of errors.

func ZeroForNonConfig

func ZeroForNonConfig(option execution.Option) execution.Option

ZeroForNonConfig returns a copy of the Option with all non-config fields reset to the zero value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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