Documentation ¶
Index ¶
- Constants
- Variables
- 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) ToURLQuery() url.Values
- func (r *InternalRelationTuple) UnmarshalJSON(raw []byte) error
- type Manager
- type ManagerProvider
- type ManagerWrapper
- 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
- 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) MarshalJSON() ([]byte, error)
- func (s *SubjectSet) String() string
- 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 = errors.New("malformed string input") ErrNilSubject = errors.New("subject is nil") )
Functions ¶
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 of the Relation Tuple // // in: query // required: true Namespace string `json:"namespace"` // Object of the Relation Tuple // // in: query // required: true Object string `json:"object"` // Relation of the Relation Tuple // // in: query // required: true Relation string `json:"relation"` // Subject of the Relation Tuple // // The subject follows the subject string encoding format. // // in: query // required: true Subject Subject `json:"subject"` }
swagger:parameters getCheck deleteRelationTuple
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) ToURLQuery ¶
func (r *InternalRelationTuple) ToURLQuery() url.Values
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 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) 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 { // required: true Namespace string `json:"namespace"` Object string `json:"object"` Relation string `json:"relation"` Subject Subject `json:"subject"` }
func (*RelationQuery) FromProto ¶
func (q *RelationQuery) FromProto(query *acl.ListRelationTuplesRequest_Query) (*RelationQuery, error)
func (*RelationQuery) FromURLQuery ¶
func (q *RelationQuery) FromURLQuery(query url.Values) (*RelationQuery, error)
func (*RelationQuery) String ¶
func (q *RelationQuery) String() string
func (*RelationQuery) ToURLQuery ¶
func (q *RelationQuery) ToURLQuery() url.Values
type Subject ¶
type Subject interface { // swagger:ignore json.Marshaler // swagger:ignore String() string // swagger:ignore FromString(string) (Subject, error) // swagger:ignore Equals(interface{}) bool // swagger:ignore ToProto() *acl.Subject }
swagger:model subject
func SubjectFromString ¶
type SubjectSet ¶
type SubjectSet struct { // Namespace of the Relation Tuple // // in: query // required: true Namespace string `json:"namespace"` // Object of the Relation Tuple // // in: query // required: true Object string `json:"object"` // Relation of the Relation Tuple // // in: query // 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) MarshalJSON ¶
func (s SubjectSet) MarshalJSON() ([]byte, error)
func (*SubjectSet) String ¶
func (s *SubjectSet) String() string
func (*SubjectSet) ToURLQuery ¶
func (s *SubjectSet) ToURLQuery() url.Values
Click to show internal directories.
Click to hide internal directories.