parameter

package
v2.9.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: Apache-2.0 Imports: 3 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 {
	// 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
	Value map[string]interface{}
}

type ParameterParserError

type ParameterParserError struct {
	// Location of the config the error happened in
	Location           coordinate.Coordinate     `json:"location"`
	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 (ParameterReference) String

func (p ParameterReference) String() string

type ParameterResolveValueError

type ParameterResolveValueError struct {
	Location           coordinate.Coordinate     `json:"location"`
	EnvironmentDetails errors.EnvironmentDetails `json:"environmentDetails"`
	ParameterName      string                    `json:"parameterName"`
	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 {
	// config the error happened in
	Location           coordinate.Coordinate     `json:"location"`
	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