pub struct MultiTenantManager { /* private fields */ }Expand description
Multi-tenant manager
Implementations§
Source§impl MultiTenantManager
impl MultiTenantManager
Sourcepub fn new(config: TenantManagerConfig) -> Self
pub fn new(config: TenantManagerConfig) -> Self
Create new multi-tenant manager
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create with default configuration
Sourcepub fn create_tenant(
&self,
tenant_id: impl Into<String>,
config: TenantConfig,
) -> MultiTenancyResult<()>
pub fn create_tenant( &self, tenant_id: impl Into<String>, config: TenantConfig, ) -> MultiTenancyResult<()>
Create tenant with configuration
Sourcepub fn get_tenant(&self, tenant_id: &str) -> MultiTenancyResult<Tenant>
pub fn get_tenant(&self, tenant_id: &str) -> MultiTenancyResult<Tenant>
Get tenant by ID
Sourcepub fn update_tenant_status(
&self,
tenant_id: &str,
status: TenantStatus,
) -> MultiTenancyResult<()>
pub fn update_tenant_status( &self, tenant_id: &str, status: TenantStatus, ) -> MultiTenancyResult<()>
Update tenant status
Sourcepub fn delete_tenant(&self, tenant_id: &str) -> MultiTenancyResult<()>
pub fn delete_tenant(&self, tenant_id: &str) -> MultiTenancyResult<()>
Delete tenant
Sourcepub fn check_operation(
&self,
context: &TenantContext,
_operation: TenantOperation,
resource_delta: Option<(ResourceType, u64)>,
) -> MultiTenancyResult<()>
pub fn check_operation( &self, context: &TenantContext, _operation: TenantOperation, resource_delta: Option<(ResourceType, u64)>, ) -> MultiTenancyResult<()>
Check if tenant can execute operation
Sourcepub fn execute_operation<F, R>(
&self,
context: &TenantContext,
operation: TenantOperation,
func: F,
) -> MultiTenancyResult<R>where
F: FnOnce() -> MultiTenancyResult<R>,
pub fn execute_operation<F, R>(
&self,
context: &TenantContext,
operation: TenantOperation,
func: F,
) -> MultiTenancyResult<R>where
F: FnOnce() -> MultiTenancyResult<R>,
Execute operation with full checks
Sourcepub fn get_statistics(
&self,
tenant_id: &str,
) -> MultiTenancyResult<TenantStatistics>
pub fn get_statistics( &self, tenant_id: &str, ) -> MultiTenancyResult<TenantStatistics>
Get tenant statistics
Sourcepub fn get_billing_metrics(
&self,
tenant_id: &str,
) -> MultiTenancyResult<BillingMetrics>
pub fn get_billing_metrics( &self, tenant_id: &str, ) -> MultiTenancyResult<BillingMetrics>
Get billing metrics
Sourcepub fn list_tenants(&self) -> MultiTenancyResult<Vec<Tenant>>
pub fn list_tenants(&self) -> MultiTenancyResult<Vec<Tenant>>
List all tenants
Sourcepub fn namespace_manager(&self) -> &NamespaceManager
pub fn namespace_manager(&self) -> &NamespaceManager
Get namespace manager
Sourcepub fn quota_enforcer(&self) -> &QuotaEnforcer
pub fn quota_enforcer(&self) -> &QuotaEnforcer
Get quota enforcer
Sourcepub fn access_control(&self) -> &AccessControl
pub fn access_control(&self) -> &AccessControl
Get access control
Sourcepub fn billing_engine(&self) -> &BillingEngine
pub fn billing_engine(&self) -> &BillingEngine
Get billing engine
Auto Trait Implementations§
impl Freeze for MultiTenantManager
impl RefUnwindSafe for MultiTenantManager
impl Send for MultiTenantManager
impl Sync for MultiTenantManager
impl Unpin for MultiTenantManager
impl UnwindSafe for MultiTenantManager
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
Mutably borrows from an owned value. Read more
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.