Documentation ¶
Index ¶
- func CodeStats(h http.Handler, vec *prometheus.CounterVec, hist *prometheus.HistogramVec) http.Handler
- func CustomValidator(h http.Handler, customValidator ValidationFunc, url opa.OPAURL, pkg string) http.Handler
- func GraphQLCustomValidator(handler http.Handler, customValidator ValidationFunc, url opa.OPAURL, ...) http.Handler
- func Logging(h http.Handler) http.Handler
- func RequestID(h http.Handler) http.Handler
- func StandardValidator(h http.Handler) http.Handler
- type Query
- type StatusRec
- type ValidationFunc
- type Variables
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CodeStats ¶
func CodeStats(h http.Handler, vec *prometheus.CounterVec, hist *prometheus.HistogramVec) http.Handler
CodesStats is a middleware that captures the status code and method of the request for metrics collection with Prometheus
func CustomValidator ¶
func CustomValidator(h http.Handler, customValidator ValidationFunc, url opa.OPAURL, pkg string) http.Handler
CustomValidtor allows for calling a specific OPA instance and defining the package name For example, to call a sidecar instead of the central OPA server and to only call the cw/underwriting package instead of the full cw package.
func GraphQLCustomValidator ¶
func GraphQLCustomValidator(handler http.Handler, customValidator ValidationFunc, url opa.OPAURL, pkg string) http.Handler
GraphQLCustomValidator is like the other CustomValidator function but for GraphQL requests. It passes through data if the query type is an introspection so that schema requests aren't validated by OPA
Types ¶
type StatusRec ¶ added in v0.2.0
type StatusRec struct { http.ResponseWriter Status int }
StatusRec wraps the http.ResponseWriter to capture the status code
func (*StatusRec) WriteHeader ¶ added in v0.2.0
WriteHeader captures the status code
type ValidationFunc ¶
type ValidationFunc func([]byte) (opa.OPARequest, error)
ValidationFunc is used to map the data in the incoming request to an OPA request. It's on the caller of the service to define the data in the OPA request and what package is called in OPA.