edge-schema 0.1.0

Shared schema types for Wasmer Edge.
Documentation
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>,
}