conf

package
v0.0.0-...-2b5a245 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConfigValidation = fmt.Errorf("error while validating config")
)
View Source
var ErrInvalidFormat = fmt.Errorf("invalid config format")

Functions

func NewASConfigFromBytes

func NewASConfigFromBytes(log logr.Logger, src []byte, srcFmt Format) (*asconfig.AsConfig, error)

Types

type ConfHandler

type ConfHandler interface {
	IsValid(log logr.Logger, version string) (bool, []*asconfig.ValidationErr, error)
	ToMap() *asconfig.Conf
	ToConfFile() asconfig.DotConf
	GetFlatMap() *asconfig.Conf
}

type ConfigMarshaller

type ConfigMarshaller struct {
	Format Format
	ConfHandler
}

func NewConfigMarshaller

func NewConfigMarshaller(conf ConfHandler, format Format) ConfigMarshaller

func (ConfigMarshaller) MarshalText

func (cm ConfigMarshaller) MarshalText() (text []byte, err error)

type ConfigValidator

type ConfigValidator struct {
	ConfHandler
	// contains filtered or unexported fields
}

func NewConfigValidator

func NewConfigValidator(confHandler ConfHandler, mgmtLogger logr.Logger, version string) *ConfigValidator

func (*ConfigValidator) Validate

func (cv *ConfigValidator) Validate() (*ValidationErrors, error)

Validate validates the parsed configuration against the schema for the given versions. ValidationErrors is not nil if any errors occur during validation.

type Format

type Format string
const (
	Invalid  Format = ""
	YAML     Format = "yaml"
	AsConfig Format = "asconfig"
)

type VErrSlice

type VErrSlice []ValidationErr

func (VErrSlice) Len

func (a VErrSlice) Len() int

func (VErrSlice) Less

func (a VErrSlice) Less(i, j int) bool

func (VErrSlice) Swap

func (a VErrSlice) Swap(i, j int)

type ValidationErr

type ValidationErr struct {
	asconfig.ValidationErr
}

func (ValidationErr) Error

func (o ValidationErr) Error() string

Outputs a human readable string of validation error details. error is not nil if validation, or any other type of error occurs.

type ValidationErrors

type ValidationErrors struct {
	Errors VErrSlice
}

func (ValidationErrors) Error

func (o ValidationErrors) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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