Skip to main content

hcloud/models/
create_floating_ip_request.rs

1/*
2 * Hetzner Cloud API
3 *
4 * Copied from the official API documentation for the Public Hetzner Cloud.
5 *
6 * The version of the OpenAPI document: 4b3f595
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// CreateFloatingIpRequest : Request for POST https://api.hetzner.cloud/v1/floating_ips
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct CreateFloatingIpRequest {
17    /// Description of the Resource.
18    #[serde(
19        rename = "description",
20        default,
21        with = "::serde_with::rust::double_option",
22        skip_serializing_if = "Option::is_none"
23    )]
24    pub description: Option<Option<String>>,
25    /// 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.
26    #[serde(rename = "home_location", skip_serializing_if = "Option::is_none")]
27    pub home_location: Option<String>,
28    /// 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\".
29    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
30    pub labels: Option<std::collections::HashMap<String, String>>,
31    /// Name of the Resource. Must be unique per Project.
32    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
33    pub name: Option<String>,
34    /// Server the Floating IP is assigned to.  `null` if not assigned.
35    #[serde(
36        rename = "server",
37        default,
38        with = "::serde_with::rust::double_option",
39        skip_serializing_if = "Option::is_none"
40    )]
41    pub server: Option<Option<i64>>,
42    #[serde(rename = "type")]
43    pub r#type: models::IpType,
44}
45
46impl CreateFloatingIpRequest {
47    /// Request for POST https://api.hetzner.cloud/v1/floating_ips
48    pub fn new(r#type: models::IpType) -> CreateFloatingIpRequest {
49        CreateFloatingIpRequest {
50            description: None,
51            home_location: None,
52            labels: None,
53            name: None,
54            server: None,
55            r#type,
56        }
57    }
58}