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

/// ResourceRecordSetToCreate : Request for POST https://api.hetzner.cloud/v1/zones/{id_or_name}/rrsets
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ResourceRecordSetToCreate {
    /// 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", skip_serializing_if = "Option::is_none")]
    pub labels: Option<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,
    /// 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",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub ttl: Option<Option<i32>>,
    #[serde(rename = "type")]
    pub r#type: models::ResourceRecordSetType,
}

impl ResourceRecordSetToCreate {
    /// Request for POST https://api.hetzner.cloud/v1/zones/{id_or_name}/rrsets
    pub fn new(
        name: String,
        records: Vec<models::ResourceRecord>,
        r#type: models::ResourceRecordSetType,
    ) -> ResourceRecordSetToCreate {
        ResourceRecordSetToCreate {
            labels: None,
            name,
            records,
            ttl: None,
            r#type,
        }
    }
}