Documentation
¶
Index ¶
- Constants
- func ApiErrorWithCode(c codes.Code) error
- func ApiErrorWithCodeAndMessage(c codes.Code, msg string, args ...interface{}) error
- func ErrorHandler() runtime.ErrorHandlerFunc
- func ForbiddenError() error
- func GetOpts(opt ...Option) options
- func InvalidArgumentErrorf(msg string, fields map[string]string) *apiError
- func JSONMarshaler() *runtime.JSONPb
- func MaskContains(paths []string, s string) bool
- func NotFoundError() error
- func NotFoundErrorf(msg string, a ...interface{}) *apiError
- func OutgoingInterceptor(ctx context.Context, w http.ResponseWriter, m proto.Message) error
- func ProtoToStruct(p proto.Message) (*structpb.Struct, error)
- func StructToProto(fields *structpb.Struct, p proto.Message, opt ...Option) error
- func ToApiError(e error) *pb.Error
- func UnauthenticatedError() error
- func ValidId(i Id, prefixes ...string) bool
- func ValidNameDescription(in string) bool
- func ValidateCreateRequest(i ApiResource, fn CustomValidatorFunc) error
- func ValidateDeleteRequest(fn CustomValidatorFunc, r DeleteRequest, prefix ...string) error
- func ValidateGetRequest(fn CustomValidatorFunc, r GetRequest, prefix ...string) error
- func ValidateUpdateRequest(r UpdateRequest, i ApiResource, fn CustomValidatorFunc, prefix ...string) error
- type ApiResource
- type CustomValidatorFunc
- type DeleteRequest
- type Filter
- type GetRequest
- type Id
- type MaskDestination
- type MaskManager
- type MaskSource
- type Option
- func WithAuthorizedActions(acts []string) Option
- func WithAuthorizedCollectionActions(colActs map[string]*structpb.ListValue) Option
- func WithDiscardUnknownFields(discard bool) Option
- func WithManagedGroupIds(ids []string) Option
- func WithMemberIds(ids []string) Option
- func WithOutputFields(fields *perms.OutputFieldsMap) Option
- func WithScope(scp *scopes.ScopeInfo) Option
- func WithUserIsAnonymous(anonListing bool) Option
- type UpdateRequest
Constants ¶
const ( HttpOnlyCookieName = "wt-http-token-cookie" JsVisibleCookieName = "wt-js-token-cookie" )
Variables ¶
This section is empty.
Functions ¶
func ApiErrorWithCode ¶
ApiErrorWithCode returns an api error with the provided code.
func ApiErrorWithCodeAndMessage ¶
ApiErrorWithCodeAndMessage returns an api error with the provided code and message.
func ErrorHandler ¶
func ErrorHandler() runtime.ErrorHandlerFunc
func ForbiddenError ¶
func ForbiddenError() error
func GetOpts ¶ added in v0.2.0
func GetOpts(opt ...Option) options
GetOpts - iterate the inbound Options and return a struct
func InvalidArgumentErrorf ¶
func JSONMarshaler ¶ added in v0.2.1
JSONMarshaler provides marshaler used for marshaling all proto as JSON in a format expected by the user facing controller API.
func MaskContains ¶
func NotFoundError ¶
func NotFoundError() error
NotFoundError returns an ApiError indicating a resource couldn't be found.
func NotFoundErrorf ¶
func NotFoundErrorf(msg string, a ...interface{}) *apiError
NotFoundErrorf returns an ApiError indicating a resource couldn't be found.
func OutgoingInterceptor ¶
func StructToProto ¶
func ToApiError ¶ added in v0.2.1
func UnauthenticatedError ¶
func UnauthenticatedError() error
func ValidNameDescription ¶ added in v0.1.1
func ValidateCreateRequest ¶
func ValidateCreateRequest(i ApiResource, fn CustomValidatorFunc) error
func ValidateDeleteRequest ¶
func ValidateDeleteRequest(fn CustomValidatorFunc, r DeleteRequest, prefix ...string) error
func ValidateGetRequest ¶
func ValidateGetRequest(fn CustomValidatorFunc, r GetRequest, prefix ...string) error
func ValidateUpdateRequest ¶
func ValidateUpdateRequest(r UpdateRequest, i ApiResource, fn CustomValidatorFunc, prefix ...string) error
Types ¶
type ApiResource ¶
type CustomValidatorFunc ¶
var NoopValidatorFn CustomValidatorFunc = func() map[string]string { return nil }
type DeleteRequest ¶
type DeleteRequest interface {
GetId() string
}
type Filter ¶ added in v0.1.8
type Filter struct {
// contains filtered or unexported fields
}
func NewFilter ¶ added in v0.1.8
NewFilter returns a Filter which can be evluated against. An empty string paramter indicates all items passed to it should succeed.
func (*Filter) Match ¶ added in v0.1.8
Match returns if the provided interface matches the filter. If the filter does not match the structure of the object being Matched, false is returned. TODO: Support more than just matching against the item being filtered. Also allow matching against
values in the request or the request context itself.
type GetRequest ¶
type GetRequest interface {
GetId() string
}
type MaskDestination ¶ added in v0.4.0
type MaskDestination []protoreflect.ProtoMessage
type MaskManager ¶
func NewMaskManager ¶
func NewMaskManager(dest MaskDestination, src MaskSource) (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 MaskSource ¶ added in v0.4.0
type MaskSource []protoreflect.ProtoMessage
type Option ¶ added in v0.2.0
type Option func(*options)
Option - how Options are passed as arguments. Some of these are used for types within the handlers package, and some are for handlers to re-use across the various handler types.
func WithAuthorizedActions ¶ added in v0.2.1
WithAuthorizedActions provides an option when creating responses to include the given authorized actions if allowed
func WithAuthorizedCollectionActions ¶ added in v0.2.1
WithAuthorizedCollectionActions provides an option when creating responses to include the given authorized collection actions if allowed
func WithDiscardUnknownFields ¶ added in v0.2.0
WithDiscardUnknownFields provides an option to cause StructToProto to ignore unknown fields. This is useful in some instances when we need to unmarshal a value from a pb.Struct after we've added some custom extra fields.
func WithManagedGroupIds ¶ added in v0.3.0
WithManagedGroupIds provides an option when creating responses to include the given managed group IDs if allowed
func WithMemberIds ¶ added in v0.3.0
WithMemberIds provides an option when creating responses to include the given member IDs if allowed
func WithOutputFields ¶ added in v0.2.1
func WithOutputFields(fields *perms.OutputFieldsMap) Option
WithOutputFields provides an option when creating responses to only include specific fields
func WithScope ¶ added in v0.2.1
WithScope provides an option when creating responses to include the given scope if allowed
func WithUserIsAnonymous ¶ added in v0.2.1
DEPRECATED: Superceded by WithOutputFields. Will be removed once all handlers have been migrated to that.
type UpdateRequest ¶
type UpdateRequest interface { GetId() string GetUpdateMask() *field_mask.FieldMask }