proxmox_api/generated/nodes/node/storage/storage/
content.rs1pub mod volume;
2pub struct ContentClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> ContentClient<T>
7where
8 T: crate::client::Client,
9{
10 pub fn new(client: T, parent_path: &str) -> Self {
11 Self {
12 client,
13 path: format!("{}{}", parent_path, "/content"),
14 }
15 }
16}
17impl<T> ContentClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "List storage content."]
22 pub fn get(&self, params: GetParams) -> Result<Vec<GetOutputItems>, T::Error> {
23 let path = self.path.to_string();
24 self.client.get(&path, ¶ms)
25 }
26}
27impl<T> ContentClient<T>
28where
29 T: crate::client::Client,
30{
31 #[doc = "Allocate disk images."]
32 pub fn post(&self, params: PostParams) -> Result<String, T::Error> {
33 let path = self.path.to_string();
34 self.client.post(&path, ¶ms)
35 }
36}
37impl GetOutputItems {
38 pub fn new(format: String, size: u64, volid: String) -> Self {
39 Self {
40 format,
41 size,
42 volid,
43 ctime: Default::default(),
44 encrypted: Default::default(),
45 notes: Default::default(),
46 parent: Default::default(),
47 protected: Default::default(),
48 used: Default::default(),
49 verification: Default::default(),
50 vmid: Default::default(),
51 additional_properties: Default::default(),
52 }
53 }
54}
55#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
56pub struct GetOutputItems {
57 #[serde(
58 serialize_with = "crate::types::serialize_int_optional",
59 deserialize_with = "crate::types::deserialize_int_optional"
60 )]
61 #[serde(skip_serializing_if = "Option::is_none", default)]
62 #[doc = "Creation time (seconds since the UNIX Epoch)."]
63 pub ctime: Option<u64>,
64 #[serde(skip_serializing_if = "Option::is_none", default)]
65 #[doc = "If whole backup is encrypted, value is the fingerprint or '1' if encrypted. Only useful for the Proxmox Backup Server storage type."]
66 pub encrypted: Option<String>,
67 #[doc = "Format identifier ('raw', 'qcow2', 'subvol', 'iso', 'tgz' ...)"]
68 pub format: String,
69 #[serde(skip_serializing_if = "Option::is_none", default)]
70 #[doc = "Optional notes. If they contain multiple lines, only the first one is returned here."]
71 pub notes: Option<String>,
72 #[serde(skip_serializing_if = "Option::is_none", default)]
73 #[doc = "Volume identifier of parent (for linked cloned)."]
74 pub parent: Option<String>,
75 #[serde(
76 serialize_with = "crate::types::serialize_bool_optional",
77 deserialize_with = "crate::types::deserialize_bool_optional"
78 )]
79 #[serde(skip_serializing_if = "Option::is_none", default)]
80 #[doc = "Protection status. Currently only supported for backups."]
81 pub protected: Option<bool>,
82 #[serde(
83 serialize_with = "crate::types::serialize_int",
84 deserialize_with = "crate::types::deserialize_int"
85 )]
86 #[doc = "Volume size in bytes."]
87 pub size: u64,
88 #[serde(
89 serialize_with = "crate::types::serialize_int_optional",
90 deserialize_with = "crate::types::deserialize_int_optional"
91 )]
92 #[serde(skip_serializing_if = "Option::is_none", default)]
93 #[doc = "Used space. Please note that most storage plugins do not report anything useful here."]
94 pub used: Option<u64>,
95 #[serde(skip_serializing_if = "Option::is_none", default)]
96 #[doc = "Last backup verification result, only useful for PBS storages."]
97 pub verification: Option<VerificationGetOutputItemsVerification>,
98 #[serde(
99 serialize_with = "crate::types::serialize_int_optional",
100 deserialize_with = "crate::types::deserialize_int_optional"
101 )]
102 #[serde(skip_serializing_if = "Option::is_none", default)]
103 #[doc = "Associated Owner VMID."]
104 pub vmid: Option<u64>,
105 #[doc = "Volume identifier."]
106 pub volid: String,
107 #[serde(
108 flatten,
109 default,
110 skip_serializing_if = "::std::collections::HashMap::is_empty"
111 )]
112 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
113}
114#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
115pub struct GetParams {
116 #[serde(skip_serializing_if = "Option::is_none", default)]
117 #[doc = "Only list content of this type."]
118 pub content: Option<String>,
119 #[serde(skip_serializing_if = "Option::is_none", default)]
120 #[doc = "Only list images for this VM"]
121 pub vmid: Option<crate::types::VmId>,
122 #[serde(
123 flatten,
124 default,
125 skip_serializing_if = "::std::collections::HashMap::is_empty"
126 )]
127 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
128}
129impl PostParams {
130 pub fn new(filename: String, size: String, vmid: crate::types::VmId) -> Self {
131 Self {
132 filename,
133 size,
134 vmid,
135 format: Default::default(),
136 additional_properties: Default::default(),
137 }
138 }
139}
140#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
141pub struct PostParams {
142 #[doc = "The name of the file to create."]
143 pub filename: String,
144 #[serde(skip_serializing_if = "Option::is_none", default)]
145 pub format: Option<Format>,
146 #[doc = "Size in kilobyte (1024 bytes). Optional suffixes 'M' (megabyte, 1024K) and 'G' (gigabyte, 1024M)"]
147 pub size: String,
148 #[doc = "Specify owner VM"]
149 pub vmid: crate::types::VmId,
150 #[serde(
151 flatten,
152 default,
153 skip_serializing_if = "::std::collections::HashMap::is_empty"
154 )]
155 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
156}
157impl VerificationGetOutputItemsVerification {
158 pub fn new(state: String, upid: String) -> Self {
159 Self {
160 state,
161 upid,
162 additional_properties: Default::default(),
163 }
164 }
165}
166#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
167pub struct VerificationGetOutputItemsVerification {
168 #[doc = "Last backup verification state."]
169 pub state: String,
170 #[doc = "Last backup verification UPID."]
171 pub upid: String,
172 #[serde(
173 flatten,
174 default,
175 skip_serializing_if = "::std::collections::HashMap::is_empty"
176 )]
177 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
178}
179#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
180pub enum Format {
181 #[serde(rename = "qcow2")]
182 Qcow2,
183 #[serde(rename = "raw")]
184 Raw,
185 #[serde(rename = "subvol")]
186 Subvol,
187}
188impl<T> ContentClient<T>
189where
190 T: crate::client::Client,
191{
192 pub fn volume(&self, volume: &str) -> volume::VolumeClient<T> {
193 volume::VolumeClient::<T>::new(self.client.clone(), &self.path, volume)
194 }
195}