Skip to main content

static_tr_plugin/
config.rs

1//! Configuration for the static tenant resolver plugin.
2
3use serde::Deserialize;
4use tenant_resolver_sdk::TenantStatus;
5use uuid::Uuid;
6
7/// Plugin configuration.
8#[derive(Debug, Clone, Deserialize)]
9#[serde(default, deny_unknown_fields)]
10pub struct StaticTrPluginConfig {
11    /// Vendor name for GTS instance registration.
12    pub vendor: String,
13
14    /// Plugin priority (lower = higher priority).
15    pub priority: i16,
16
17    /// Static tenant definitions.
18    pub tenants: Vec<TenantConfig>,
19}
20
21impl Default for StaticTrPluginConfig {
22    fn default() -> Self {
23        Self {
24            vendor: "hyperspot".to_owned(),
25            priority: 100,
26            tenants: Vec::new(),
27        }
28    }
29}
30
31/// Configuration for a single tenant.
32#[derive(Debug, Clone, Deserialize)]
33#[serde(deny_unknown_fields)]
34pub struct TenantConfig {
35    /// Tenant ID.
36    pub id: Uuid,
37
38    /// Tenant name.
39    pub name: String,
40
41    /// Tenant status (defaults to Active).
42    #[serde(default)]
43    pub status: TenantStatus,
44
45    /// Tenant type classification.
46    #[serde(rename = "type", default)]
47    pub tenant_type: Option<String>,
48
49    /// Parent tenant ID. `None` for root tenants.
50    #[serde(default)]
51    pub parent_id: Option<Uuid>,
52
53    /// Whether this tenant is self-managed (barrier).
54    /// When `true`, parent tenants cannot traverse into this subtree
55    /// unless `BarrierMode::Ignore` is used.
56    #[serde(default)]
57    pub self_managed: bool,
58}