Skip to main content

xbp_cli/provider_support/
registry.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4#[serde(rename_all = "snake_case")]
5pub enum ProviderStatus {
6    Implemented,
7    Planned,
8}
9
10#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
11#[serde(rename_all = "snake_case")]
12pub enum ProviderDomain {
13    Secrets,
14    Dns,
15    Domains,
16}
17
18#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
19pub struct ProviderDescriptor {
20    pub key: String,
21    pub label: String,
22    pub domain: ProviderDomain,
23    pub status: ProviderStatus,
24    pub capabilities: Vec<String>,
25    pub notes: Option<String>,
26}
27
28pub fn secrets_providers() -> Vec<ProviderDescriptor> {
29    vec![
30        ProviderDescriptor {
31            key: "github".to_string(),
32            label: "GitHub".to_string(),
33            domain: ProviderDomain::Secrets,
34            status: ProviderStatus::Implemented,
35            capabilities: vec![
36                "env_sync.list".to_string(),
37                "env_sync.push".to_string(),
38                "env_sync.pull".to_string(),
39                "env_sync.diff".to_string(),
40                "env_sync.verify".to_string(),
41                "env_sync.diag".to_string(),
42            ],
43            notes: Some("GitHub Actions environment variable sync.".to_string()),
44        },
45        ProviderDescriptor {
46            key: "cloudflare".to_string(),
47            label: "Cloudflare".to_string(),
48            domain: ProviderDomain::Secrets,
49            status: ProviderStatus::Implemented,
50            capabilities: vec![
51                "stores.list".to_string(),
52                "stores.get".to_string(),
53                "stores.create".to_string(),
54                "stores.delete".to_string(),
55                "secrets.list".to_string(),
56                "secrets.get".to_string(),
57                "secrets.create".to_string(),
58                "secrets.edit".to_string(),
59                "secrets.delete".to_string(),
60                "secrets.delete_bulk".to_string(),
61                "secrets.duplicate".to_string(),
62                "quota.get".to_string(),
63            ],
64            notes: Some("Cloudflare Secrets Store APIs.".to_string()),
65        },
66        ProviderDescriptor {
67            key: "railway".to_string(),
68            label: "Railway".to_string(),
69            domain: ProviderDomain::Secrets,
70            status: ProviderStatus::Implemented,
71            capabilities: vec!["env_sync.pull".to_string(), "env_sync.diag".to_string()],
72            notes: Some(
73                "Pulls variables through the authenticated Railway CLI session.".to_string(),
74            ),
75        },
76        ProviderDescriptor {
77            key: "vercel".to_string(),
78            label: "Vercel".to_string(),
79            domain: ProviderDomain::Secrets,
80            status: ProviderStatus::Implemented,
81            capabilities: vec!["env_sync.pull".to_string(), "env_sync.diag".to_string()],
82            notes: Some(
83                "Pulls variables through the authenticated Vercel CLI session.".to_string(),
84            ),
85        },
86    ]
87}
88
89pub fn dns_providers() -> Vec<ProviderDescriptor> {
90    vec![
91        ProviderDescriptor {
92            key: "cloudflare".to_string(),
93            label: "Cloudflare".to_string(),
94            domain: ProviderDomain::Dns,
95            status: ProviderStatus::Implemented,
96            capabilities: vec![
97                "zones.list".to_string(),
98                "zones.get".to_string(),
99                "zones.create".to_string(),
100                "zones.edit".to_string(),
101                "zones.delete".to_string(),
102                "records.list".to_string(),
103                "records.get".to_string(),
104                "records.create".to_string(),
105                "records.replace".to_string(),
106                "records.edit".to_string(),
107                "records.delete".to_string(),
108                "records.batch".to_string(),
109                "records.import".to_string(),
110                "records.export".to_string(),
111                "dnssec.get".to_string(),
112                "dnssec.edit".to_string(),
113                "settings.get".to_string(),
114                "settings.edit".to_string(),
115            ],
116            notes: Some("Cloudflare core DNS APIs.".to_string()),
117        },
118        ProviderDescriptor {
119            key: "hetzner".to_string(),
120            label: "Hetzner".to_string(),
121            domain: ProviderDomain::Dns,
122            status: ProviderStatus::Planned,
123            capabilities: vec![],
124            notes: Some("Planned provider.".to_string()),
125        },
126        ProviderDescriptor {
127            key: "vercel".to_string(),
128            label: "Vercel".to_string(),
129            domain: ProviderDomain::Dns,
130            status: ProviderStatus::Planned,
131            capabilities: vec![],
132            notes: Some("Planned provider.".to_string()),
133        },
134        ProviderDescriptor {
135            key: "custom".to_string(),
136            label: "Custom".to_string(),
137            domain: ProviderDomain::Dns,
138            status: ProviderStatus::Planned,
139            capabilities: vec![],
140            notes: Some("Planned provider.".to_string()),
141        },
142    ]
143}
144
145pub fn domains_providers() -> Vec<ProviderDescriptor> {
146    vec![ProviderDescriptor {
147        key: "cloudflare".to_string(),
148        label: "Cloudflare".to_string(),
149        domain: ProviderDomain::Domains,
150        status: ProviderStatus::Implemented,
151        capabilities: vec![
152            "domains.search".to_string(),
153            "domains.check".to_string(),
154            "domains.list".to_string(),
155        ],
156        notes: Some("Registrar discovery endpoints only in v1.".to_string()),
157    }]
158}