pub struct SpicedbClient {
pub channel: Channel,
/* private fields */
}Expand description
SpiceDB client
Fields§
§channel: ChannelImplementations§
Source§impl SpicedbClient
impl SpicedbClient
Create a new SpicedbClient from the server URL and a preshared key.
let mut client =
SpicedbClient::from_url_and_preshared_key("http://localhost:50051", "spicedb")
.await
.unwrap();Sourcepub async fn read_schema(&mut self) -> Result<ReadSchemaResponse>
pub async fn read_schema(&mut self) -> Result<ReadSchemaResponse>
Read the current Object Definitions for a Permissions System.
Errors include:
- INVALID_ARGUMENT: a provided value has failed to semantically validate
- NOT_FOUND: no schema has been defined
Sourcepub async fn write_schema(
&mut self,
schema: impl ToString,
) -> Result<WriteSchemaResponse>
pub async fn write_schema( &mut self, schema: impl ToString, ) -> Result<WriteSchemaResponse>
Overwrite the current Object Definitions for a Permissions System.
Sourcepub async fn read_relationships(
&mut self,
request: ReadRelationshipsRequest,
) -> Result<Streaming<ReadRelationshipsResponse>>
pub async fn read_relationships( &mut self, request: ReadRelationshipsRequest, ) -> Result<Streaming<ReadRelationshipsResponse>>
Read a set of the relationships matching one or more filters.
Sourcepub async fn write_relationships(
&mut self,
request: WriteRelationshipsRequest,
) -> Result<WriteRelationshipsResponse>
pub async fn write_relationships( &mut self, request: WriteRelationshipsRequest, ) -> Result<WriteRelationshipsResponse>
Atomically write and/or delete a set of specified relationships. An optional set of preconditions can be provided that must be satisfied for the operation to commit.
Sourcepub async fn delete_relationships(
&mut self,
request: DeleteRelationshipsRequest,
) -> Result<DeleteRelationshipsResponse>
pub async fn delete_relationships( &mut self, request: DeleteRelationshipsRequest, ) -> Result<DeleteRelationshipsResponse>
Atomically bulk delete all relationships matching the provided filter. If no relationships match, none will be deleted and the operation will succeed. An optional set of preconditions can be provided that must be satisfied for the operation to commit.
Sourcepub async fn check_permission(
&mut self,
request: CheckPermissionRequest,
) -> Result<CheckPermissionResponse>
pub async fn check_permission( &mut self, request: CheckPermissionRequest, ) -> Result<CheckPermissionResponse>
Determine, for a given resource, whether a subject computes to having a permission or is a direct member of a particular relation.
Sourcepub async fn check_bulk_permissions(
&mut self,
request: CheckBulkPermissionsRequest,
) -> Result<CheckBulkPermissionsResponse>
pub async fn check_bulk_permissions( &mut self, request: CheckBulkPermissionsRequest, ) -> Result<CheckBulkPermissionsResponse>
Evaluate the given list of permission checks.
Sourcepub async fn expand_permission_tree(
&mut self,
request: ExpandPermissionTreeRequest,
) -> Result<ExpandPermissionTreeResponse>
pub async fn expand_permission_tree( &mut self, request: ExpandPermissionTreeRequest, ) -> Result<ExpandPermissionTreeResponse>
Reveal the graph structure for a resource’s permission or relation. This RPC does not recurse infinitely deep and may require multiple calls to fully unnest a deeply nested graph.
Sourcepub async fn lookup_resources(
&mut self,
request: LookupResourcesRequest,
) -> Result<Streaming<LookupResourcesResponse>>
pub async fn lookup_resources( &mut self, request: LookupResourcesRequest, ) -> Result<Streaming<LookupResourcesResponse>>
Return all the resources of a given type that a subject can access whether via a computed permission or relation membership.
Sourcepub async fn lookup_subjects(
&mut self,
request: LookupSubjectsRequest,
) -> Result<Streaming<LookupSubjectsResponse>>
pub async fn lookup_subjects( &mut self, request: LookupSubjectsRequest, ) -> Result<Streaming<LookupSubjectsResponse>>
Return all the subjects of a given type that have access whether via a computed permission or relation membership.
Sourcepub async fn watch(
&mut self,
request: WatchRequest,
) -> Result<Streaming<WatchResponse>>
pub async fn watch( &mut self, request: WatchRequest, ) -> Result<Streaming<WatchResponse>>
Watch the database for mutations.
SpiceDB’s Watch API requires commit timestamp tracking be enabled for PostgreSQL and the experimental changefeed for CockroachDB.
Trait Implementations§
Source§impl Clone for SpicedbClient
impl Clone for SpicedbClient
Source§fn clone(&self) -> SpicedbClient
fn clone(&self) -> SpicedbClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !Freeze for SpicedbClient
impl !RefUnwindSafe for SpicedbClient
impl Send for SpicedbClient
impl Sync for SpicedbClient
impl Unpin for SpicedbClient
impl !UnwindSafe for SpicedbClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request