Documentation
¶
Overview ¶
Package opa provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 DO NOT EDIT.
Index ¶
- func RegisterHandlers(router EchoRouter, si ServerInterface)
- func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)
- type EchoRouter
- type EvaluateDocument200JSONResponse
- type EvaluateDocumentJSONRequestBody
- type EvaluateDocumentRequestObject
- type EvaluateDocumentResponseObject
- type EvaluateDocumentWildcardPolicy200JSONResponse
- type EvaluateDocumentWildcardPolicyJSONRequestBody
- type EvaluateDocumentWildcardPolicyRequestObject
- type EvaluateDocumentWildcardPolicyResponseObject
- type Input
- type Outcome
- type ServerInterface
- type ServerInterfaceWrapper
- type StrictHandlerFunc
- type StrictMiddlewareFunc
- type StrictServerInterface
- type Wrapper
- func (w Wrapper) EvaluateDocument(ctx context.Context, request EvaluateDocumentRequestObject) (EvaluateDocumentResponseObject, error)
- func (w Wrapper) EvaluateDocumentWildcardPolicy(ctx context.Context, request EvaluateDocumentWildcardPolicyRequestObject) (EvaluateDocumentWildcardPolicyResponseObject, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterHandlers ¶
func RegisterHandlers(router EchoRouter, si ServerInterface)
RegisterHandlers adds each server route to the EchoRouter.
func RegisterHandlersWithBaseURL ¶
func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)
Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.
Types ¶
type EchoRouter ¶
type EchoRouter interface {
CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}
This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration
type EvaluateDocument200JSONResponse ¶
type EvaluateDocument200JSONResponse Outcome
func (EvaluateDocument200JSONResponse) VisitEvaluateDocumentResponse ¶
func (response EvaluateDocument200JSONResponse) VisitEvaluateDocumentResponse(w http.ResponseWriter) error
type EvaluateDocumentJSONRequestBody ¶
type EvaluateDocumentJSONRequestBody = Input
EvaluateDocumentJSONRequestBody defines body for EvaluateDocument for application/json ContentType.
type EvaluateDocumentRequestObject ¶
type EvaluateDocumentRequestObject struct {
Body *EvaluateDocumentJSONRequestBody
}
type EvaluateDocumentResponseObject ¶
type EvaluateDocumentResponseObject interface {
VisitEvaluateDocumentResponse(w http.ResponseWriter) error
}
type EvaluateDocumentWildcardPolicy200JSONResponse ¶
type EvaluateDocumentWildcardPolicy200JSONResponse Outcome
func (EvaluateDocumentWildcardPolicy200JSONResponse) VisitEvaluateDocumentWildcardPolicyResponse ¶
func (response EvaluateDocumentWildcardPolicy200JSONResponse) VisitEvaluateDocumentWildcardPolicyResponse(w http.ResponseWriter) error
type EvaluateDocumentWildcardPolicyJSONRequestBody ¶
type EvaluateDocumentWildcardPolicyJSONRequestBody = Input
EvaluateDocumentWildcardPolicyJSONRequestBody defines body for EvaluateDocumentWildcardPolicy for application/json ContentType.
type EvaluateDocumentWildcardPolicyRequestObject ¶
type EvaluateDocumentWildcardPolicyRequestObject struct {
Body *EvaluateDocumentWildcardPolicyJSONRequestBody
}
type EvaluateDocumentWildcardPolicyResponseObject ¶
type EvaluateDocumentWildcardPolicyResponseObject interface {
VisitEvaluateDocumentWildcardPolicyResponse(w http.ResponseWriter) error
}
type Input ¶
type Input struct {
// Input Policy decision information. Must contain the fields in the example.
Input map[string]interface{} `json:"input"`
}
Input defines model for Input.
type Outcome ¶
type Outcome struct {
// Result The result of the OPA policy evaluation
Result map[string]interface{} `json:"result"`
}
Outcome defines model for Outcome.
type ServerInterface ¶
type ServerInterface interface {
// calls https://www.openpolicyagent.org/docs/latest/rest-api/#get-a-document-with-input internally
// (POST /v1/data)
EvaluateDocument(ctx echo.Context) error
// calls https://www.openpolicyagent.org/docs/latest/rest-api/#get-a-document-with-input internally
// (POST /v1/data/*)
EvaluateDocumentWildcardPolicy(ctx echo.Context) error
}
ServerInterface represents all server handlers.
func NewStrictHandler ¶
func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
ServerInterfaceWrapper converts echo contexts to parameters.
func (*ServerInterfaceWrapper) EvaluateDocument ¶
func (w *ServerInterfaceWrapper) EvaluateDocument(ctx echo.Context) error
EvaluateDocument converts echo context to params.
func (*ServerInterfaceWrapper) EvaluateDocumentWildcardPolicy ¶
func (w *ServerInterfaceWrapper) EvaluateDocumentWildcardPolicy(ctx echo.Context) error
EvaluateDocumentWildcardPolicy converts echo context to params.
type StrictHandlerFunc ¶
type StrictHandlerFunc = strictecho.StrictEchoHandlerFunc
type StrictMiddlewareFunc ¶
type StrictMiddlewareFunc = strictecho.StrictEchoMiddlewareFunc
type StrictServerInterface ¶
type StrictServerInterface interface {
// calls https://www.openpolicyagent.org/docs/latest/rest-api/#get-a-document-with-input internally
// (POST /v1/data)
EvaluateDocument(ctx context.Context, request EvaluateDocumentRequestObject) (EvaluateDocumentResponseObject, error)
// calls https://www.openpolicyagent.org/docs/latest/rest-api/#get-a-document-with-input internally
// (POST /v1/data/*)
EvaluateDocumentWildcardPolicy(ctx context.Context, request EvaluateDocumentWildcardPolicyRequestObject) (EvaluateDocumentWildcardPolicyResponseObject, error)
}
StrictServerInterface represents all server handlers.
type Wrapper ¶
type Wrapper struct {
DecisionMaker policy.DecisionMaker
}
func (Wrapper) EvaluateDocument ¶
func (w Wrapper) EvaluateDocument(ctx context.Context, request EvaluateDocumentRequestObject) (EvaluateDocumentResponseObject, error)
func (Wrapper) EvaluateDocumentWildcardPolicy ¶
func (w Wrapper) EvaluateDocumentWildcardPolicy(ctx context.Context, request EvaluateDocumentWildcardPolicyRequestObject) (EvaluateDocumentWildcardPolicyResponseObject, error)