Documentation ¶
Index ¶
- func CheckErrors(errs ...error) error
- func Dump(message interface{}) error
- func DumpYaml(cfg interface{})
- func GRPCLoggingMiddleware(logger logger.Logger) grpc.UnaryServerInterceptor
- func GetHTTPCodeFromError(err error) int
- func GetPagination(options *v1alpha1.ListOptions) *v1alpha1.ListOptions
- func IgnoredFlag(f *pflag.FlagSet, name, message string)
- func LoadConfig(filename string, pointer interface{}) error
- func PaginateSlice(options *v1alpha1.ListOptions, pointer interface{}) error
- func ParseConfigFileParameter(args []string) (configFile string)
- func RegisterExitHandlers(logger logger.Logger, cancelFunc func()) (stop chan struct{})
- func SplitYAML(data []byte) ([][]byte, error)
- func StartMetricsServer(ctx context.Context, cancelFunc context.CancelFunc, logger logger.Logger, ...) error
- func StartServiceAsync(ctx context.Context, cancelFunc context.CancelFunc, logger logger.Logger, ...)
- func ValidateConfigs(configs ...ValidatableConfig) error
- type PluggableConfig
- type RegistrableConfig
- type ValidatableConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GRPCLoggingMiddleware ¶
func GRPCLoggingMiddleware(logger logger.Logger) grpc.UnaryServerInterceptor
GRPCLoggingMiddleware is grpc logging middleware
func GetHTTPCodeFromError ¶
GetHTTPCodeFromError is used to get http code from error
func GetPagination ¶
func GetPagination(options *v1alpha1.ListOptions) *v1alpha1.ListOptions
GetPagination is used to make ListOptions safety
func IgnoredFlag ¶
IgnoredFlag ignores set value, without any warning
func LoadConfig ¶
LoadConfig read YAML-formatted config from filename into cfg.
func PaginateSlice ¶
func PaginateSlice(options *v1alpha1.ListOptions, pointer interface{}) error
PaginateSlice is used to paginate slice
func ParseConfigFileParameter ¶
Parse -config.file and -config.expand-env option via separate flag set, to avoid polluting default one and calling flag.Parse on it twice.
func RegisterExitHandlers ¶
RegisterExitHandlers is used to register exit handlers
func StartMetricsServer ¶
func StartMetricsServer(ctx context.Context, cancelFunc context.CancelFunc, logger logger.Logger, address string, registerer prometheus.Registerer) error
StartMetricsServer is used to start metric server
func StartServiceAsync ¶
func StartServiceAsync(ctx context.Context, cancelFunc context.CancelFunc, logger logger.Logger, serveFn func() error, stopFn func() error)
StartServiceAsync is used to start service async
func ValidateConfigs ¶
func ValidateConfigs(configs ...ValidatableConfig) error
ValidateConfigs is used to validate validatable configs
Types ¶
type PluggableConfig ¶
type PluggableConfig interface { // IsEnabled is used to return whether the current component is enabled // This attribute is required in pluggable components IsEnabled() bool }
PluggableConfig defines the pluggable Config
type RegistrableConfig ¶ added in v0.3.0
type RegistrableConfig interface { // RegisterFlagsWithPrefix is used to registerer flag with prefix RegisterFlagsWithPrefix(prefix string, f *pflag.FlagSet) }
RegistrableConfig defines the registrable config
type ValidatableConfig ¶
type ValidatableConfig interface { // Validate is used to validate config and returns error on failure Validate() error }
ValidatableConfig defines the validatable Config