util

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AWSAccessKeyEnvvar string = "AWS_ACCESS_KEY_ID"
	AWSSecretKeyEnvvar string = "AWS_SECRET_ACCESS_KEY"
	AWSRegionEnvvar    string = "AWS_REGION"
)

Variables

This section is empty.

Functions

func AWSConfig

func AWSConfig(ctx context.Context, accessKeyID, secretAccessKey, region string, serviceEndpoint *string) (*aws.Config, error)

func ConcatSlices

func ConcatSlices[T any](slices ...[]T) []T

func LookupIPv4

func LookupIPv4(ctx context.Context, host string) (string, error)

LookupIPv4 resolves the given hostname to a IPv4. WARNING: It only returns the first IP even if the hostname resolves to several

func WrapError

func WrapError(context string, err error) error

WrapError can be used to provide information about the context where the error occured

Types

type LogConfig

type LogConfig struct {
	LogMode      string `envconfig:"LOG_MODE" default:"production"`
	LogEncoding  string `envconfig:"LOG_ENCODING"`
	LogLevel     string `envconfig:"LOG_LEVEL"`
	LogVerbosity int8   `envconfig:"LOG_VERBOSITY" default:"0"`
}

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

func (Logger) New

func (l Logger) New() logr.Logger

New will return a Logger configured with the LOG_* environment variables and the supported --zap* flags passed to the operator command line

type MultiError

type MultiError []error

Type MultiError can be used for iterative operations that must keep going even if errors are detected. It will return the list of all encountered errors. MultiError implements the Error interface and can be passed around as a normal error.

func (MultiError) Error

func (me MultiError) Error() string

func (MultiError) ErrorOrNil

func (me MultiError) ErrorOrNil() error

func (MultiError) Unwrap

func (me MultiError) Unwrap() []error

type ProfilerConfig

type ProfilerConfig struct {
	EnableProfiler      bool   `envconfig:"PROFILER_ENABLE" default:"false"`
	ProfilerBindAddress string `envconfig:"PROFILER_BIND_ADDRESS" default:"0.0.0.0"`
	ProfilerBinbPort    string `envconfig:"PROFILER_BIND_ORT" default:"6060"`
	Log                 logr.Logger
}

func (ProfilerConfig) Setup

func (cfg ProfilerConfig) Setup() error

Jump to

Keyboard shortcuts

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