pub struct TenantManager { /* private fields */ }Expand description
Multi-tenancy manager
Implementations§
Source§impl TenantManager
impl TenantManager
Sourcepub fn create_tenant(&self, name: String, plan: TenantPlan) -> Result<Tenant>
pub fn create_tenant(&self, name: String, plan: TenantPlan) -> Result<Tenant>
Create a new tenant
Sourcepub fn get_tenant(&self, tenant_id: &str) -> Result<Tenant>
pub fn get_tenant(&self, tenant_id: &str) -> Result<Tenant>
Get tenant by ID
Sourcepub fn get_tenant_by_name(&self, name: &str) -> Result<Tenant>
pub fn get_tenant_by_name(&self, name: &str) -> Result<Tenant>
Get tenant by name
Sourcepub fn update_tenant(&self, tenant: Tenant) -> Result<()>
pub fn update_tenant(&self, tenant: Tenant) -> Result<()>
Update tenant
Sourcepub fn delete_tenant(&self, tenant_id: &str) -> Result<()>
pub fn delete_tenant(&self, tenant_id: &str) -> Result<()>
Delete tenant
Sourcepub fn list_tenants(&self) -> Vec<Tenant>
pub fn list_tenants(&self) -> Vec<Tenant>
List all tenants
Sourcepub fn increment_usage(
&self,
tenant_id: &str,
resource_type: &str,
) -> Result<()>
pub fn increment_usage( &self, tenant_id: &str, resource_type: &str, ) -> Result<()>
Increment usage counter
Sourcepub fn decrement_usage(
&self,
tenant_id: &str,
resource_type: &str,
) -> Result<()>
pub fn decrement_usage( &self, tenant_id: &str, resource_type: &str, ) -> Result<()>
Decrement usage counter
Sourcepub fn check_permission(&self, tenant_id: &str, permission: &str) -> Result<()>
pub fn check_permission(&self, tenant_id: &str, permission: &str) -> Result<()>
Check permission for tenant
Sourcepub fn check_and_increment(
&self,
tenant_id: &str,
resource_type: &str,
) -> Result<()>
pub fn check_and_increment( &self, tenant_id: &str, resource_type: &str, ) -> Result<()>
Check quota and increment if allowed
Sourcepub fn upgrade_plan(&self, tenant_id: &str, new_plan: TenantPlan) -> Result<()>
pub fn upgrade_plan(&self, tenant_id: &str, new_plan: TenantPlan) -> Result<()>
Upgrade tenant plan
Sourcepub fn disable_tenant(&self, tenant_id: &str) -> Result<()>
pub fn disable_tenant(&self, tenant_id: &str) -> Result<()>
Disable tenant
Sourcepub fn enable_tenant(&self, tenant_id: &str) -> Result<()>
pub fn enable_tenant(&self, tenant_id: &str) -> Result<()>
Enable tenant
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TenantManager
impl !RefUnwindSafe for TenantManager
impl Send for TenantManager
impl Sync for TenantManager
impl Unpin for TenantManager
impl !UnwindSafe for TenantManager
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request