ketoapi

package
v0.9.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubjectIDKey           = "subject_id"
	SubjectSetNamespaceKey = "subject_set.namespace"
	SubjectSetObjectKey    = "subject_set.object"
	SubjectSetRelationKey  = "subject_set.relation"
)

Variables

View Source
var (
	ErrDroppedSubjectKey = herodot.ErrBadRequest.WithDebug(`provide "subject_id" or "subject_set.*"; support for "subject" was dropped`)
	ErrDuplicateSubject  = herodot.ErrBadRequest.WithError("exactly one of subject_set or subject_id has to be provided")
	ErrIncompleteSubject = herodot.ErrBadRequest.WithError(`incomplete subject, provide "subject_id" or a complete "subject_set.*"`)
	ErrNilSubject        = herodot.ErrBadRequest.WithError("subject is not allowed to be nil").WithDebug("Please provide a subject.")
	ErrIncompleteTuple   = herodot.ErrBadRequest.WithError(`incomplete tuple, provide "namespace", "object", "relation", and a subject`)
	ErrUnknownNodeType   = errors.New("unknown node type")
)
View Source
var ErrMalformedInput = herodot.ErrBadRequest.WithError("malformed string input")

Functions

This section is empty.

Types

type ExpandNodeType

type ExpandNodeType string

swagger:enum ExpandNodeType

const (
	ExpandNodeUnion        ExpandNodeType = "union"
	ExpandNodeExclusion    ExpandNodeType = "exclusion"
	ExpandNodeIntersection ExpandNodeType = "intersection"
	ExpandNodeLeaf         ExpandNodeType = "leaf"
	ExpandNodeUnspecified  ExpandNodeType = "unspecified"
)

func (ExpandNodeType) FromProto

func (ExpandNodeType) FromProto(pt rts.NodeType) ExpandNodeType

func (ExpandNodeType) String

func (t ExpandNodeType) String() string

func (ExpandNodeType) ToProto

func (t ExpandNodeType) ToProto() rts.NodeType

func (*ExpandNodeType) UnmarshalJSON

func (t *ExpandNodeType) UnmarshalJSON(v []byte) error

type ExpandTree

type ExpandTree struct {
	// The type of the node.
	//
	// required: true
	Type ExpandNodeType `json:"type"`
	// The children of the node, possibly none.
	Children []*ExpandTree `json:"children,omitempty"`
	// The subject set the node represents. Either this field, or SubjectID are set.
	SubjectSet *SubjectSet `json:"subject_set,omitempty"`
	// The subject ID the node represents. Either this field, or SubjectSet are set.
	SubjectID *string `json:"subject_id,omitempty"`
}

swagger:model expandTree

func (*ExpandTree) FromProto

func (t *ExpandTree) FromProto(pt *rts.SubjectTree) *ExpandTree

func (*ExpandTree) String

func (t *ExpandTree) String() string

func (*ExpandTree) ToProto

func (t *ExpandTree) ToProto() *rts.SubjectTree

type GetResponse

type GetResponse struct {
	RelationTuples []*RelationTuple `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 PatchAction

type PatchAction string

swagger:enum PatchAction

const (
	ActionInsert PatchAction = "insert"
	ActionDelete PatchAction = "delete"
)

type PatchDelta

type PatchDelta struct {
	Action        PatchAction    `json:"action"`
	RelationTuple *RelationTuple `json:"relation_tuple"`
}

swagger:model patchDelta

type RelationQuery

type RelationQuery struct {
	// Namespace to query
	Namespace *string `json:"namespace"`

	// Object to query
	Object *string `json:"object"`

	// Relation to query
	Relation *string `json:"relation"`

	// SubjectID to query
	//
	// Either SubjectSet or SubjectID can be provided.
	SubjectID *string `json:"subject_id,omitempty"`
	// SubjectSet to query
	//
	// Either SubjectSet or SubjectID can be provided.
	//
	// swagger:allOf
	SubjectSet *SubjectSet `json:"subject_set,omitempty"`
}

swagger:model relationQuery

func (*RelationQuery) FromDataProvider

func (q *RelationQuery) FromDataProvider(d queryData) *RelationQuery

func (*RelationQuery) FromURLQuery

func (q *RelationQuery) FromURLQuery(query url.Values) (*RelationQuery, error)

func (*RelationQuery) ToProto

func (q *RelationQuery) ToProto() *rts.RelationQuery

func (*RelationQuery) ToURLQuery

func (q *RelationQuery) ToURLQuery() url.Values

type RelationTuple

type RelationTuple struct {
	// Namespace of the Relation Tuple
	//
	// required: true
	Namespace string `json:"namespace"`

	// Object of the Relation Tuple
	//
	// required: true
	Object string `json:"object"`

	// Relation of the Relation Tuple
	//
	// required: true
	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"`
}

swagger:model relationTuple

func (*RelationTuple) Columns

func (r *RelationTuple) Columns() []string

func (*RelationTuple) FromDataProvider

func (r *RelationTuple) FromDataProvider(d TupleData) (*RelationTuple, error)

func (*RelationTuple) FromString

func (r *RelationTuple) FromString(s string) (*RelationTuple, error)

func (*RelationTuple) FromURLQuery

func (r *RelationTuple) FromURLQuery(query url.Values) (*RelationTuple, error)

func (*RelationTuple) Header

func (r *RelationTuple) Header() []string

func (*RelationTuple) Interface

func (r *RelationTuple) Interface() interface{}

func (*RelationTuple) String

func (r *RelationTuple) String() string

func (*RelationTuple) ToLoggerFields

func (r *RelationTuple) ToLoggerFields() logrus.Fields

func (*RelationTuple) ToProto

func (r *RelationTuple) ToProto() *rts.RelationTuple

func (*RelationTuple) ToURLQuery

func (r *RelationTuple) ToURLQuery() url.Values

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:model subjectSet

func (*SubjectSet) FromString

func (s *SubjectSet) FromString(str string) (*SubjectSet, error)

func (*SubjectSet) FromURLQuery

func (s *SubjectSet) FromURLQuery(values url.Values) *SubjectSet

func (*SubjectSet) String

func (s *SubjectSet) String() string

func (*SubjectSet) ToURLQuery

func (s *SubjectSet) ToURLQuery() url.Values

type TupleData

type TupleData interface {
	GetSubject() *rts.Subject
	GetObject() string
	GetNamespace() string
	GetRelation() string
}

Jump to

Keyboard shortcuts

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