server

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0, BSD-3-Clause, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeEvaluateRequest

func DecodeEvaluateRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeEvaluateRequest returns a decoder for requests sent to the policy Evaluate endpoint.

func DecodeLockRequest

func DecodeLockRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeLockRequest returns a decoder for requests sent to the policy Lock endpoint.

func DecodeUnlockRequest

func DecodeUnlockRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeUnlockRequest returns a decoder for requests sent to the policy Unlock endpoint.

func EncodeEvaluateResponse

func EncodeEvaluateResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeEvaluateResponse returns an encoder for responses returned by the policy Evaluate endpoint.

func EncodeLockResponse

func EncodeLockResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeLockResponse returns an encoder for responses returned by the policy Lock endpoint.

func EncodeUnlockResponse

func EncodeUnlockResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeUnlockResponse returns an encoder for responses returned by the policy Unlock endpoint.

func EvaluatePolicyPath

func EvaluatePolicyPath(group string, policyName string, version string) string

EvaluatePolicyPath returns the URL path to the policy service Evaluate HTTP endpoint.

func EvaluatePolicyPath2

func EvaluatePolicyPath2(group string, policyName string, version string) string

EvaluatePolicyPath2 returns the URL path to the policy service Evaluate HTTP endpoint.

func EvaluatePolicyPath3

func EvaluatePolicyPath3(group string, policyName string, version string) string

EvaluatePolicyPath3 returns the URL path to the policy service Evaluate HTTP endpoint.

func LockPolicyPath

func LockPolicyPath(group string, policyName string, version string) string

LockPolicyPath returns the URL path to the policy service Lock HTTP endpoint.

func Mount

func Mount(mux goahttp.Muxer, h *Server)

Mount configures the mux to serve the policy endpoints.

func MountEvaluateHandler

func MountEvaluateHandler(mux goahttp.Muxer, h http.Handler)

MountEvaluateHandler configures the mux to serve the "policy" service "Evaluate" endpoint.

func MountLockHandler

func MountLockHandler(mux goahttp.Muxer, h http.Handler)

MountLockHandler configures the mux to serve the "policy" service "Lock" endpoint.

func MountUnlockHandler

func MountUnlockHandler(mux goahttp.Muxer, h http.Handler)

MountUnlockHandler configures the mux to serve the "policy" service "Unlock" endpoint.

func NewEvaluateHandler

func NewEvaluateHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewEvaluateHandler creates a HTTP handler which loads the HTTP request and calls the "policy" service "Evaluate" endpoint.

func NewEvaluateRequest

func NewEvaluateRequest(body interface{}, group string, policyName string, version string, evaluationID *string, ttl *int) *policy.EvaluateRequest

NewEvaluateRequest builds a policy service Evaluate endpoint payload.

func NewLockHandler

func NewLockHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewLockHandler creates a HTTP handler which loads the HTTP request and calls the "policy" service "Lock" endpoint.

func NewLockRequest

func NewLockRequest(group string, policyName string, version string) *policy.LockRequest

NewLockRequest builds a policy service Lock endpoint payload.

func NewUnlockHandler

func NewUnlockHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewUnlockHandler creates a HTTP handler which loads the HTTP request and calls the "policy" service "Unlock" endpoint.

func NewUnlockRequest

func NewUnlockRequest(group string, policyName string, version string) *policy.UnlockRequest

NewUnlockRequest builds a policy service Unlock endpoint payload.

func UnlockPolicyPath

func UnlockPolicyPath(group string, policyName string, version string) string

UnlockPolicyPath returns the URL path to the policy service Unlock HTTP endpoint.

Types

type ErrorNamer

type ErrorNamer interface {
	ErrorName() string
}

ErrorNamer is an interface implemented by generated error structs that exposes the name of the error as defined in the design.

type MountPoint

type MountPoint struct {
	// Method is the name of the service method served by the mounted HTTP handler.
	Method string
	// Verb is the HTTP method used to match requests to the mounted handler.
	Verb string
	// Pattern is the HTTP request path pattern used to match requests to the
	// mounted handler.
	Pattern string
}

MountPoint holds information about the mounted endpoints.

type Server

type Server struct {
	Mounts   []*MountPoint
	Evaluate http.Handler
	Lock     http.Handler
	Unlock   http.Handler
}

Server lists the policy service endpoint HTTP handlers.

func New

func New(
	e *policy.Endpoints,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) *Server

New instantiates HTTP handlers for all the policy service endpoints using the provided encoder and decoder. The handlers are mounted on the given mux using the HTTP verb and path defined in the design. errhandler is called whenever a response fails to be encoded. formatter is used to format errors returned by the service methods prior to encoding. Both errhandler and formatter are optional and can be nil.

func (*Server) Mount

func (s *Server) Mount(mux goahttp.Muxer)

Mount configures the mux to serve the policy endpoints.

func (*Server) Service

func (s *Server) Service() string

Service returns the name of the service served.

func (*Server) Use

func (s *Server) Use(m func(http.Handler) http.Handler)

Use wraps the server handlers with the given middleware.

Jump to

Keyboard shortcuts

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