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};

/// Nameserver : Primary nameserver that returns Zones via `AXFR`.  Must allow queries from and may send `NOTIFY` queries to [Hetzner's secondary nameservers](https://docs.hetzner.com/dns-console/dns/general/authoritative-name-servers#secondary-dns-servers-old-name-servers-for-robot-customers).
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Nameserver {
    /// Public IPv4 or IPv6 address of the primary nameserver.
    #[serde(rename = "address")]
    pub address: String,
    /// Port of the primary nameserver.
    #[serde(rename = "port", skip_serializing_if = "Option::is_none")]
    pub port: Option<i32>,
    /// [Transaction signature (TSIG)](https://en.wikipedia.org/wiki/TSIG) algorithm used to generate the TSIG key.
    #[serde(rename = "tsig_algorithm", skip_serializing_if = "Option::is_none")]
    pub tsig_algorithm: Option<TsigAlgorithm>,
    /// [Transaction signature (TSIG)](https://en.wikipedia.org/wiki/TSIG) key to use for the zone transfer. Must be base64 encoded.
    #[serde(rename = "tsig_key", skip_serializing_if = "Option::is_none")]
    pub tsig_key: Option<String>,
}

impl Nameserver {
    /// Primary nameserver that returns Zones via `AXFR`.  Must allow queries from and may send `NOTIFY` queries to [Hetzner's secondary nameservers](https://docs.hetzner.com/dns-console/dns/general/authoritative-name-servers#secondary-dns-servers-old-name-servers-for-robot-customers).
    pub fn new(address: String) -> Nameserver {
        Nameserver {
            address,
            port: None,
            tsig_algorithm: None,
            tsig_key: None,
        }
    }
}
/// [Transaction signature (TSIG)](https://en.wikipedia.org/wiki/TSIG) algorithm used to generate the TSIG key.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TsigAlgorithm {
    #[serde(rename = "hmac-md5")]
    Md5,
    #[serde(rename = "hmac-sha1")]
    Sha1,
    #[serde(rename = "hmac-sha256")]
    Sha256,
}

impl Default for TsigAlgorithm {
    fn default() -> TsigAlgorithm {
        Self::Md5
    }
}