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
/*
* 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};
/// CreatePrimaryIpRequest : Request for POST https://api.hetzner.cloud/v1/primary_ips
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreatePrimaryIpRequest {
/// ID of resource to assign the Primary IP to. Omitted if the Primary IP should not get assigned.
#[serde(
rename = "assignee_id",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub assignee_id: Option<Option<i64>>,
/// Type of resource the Primary IP can get assigned to. Currently Primary IPs can only be assigned to Servers, therefore this field must be set to `server`.
#[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", skip_serializing_if = "Option::is_none")]
pub auto_delete: Option<bool>,
/// Data Center ID or name. The Primary IP will be bound to this Data Center. Omit if `assignee_id`/`assignee_type` is provided.
#[serde(rename = "datacenter", skip_serializing_if = "Option::is_none")]
pub datacenter: 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")]
pub name: String,
#[serde(rename = "type")]
pub r#type: models::IpType,
}
impl CreatePrimaryIpRequest {
/// Request for POST https://api.hetzner.cloud/v1/primary_ips
pub fn new(
assignee_type: AssigneeType,
name: String,
r#type: models::IpType,
) -> CreatePrimaryIpRequest {
CreatePrimaryIpRequest {
assignee_id: None,
assignee_type,
auto_delete: None,
datacenter: None,
labels: None,
name,
r#type,
}
}
}
/// Type of resource the Primary IP can get assigned to. Currently Primary IPs can only be assigned to Servers, therefore this field must be set to `server`.
#[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
}
}