restproxyserver

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MIMEWildcard = runtime.MIMEWildcard
)

Variables

View Source
var (
	ErrNilRegisterer      = errors.New("Nil Registerer")
	ErrNilRegistererValue = errors.New("Nil Registerer value")
)

Functions

func DefaultHTTPErrorHandler

func DefaultHTTPErrorHandler(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, r *http.Request, err error)

Types

type DialOption

type DialOption = grpc.DialOption

type ErrorHandlerFunc

type ErrorHandlerFunc = runtime.ErrorHandlerFunc

type HandleChainFunc

type HandleChainFunc = httpserver.HandleChainFunc

type HeaderMatcherFunc

type HeaderMatcherFunc = runtime.HeaderMatcherFunc

type Logger

type Logger = logger.Logger

type Marshaler

type Marshaler = runtime.Marshaler

type QueryParameterParser

type QueryParameterParser = runtime.QueryParameterParser

type RESTProxyServer

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

RESTProxyServer represents the grpc-gateway rest serve endpoint.

func New

func New(log Logger, name string, port string, opts ...RESTProxyServerOption) RESTProxyServer

New creates a new RESTProxyServer that is bound to a specific GRPC Gateway API. This object complies with the standard Listener interface and can be managed by the startup.Listeners object.

func (*RESTProxyServer) Listen

func (g *RESTProxyServer) Listen() error

func (*RESTProxyServer) Shutdown

func (g *RESTProxyServer) Shutdown(ctx context.Context) error

func (*RESTProxyServer) String

func (g *RESTProxyServer) String() string

type RESTProxyServerOption

type RESTProxyServerOption func(*RESTProxyServer)

func SetQueryParameterParser

func SetQueryParameterParser(p QueryParameterParser) RESTProxyServerOption

SetQueryParameterParser adds an intercepror that matches header values.

func WithAppendedDialOption

func WithAppendedDialOption(d DialOption) RESTProxyServerOption

WithAppendedDialOption appends a grpc dial option.

func WithErrorHandler

func WithErrorHandler(o ErrorHandlerFunc) RESTProxyServerOption

WithErrorHandler adds error handling in special cases - e.g on 402 or 429. Nil argument is ignored.

func WithGRPCAddress

func WithGRPCAddress(a string) RESTProxyServerOption

WithGRPCAddress - overides the defaultGRPCAddress ('localhost:<port>')

func WithHTTPHandlers added in v0.10.0

func WithHTTPHandlers(handlers ...HandleChainFunc) RESTProxyServerOption

WithHTTPHandlers adds handlers on the http endpoint. A nil value will return an error on executiong Listen()

func WithHandlePath

func WithHandlePath(verb string, urlPath string, f func(http.ResponseWriter, *http.Request, map[string]string)) RESTProxyServerOption

WithHandlePath add REST file path handler.

func WithIncomingHeaderMatcher

func WithIncomingHeaderMatcher(o HeaderMatcherFunc) RESTProxyServerOption

WithIncomingHeaderMatcher adds an intercepror that matches header values.

func WithMarshaler

func WithMarshaler(mime string, m Marshaler) RESTProxyServerOption

WithMarshaler specifies an optional marshaler.

func WithOptionalHTTPHandlers added in v0.10.0

func WithOptionalHTTPHandlers(handlers ...HandleChainFunc) RESTProxyServerOption

WithOptionalHTTPHandlers adds handlers on the http endpoint. A nil value will be ignored.

func WithOptionalRegisterHandlers added in v0.10.0

func WithOptionalRegisterHandlers(registerers ...RegisterRESTProxyServer) RESTProxyServerOption

WithOptionalRegisterHandler adds grpc-gateway handlers. A nil value will be ignored.

func WithOutgoingHeaderMatcher

func WithOutgoingHeaderMatcher(o HeaderMatcherFunc) RESTProxyServerOption

WithOutgoingHeaderMatcher matches header values on output. Nil argument is ignored.

func WithPrependedDialOption

func WithPrependedDialOption(d DialOption) RESTProxyServerOption

WithPrependedDialOption prepends a grpc dial option.

func WithRegisterHandlers added in v0.10.0

func WithRegisterHandlers(registerers ...RegisterRESTProxyServer) RESTProxyServerOption

WithRegisterHandlers adds grpc-gateway handlers. A nil value will emit an error from the Listen() method.

type RegisterRESTProxyServer

type RegisterRESTProxyServer func(context.Context, *ServeMux, string, []DialOption) error

type ServeMux

type ServeMux = runtime.ServeMux

Jump to

Keyboard shortcuts

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