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
/*
* 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};
/// Volume : A Volume is a highly-available, scalable, and SSD-based block storage for Servers. Pricing for Volumes depends on the Volume size and Location, not the actual used storage. Please see [Hetzner Wiki](https://wiki.hetzner.de/index.php/CloudServer/en#Volumes) for more details about Volumes.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Volume {
/// Point in time when the Resource was created (in ISO-8601 format).
#[serde(rename = "created")]
pub created: String,
/// Filesystem of the Volume if formatted on creation, null if not formatted on creation.
#[serde(rename = "format", deserialize_with = "Option::deserialize")]
pub format: Option<String>,
/// ID of the Volume.
#[serde(rename = "id")]
pub id: i64,
/// 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>,
/// Device path on the file system for the Volume.
#[serde(rename = "linux_device")]
pub linux_device: String,
#[serde(rename = "location")]
pub location: Box<models::Location>,
/// Name of the Resource. Must be unique per Project.
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "protection")]
pub protection: Box<models::Protection>,
/// ID of the Server the Volume is attached to, null if it is not attached at all.
#[serde(rename = "server", deserialize_with = "Option::deserialize")]
pub server: Option<i64>,
/// Size in GB of the Volume.
#[serde(rename = "size")]
pub size: f64,
/// Status of the Volume.
#[serde(rename = "status")]
pub status: Status,
}
impl Volume {
/// A Volume is a highly-available, scalable, and SSD-based block storage for Servers. Pricing for Volumes depends on the Volume size and Location, not the actual used storage. Please see [Hetzner Wiki](https://wiki.hetzner.de/index.php/CloudServer/en#Volumes) for more details about Volumes.
pub fn new(
created: String,
format: Option<String>,
id: i64,
labels: std::collections::HashMap<String, String>,
linux_device: String,
location: models::Location,
name: String,
protection: models::Protection,
server: Option<i64>,
size: f64,
status: Status,
) -> Volume {
Volume {
created,
format,
id,
labels,
linux_device,
location: Box::new(location),
name,
protection: Box::new(protection),
server,
size,
status,
}
}
}
/// Status of the Volume.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "available")]
Available,
#[serde(rename = "creating")]
Creating,
}
impl Default for Status {
fn default() -> Status {
Self::Available
}
}