xbp_cli/provider_support/
registry.rs1use 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 ]
67}
68
69pub fn dns_providers() -> Vec<ProviderDescriptor> {
70 vec![
71 ProviderDescriptor {
72 key: "cloudflare".to_string(),
73 label: "Cloudflare".to_string(),
74 domain: ProviderDomain::Dns,
75 status: ProviderStatus::Implemented,
76 capabilities: vec![
77 "zones.list".to_string(),
78 "zones.get".to_string(),
79 "zones.create".to_string(),
80 "zones.edit".to_string(),
81 "zones.delete".to_string(),
82 "records.list".to_string(),
83 "records.get".to_string(),
84 "records.create".to_string(),
85 "records.replace".to_string(),
86 "records.edit".to_string(),
87 "records.delete".to_string(),
88 "records.batch".to_string(),
89 "records.import".to_string(),
90 "records.export".to_string(),
91 "dnssec.get".to_string(),
92 "dnssec.edit".to_string(),
93 "settings.get".to_string(),
94 "settings.edit".to_string(),
95 ],
96 notes: Some("Cloudflare core DNS APIs.".to_string()),
97 },
98 ProviderDescriptor {
99 key: "hetzner".to_string(),
100 label: "Hetzner".to_string(),
101 domain: ProviderDomain::Dns,
102 status: ProviderStatus::Planned,
103 capabilities: vec![],
104 notes: Some("Planned provider.".to_string()),
105 },
106 ProviderDescriptor {
107 key: "vercel".to_string(),
108 label: "Vercel".to_string(),
109 domain: ProviderDomain::Dns,
110 status: ProviderStatus::Planned,
111 capabilities: vec![],
112 notes: Some("Planned provider.".to_string()),
113 },
114 ProviderDescriptor {
115 key: "custom".to_string(),
116 label: "Custom".to_string(),
117 domain: ProviderDomain::Dns,
118 status: ProviderStatus::Planned,
119 capabilities: vec![],
120 notes: Some("Planned provider.".to_string()),
121 },
122 ]
123}
124
125pub fn domains_providers() -> Vec<ProviderDescriptor> {
126 vec![ProviderDescriptor {
127 key: "cloudflare".to_string(),
128 label: "Cloudflare".to_string(),
129 domain: ProviderDomain::Domains,
130 status: ProviderStatus::Implemented,
131 capabilities: vec![
132 "domains.search".to_string(),
133 "domains.check".to_string(),
134 "domains.list".to_string(),
135 ],
136 notes: Some("Registrar discovery endpoints only in v1.".to_string()),
137 }]
138}