properties

package
v1.1.81 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidSecretReference = errors.Newf(1411, "invalid secret reference - %s, please check the value for %s config")

ErrInvalidSecretReference - Error for parsing properties with secret reference

Functions

func GetAliasKeyPrefix

func GetAliasKeyPrefix() string

GetAliasKeyPrefix -

func SetAliasKeyPrefix

func SetAliasKeyPrefix(keyPrefix string)

SetAliasKeyPrefix -

Types

type DurationOpt

type DurationOpt func(prop *durationOpts)

DurationOpt are duration range options passed into AddDurationProperty

func WithLowerLimit

func WithLowerLimit(lower time.Duration) DurationOpt

WithLowerLimit - lower limit of the duration range

func WithQAOverride added in v1.1.44

func WithQAOverride() DurationOpt

WithQAOverride - set to true to allow this setting to be overwritten with a qa env var

func WithUpperLimit

func WithUpperLimit(upper time.Duration) DurationOpt

WithUpperLimit - upper limit of the duration range

type Properties

type Properties interface {
	// Methods for adding yaml properties and command flag
	AddStringProperty(name string, defaultVal string, description string)
	AddStringPersistentFlag(name string, defaultVal string, description string)
	AddStringFlag(name string, description string)
	AddDurationProperty(name string, defaultVal time.Duration, description string, options ...DurationOpt)
	AddIntProperty(name string, defaultVal int, description string)
	AddBoolProperty(name string, defaultVal bool, description string)
	AddBoolFlag(name, description string)
	AddStringSliceProperty(name string, defaultVal []string, description string)
	AddObjectSliceProperty(name string, objectPropertyNames []string)

	// Methods to get the configured properties
	StringPropertyValue(name string) string
	StringFlagValue(name string) (bool, string)
	DurationPropertyValue(name string) time.Duration
	IntPropertyValue(name string) int
	BoolPropertyValue(name string) bool
	BoolPropertyValueOrTrue(name string) bool // Use this method when the default value, no config given, is true
	BoolFlagValue(name string) bool
	StringSlicePropertyValue(name string) []string
	ObjectSlicePropertyValue(name string) []map[string]interface{}

	// Methods to set a property
	SetStringFlagValue(name string, value string)

	// Log Properties
	MaskValues(name string)
	DebugLogProperties()
	SetAliasKeyPrefix(aliasKeyPrefix string)
}

Properties - Root Command Properties interface for all configs to use for adding and parsing values

func NewProperties

func NewProperties(rootCmd *cobra.Command) Properties

NewProperties - Creates a new Properties struct

func NewPropertiesWithSecretResolver

func NewPropertiesWithSecretResolver(rootCmd *cobra.Command, secretResolver SecretPropertyResolver) Properties

NewPropertiesWithSecretResolver - Creates a new Properties struct with secret resolver for string property/flag

type SecretPropertyResolver

type SecretPropertyResolver interface {
	ResolveSecret(secretRef string) (string, error)
}

SecretPropertyResolver - interface for resolving property values with secret references

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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