support_kit/deployments/
deployment_config.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]
#[serde(rename_all = "kebab-case")]
pub struct DeploymentConfig {
    pub artifacts: Option<Artifacts>,
    pub hosts: Vec<HostDefinition>,
    #[serde(default)]
    pub security: SecurityConfig,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]
#[serde(rename_all = "kebab-case")]
pub struct Artifacts {
    pub containers: Option<Containers>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]
#[serde(rename_all = "kebab-case")]
pub struct Containers {
    pub registry: Option<Registry>,
    pub images: Vec<ImageDefinition>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]
#[serde(rename_all = "kebab-case")]
pub struct Registry {
    pub account: String,
    pub host: String,
    pub token: String,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]
#[serde(rename_all = "kebab-case")]
pub struct ImageDefinition {
    pub definition: String,
    pub name: String,
    pub label: String,
    pub namespace: String,
    pub repo: String,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]
#[serde(rename_all = "kebab-case")]
pub struct HostDefinition {
    pub address: String,
    pub port: Option<u16>,
    pub user: Option<String>,
    pub auth: Option<String>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]
#[serde(rename_all = "kebab-case")]
struct Security {
    certificates: Option<SecurityConfig>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]
#[serde(tag = "type", rename_all = "kebab-case")]
pub enum SecurityConfig {
    Acme {
        domains: Vec<String>,
        emails: Vec<String>,
        cache: Option<String>,
        production: bool,
    },
    #[serde(untagged)]
    #[default]
    Off,
    #[serde(untagged)]
    Unknown(serde_json::Value),
}