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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
* 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 ServerType {
#[serde(rename = "architecture")]
pub architecture: models::Architecture,
/// Category of Server Type.
#[serde(rename = "category", skip_serializing_if = "Option::is_none")]
pub category: Option<String>,
/// Number of cpu cores a Server of this type will have.
#[serde(rename = "cores")]
pub cores: i32,
/// Type of cpu.
#[serde(rename = "cpu_type")]
pub cpu_type: CpuType,
/// This field is deprecated. Use the deprecation object instead.
#[serde(rename = "deprecated", deserialize_with = "Option::deserialize")]
pub deprecated: Option<bool>,
/// This field is deprecated. Use the `deprecation` object in the `locations` field instead (`.locations[].deprecation`).
#[serde(
rename = "deprecation",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub deprecation: Option<Option<Box<models::DeprecationInfo>>>,
/// Description of the Server type.
#[serde(rename = "description")]
pub description: String,
/// Disk size a Server of this type will have in GB.
#[serde(rename = "disk")]
pub disk: f64,
/// ID of the Server type.
#[serde(rename = "id")]
pub id: i64,
/// Supported Location and per Location details for the Server Type. A Server Type is: - only supported in the Location that are listed. - deprecated in the Location when the `deprecation` property is set. - unavailable in the Location when the `deprecation.unavailable_after` date is in the past.
#[serde(rename = "locations")]
pub locations: Vec<models::ServerTypeLocation>,
/// Memory a Server of this type will have in GB.
#[serde(rename = "memory")]
pub memory: f64,
/// Unique identifier of the Server type.
#[serde(rename = "name")]
pub name: String,
/// Price per Location.
#[serde(rename = "prices")]
pub prices: Vec<models::PricePerTime>,
/// Type of Server boot drive. Local has higher speed. Network has better availability.
#[serde(rename = "storage_type")]
pub storage_type: StorageType,
}
impl ServerType {
pub fn new(
architecture: models::Architecture,
cores: i32,
cpu_type: CpuType,
deprecated: Option<bool>,
description: String,
disk: f64,
id: i64,
locations: Vec<models::ServerTypeLocation>,
memory: f64,
name: String,
prices: Vec<models::PricePerTime>,
storage_type: StorageType,
) -> ServerType {
ServerType {
architecture,
category: None,
cores,
cpu_type,
deprecated,
deprecation: None,
description,
disk,
id,
locations,
memory,
name,
prices,
storage_type,
}
}
}
/// Type of cpu.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum CpuType {
#[serde(rename = "dedicated")]
Dedicated,
#[serde(rename = "shared")]
Shared,
}
impl Default for CpuType {
fn default() -> CpuType {
Self::Dedicated
}
}
/// Type of Server boot drive. Local has higher speed. Network has better availability.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum StorageType {
#[serde(rename = "local")]
Local,
#[serde(rename = "network")]
Network,
}
impl Default for StorageType {
fn default() -> StorageType {
Self::Local
}
}