values

package
v0.0.0-...-614ca16 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ValueSetAll = "all"

Variables

This section is empty.

Functions

func Distill

func Distill(left Values, right Values) (common Values, leftResidue Values, rightResidue Values)

Distill returns what is common between this instance and the other instance. Anything that is not common is returned in the residue parameter.

Types

type ErrNoTable

type ErrNoTable error

ErrNoTable indicates that a chart does not have a matching table.

type ErrNoValue

type ErrNoValue error

ErrNoValue indicates that Values does not contain a key with a value

type ExtractValueSetArgs

type ExtractValueSetArgs struct {
	Names      []string
	Roles      []core.EnvironmentRole
	ExactMatch map[string]string
}

type PersistableValues

type PersistableValues struct {
	Attribution Values `yaml:"attribution"`
	Values      Values `yaml:"values"`
	FilePath    string `yaml:"-"`
}

func (*PersistableValues) Cleanup

func (r *PersistableValues) Cleanup()

func (*PersistableValues) PersistValues

func (r *PersistableValues) PersistValues() (string, error)

func (*PersistableValues) Report

func (r *PersistableValues) Report() string

type ValueMappings

type ValueMappings map[string]string

ValueMappings is a map of dotted value path to dotted value path. When ApplyToValues is called, it takes the values found at the key path and writes them to the value path.

func (ValueMappings) ApplyToValues

func (v ValueMappings) ApplyToValues(target Values) error

type ValueSet

type ValueSet struct {
	core.ConfigShared   `yaml:",inline"`
	Source              string                           `yaml:"source,omitempty"`
	StaticAttributions  Values                           `yaml:"staticAttributions,omitempty"`
	DynamicAttributions Values                           `yaml:"dynamicAttributions,omitempty"`
	Roles               []core.EnvironmentRole           `yaml:"roles,flow,omitempty"`
	ExactMatchFilters   filter.MatchMapConfig            `yaml:"exactMatchFilters,omitempty"`
	Dynamic             map[string]*command.CommandValue `yaml:"dynamic,omitempty" json:"dynamic,omitempty"`
	Files               []string                         `yaml:"files,omitempty" json:"files,omitempty"`
	Static              Values                           `yaml:"static,omitempty" json:"static,omitempty"`
}

func ExtractValueSet

func ExtractValueSet(provider ValueSetCollectionProvider, argsProvider filter.MatchMapArgContainer) ValueSet

func ExtractValueSetAdvanced

func ExtractValueSetAdvanced(provider ValueSetCollectionProvider, args ExtractValueSetArgs) ValueSet

func NewValueSet

func NewValueSet() ValueSet

func (ValueSet) Clone

func (v ValueSet) Clone() ValueSet

func (*ValueSet) MarshalYAML

func (v *ValueSet) MarshalYAML() (interface{}, error)

func (*ValueSet) UnmarshalYAML

func (v *ValueSet) UnmarshalYAML(unmarshal func(interface{}) error) error

func (ValueSet) WithDefaultSource

func (v ValueSet) WithDefaultSource(source string) ValueSet

Returns a value set with the source set if it wasn't set before.

func (ValueSet) WithDynamicValuesResolved

func (v ValueSet) WithDynamicValuesResolved(ctx command.ExecutionContext) (ValueSet, error)

WithDynamicValuesResolved returns a ValueSet based on this instance, but with all dynamic values resolved and merged into the static values, and with all values which contain go templates rendered into their final values using the static values as of when this method was called.

func (ValueSet) WithFilesLoaded

func (v ValueSet) WithFilesLoaded(pathResolver core.PathResolver) (ValueSet, error)

WithFilesLoaded returns a new ValueSet based on this one, but with all files loaded and merged UNDER existing static values.

func (ValueSet) WithSource

func (v ValueSet) WithSource(source string) ValueSet

func (ValueSet) WithValueSetAtPath

func (v ValueSet) WithValueSetAtPath(path string, value interface{}, attribution string) (ValueSet, error)

func (ValueSet) WithValues

func (v ValueSet) WithValues(other ValueSet) ValueSet

WithValues returns a new ValueSet with the values from other added after (and/or overwriting) the values from this instance)

type ValueSetChain

type ValueSetChain struct {
	ValueSets ValueSets
}

func (*ValueSetChain) Append

func (v *ValueSetChain) Append(source string, valueSet ValueSet)

func (*ValueSetChain) Prepend

func (v *ValueSetChain) Prepend(source string, valueSet ValueSet)

type ValueSetCollection

type ValueSetCollection struct {
	Disabled      bool      `yaml:"disabled"`
	DefaultValues ValueSet  `yaml:"defaults"`
	ValueSets     ValueSets `yaml:"custom"`
}

ValueSetCollection is a map of (possibly multiple) names to ValueSets. The the keys can be single names (like "red") or multiple, comma-delimited names (like "red,green"). Use ExtractValueSetByName to get a merged ValueSet comprising the ValueSets under each key which contains that name.

func NewValueSetCollection

func NewValueSetCollection() ValueSetCollection

func (ValueSetCollection) CanonicalizedCopy

func (v ValueSetCollection) CanonicalizedCopy() ValueSetCollection

