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
use serde::{Deserialize, Serialize};

use super::Merge;

#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, schemars::JsonSchema)]
pub struct CapabilityNetworkGatewayV1 {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub enforce_https: Option<bool>,

    /// List of enabled domain names.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub domains: Option<Vec<String>>,
}

impl Merge for CapabilityNetworkGatewayV1 {
    fn merge_extend(self, other: &Self) -> Self {
        Self {
            enforce_https: self.enforce_https.merge_extend(&other.enforce_https),
            domains: self.domains.merge_extend(&other.domains),
        }
    }
}

#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, schemars::JsonSchema)]
pub struct NetworkGatewayTlsV1 {
    pub automatic_certificates: Option<NetworkGatewayTlsAutoCertsV1>,
}

#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, schemars::JsonSchema)]
pub struct NetworkGatewayTlsAutoCertsV1 {
    /// Contact email to use for generated certificates.
    pub contact_email: Option<String>,
    /// Let's encrypt compatible certificate issuer API url.
    pub issuer_api_url: Option<String>,
}