Documentation ¶
Index ¶
- func ContextWithHeaders(r *http.Request) context.Context
- func Guard(ctx context.Context, guardName string, opts ...GuardOpt) *handlers.Guard
- func GuardHandler(next http.Handler, guardName string, opts ...GuardOpt) http.Handler
- func GuardMiddleware(next func(w http.ResponseWriter, r *http.Request), guardName string, ...) func(w http.ResponseWriter, r *http.Request)
- func HttpGet(ctx context.Context, guardName, url string, opts ...GuardOpt) (*http.Response, error)
- func HttpPost(ctx context.Context, guardName, url string, body io.Reader, opts ...GuardOpt) (*http.Response, error)
- func HttpServer(guardName string, opts ...GuardOpt) (*httphandler.InboundHandler, error)
- func Init(ctx context.Context, co ClientOptions) (func(), error)
- func NewGrpcInboundHandler(gn string, fn *string, pb *int32, dw *float32, kv *map[string]string) (*grpchandler.InboundHandler, error)
- func NewGrpcOutboundHandler(gn string, fn *string, pb *int32, dw *float32, kv *map[string]string) (*grpchandler.OutboundHandler, error)
- func NewHttpInboundHandler(gn string, fn *string, pb *int32, dw *float32, kv *map[string]string) (*httphandler.InboundHandler, error)
- func NewHttpOutboundHandler(gn string, fn *string, pb *int32, dw *float32, kv *map[string]string) (*httphandler.OutboundHandler, error)
- func RegisterGuard(ctx context.Context, guard string)
- func StreamClientInterceptor(guardName string, opts ...GuardOpt) grpc.StreamClientInterceptor
- func StreamServerInterceptor(guardName string, opts ...GuardOpt) grpc.StreamServerInterceptor
- func UnaryClientInterceptor(guardName string, opts ...GuardOpt) grpc.UnaryClientInterceptor
- func UnaryServerInterceptor(guardName string, opts ...GuardOpt) grpc.UnaryServerInterceptor
- type ClientOptions
- type GuardOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithHeaders ¶
ContextWithHeaders is a helper function which extracts and OTEL TraceContext, Baggage, and StanzaHeaders from a given http.Request into a context.Context.
func GuardHandler ¶
func GuardMiddleware ¶
func GuardMiddleware(next func(w http.ResponseWriter, r *http.Request), guardName string, opts ...GuardOpt) func(w http.ResponseWriter, r *http.Request)
func HttpPost ¶
func HttpPost(ctx context.Context, guardName, url string, body io.Reader, opts ...GuardOpt) (*http.Response, error)
HttpPost is a helper function to Guard an outbound HTTP POST
func HttpServer ¶
func HttpServer(guardName string, opts ...GuardOpt) (*httphandler.InboundHandler, error)
HttpServer is a helper function to Guard inbound HTTP requests
func Init ¶
func Init(ctx context.Context, co ClientOptions) (func(), error)
Init initializes the SDK with ClientOptions. The returned error is non-nil if options is invalid, if a global client already exists, or if StanzaHub can't be reached.
func NewGrpcInboundHandler ¶
func NewGrpcInboundHandler(gn string, fn *string, pb *int32, dw *float32, kv *map[string]string) (*grpchandler.InboundHandler, error)
gRPC Server
func NewGrpcOutboundHandler ¶
func NewGrpcOutboundHandler(gn string, fn *string, pb *int32, dw *float32, kv *map[string]string) (*grpchandler.OutboundHandler, error)
gRPC Client
func NewHttpInboundHandler ¶
func NewHttpInboundHandler(gn string, fn *string, pb *int32, dw *float32, kv *map[string]string) (*httphandler.InboundHandler, error)
HTTP Server
func NewHttpOutboundHandler ¶
func NewHttpOutboundHandler(gn string, fn *string, pb *int32, dw *float32, kv *map[string]string) (*httphandler.OutboundHandler, error)
HTTP Client
func RegisterGuard ¶
func StreamClientInterceptor ¶
func StreamClientInterceptor(guardName string, opts ...GuardOpt) grpc.StreamClientInterceptor
StreamClientInterceptor is a helper function to Guard an outbound grpc streaming client
func StreamServerInterceptor ¶
func StreamServerInterceptor(guardName string, opts ...GuardOpt) grpc.StreamServerInterceptor
StreamServerInterceptor is a helper function to Guard an inbound grpc streaming server
func UnaryClientInterceptor ¶
func UnaryClientInterceptor(guardName string, opts ...GuardOpt) grpc.UnaryClientInterceptor
UnaryClientInterceptor is a helper function to Guard an outbound grpc unary client
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(guardName string, opts ...GuardOpt) grpc.UnaryServerInterceptor
UnaryServerInterceptor is a helper function to Guard an inbound grpc unary server
Types ¶
type ClientOptions ¶
type ClientOptions struct { // Required APIKey string // customer generated API key // Optional Name string // defines service unique name Release string // defines service version Environment string // defines service environment StanzaHub string // host:port (ipv4, ipv6, or resolvable hostname) Guard []string // prefetch config for these guards }