Skip to main content

oxigdal_security/multitenancy/
mod.rs

1//! Multi-tenancy support.
2
3pub mod isolation;
4pub mod quotas;
5pub mod tenant;
6
7use serde::{Deserialize, Serialize};
8use std::collections::HashMap;
9
10/// Tenant configuration.
11#[derive(Debug, Clone, Serialize, Deserialize)]
12pub struct TenantConfig {
13    /// Tenant ID.
14    pub tenant_id: String,
15    /// Tenant name.
16    pub name: String,
17    /// Encryption key ID for this tenant.
18    pub encryption_key_id: Option<String>,
19    /// Resource quotas.
20    pub quotas: HashMap<String, u64>,
21    /// Custom metadata.
22    pub metadata: HashMap<String, String>,
23}
24
25impl TenantConfig {
26    /// Create new tenant config.
27    pub fn new(tenant_id: String, name: String) -> Self {
28        Self {
29            tenant_id,
30            name,
31            encryption_key_id: None,
32            quotas: HashMap::new(),
33            metadata: HashMap::new(),
34        }
35    }
36}