1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
* 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
}
}