hcloud 0.25.0

Unofficial Rust crate for accessing the Hetzner Cloud API
Documentation
/*
 * Hetzner Cloud API
 *
 * Copied from the official API documentation for the Public Hetzner Cloud.
 *
 * The version of the OpenAPI document: 0.28.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Zone {
    #[serde(rename = "authoritative_nameservers")]
    pub authoritative_nameservers: Box<models::ZoneAuthoritativeNameservers>,
    /// Point in time when the Resource was created (in ISO-8601 format).
    #[serde(rename = "created")]
    pub created: String,
    /// ID of the Zone.
    #[serde(rename = "id")]
    pub id: i64,
    /// User-defined labels (`key/value` pairs) for the Resource. For more information, see \"Labels\".  | User-defined labels (`key/value` pairs) for the Resource.  Note that the set of Labels provided in the request will overwrite the existing one.  For more information, see \"Labels\".
    #[serde(rename = "labels")]
    pub labels: std::collections::HashMap<String, String>,
    /// Mode of the Zone.  For more information, see Zone Modes.
    #[serde(rename = "mode")]
    pub mode: Mode,
    /// Name of the Zone.  All names with [well-known public suffixes](https://publicsuffix.org/) (e.g. `.de`, `.com`, `.co.uk`) are supported. Subdomains are not supported.  The name must be in lower case and must not end with a dot. [Internationalized domain names](https://en.wikipedia.org/wiki/Internationalized_domain_name) must be transcribed to [Punycode](https://wikipedia.org/wiki/Punycode) representation with ACE prefix, e.g. `xn--mnchen-3ya.de` (`münchen.de`).
    #[serde(rename = "name")]
    pub name: String,
    /// Primary nameservers of the Zone.  Only set if Zone is in secondary mode, otherwise empty.
    #[serde(
        rename = "primary_nameservers",
        skip_serializing_if = "Option::is_none"
    )]
    pub primary_nameservers: Option<Vec<models::Nameserver>>,
    #[serde(rename = "protection")]
    pub protection: Box<models::Protection>,
    /// Number of resource records (RR) within the Zone.
    #[serde(rename = "record_count")]
    pub record_count: i32,
    /// Registrar of the domain.
    #[serde(rename = "registrar")]
    pub registrar: Registrar,
    /// Status of the Zone.  - `ok`: the Zone is pushed to the authoritative nameservers. - `updating`: the Zone is currently being published to the authoritative nameservers. - `error`: the Zone could not be published to the authoritative nameservers.
    #[serde(rename = "status")]
    pub status: Status,
    /// Default Time To Live (TTL) of the Zone.  Must be in between 60s and 2147483647s.  This TTL is used for RRSets that do not explicitly define a TTL.
    #[serde(rename = "ttl")]
    pub ttl: i32,
}

impl Zone {
    pub fn new(
        authoritative_nameservers: models::ZoneAuthoritativeNameservers,
        created: String,
        id: i64,
        labels: std::collections::HashMap<String, String>,
        mode: Mode,
        name: String,
        protection: models::Protection,
        record_count: i32,
        registrar: Registrar,
        status: Status,
        ttl: i32,
    ) -> Zone {
        Zone {
            authoritative_nameservers: Box::new(authoritative_nameservers),
            created,
            id,
            labels,
            mode,
            name,
            primary_nameservers: None,
            protection: Box::new(protection),
            record_count,
            registrar,
            status,
            ttl,
        }
    }
}
/// Mode of the Zone.  For more information, see Zone Modes.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Mode {
    #[serde(rename = "primary")]
    Primary,
    #[serde(rename = "secondary")]
    Secondary,
}

impl Default for Mode {
    fn default() -> Mode {
        Self::Primary
    }
}
/// Registrar of the domain.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Registrar {
    #[serde(rename = "hetzner")]
    Hetzner,
    #[serde(rename = "other")]
    Other,
    #[serde(rename = "unknown")]
    Unknown,
}

impl Default for Registrar {
    fn default() -> Registrar {
        Self::Hetzner
    }
}
/// Status of the Zone.  - `ok`: the Zone is pushed to the authoritative nameservers. - `updating`: the Zone is currently being published to the authoritative nameservers. - `error`: the Zone could not be published to the authoritative nameservers.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "error")]
    Error,
    #[serde(rename = "ok")]
    Ok,
    #[serde(rename = "updating")]
    Updating,
}

impl Default for Status {
    fn default() -> Status {
        Self::Error
    }
}