aipmiddleware

package
v0.52.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ParentValidator

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

ParentValidator validates that response resources are children of requested parent resources.

func NewParentValidator

func NewParentValidator(config ParentValidatorConfig) *ParentValidator

NewParentValidator creates a new parent validator middleware.

func (*ParentValidator) UnaryServerInterceptor

func (p *ParentValidator) UnaryServerInterceptor(
	ctx context.Context,
	request interface{},
	info *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler,
) (interface{}, error)

UnaryServerInterceptor implements grpc.UnaryServerInterceptor.

type ParentValidatorConfig

type ParentValidatorConfig struct {
	// ErrorLogHook is called when parent validation fails, with the failing request/response, parent/name combination.
	ErrorLogHook func(info *grpc.UnaryServerInfo, request, response proto.Message, parent, name string)
	// LogOnly configures the middleware to only log violations and not return errors.
	LogOnly bool
}

ParentValidatorConfig configures the ParentValidator middleware.

Jump to

Keyboard shortcuts

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