parameter

package
v2.17.3 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewParameterParserError

func NewParameterParserError(context ParameterParserContext, reason string) error

func NewParameterWriterError

func NewParameterWriterError(context ParameterWriterContext, reason string) error

Types

type NamedParameter added in v2.6.0

type NamedParameter struct {
	Name      string
	Parameter Parameter
}

type Parameter

type Parameter interface {
	// GetType returns the type of the parameter.
	GetType() string

	// GetReferences returns a slice of all other parameters this parameter references.
	// this is need in the sorting phase to first deploy references, so that
	// they an be resolved during deployment phase.
	GetReferences() []ParameterReference

	// ResolveValue resolves the value of this parameter. the context offers some more information
	// on the current deployment and resolving phase. if the value cannot be resolved,
	// an error should be returned.
	ResolveValue(context ResolveContext) (interface{}, error)
}

type ParameterParser

type ParameterParser func(ParameterParserContext) (Parameter, error)

function loading a parameter from a given context

type ParameterParserContext

type ParameterParserContext struct {
	Coordinate    coordinate.Coordinate
	Group         string
	Environment   string
	ParameterName string
	Fs            afero.Fs
	Value         map[string]interface {
	}
}

type ParameterParserError

type ParameterParserError struct {
	// Location (coordinate) of the config the error happened in
	Location coordinate.Coordinate `json:"location"`
	// EnvironmentDetails of the environment the parsing of the parameter failed for
	EnvironmentDetails errors.EnvironmentDetails `json:"environmentDetails"`
	// ParameterName holds the name of the parameter triggering the error
	ParameterName string `json:"parameterName"`
	// Reason is a text describing what went wrong
	Reason string `json:"reason"`
}

func (ParameterParserError) Coordinates

func (p ParameterParserError) Coordinates() coordinate.Coordinate

func (ParameterParserError) Error

func (p ParameterParserError) Error() string

func (ParameterParserError) LocationDetails

func (p ParameterParserError) LocationDetails() errors.EnvironmentDetails

type ParameterReference

type ParameterReference struct {
	Config   coordinate.Coordinate
	Property string
}

ParameterReference is used to identify a certain parameter in a config

func ToParameterReferences added in v2.14.0

func ToParameterReferences(params []interface{}, coord coordinate.Coordinate) (paramRefs []ParameterReference, err error)

func (ParameterReference) String

func (p ParameterReference) String() string

type ParameterResolveValueError

type ParameterResolveValueError struct {
	// Location (coordinate) of the config.Config in which a parameter failed to be resolved
	Location coordinate.Coordinate `json:"location"`
	// EnvironmentDetails of the environment the resolving failed for
	EnvironmentDetails errors.EnvironmentDetails `json:"environmentDetails"`
	// ParameterName is the name of the parameter that failed to be resolved
	ParameterName string `json:"parameterName"`
	// Reason describing what went wrong
	Reason string `json:"reason"`
}

ParameterResolveValueError is used to indicate that an error occurred during the resolving phase of a parameter.

func NewParameterResolveValueError

func NewParameterResolveValueError(context ResolveContext, reason string) ParameterResolveValueError

func (ParameterResolveValueError) Coordinates

func (ParameterResolveValueError) Error

func (ParameterResolveValueError) LocationDetails

type ParameterSerDe

type ParameterSerDe struct {
	Serializer   ParameterWriter
	Deserializer ParameterParser
}

struct holding pointers to functions used to serialize and deserialize a parameter. this information is then used by the config loader.

type ParameterWriter

type ParameterWriter func(ParameterWriterContext) (map[string]interface{}, error)

function used to transform a parameter to map structure, which can be serialized.

type ParameterWriterContext

type ParameterWriterContext struct {
	// coordinates of the current config to parse
	Coordinate  coordinate.Coordinate
	Group       string
	Environment string
	// name of the current parameter to parse
	ParameterName string
	// current value to parse
	Parameter Parameter
}

type ParameterWriterError

type ParameterWriterError struct {
	// Location (coordinate) of the config the error happened in
	Location coordinate.Coordinate `json:"location"`
	// EnvironmentDetails of the environment the parsing of the parameter failed for
	EnvironmentDetails errors.EnvironmentDetails `json:"environmentDetails"`
	// name of the parameter triggering the error
	ParameterName string `json:"parameterName"`
	// text describing what went wrong
	Reason string `json:"reason"`
}

func (ParameterWriterError) Coordinates

func (p ParameterWriterError) Coordinates() coordinate.Coordinate

func (ParameterWriterError) Error

func (p ParameterWriterError) Error() string

func (ParameterWriterError) LocationDetails

func (p ParameterWriterError) LocationDetails() errors.EnvironmentDetails

type Properties

type Properties map[string]interface{}

Properties defines a map representing resolved parameters

type PropertyResolver added in v2.8.0

type PropertyResolver interface {
	GetResolvedProperty(coordinate coordinate.Coordinate, propertyName string) (any, bool)
}

PropertyResolver is used in parameter resolution to fetch the values of already deployed configs

type ResolveContext

type ResolveContext struct {
	PropertyResolver PropertyResolver

	// coordinates of the current config
	ConfigCoordinate coordinate.Coordinate

	// group of the current config
	Group string

	// environment of the current config
	Environment string

	// name of the parameter to resolve
	ParameterName string

	// resolved values of the current config
	ResolvedParameterValues Properties
}

ResolveContext used to give some more information on the resolving phase

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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