handlers

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2021 License: MPL-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HttpOnlyCookieName  = "wt-http-token-cookie"
	JsVisibleCookieName = "wt-js-token-cookie"
)

Variables

This section is empty.

Functions

func ApiErrorWithCode

func ApiErrorWithCode(c codes.Code) error

ApiErrorWithCode returns an api error with the provided code.

func ApiErrorWithCodeAndMessage

func ApiErrorWithCodeAndMessage(c codes.Code, msg string, args ...interface{}) error

ApiErrorWithCodeAndMessage returns an api error with the provided code and message.

func ErrorHandler

func ErrorHandler(logger hclog.Logger) runtime.ErrorHandlerFunc

func ForbiddenError

func ForbiddenError() error

func InvalidArgumentErrorf

func InvalidArgumentErrorf(msg string, fields map[string]string) error

func MaskContains

func MaskContains(paths []string, s string) bool

func NotFoundError

func NotFoundError() error

NotFoundError returns an ApiError indicating a resource couldn't be found.

func NotFoundErrorf

func NotFoundErrorf(msg string, a ...interface{}) error

NotFoundErrorf returns an ApiError indicating a resource couldn't be found.

func OutgoingInterceptor

func OutgoingInterceptor(ctx context.Context, w http.ResponseWriter, m proto.Message) error

func ProtoToStruct

func ProtoToStruct(p proto.Message) (*structpb.Struct, error)

func StructToProto

func StructToProto(fields *structpb.Struct, p proto.Message) error

func UnauthenticatedError

func UnauthenticatedError() error

func ValidId

func ValidId(prefix, id string) bool

func ValidNameDescription added in v0.1.1

func ValidNameDescription(in string) bool

func ValidateCreateRequest

func ValidateCreateRequest(i ApiResource, fn CustomValidatorFunc) error

func ValidateDeleteRequest

func ValidateDeleteRequest(prefix string, r DeleteRequest, fn CustomValidatorFunc) error

func ValidateGetRequest

func ValidateGetRequest(prefix string, r GetRequest, fn CustomValidatorFunc) error

func ValidateUpdateRequest

func ValidateUpdateRequest(prefix string, r UpdateRequest, i ApiResource, fn CustomValidatorFunc) error

Types

type ApiResource

type ApiResource interface {
	GetId() string
	GetScope() *scopes.ScopeInfo
	GetName() *wrappers.StringValue
	GetDescription() *wrappers.StringValue
	GetCreatedTime() *timestamp.Timestamp
	GetUpdatedTime() *timestamp.Timestamp
	GetVersion() uint32
}

type CustomValidatorFunc

type CustomValidatorFunc func() map[string]string
var NoopValidatorFn CustomValidatorFunc = func() map[string]string { return nil }

type DeleteRequest

type DeleteRequest interface {
	GetId() string
}

type GetRequest

type GetRequest interface {
	GetId() string
}

type MaskManager

type MaskManager map[string]string

func NewMaskManager

func NewMaskManager(dest protoreflect.ProtoMessage, src ...protoreflect.ProtoMessage) (MaskManager, error)

NewMaskManager returns a mask manager that can translate field masks into the first proto from all subsequent protos assuming they are both using the mask_mapping custom option. Error is returned if no mappings are found or if one of the passed protos has a mapping that doesn't reciprocate.

func (MaskManager) Translate

func (m MaskManager) Translate(paths []string) []string

Translate takes a field mask's paths and returns paths translated for the destination's protobuf.

type UpdateRequest

type UpdateRequest interface {
	GetId() string
	GetUpdateMask() *field_mask.FieldMask
}

Jump to

Keyboard shortcuts

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