use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum ZoneType {
Primary,
Secondary,
Stub,
Forwarder,
SecondaryForwarder,
Catalog,
SecondaryCatalog,
}
impl std::fmt::Display for ZoneType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Primary => write!(f, "Primary"),
Self::Secondary => write!(f, "Secondary"),
Self::Stub => write!(f, "Stub"),
Self::Forwarder => write!(f, "Forwarder"),
Self::SecondaryForwarder => write!(f, "SecondaryForwarder"),
Self::Catalog => write!(f, "Catalog"),
Self::SecondaryCatalog => write!(f, "SecondaryCatalog"),
}
}
}
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Zone {
pub name: String,
#[serde(rename = "type")]
pub zone_type: ZoneType,
#[serde(default)]
pub disabled: bool,
#[serde(default)]
pub internal: bool,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct ZoneListResponse {
pub zones: Vec<Zone>,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct ZoneCreateResponse {
pub domain: Option<String>,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ZoneOptions {
#[serde(default)]
pub zone_transfer_allowed_networks: Vec<String>,
#[serde(default)]
pub notify_name_servers: Vec<String>,
}