pub struct TenantConfig {
pub id: TenantId,
pub name: Option<String>,
pub allowed_models: HashSet<String>,
pub blocked_models: HashSet<String>,
pub rate_limit: Option<RateLimitConfig>,
pub cost_limit: Option<CostLimitConfig>,
pub active: bool,
pub metadata: HashMap<String, String>,
}Expand description
Tenant configuration.
Fields§
§id: TenantIdUnique tenant identifier
name: Option<String>Display name
allowed_models: HashSet<String>Allowed models (empty = all allowed)
blocked_models: HashSet<String>Blocked models
rate_limit: Option<RateLimitConfig>Rate limit configuration
cost_limit: Option<CostLimitConfig>Cost limit configuration
active: boolWhether the tenant is active
metadata: HashMap<String, String>Custom metadata
Implementations§
Source§impl TenantConfig
impl TenantConfig
Sourcepub fn with_allowed_models<I, S>(self, models: I) -> Self
pub fn with_allowed_models<I, S>(self, models: I) -> Self
Set allowed models.
Sourcepub fn allow_model(self, model: impl Into<String>) -> Self
pub fn allow_model(self, model: impl Into<String>) -> Self
Add an allowed model.
Sourcepub fn block_model(self, model: impl Into<String>) -> Self
pub fn block_model(self, model: impl Into<String>) -> Self
Block a model.
Sourcepub fn with_rate_limit(self, config: RateLimitConfig) -> Self
pub fn with_rate_limit(self, config: RateLimitConfig) -> Self
Set rate limit configuration.
Sourcepub fn with_cost_limit(self, config: CostLimitConfig) -> Self
pub fn with_cost_limit(self, config: CostLimitConfig) -> Self
Set cost limit configuration.
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add metadata.
Sourcepub fn is_model_allowed(&self, model: &str) -> bool
pub fn is_model_allowed(&self, model: &str) -> bool
Check if a model is allowed for this tenant.
Trait Implementations§
Source§impl Clone for TenantConfig
impl Clone for TenantConfig
Source§fn clone(&self) -> TenantConfig
fn clone(&self) -> TenantConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TenantConfig
impl Debug for TenantConfig
Source§impl<'de> Deserialize<'de> for TenantConfig
impl<'de> Deserialize<'de> for TenantConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TenantConfig
impl RefUnwindSafe for TenantConfig
impl Send for TenantConfig
impl Sync for TenantConfig
impl Unpin for TenantConfig
impl UnwindSafe for TenantConfig
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