Documentation
¶
Index ¶
- Constants
- Variables
- func IsolationTest(t *testing.T, m0, m1 Manager, ...)
- func ManagerTest(t *testing.T, m Manager, ...)
- func NewHandler(d handlerDeps) *handler
- type GetResponse
- type InternalRelationTuple
- func (r *InternalRelationTuple) Columns() []string
- func (r *InternalRelationTuple) DeriveSubject() *SubjectSet
- func (r *InternalRelationTuple) FromDataProvider(d TupleData) (*InternalRelationTuple, error)
- func (r *InternalRelationTuple) FromString(s string) (*InternalRelationTuple, error)
- func (r *InternalRelationTuple) FromURLQuery(query url.Values) (*InternalRelationTuple, error)
- func (r *InternalRelationTuple) Header() []string
- func (r *InternalRelationTuple) Interface() interface{}
- func (r *InternalRelationTuple) MarshalJSON() ([]byte, error)
- func (r *InternalRelationTuple) String() string
- func (r *InternalRelationTuple) ToLoggerFields() logrus.Fields
- func (r *InternalRelationTuple) ToProto() *acl.RelationTuple
- func (r *InternalRelationTuple) ToQuery() *RelationQuery
- func (r *InternalRelationTuple) ToURLQuery() (url.Values, error)
- func (r *InternalRelationTuple) UnmarshalJSON(raw []byte) error
- type Manager
- type ManagerProvider
- type ManagerWrapper
- func (t *ManagerWrapper) DeleteAllRelationTuples(ctx context.Context, query *RelationQuery) error
- func (t *ManagerWrapper) DeleteRelationTuples(ctx context.Context, rs ...*InternalRelationTuple) error
- func (t *ManagerWrapper) GetRelationTuples(ctx context.Context, query *RelationQuery, options ...x.PaginationOptionSetter) ([]*InternalRelationTuple, string, error)
- func (t *ManagerWrapper) RelationTupleManager() Manager
- func (t *ManagerWrapper) TransactRelationTuples(ctx context.Context, insert []*InternalRelationTuple, ...) error
- func (t *ManagerWrapper) WriteRelationTuples(ctx context.Context, rs ...*InternalRelationTuple) error
- type PatchDelta
- type RelationCollection
- func (r *RelationCollection) Header() []string
- func (r *RelationCollection) IDs() []string
- func (r *RelationCollection) Interface() interface{}
- func (r *RelationCollection) Len() int
- func (r *RelationCollection) MarshalJSON() ([]byte, error)
- func (r *RelationCollection) Table() [][]string
- func (r *RelationCollection) ToInternal() ([]*InternalRelationTuple, error)
- func (r *RelationCollection) UnmarshalJSON(raw []byte) error
- type RelationQuery
- type Subject
- type SubjectID
- func (s *SubjectID) Equals(v interface{}) bool
- func (s *SubjectID) FromString(str string) (Subject, error)
- func (s SubjectID) MarshalJSON() ([]byte, error)
- func (s *SubjectID) String() string
- func (s *SubjectID) SubjectID() *string
- func (s *SubjectID) SubjectSet() *SubjectSet
- func (s *SubjectID) ToProto() *acl.Subject
- type SubjectSet
- func (s *SubjectSet) Equals(v interface{}) bool
- func (s *SubjectSet) FromString(str string) (Subject, error)
- func (s *SubjectSet) FromURLQuery(values url.Values) *SubjectSet
- func (s *SubjectSet) String() string
- func (s *SubjectSet) SubjectID() *string
- func (s *SubjectSet) SubjectSet() *SubjectSet
- func (s *SubjectSet) ToProto() *acl.Subject
- func (s *SubjectSet) ToURLQuery() url.Values
- type TupleData
Constants ¶
View Source
const ( ActionInsert patchAction = "insert" ActionDelete patchAction = "delete" )
View Source
const (
RouteBase = "/relation-tuples"
)
Variables ¶
View Source
var ( ErrMalformedInput = herodot.ErrBadRequest.WithError("malformed string input") ErrNilSubject = herodot.ErrBadRequest.WithError("subject is not allowed to be nil") ErrDuplicateSubject = herodot.ErrBadRequest.WithError("exactly one of subject_set or subject_id has to be provided") ErrDroppedSubjectKey = herodot.ErrBadRequest.WithDebug(`provide "subject_id" or "subject_set.*"; support for "subject" was dropped`) ErrIncompleteSubject = herodot.ErrBadRequest.WithError(`incomplete subject, provide "subject_id" or a complete "subject_set.*"`) )
Functions ¶
func IsolationTest ¶
func ManagerTest ¶
func NewHandler ¶
func NewHandler(d handlerDeps) *handler
Types ¶
type GetResponse ¶
type GetResponse struct {
RelationTuples []*InternalRelationTuple `json:"relation_tuples"`
// The opaque token to provide in a subsequent request
// to get the next page. It is the empty string iff this is
// the last page.
NextPageToken string `json:"next_page_token"`
}
swagger:model getRelationTuplesResponse
type InternalRelationTuple ¶
type InternalRelationTuple struct {
Namespace string `json:"namespace"`
Object string `json:"object"`
Relation string `json:"relation"`
Subject Subject `json:"subject"`
}
swagger:ignore
func (*InternalRelationTuple) Columns ¶
func (r *InternalRelationTuple) Columns() []string
func (*InternalRelationTuple) DeriveSubject ¶
func (r *InternalRelationTuple) DeriveSubject() *SubjectSet
func (*InternalRelationTuple) FromDataProvider ¶
func (r *InternalRelationTuple) FromDataProvider(d TupleData) (*InternalRelationTuple, error)
func (*InternalRelationTuple) FromString ¶
func (r *InternalRelationTuple) FromString(s string) (*InternalRelationTuple, error)
func (*InternalRelationTuple) FromURLQuery ¶
func (r *InternalRelationTuple) FromURLQuery(query url.Values) (*InternalRelationTuple, error)
func (*InternalRelationTuple) Header ¶
func (r *InternalRelationTuple) Header() []string
func (*InternalRelationTuple) Interface ¶
func (r *InternalRelationTuple) Interface() interface{}
func (*InternalRelationTuple) MarshalJSON ¶
func (r *InternalRelationTuple) MarshalJSON() ([]byte, error)
func (*InternalRelationTuple) String ¶
func (r *InternalRelationTuple) String() string
func (*InternalRelationTuple) ToLoggerFields ¶
func (r *InternalRelationTuple) ToLoggerFields() logrus.Fields
func (*InternalRelationTuple) ToProto ¶
func (r *InternalRelationTuple) ToProto() *acl.RelationTuple
func (*InternalRelationTuple) ToQuery ¶
func (r *InternalRelationTuple) ToQuery() *RelationQuery
func (*InternalRelationTuple) ToURLQuery ¶
func (r *InternalRelationTuple) ToURLQuery() (url.Values, error)
func (*InternalRelationTuple) UnmarshalJSON ¶
func (r *InternalRelationTuple) UnmarshalJSON(raw []byte) error
type Manager ¶
type Manager interface {
GetRelationTuples(ctx context.Context, query *RelationQuery, options ...x.PaginationOptionSetter) ([]*InternalRelationTuple, string, error)
WriteRelationTuples(ctx context.Context, rs ...*InternalRelationTuple) error
DeleteRelationTuples(ctx context.Context, rs ...*InternalRelationTuple) error
DeleteAllRelationTuples(ctx context.Context, query *RelationQuery) error
TransactRelationTuples(ctx context.Context, insert []*InternalRelationTuple, delete []*InternalRelationTuple) error
}
type ManagerProvider ¶
type ManagerProvider interface {
RelationTupleManager() Manager
}
type ManagerWrapper ¶
type ManagerWrapper struct {
Reg ManagerProvider
PageOpts []x.PaginationOptionSetter
RequestedPages []string
}
func NewManagerWrapper ¶
func NewManagerWrapper(_ *testing.T, reg ManagerProvider, options ...x.PaginationOptionSetter) *ManagerWrapper
func (*ManagerWrapper) DeleteAllRelationTuples ¶
func (t *ManagerWrapper) DeleteAllRelationTuples(ctx context.Context, query *RelationQuery) error
func (*ManagerWrapper) DeleteRelationTuples ¶
func (t *ManagerWrapper) DeleteRelationTuples(ctx context.Context, rs ...*InternalRelationTuple) error
func (*ManagerWrapper) GetRelationTuples ¶
func (t *ManagerWrapper) GetRelationTuples(ctx context.Context, query *RelationQuery, options ...x.PaginationOptionSetter) ([]*InternalRelationTuple, string, error)
func (*ManagerWrapper) RelationTupleManager ¶
func (t *ManagerWrapper) RelationTupleManager() Manager
func (*ManagerWrapper) TransactRelationTuples ¶
func (t *ManagerWrapper) TransactRelationTuples(ctx context.Context, insert []*InternalRelationTuple, delete []*InternalRelationTuple) error
func (*ManagerWrapper) WriteRelationTuples ¶
func (t *ManagerWrapper) WriteRelationTuples(ctx context.Context, rs ...*InternalRelationTuple) error
type PatchDelta ¶
type PatchDelta struct {
Action patchAction `json:"action"`
RelationTuple *InternalRelationTuple `json:"relation_tuple"`
}
type RelationCollection ¶
type RelationCollection struct {
// contains filtered or unexported fields
}
func NewProtoRelationCollection ¶
func NewProtoRelationCollection(rels []*acl.RelationTuple) *RelationCollection
func NewRelationCollection ¶
func NewRelationCollection(rels []*InternalRelationTuple) *RelationCollection
func (*RelationCollection) Header ¶
func (r *RelationCollection) Header() []string
func (*RelationCollection) IDs ¶
func (r *RelationCollection) IDs() []string
func (*RelationCollection) Interface ¶
func (r *RelationCollection) Interface() interface{}
func (*RelationCollection) Len ¶
func (r *RelationCollection) Len() int
func (*RelationCollection) MarshalJSON ¶
func (r *RelationCollection) MarshalJSON() ([]byte, error)
func (*RelationCollection) Table ¶
func (r *RelationCollection) Table() [][]string
func (*RelationCollection) ToInternal ¶
func (r *RelationCollection) ToInternal() ([]*InternalRelationTuple, error)
func (*RelationCollection) UnmarshalJSON ¶
func (r *RelationCollection) UnmarshalJSON(raw []byte) error
type RelationQuery ¶
type RelationQuery struct {
// Namespace of the Relation Tuple
Namespace string `json:"namespace"`
// Object of the Relation Tuple
Object string `json:"object"`
// Relation of the Relation Tuple
Relation string `json:"relation"`
// SubjectID of the Relation Tuple
//
// Either SubjectSet or SubjectID can be provided.
SubjectID *string `json:"subject_id,omitempty"`
// SubjectSet of the Relation Tuple
//
// Either SubjectSet or SubjectID can be provided.
//
// swagger:allOf
SubjectSet *SubjectSet `json:"subject_set,omitempty"`
}
func (*RelationQuery) FromProto ¶
func (q *RelationQuery) FromProto(query TupleData) (*RelationQuery, error)
func (*RelationQuery) FromURLQuery ¶
func (q *RelationQuery) FromURLQuery(query url.Values) (*RelationQuery, error)
func (*RelationQuery) String ¶
func (q *RelationQuery) String() string
func (*RelationQuery) Subject ¶
func (q *RelationQuery) Subject() Subject
func (*RelationQuery) ToURLQuery ¶
func (q *RelationQuery) ToURLQuery() url.Values
type Subject ¶
type Subject interface {
// swagger:ignore
String() string
// swagger:ignore
FromString(string) (Subject, error)
// swagger:ignore
Equals(interface{}) bool
// swagger:ignore
SubjectID() *string
// swagger:ignore
SubjectSet() *SubjectSet
// swagger:ignore
ToProto() *acl.Subject
}
swagger:model subject
func SubjectFromString ¶
type SubjectID ¶
type SubjectID struct {
ID string `json:"id"`
}
func (SubjectID) MarshalJSON ¶
func (*SubjectID) SubjectSet ¶
func (s *SubjectID) SubjectSet() *SubjectSet
type SubjectSet ¶
type SubjectSet struct {
// Namespace of the Subject Set
//
// required: true
Namespace string `json:"namespace"`
// Object of the Subject Set
//
// required: true
Object string `json:"object"`
// Relation of the Subject Set
//
// required: true
Relation string `json:"relation"`
}
swagger:parameters getExpand
func (*SubjectSet) Equals ¶
func (s *SubjectSet) Equals(v interface{}) bool
func (*SubjectSet) FromString ¶
func (s *SubjectSet) FromString(str string) (Subject, error)
func (*SubjectSet) FromURLQuery ¶
func (s *SubjectSet) FromURLQuery(values url.Values) *SubjectSet
func (*SubjectSet) String ¶
func (s *SubjectSet) String() string
func (*SubjectSet) SubjectID ¶
func (s *SubjectSet) SubjectID() *string
func (*SubjectSet) SubjectSet ¶
func (s *SubjectSet) SubjectSet() *SubjectSet
func (*SubjectSet) ToURLQuery ¶
func (s *SubjectSet) ToURLQuery() url.Values
Click to show internal directories.
Click to hide internal directories.