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 PrimaryIp {
    /// ID of resource the Primary IP is assigned to.  `null` if the Primary IP is not assigned.
    #[serde(rename = "assignee_id", deserialize_with = "Option::deserialize")]
    pub assignee_id: Option<i64>,
    /// Type of resource the Primary IP can get assigned to.
    #[serde(rename = "assignee_type")]
    pub assignee_type: AssigneeType,
    /// Auto deletion state.  If enabled the Primary IP will be deleted once the assigned resource gets deleted.
    #[serde(rename = "auto_delete")]
    pub auto_delete: bool,
    /// Blocked state of the Primary IP.
    #[serde(rename = "blocked")]
    pub blocked: bool,
    /// Point in time when the Resource was created (in ISO-8601 format).
    #[serde(rename = "created")]
    pub created: String,
    #[serde(rename = "datacenter")]
    pub datacenter: Box<models::DataCenter>,
    /// List of reverse DNS records.
    #[serde(rename = "dns_ptr")]
    pub dns_ptr: Vec<models::DnsPtr>,
    /// ID of the Primary IP.
    #[serde(rename = "id")]
    pub id: i64,
    /// IP address.
    #[serde(rename = "ip")]
    pub ip: 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 Resource. Must be unique per Project.
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "protection")]
    pub protection: Box<models::Protection>,
    #[serde(rename = "type")]
    pub r#type: models::IpType,
}

impl PrimaryIp {
    pub fn new(
        assignee_id: Option<i64>,
        assignee_type: AssigneeType,
        auto_delete: bool,
        blocked: bool,
        created: String,
        datacenter: models::DataCenter,
        dns_ptr: Vec<models::DnsPtr>,
        id: i64,
        ip: String,
        labels: std::collections::HashMap<String, String>,
        name: String,
        protection: models::Protection,
        r#type: models::IpType,
    ) -> PrimaryIp {
        PrimaryIp {
            assignee_id,
            assignee_type,
            auto_delete,
            blocked,
            created,
            datacenter: Box::new(datacenter),
            dns_ptr,
            id,
            ip,
            labels,
            name,
            protection: Box::new(protection),
            r#type,
        }
    }
}
/// Type of resource the Primary IP can get assigned to.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum AssigneeType {
    #[serde(rename = "server")]
    Server,
}

impl Default for AssigneeType {
    fn default() -> AssigneeType {
        Self::Server
    }
}