Documentation ¶
Index ¶
- func CastTo(target interface{}, value interface{}) bool
- func CreateSimpleJSONBody(code, message string, errs ...error) []byte
- func DefaultErrorHandler(ctx Context, err error) api.StatusType
- func DefaultRender(keysAndValues []interface{}) []interface{}
- func NewLogger(callback api.FilterCallbacks) logr.Logger
- func ToFlatHeader(header http.Header) map[string]string
- type Context
- type ErrorHandler
- type Handler
- type HandlerFunc
- type HandlerManager
- type Header
- type ReplyOption
- type ReplyOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateSimpleJSONBody ¶
func DefaultErrorHandler ¶
func DefaultErrorHandler(ctx Context, err error) api.StatusType
func DefaultRender ¶ added in v0.1.1
func DefaultRender(keysAndValues []interface{}) []interface{}
DefaultRender supports logr.Marshaler and fmt.Stringer.
Types ¶
type Context ¶
type Context interface { // RequestHeader provides an interface to access HTTP Request header, including // add, overwrite, or delete existing header. RequestHeader() Header // Request returns an http.Request struct, which is a read-only data. // Attempting to modify this value will have no effect. // To make modifications to the request, such as its headers, please use the RequestHeader() method instead. Request() *http.Request // SetRequest is a low-level API, it set response from RequestHeaderMap interface SetRequest(api.RequestHeaderMap) // ResponseHeader provides an interface to access HTTP Response header, including // add, overwrite, or delete existing header. ResponseHeader() Header // Response returns an http.Response struct, which is a read-only data. // It means, update anything to this value will result nothing. // To make modifications to the response, such as its headers, please use the ResponseHeader() method instead. Response() *http.Response // SetResponse is a low-level API, it set response from ResponseHeaderMap interface SetResponse(api.ResponseHeaderMap) // StreamInfo offers an interface for retrieving comprehensive details about the incoming HTTP traffic, including // information such as the route name, filter chain name, dynamic metadata, and more. // It provides direct access to low-level Envoy information, so it's important to use it with a clear understanding of your intent. StreamInfo() api.StreamInfo // Store allows you to save a value of any type under a key of any type. // Please be cautious! The Store function overwrites any existing data. Store(key any, value any) // Load retrieves a value associated with a specific key and assigns it to the receiver. // It returns true if a compatible value is successfully loaded, // and false if no value is found or an error occurs during the process. Load(key any, receiver interface{}) (ok bool, err error) // Log provides a logger from the plugin to the Envoy Log. It accessible under Envoy `http` component. // e.g., Envoy flag `--component-log-level http:{debug,info,warn,error,critical}` Log() logr.Logger // JSON sends a JSON response with status code. JSON(code int, b []byte, headers map[string]string, opts ...ReplyOption) error // String sends a plain text response with status code. String(code int, s string, opts ...ReplyOption) error // StatusType is a low-level API used to specify the type of status to be communicated to Envoy. StatusType() api.StatusType // Committed indicates whether the current context has already completed its processing // within the plugin and forwarded the result to Envoy. Committed() bool }
func NewContext ¶ added in v0.1.1
func NewContext(callback api.FilterCallbacks) (Context, error)
type ErrorHandler ¶
type ErrorHandler func(Context, error) api.StatusType
type Handler ¶ added in v0.1.1
type Handler func(next HandlerFunc) HandlerFunc
type HandlerFunc ¶ added in v0.1.1
func HandlerDecorator ¶ added in v0.1.1
func HandlerDecorator(next HandlerFunc) HandlerFunc
type HandlerManager ¶ added in v0.1.1
type HandlerManager interface { Use(handler Handler) Handle(ctx Context) api.StatusType }
func NewManager ¶ added in v0.1.1
func NewManager() HandlerManager
func NewManagerWithErrorHandler ¶ added in v0.1.1
func NewManagerWithErrorHandler(errHandler ErrorHandler) HandlerManager
type ReplyOption ¶ added in v0.1.1
type ReplyOption func(o *ReplyOptions)
func WithGrpcStatus ¶
func WithGrpcStatus(status int64) ReplyOption
func WithResponseCodeDetails ¶ added in v0.1.1
func WithResponseCodeDetails(detail string) ReplyOption
type ReplyOptions ¶ added in v0.1.1
type ReplyOptions struct {
// contains filtered or unexported fields
}
func GetDefaultReplyOptions ¶ added in v0.1.1
func GetDefaultReplyOptions() *ReplyOptions
Click to show internal directories.
Click to hide internal directories.