utils

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClusterGroupKind = v1.Kind("Cluster")
View Source
var ClusterResource = v1.Resource("Clusters")

Functions

func GetLogger

func GetLogger() *logrus.Logger

func IntInSlice

func IntInSlice(i int, l []int) bool

func NewForbidden

func NewForbidden(qualifiedResource schema.GroupResource, name string, err error) *errors.StatusError

func NewInternalError

func NewInternalError(err error) *errors.StatusError

func NewInvalid

func NewInvalid(qualifiedKind schema.GroupKind, name string, fieldName string, err error) *errors.StatusError

NewInvalid returns an error indicating the item is invalid and cannot be processed.

func NewNotFound

func NewNotFound(qualifiedResource schema.GroupResource, name string, message string) *errors.StatusError

NewNotFound returns a new error which indicates that the resource of the kind and the name was not found.

func NewUnauthorized

func NewUnauthorized(reason string) *errors.StatusError

NewUnauthorized returns an error indicating the client is not authorized to perform the requested action.

func StringInSlice

func StringInSlice(s string, l []string) bool

StringInSlice returns true if given string in slice

func UpdateLoggerLevel

func UpdateLoggerLevel(level logrus.Level)

func WriteErrorResponse

func WriteErrorResponse(rw http.ResponseWriter, statusCode int, err *types.ErrorResponse)

WriteErrorResponse writes a standard error response

func WriteKubeAPIError

func WriteKubeAPIError(rw http.ResponseWriter, err *errors.StatusError)

WriteKubeAPIError writes a standard error response

Types

type SimpleContext

type SimpleContext struct{}

func (SimpleContext) Fire

func (hook SimpleContext) Fire(entry *logrus.Entry) error

func (SimpleContext) Levels

func (hook SimpleContext) Levels() []logrus.Level

type TraceContext

type TraceContext struct {
	ShowFileno    bool
	ShowFuncField bool
}

func NewTraceContext

func NewTraceContext(showFileno, showFuncField bool) *TraceContext

func (TraceContext) Fire

func (hook TraceContext) Fire(entry *logrus.Entry) error

Fire adds filename and lino number info compare to the original log format

func (TraceContext) Levels

func (hook TraceContext) Levels() []logrus.Level

Jump to

Keyboard shortcuts

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