Trait ResourceProviderExt

Source
pub trait ResourceProviderExt: ResourceProvider {
    // Provided methods
    fn create_single_tenant(
        &self,
        resource_type: &str,
        data: Value,
        request_id: Option<String>,
    ) -> impl Future<Output = Result<Resource, Self::Error>> + Send
       where Self: Sync { ... }
    fn create_multi_tenant(
        &self,
        tenant_id: &str,
        resource_type: &str,
        data: Value,
        request_id: Option<String>,
    ) -> impl Future<Output = Result<Resource, Self::Error>> + Send
       where Self: Sync { ... }
    fn get_single_tenant(
        &self,
        resource_type: &str,
        id: &str,
        request_id: Option<String>,
    ) -> impl Future<Output = Result<Option<Resource>, Self::Error>> + Send
       where Self: Sync { ... }
    fn get_multi_tenant(
        &self,
        tenant_id: &str,
        resource_type: &str,
        id: &str,
        request_id: Option<String>,
    ) -> impl Future<Output = Result<Option<Resource>, Self::Error>> + Send
       where Self: Sync { ... }
}
Expand description

Extension trait providing convenience methods for common provider operations.

This trait automatically implements ergonomic helper methods for both single-tenant and multi-tenant scenarios on any type that implements ResourceProvider.

Provided Methods§

Source

fn create_single_tenant( &self, resource_type: &str, data: Value, request_id: Option<String>, ) -> impl Future<Output = Result<Resource, Self::Error>> + Send
where Self: Sync,

Convenience method for single-tenant resource creation.

Creates a RequestContext with no tenant information and calls create_resource.

Source

fn create_multi_tenant( &self, tenant_id: &str, resource_type: &str, data: Value, request_id: Option<String>, ) -> impl Future<Output = Result<Resource, Self::Error>> + Send
where Self: Sync,

Convenience method for multi-tenant resource creation.

Creates a RequestContext with the specified tenant and calls create_resource.

Source

fn get_single_tenant( &self, resource_type: &str, id: &str, request_id: Option<String>, ) -> impl Future<Output = Result<Option<Resource>, Self::Error>> + Send
where Self: Sync,

Convenience method for single-tenant resource retrieval.

Source

fn get_multi_tenant( &self, tenant_id: &str, resource_type: &str, id: &str, request_id: Option<String>, ) -> impl Future<Output = Result<Option<Resource>, Self::Error>> + Send
where Self: Sync,

Convenience method for multi-tenant resource retrieval.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: ResourceProvider> ResourceProviderExt for T

Blanket implementation of ResourceProviderExt for all types implementing ResourceProvider.