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

/// CreateFloatingIpRequest : Request for POST https://api.hetzner.cloud/v1/floating_ips
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateFloatingIpRequest {
    /// Description of the Resource.
    #[serde(
        rename = "description",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub description: Option<Option<String>>,
    /// Home Location for the Floating IP.  Either the ID or the name of the Location.  Only optional if no Server is provided. Routing is optimized for this Locations.
    #[serde(rename = "home_location", skip_serializing_if = "Option::is_none")]
    pub home_location: Option<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", skip_serializing_if = "Option::is_none")]
    pub labels: Option<std::collections::HashMap<String, String>>,
    /// Name of the Resource. Must be unique per Project.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// Server the Floating IP is assigned to.  `null` if not assigned.
    #[serde(
        rename = "server",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub server: Option<Option<i64>>,
    #[serde(rename = "type")]
    pub r#type: models::IpType,
}

impl CreateFloatingIpRequest {
    /// Request for POST https://api.hetzner.cloud/v1/floating_ips
    pub fn new(r#type: models::IpType) -> CreateFloatingIpRequest {
        CreateFloatingIpRequest {
            description: None,
            home_location: None,
            labels: None,
            name: None,
            server: None,
            r#type,
        }
    }
}