CanonicalizedCopy returns a copy of this ValueSetCollection with only single-role entries, by de-normalizing any multi-role entries. Each ValueSet will have its name set to the value of the name it's under.

func (ValueSetCollection) ExtractValueSet

func (v ValueSetCollection) ExtractValueSet(args ExtractValueSetArgs) ValueSet

func (ValueSetCollection) ExtractValueSetByName

func (v ValueSetCollection) ExtractValueSetByName(name string) ValueSet

ExtractValueSetByName returns a merged ValueSet comprising the ValueSets under each key which contains the provided names. ValueSets with the same name are merged in order from least specific key to most specific, so values under the key "red" will overwrite values under "red,green", which will overwrite values under "red,green,blue", and so on. Then the ValueSets with each name are merged in the order the names were provided.

func (ValueSetCollection) ExtractValueSetByNames

func (v ValueSetCollection) ExtractValueSetByNames(names ...string) ValueSet

func (ValueSetCollection) ExtractValueSetByRole

func (v ValueSetCollection) ExtractValueSetByRole(role core.EnvironmentRole) ValueSet

func (ValueSetCollection) ExtractValueSetByRoles

func (v ValueSetCollection) ExtractValueSetByRoles(roles ...core.EnvironmentRole) ValueSet

func (ValueSetCollection) FindValueSetForRole

func (v ValueSetCollection) FindValueSetForRole(role core.EnvironmentRole) (ValueSet, error)

func (ValueSetCollection) MarshalYAML

func (v ValueSetCollection) MarshalYAML() (interface{}, error)

func (*ValueSetCollection) SetFromPath

func (v *ValueSetCollection) SetFromPath(fromPath string)

func (*ValueSetCollection) UnmarshalYAML

func (v *ValueSetCollection) UnmarshalYAML(unmarshal func(interface{}) error) error

type ValueSetCollectionProvider

type ValueSetCollectionProvider interface {
	GetValueSetCollection() ValueSetCollection
}

type ValueSets

type ValueSets []ValueSet

func (ValueSets) Len

func (v ValueSets) Len() int

func (ValueSets) Less

func (v ValueSets) Less(i, j int) bool

func (ValueSets) Swap

func (v ValueSets) Swap(i, j int)

type Values

type Values map[string]interface{}

Values represents a collection of chart values.

func ReadValues

func ReadValues(data []byte) (vals Values, err error)

ReadValues will parse YAML byte data into a Values.

func ReadValuesFile

func ReadValuesFile(filename string) (Values, error)

ReadValuesFile will parse a YAML file into a map of values.

func (Values) AddEnvAsPath

func (v Values) AddEnvAsPath(prefix, envName string, value interface{}) error

AddEnvAsPath turns an environment variable (like BOSUN_APP_VERSION) into a path (like app.version) by trimming the prefix, lower casing, and converting to dots, then adds it to the Values.

func (Values) AsMap

func (v Values) AsMap() map[string]interface{}

AsMap is a utility function for converting Values to a map[string]interface{}.

It protects against nil map panics.

func (Values) Clone

func (v Values) Clone() Values

func (Values) Encode

func (v Values) Encode(w io.Writer) error

Encode writes serialized Values information to the given io.Writer.

func (Values) GetAtPath

func (v Values) GetAtPath(path string) (interface{}, error)

SetAtPath adds value to Values at the provided path, which can be a compound name. If there table missing from the path, they will be created.

func (Values) Include

func (v Values) Include(src Values)

Include takes any properties in src which are not in this instance and adds them to this instance.

func (Values) MakeAttributionValues

func (v Values) MakeAttributionValues(attribution string) Values

func (Values) Marshal

func (v Values) Marshal(in interface{}) error

func (Values) MarshalJSON

func (v Values) MarshalJSON() ([]byte, error)

func (Values) Merge

func (v Values) Merge(src Values) Values

Merge takes the properties in src and merges them into Values. Maps are merged (keys are overwritten) while values and arrays are replaced.

func (Values) MustSetAtPath

func (v Values) MustSetAtPath(path string, value interface{})

MustSetAtPath adds value to Values at the provided path, which can be a compound name. This will panic if path is invalid, so it should only be used with literal string paths, not user provided ones.

func (Values) SetAtPath

func (v Values) SetAtPath(path string, value interface{}) error

SetAtPath adds value to Values at the provided path, which can be a compound name. If there table missing from the path, they will be created.

func (Values) Table

func (v Values) Table(name string) (Values, error)

Table gets a table (YAML subsection) from a Values object.

The table is returned as a Values.

Compound table names may be specified with dots:

foo.bar

The above will be evaluated as "The table bar inside the table foo".

An ErrNoTable is returned if the table does not exist.

func (Values) ToEnv

func (v Values) ToEnv(prefix string) map[string]string

ToEnv returns a map with all the tables in the Values converted to _ delimited environment variables, prefixed with `prefix`.

func (Values) ToMapStringInterface

func (v Values) ToMapStringInterface() map[string]interface{}

func (Values) Unmarshal

func (v Values) Unmarshal(out interface{}) error

func (*Values) UnmarshalYAML

func (v *Values) UnmarshalYAML(unmarshal func(interface{}) error) error

func (Values) YAML

func (v Values) YAML() (string, error)

YAML encodes the Values into a YAML string.

Jump to

Keyboard shortcuts

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