statehub_api/v0/
cluster.rs1use super::*;
7
8mod impls;
9
10#[derive(Clone, Debug, Serialize, Deserialize)]
11pub struct Cluster {
12 pub id: Uuid,
13 pub name: ClusterName,
14 pub namespace: Option<String>,
15 pub created: DateTime<Utc>,
16 pub modified: DateTime<Utc>,
17 #[serde(default)]
18 pub locations: ClusterLocations,
19 pub helm: Vec<Helm>,
20}
21
22#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, PartialOrd, Hash)]
23#[serde(rename_all = "lowercase")]
24pub enum Provider {
25 Eks,
26 Aks,
27 Kops,
28 Generic,
29}
30
31#[derive(Clone, Debug, Serialize, Deserialize)]
32pub struct CreateClusterDto {
33 pub name: ClusterName,
34 pub namespace: Option<String>,
35 pub provider: Provider,
36 pub locations: ClusterLocations,
37}
38
39#[derive(Clone, Debug, Serialize, Deserialize)]
40pub struct ClusterToken {
41 pub token: String,
42}
43
44#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
45pub struct ClusterName(pub String);
46
47#[derive(Clone, Debug, Default, Serialize, Deserialize)]
48pub struct ClusterLocations {
49 #[serde(default)]
50 pub aws: Vec<ClusterLocationAws>,
51 #[serde(default)]
52 pub azure: Vec<ClusterLocationAzure>,
53}
54#[skip_serializing_none]
55#[derive(Clone, Debug, Serialize, Deserialize)]
56#[serde(rename_all = "camelCase")]
57pub struct ClusterLocationAws {
58 pub region: AwsRegion,
59 pub account_principal: Option<String>,
60}
61
62#[derive(Clone, Debug, Serialize, Deserialize)]
63pub struct ClusterLocationAzure {
64 pub region: AzureRegion,
65}
66
67#[cfg(test)]
68mod tests;