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 ResourceRecordSet {
    /// ID of the RRSet.  The ID is composed of the name and type, joined with a slash (e.g. `www/AAAA`).
    #[serde(rename = "id")]
    pub id: String,
    /// 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>,
    /// Name of the RRSet.  The name must be in lower case, and must not end with a dot or the Zone name. Names containing non-ASCII characters must be transcribed to [Punycode](https://wikipedia.org/wiki/Punycode) representation with ACE prefix, e.g. `xn--4bi` (✉️).  For the Zone apex, use `@`.
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "protection")]
    pub protection: Box<models::ResourceRecordSetProtection>,
    /// Records of the RRSet.  Must not be empty and must only contain distinct record values. The order of records returned in responses is not guaranteed to be consistent.
    #[serde(rename = "records")]
    pub records: Vec<models::ResourceRecord>,
    /// Time To Live (TTL) of the RRSet.  Must be in between 60s and 2147483647s.  If not set, the Zone's Default TTL is used.
    #[serde(rename = "ttl", deserialize_with = "Option::deserialize")]
    pub ttl: Option<i32>,
    #[serde(rename = "type")]
    pub r#type: models::ResourceRecordSetType,
    /// ID of the Zone.
    #[serde(rename = "zone")]
    pub zone: i64,
}

impl ResourceRecordSet {
    pub fn new(
        id: String,
        labels: std::collections::HashMap<String, String>,
        name: String,
        protection: models::ResourceRecordSetProtection,
        records: Vec<models::ResourceRecord>,
        ttl: Option<i32>,
        r#type: models::ResourceRecordSetType,
        zone: i64,
    ) -> ResourceRecordSet {
        ResourceRecordSet {
            id,
            labels,
            name,
            protection: Box::new(protection),
            records,
            ttl,
            r#type,
            zone,
        }
    }
}