libomni/types/db/v1/
provider.rs

1use serde::Serialize;
2use chrono::{DateTime, Utc};
3use super::region::Region;
4
5#[derive(Debug, sqlx::FromRow, Serialize)]
6pub struct Provider {
7    pub id: i64,
8    pub name: String,
9    pub display_name: String,
10    pub provider_type: String, // enum in DB: 'kubernetes' or 'custom'
11    pub status: String, // enum in DB: 'active', 'inactive', 'maintenance'
12    pub created_at: DateTime<Utc>,
13    pub updated_at: DateTime<Utc>,
14}
15
16#[derive(Debug, sqlx::FromRow, Serialize)]
17pub struct ProviderAuditLog {
18    pub id: i64,
19    pub provider_id: i64,
20    pub action: String,
21    pub details: Option<String>,
22    pub created_at: DateTime<Utc>,
23    pub updated_at: DateTime<Utc>,
24}
25
26/// List provider-regions.
27///
28/// This function fetches all regions from the database, paired with their providers and their binding table data.
29#[derive(sqlx::FromRow, Debug, Serialize)]
30pub struct ProviderRegion {
31    #[sqlx(flatten)]
32    region: Region,
33    provider_name: String,
34    binding_status: String,
35}