hyperlane_plugin_tenant/enum.rs
1use super::*;
2
3/// Lifecycle status of a registered tenant.
4#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
5pub enum TenantStatus {
6 /// Tenant is active and allowed to serve traffic.
7 #[default]
8 Active,
9 /// Tenant is suspended and receives `403 Forbidden`.
10 Suspended,
11}
12
13/// Strategy used to extract a raw tenant identifier from an incoming request.
14#[derive(Clone, Copy, Debug, Eq, PartialEq)]
15pub enum TenantSource {
16 /// Extracted from the configured HTTP request header (default `x-tenant-id`).
17 Header,
18 /// Extracted from the leading subdomain label before `base_domain`.
19 Subdomain,
20 /// Extracted from a leading path prefix segment (`/<prefix>/<tenant>/...`).
21 PathPrefix,
22 /// Supplied by the configured fallback default tenant.
23 Default,
24}
25
26/// Resolution outcome produced by [`TenantPlugin::resolve`].
27#[derive(Clone, Debug, Eq, PartialEq)]
28pub enum TenantResolution {
29 /// Path is exempt from tenant enforcement.
30 Exempt,
31 /// Successfully resolved to an active [`TenantContext`].
32 Resolved(TenantContext),
33 /// Request carried no valid tenant identifier (`400 Bad Request`).
34 Missing,
35 /// Extracted tenant ID was not found in the registry (`404 Not Found`).
36 Unknown,
37 /// Extracted tenant ID is suspended (`403 Forbidden`).
38 Suspended,
39}