restproxyserver

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MIMEWildcard = runtime.MIMEWildcard
)

Variables

This section is empty.

Functions

func DefaultHTTPErrorHandler added in v0.7.1

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 added in v0.8.0

type ErrorHandlerFunc = runtime.ErrorHandlerFunc

type HandleChainFunc added in v0.8.0

type HandleChainFunc = httpserver.HandleChainFunc

type HeaderMatcherFunc added in v0.8.0

type HeaderMatcherFunc = runtime.HeaderMatcherFunc

type Logger

type Logger = logger.Logger

type Marshaler

type Marshaler = runtime.Marshaler

type QueryParameterParser added in v0.7.1

type QueryParameterParser = runtime.QueryParameterParser

type RESTProxyServer

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

RESTProxyServer represents the grpc-gateway rest openapiv2 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 added in v0.7.1

func SetQueryParameterParser(p QueryParameterParser) RESTProxyServerOption

SetQueryParameterParser adds an intercepror that matches header values.

func WithAppendedDialOption added in v0.7.1

func WithAppendedDialOption(d DialOption) RESTProxyServerOption

WithAppendedDialOption appends a grpc dial option.

func WithErrorHandler added in v0.7.1

func WithErrorHandler(o ErrorHandlerFunc) RESTProxyServerOption

WithErrorHandler adds error handling in special cases - e.g on 402 or 429.

func WithGRPCAddress added in v0.7.1

func WithGRPCAddress(a string) RESTProxyServerOption

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

func WithHTTPHandler added in v0.8.0

func WithHTTPHandler(h HandleChainFunc) RESTProxyServerOption

WithHTTPHandler adds a handler on the http endpoint.

func WithHandlePath added in v0.7.1

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

WithHandlePath add REST file path handler.

func WithIncomingHeaderMatcher added in v0.7.1

func WithIncomingHeaderMatcher(o HeaderMatcherFunc) RESTProxyServerOption

WithOutgoingHeaderMatcher matches header values on oupput. WithIncomingHeaderMatcher adds an intercepror that matches header values.

func WithMarshaler

func WithMarshaler(mime string, m Marshaler) RESTProxyServerOption

WithMarshaler specifies on an optional marshaler.

func WithOutgoingHeaderMatcher added in v0.7.1

func WithOutgoingHeaderMatcher(o HeaderMatcherFunc) RESTProxyServerOption

WithOutgoingHeaderMatcher matches header values on oupput.

func WithPrependedDialOption added in v0.7.1

func WithPrependedDialOption(d DialOption) RESTProxyServerOption

WithPrependedDialOption prepends a grpc dial option.

func WithRegisterHandler added in v0.8.0

func WithRegisterHandler(r RegisterRESTProxyServer) RESTProxyServerOption

WithRegisterHandler adds another grpc-gateway handler

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