Documentation
¶
Index ¶
- Constants
- type CheckQuery
- type ConnectedObjectsCommand
- type ConnectedObjectsRequest
- type CreateStoreCommand
- type DeleteStoreCommand
- type ExpandQuery
- type GetStoreQuery
- type ListObjectsQuery
- type ListStoresQuery
- type ReadAssertionsQuery
- type ReadAuthorizationModelQuery
- type ReadAuthorizationModelsQuery
- type ReadChangesQuery
- type ReadQuery
- type WriteAssertionsCommand
- type WriteAuthorizationModelCommand
- type WriteCommand
Constants ¶
const (
IndirectWriteErrorReason = "Attempting to write directly to an indirect only relationship"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckQuery ¶ added in v0.1.1
type CheckQuery struct {
// contains filtered or unexported fields
}
A CheckQuery can be used to Check if a User has a Relation to an Object CheckQuery instances may be safely shared by multiple go-routines
func NewCheckQuery ¶ added in v0.1.1
func NewCheckQuery(datastore storage.OpenFGADatastore, t trace.Tracer, m metric.Meter, l logger.Logger, resolveNodeLimit uint32) *CheckQuery
NewCheckQuery creates a CheckQuery with specified `tupleBackend` and `typeDefinitionReadBackend` to use for storage
func (*CheckQuery) Execute ¶ added in v0.1.1
func (q *CheckQuery) Execute(ctx context.Context, req *openfgapb.CheckRequest) (*openfgapb.CheckResponse, error)
Execute the query in `checkRequest`, returning the response or an error.
type ConnectedObjectsCommand ¶ added in v0.2.5
type ConnectedObjectsCommand struct {
Datastore storage.OpenFGADatastore
Typesystem *typesystem.TypeSystem
ResolveNodeLimit uint32
// Limit limits the results yielded by the ConnectedObjects API.
Limit uint32
}
func (*ConnectedObjectsCommand) StreamedConnectedObjects ¶ added in v0.2.5
func (c *ConnectedObjectsCommand) StreamedConnectedObjects( ctx context.Context, req *ConnectedObjectsRequest, resultChan chan<- string, ) error
StreamedConnectedObjects yields all of the objects of the provided objectType that the given user has a specific relation with. The results will be limited by the request limit. If a 0 limit is provided then all objects of the provided objectType will be returned.
type ConnectedObjectsRequest ¶ added in v0.2.5
type CreateStoreCommand ¶
type CreateStoreCommand struct {
// contains filtered or unexported fields
}
func NewCreateStoreCommand ¶
func NewCreateStoreCommand( storesBackend storage.StoresBackend, logger logger.Logger, ) *CreateStoreCommand
func (*CreateStoreCommand) Execute ¶
func (s *CreateStoreCommand) Execute(ctx context.Context, req *openfgapb.CreateStoreRequest) (*openfgapb.CreateStoreResponse, error)
type DeleteStoreCommand ¶
type DeleteStoreCommand struct {
// contains filtered or unexported fields
}
func NewDeleteStoreCommand ¶
func NewDeleteStoreCommand( storesBackend storage.StoresBackend, logger logger.Logger, ) *DeleteStoreCommand
func (*DeleteStoreCommand) Execute ¶
func (s *DeleteStoreCommand) Execute(ctx context.Context, req *openfgapb.DeleteStoreRequest) (*openfgapb.DeleteStoreResponse, error)
type ExpandQuery ¶ added in v0.1.1
type ExpandQuery struct {
// contains filtered or unexported fields
}
ExpandQuery resolves a target TupleKey into a UsersetTree by expanding type definitions.
func NewExpandQuery ¶ added in v0.1.1
func NewExpandQuery(datastore storage.OpenFGADatastore, tracer trace.Tracer, logger logger.Logger) *ExpandQuery
NewExpandQuery creates a new ExpandQuery using the supplied backends for retrieving data.
func (*ExpandQuery) Execute ¶ added in v0.1.1
func (q *ExpandQuery) Execute(ctx context.Context, req *openfgapb.ExpandRequest) (*openfgapb.ExpandResponse, error)
type GetStoreQuery ¶ added in v0.1.1
type GetStoreQuery struct {
// contains filtered or unexported fields
}
func NewGetStoreQuery ¶ added in v0.1.1
func NewGetStoreQuery(storesBackend storage.StoresBackend, logger logger.Logger) *GetStoreQuery
func (*GetStoreQuery) Execute ¶ added in v0.1.1
func (q *GetStoreQuery) Execute(ctx context.Context, req *openfgapb.GetStoreRequest) (*openfgapb.GetStoreResponse, error)
type ListObjectsQuery ¶ added in v0.2.0
type ListObjectsQuery struct {
Datastore storage.OpenFGADatastore
Logger logger.Logger
Tracer trace.Tracer
Meter metric.Meter
ListObjectsDeadline time.Duration
ListObjectsMaxResults uint32
ResolveNodeLimit uint32
ConnectedObjects func(ctx context.Context, req *ConnectedObjectsRequest, results chan<- string) error
}
func (*ListObjectsQuery) Execute ¶ added in v0.2.0
func (q *ListObjectsQuery) Execute( ctx context.Context, req *openfgapb.ListObjectsRequest, ) (*openfgapb.ListObjectsResponse, error)
Execute the ListObjectsQuery, returning a list of object IDs
func (*ListObjectsQuery) ExecuteStreamed ¶ added in v0.2.0
func (q *ListObjectsQuery) ExecuteStreamed( ctx context.Context, req *openfgapb.StreamedListObjectsRequest, srv openfgapb.OpenFGAService_StreamedListObjectsServer, ) error
type ListStoresQuery ¶ added in v0.1.1
type ListStoresQuery struct {
// contains filtered or unexported fields
}
func NewListStoresQuery ¶ added in v0.1.1
func NewListStoresQuery(storesBackend storage.StoresBackend, logger logger.Logger, encoder encoder.Encoder) *ListStoresQuery
func (*ListStoresQuery) Execute ¶ added in v0.1.1
func (q *ListStoresQuery) Execute(ctx context.Context, req *openfgapb.ListStoresRequest) (*openfgapb.ListStoresResponse, error)
type ReadAssertionsQuery ¶ added in v0.1.1
type ReadAssertionsQuery struct {
// contains filtered or unexported fields
}
func NewReadAssertionsQuery ¶ added in v0.1.1
func NewReadAssertionsQuery(backend storage.AssertionsBackend, logger logger.Logger) *ReadAssertionsQuery
func (*ReadAssertionsQuery) Execute ¶ added in v0.1.1
func (q *ReadAssertionsQuery) Execute(ctx context.Context, store, authorizationModelID string) (*openfgapb.ReadAssertionsResponse, error)
type ReadAuthorizationModelQuery ¶ added in v0.1.1
type ReadAuthorizationModelQuery struct {
// contains filtered or unexported fields
}
ReadAuthorizationModelQuery retrieves a single type definition from a storage backend.
func NewReadAuthorizationModelQuery ¶ added in v0.1.1
func NewReadAuthorizationModelQuery(backend storage.AuthorizationModelReadBackend, logger logger.Logger) *ReadAuthorizationModelQuery
func (*ReadAuthorizationModelQuery) Execute ¶ added in v0.1.1
func (q *ReadAuthorizationModelQuery) Execute(ctx context.Context, req *openfgapb.ReadAuthorizationModelRequest) (*openfgapb.ReadAuthorizationModelResponse, error)
type ReadAuthorizationModelsQuery ¶ added in v0.1.1
type ReadAuthorizationModelsQuery struct {
// contains filtered or unexported fields
}
func NewReadAuthorizationModelsQuery ¶ added in v0.1.1
func NewReadAuthorizationModelsQuery(backend storage.AuthorizationModelReadBackend, logger logger.Logger, encoder encoder.Encoder) *ReadAuthorizationModelsQuery
func (*ReadAuthorizationModelsQuery) Execute ¶ added in v0.1.1
func (q *ReadAuthorizationModelsQuery) Execute(ctx context.Context, req *openfgapb.ReadAuthorizationModelsRequest) (*openfgapb.ReadAuthorizationModelsResponse, error)
type ReadChangesQuery ¶ added in v0.1.1
type ReadChangesQuery struct {
// contains filtered or unexported fields
}
func NewReadChangesQuery ¶ added in v0.1.1
func NewReadChangesQuery(backend storage.ChangelogBackend, tracer trace.Tracer, logger logger.Logger, encoder encoder.Encoder, horizonOffset int) *ReadChangesQuery
NewReadChangesQuery creates a ReadChangesQuery with specified `ChangelogBackend` and `typeDefinitionReadBackend` to use for storage
func (*ReadChangesQuery) Execute ¶ added in v0.1.1
func (q *ReadChangesQuery) Execute(ctx context.Context, req *openfgapb.ReadChangesRequest) (*openfgapb.ReadChangesResponse, error)
Execute the ReadChangesQuery, returning paginated `openfga.TupleChange`(s) and a possibly non-empty continuation token.
type ReadQuery ¶ added in v0.1.1
type ReadQuery struct {
// contains filtered or unexported fields
}
A ReadQuery can be used to read one or many tuplesets Each tupleset specifies keys of a set of relation tuples. The set can include a single tuple key, or all tuples with a given object ID or userset in a type, optionally constrained by a relation name.
func NewReadQuery ¶ added in v0.1.1
func NewReadQuery(datastore storage.OpenFGADatastore, tracer trace.Tracer, logger logger.Logger, encoder encoder.Encoder) *ReadQuery
NewReadQuery creates a ReadQuery using the provided OpenFGA datastore implementation.
func (*ReadQuery) Execute ¶ added in v0.1.1
func (q *ReadQuery) Execute(ctx context.Context, req *openfgapb.ReadRequest) (*openfgapb.ReadResponse, error)
Execute the ReadQuery, returning paginated `openfga.Tuple`(s) that match the tuple. Return all tuples if the tuple is nil or empty.
type WriteAssertionsCommand ¶
type WriteAssertionsCommand struct {
// contains filtered or unexported fields
}
func NewWriteAssertionsCommand ¶
func NewWriteAssertionsCommand( datastore storage.OpenFGADatastore, logger logger.Logger, ) *WriteAssertionsCommand
func (*WriteAssertionsCommand) Execute ¶
func (w *WriteAssertionsCommand) Execute(ctx context.Context, req *openfgapb.WriteAssertionsRequest) (*openfgapb.WriteAssertionsResponse, error)
type WriteAuthorizationModelCommand ¶
type WriteAuthorizationModelCommand struct {
// contains filtered or unexported fields
}
WriteAuthorizationModelCommand performs updates of the store authorization model.
func NewWriteAuthorizationModelCommand ¶
func NewWriteAuthorizationModelCommand( backend storage.TypeDefinitionWriteBackend, logger logger.Logger, ) *WriteAuthorizationModelCommand
func (*WriteAuthorizationModelCommand) Execute ¶
func (w *WriteAuthorizationModelCommand) Execute(ctx context.Context, req *openfgapb.WriteAuthorizationModelRequest) (*openfgapb.WriteAuthorizationModelResponse, error)
Execute the command using the supplied request.
type WriteCommand ¶
type WriteCommand struct {
// contains filtered or unexported fields
}
WriteCommand is used to Write and Delete tuples. Instances may be safely shared by multiple goroutines.
func NewWriteCommand ¶
func NewWriteCommand(datastore storage.OpenFGADatastore, tracer trace.Tracer, logger logger.Logger) *WriteCommand
NewWriteCommand creates a WriteCommand with specified storage.TupleBackend to use for storage.
func (*WriteCommand) Execute ¶
func (c *WriteCommand) Execute(ctx context.Context, req *openfgapb.WriteRequest) (*openfgapb.WriteResponse, error)
Execute deletes and writes the specified tuples. Deletes are applied first, then writes.