1pub mod storage;
2pub struct StorageClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> StorageClient<T>
7where
8 T: crate::client::Client,
9{
10 pub fn new(client: T) -> Self {
11 Self {
12 client,
13 path: "/storage".to_string(),
14 }
15 }
16}
17impl<T> StorageClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Storage index."]
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> StorageClient<T>
28where
29 T: crate::client::Client,
30{
31 #[doc = "Create a new storage."]
32 pub fn post(&self, params: PostParams) -> Result<PostOutput, T::Error> {
33 let path = self.path.to_string();
34 self.client.post(&path, ¶ms)
35 }
36}
37#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
38pub struct ConfigPostOutputConfig {
39 #[serde(rename = "encryption-key")]
40 #[serde(skip_serializing_if = "Option::is_none", default)]
41 #[doc = "The, possible auto-generated, encryption-key."]
42 pub encryption_key: Option<String>,
43 #[serde(
44 flatten,
45 default,
46 skip_serializing_if = "::std::collections::HashMap::is_empty"
47 )]
48 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
49}
50impl GetOutputItems {
51 pub fn new(storage: String) -> Self {
52 Self {
53 storage,
54 additional_properties: Default::default(),
55 }
56 }
57}
58#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
59pub struct GetOutputItems {
60 pub storage: String,
61 #[serde(
62 flatten,
63 default,
64 skip_serializing_if = "::std::collections::HashMap::is_empty"
65 )]
66 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
67}
68#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
69pub struct GetParams {
70 #[serde(rename = "type")]
71 #[serde(skip_serializing_if = "Option::is_none", default)]
72 #[doc = "Only list storage of specific type"]
73 pub ty: Option<Type>,
74 #[serde(
75 flatten,
76 default,
77 skip_serializing_if = "::std::collections::HashMap::is_empty"
78 )]
79 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
80}
81impl PostOutput {
82 pub fn new(storage: String, ty: Type) -> Self {
83 Self {
84 storage,
85 ty,
86 config: Default::default(),
87 additional_properties: Default::default(),
88 }
89 }
90}
91#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
92pub struct PostOutput {
93 #[serde(skip_serializing_if = "Option::is_none", default)]
94 #[doc = "Partial, possible server generated, configuration properties."]
95 pub config: Option<ConfigPostOutputConfig>,
96 #[doc = "The ID of the created storage."]
97 pub storage: String,
98 #[serde(rename = "type")]
99 #[doc = "The type of the created storage."]
100 pub ty: Type,
101 #[serde(
102 flatten,
103 default,
104 skip_serializing_if = "::std::collections::HashMap::is_empty"
105 )]
106 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
107}
108impl PostParams {
109 pub fn new(storage: String, ty: Type) -> Self {
110 Self {
111 storage,
112 ty,
113 authsupported: Default::default(),
114 base: Default::default(),
115 blocksize: Default::default(),
116 bwlimit: Default::default(),
117 comstar_hg: Default::default(),
118 comstar_tg: Default::default(),
119 content: Default::default(),
120 content_dirs: Default::default(),
121 create_base_path: Default::default(),
122 create_subdirs: Default::default(),
123 data_pool: Default::default(),
124 datastore: Default::default(),
125 disable: Default::default(),
126 domain: Default::default(),
127 encryption_key: Default::default(),
128 export: Default::default(),
129 fingerprint: Default::default(),
130 format: Default::default(),
131 fs_name: Default::default(),
132 fuse: Default::default(),
133 is_mountpoint: Default::default(),
134 iscsiprovider: Default::default(),
135 keyring: Default::default(),
136 krbd: Default::default(),
137 lio_tpg: Default::default(),
138 master_pubkey: Default::default(),
139 max_protected_backups: Default::default(),
140 maxfiles: Default::default(),
141 mkdir: Default::default(),
142 monhost: Default::default(),
143 mountpoint: Default::default(),
144 namespace: Default::default(),
145 nocow: Default::default(),
146 nodes: Default::default(),
147 nowritecache: Default::default(),
148 options: Default::default(),
149 password: Default::default(),
150 path: Default::default(),
151 pool: Default::default(),
152 port: Default::default(),
153 portal: Default::default(),
154 preallocation: Default::default(),
155 prune_backups: Default::default(),
156 saferemove: Default::default(),
157 saferemove_throughput: Default::default(),
158 server: Default::default(),
159 server2: Default::default(),
160 share: Default::default(),
161 shared: Default::default(),
162 skip_cert_verification: Default::default(),
163 smbversion: Default::default(),
164 sparse: Default::default(),
165 subdir: Default::default(),
166 tagged_only: Default::default(),
167 target: Default::default(),
168 thinpool: Default::default(),
169 transport: Default::default(),
170 username: Default::default(),
171 vgname: Default::default(),
172 volume: Default::default(),
173 additional_properties: Default::default(),
174 }
175 }
176}
177#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
178pub struct PostParams {
179 #[serde(skip_serializing_if = "Option::is_none", default)]
180 #[doc = "Authsupported."]
181 pub authsupported: Option<String>,
182 #[serde(skip_serializing_if = "Option::is_none", default)]
183 #[doc = "Base volume. This volume is automatically activated."]
184 pub base: Option<String>,
185 #[serde(skip_serializing_if = "Option::is_none", default)]
186 #[doc = "block size"]
187 pub blocksize: Option<String>,
188 #[serde(skip_serializing_if = "Option::is_none", default)]
189 #[doc = "Set I/O bandwidth limit for various operations (in KiB/s)."]
190 pub bwlimit: Option<String>,
191 #[serde(skip_serializing_if = "Option::is_none", default)]
192 #[doc = "host group for comstar views"]
193 pub comstar_hg: Option<String>,
194 #[serde(skip_serializing_if = "Option::is_none", default)]
195 #[doc = "target group for comstar views"]
196 pub comstar_tg: Option<String>,
197 #[serde(skip_serializing_if = "Option::is_none", default)]
198 #[doc = "Allowed content types.\n\nNOTE: the value 'rootdir' is used for Containers, and value 'images' for VMs.\n"]
199 pub content: Option<String>,
200 #[serde(rename = "content-dirs")]
201 #[serde(skip_serializing_if = "Option::is_none", default)]
202 #[doc = "Overrides for default content type directories."]
203 pub content_dirs: Option<String>,
204 #[serde(rename = "create-base-path")]
205 #[serde(skip_serializing_if = "Option::is_none", default)]
206 #[doc = "Create the base directory if it doesn't exist."]
207 pub create_base_path: Option<()>,
208 #[serde(rename = "create-subdirs")]
209 #[serde(skip_serializing_if = "Option::is_none", default)]
210 #[doc = "Populate the directory with the default structure."]
211 pub create_subdirs: Option<()>,
212 #[serde(rename = "data-pool")]
213 #[serde(skip_serializing_if = "Option::is_none", default)]
214 #[doc = "Data Pool (for erasure coding only)"]
215 pub data_pool: Option<String>,
216 #[serde(skip_serializing_if = "Option::is_none", default)]
217 #[doc = "Proxmox Backup Server datastore name."]
218 pub datastore: Option<String>,
219 #[serde(
220 serialize_with = "crate::types::serialize_bool_optional",
221 deserialize_with = "crate::types::deserialize_bool_optional"
222 )]
223 #[serde(skip_serializing_if = "Option::is_none", default)]
224 #[doc = "Flag to disable the storage."]
225 pub disable: Option<bool>,
226 #[serde(skip_serializing_if = "Option::is_none", default)]
227 #[doc = "CIFS domain."]
228 pub domain: Option<String>,
229 #[serde(rename = "encryption-key")]
230 #[serde(skip_serializing_if = "Option::is_none", default)]
231 #[doc = "Encryption key. Use 'autogen' to generate one automatically without passphrase."]
232 pub encryption_key: Option<String>,
233 #[serde(skip_serializing_if = "Option::is_none", default)]
234 #[doc = "NFS export path."]
235 pub export: Option<String>,
236 #[serde(skip_serializing_if = "Option::is_none", default)]
237 #[doc = "Certificate SHA 256 fingerprint."]
238 pub fingerprint: Option<String>,
239 #[serde(skip_serializing_if = "Option::is_none", default)]
240 #[doc = "Default image format."]
241 pub format: Option<String>,
242 #[serde(rename = "fs-name")]
243 #[serde(skip_serializing_if = "Option::is_none", default)]
244 #[doc = "The Ceph filesystem name."]
245 pub fs_name: Option<String>,
246 #[serde(
247 serialize_with = "crate::types::serialize_bool_optional",
248 deserialize_with = "crate::types::deserialize_bool_optional"
249 )]
250 #[serde(skip_serializing_if = "Option::is_none", default)]
251 #[doc = "Mount CephFS through FUSE."]
252 pub fuse: Option<bool>,
253 #[serde(skip_serializing_if = "Option::is_none", default)]
254 #[doc = "Assume the given path is an externally managed mountpoint and consider the storage offline if it is not mounted. Using a boolean (yes/no) value serves as a shortcut to using the target path in this field."]
255 pub is_mountpoint: Option<String>,
256 #[serde(skip_serializing_if = "Option::is_none", default)]
257 #[doc = "iscsi provider"]
258 pub iscsiprovider: Option<String>,
259 #[serde(skip_serializing_if = "Option::is_none", default)]
260 #[doc = "Client keyring contents (for external clusters)."]
261 pub keyring: Option<String>,
262 #[serde(
263 serialize_with = "crate::types::serialize_bool_optional",
264 deserialize_with = "crate::types::deserialize_bool_optional"
265 )]
266 #[serde(skip_serializing_if = "Option::is_none", default)]
267 #[doc = "Always access rbd through krbd kernel module."]
268 pub krbd: Option<bool>,
269 #[serde(skip_serializing_if = "Option::is_none", default)]
270 #[doc = "target portal group for Linux LIO targets"]
271 pub lio_tpg: Option<String>,
272 #[serde(rename = "master-pubkey")]
273 #[serde(skip_serializing_if = "Option::is_none", default)]
274 #[doc = "Base64-encoded, PEM-formatted public RSA key. Used to encrypt a copy of the encryption-key which will be added to each encrypted backup."]
275 pub master_pubkey: Option<String>,
276 #[serde(rename = "max-protected-backups")]
277 #[serde(skip_serializing_if = "Option::is_none", default)]
278 #[doc = "Maximal number of protected backups per guest. Use '-1' for unlimited."]
279 pub max_protected_backups: Option<()>,
280 #[serde(
281 serialize_with = "crate::types::serialize_int_optional",
282 deserialize_with = "crate::types::deserialize_int_optional"
283 )]
284 #[serde(skip_serializing_if = "Option::is_none", default)]
285 #[doc = "Deprecated: use 'prune-backups' instead. Maximal number of backup files per VM. Use '0' for unlimited."]
286 pub maxfiles: Option<u64>,
287 #[serde(skip_serializing_if = "Option::is_none", default)]
288 #[doc = "Create the directory if it doesn't exist and populate it with default sub-dirs. NOTE: Deprecated, use the 'create-base-path' and 'create-subdirs' options instead."]
289 pub mkdir: Option<()>,
290 #[serde(skip_serializing_if = "Option::is_none", default)]
291 #[doc = "IP addresses of monitors (for external clusters)."]
292 pub monhost: Option<String>,
293 #[serde(skip_serializing_if = "Option::is_none", default)]
294 #[doc = "mount point"]
295 pub mountpoint: Option<String>,
296 #[serde(skip_serializing_if = "Option::is_none", default)]
297 #[doc = "Namespace."]
298 pub namespace: Option<String>,
299 #[serde(
300 serialize_with = "crate::types::serialize_bool_optional",
301 deserialize_with = "crate::types::deserialize_bool_optional"
302 )]
303 #[serde(skip_serializing_if = "Option::is_none", default)]
304 #[doc = "Set the NOCOW flag on files. Disables data checksumming and causes data errors to be unrecoverable from while allowing direct I/O. Only use this if data does not need to be any more safe than on a single ext4 formatted disk with no underlying raid system."]
305 pub nocow: Option<bool>,
306 #[serde(skip_serializing_if = "Option::is_none", default)]
307 #[doc = "List of nodes for which the storage configuration applies."]
308 pub nodes: Option<String>,
309 #[serde(
310 serialize_with = "crate::types::serialize_bool_optional",
311 deserialize_with = "crate::types::deserialize_bool_optional"
312 )]
313 #[serde(skip_serializing_if = "Option::is_none", default)]
314 #[doc = "disable write caching on the target"]
315 pub nowritecache: Option<bool>,
316 #[serde(skip_serializing_if = "Option::is_none", default)]
317 #[doc = "NFS/CIFS mount options (see 'man nfs' or 'man mount.cifs')"]
318 pub options: Option<String>,
319 #[serde(skip_serializing_if = "Option::is_none", default)]
320 #[doc = "Password for accessing the share/datastore."]
321 pub password: Option<String>,
322 #[serde(skip_serializing_if = "Option::is_none", default)]
323 #[doc = "File system path."]
324 pub path: Option<String>,
325 #[serde(skip_serializing_if = "Option::is_none", default)]
326 #[doc = "Pool."]
327 pub pool: Option<String>,
328 #[serde(
329 serialize_with = "crate::types::serialize_int_optional",
330 deserialize_with = "crate::types::deserialize_int_optional"
331 )]
332 #[serde(skip_serializing_if = "Option::is_none", default)]
333 #[doc = "For non default port."]
334 pub port: Option<u64>,
335 #[serde(skip_serializing_if = "Option::is_none", default)]
336 #[doc = "iSCSI portal (IP or DNS name with optional port)."]
337 pub portal: Option<String>,
338 #[serde(skip_serializing_if = "Option::is_none", default)]
339 #[doc = "Preallocation mode for raw and qcow2 images. Using 'metadata' on raw images results in preallocation=off."]
340 pub preallocation: Option<Preallocation>,
341 #[serde(rename = "prune-backups")]
342 #[serde(skip_serializing_if = "Option::is_none", default)]
343 #[doc = "The retention options with shorter intervals are processed first with --keep-last being the very first one. Each option covers a specific period of time. We say that backups within this period are covered by this option. The next option does not take care of already covered backups and only considers older backups."]
344 pub prune_backups: Option<String>,
345 #[serde(
346 serialize_with = "crate::types::serialize_bool_optional",
347 deserialize_with = "crate::types::deserialize_bool_optional"
348 )]
349 #[serde(skip_serializing_if = "Option::is_none", default)]
350 #[doc = "Zero-out data when removing LVs."]
351 pub saferemove: Option<bool>,
352 #[serde(skip_serializing_if = "Option::is_none", default)]
353 #[doc = "Wipe throughput (cstream -t parameter value)."]
354 pub saferemove_throughput: Option<String>,
355 #[serde(skip_serializing_if = "Option::is_none", default)]
356 #[doc = "Server IP or DNS name."]
357 pub server: Option<String>,
358 #[serde(skip_serializing_if = "Option::is_none", default)]
359 #[doc = "Backup volfile server IP or DNS name."]
360 pub server2: Option<String>,
361 #[serde(skip_serializing_if = "Option::is_none", default)]
362 #[doc = "CIFS share."]
363 pub share: Option<String>,
364 #[serde(
365 serialize_with = "crate::types::serialize_bool_optional",
366 deserialize_with = "crate::types::deserialize_bool_optional"
367 )]
368 #[serde(skip_serializing_if = "Option::is_none", default)]
369 #[doc = "Indicate that this is a single storage with the same contents on all nodes (or all listed in the 'nodes' option). It will not make the contents of a local storage automatically accessible to other nodes, it just marks an already shared storage as such!"]
370 pub shared: Option<bool>,
371 #[serde(rename = "skip-cert-verification")]
372 #[serde(skip_serializing_if = "Option::is_none", default)]
373 #[doc = "Disable TLS certificate verification, only enable on fully trusted networks!"]
374 pub skip_cert_verification: Option<()>,
375 #[serde(skip_serializing_if = "Option::is_none", default)]
376 #[doc = "SMB protocol version. 'default' if not set, negotiates the highest SMB2+ version supported by both the client and server."]
377 pub smbversion: Option<Smbversion>,
378 #[serde(
379 serialize_with = "crate::types::serialize_bool_optional",
380 deserialize_with = "crate::types::deserialize_bool_optional"
381 )]
382 #[serde(skip_serializing_if = "Option::is_none", default)]
383 #[doc = "use sparse volumes"]
384 pub sparse: Option<bool>,
385 #[doc = "The storage identifier."]
386 pub storage: String,
387 #[serde(skip_serializing_if = "Option::is_none", default)]
388 #[doc = "Subdir to mount."]
389 pub subdir: Option<String>,
390 #[serde(
391 serialize_with = "crate::types::serialize_bool_optional",
392 deserialize_with = "crate::types::deserialize_bool_optional"
393 )]
394 #[serde(skip_serializing_if = "Option::is_none", default)]
395 #[doc = "Only use logical volumes tagged with 'pve-vm-ID'."]
396 pub tagged_only: Option<bool>,
397 #[serde(skip_serializing_if = "Option::is_none", default)]
398 #[doc = "iSCSI target."]
399 pub target: Option<String>,
400 #[serde(skip_serializing_if = "Option::is_none", default)]
401 #[doc = "LVM thin pool LV name."]
402 pub thinpool: Option<String>,
403 #[serde(skip_serializing_if = "Option::is_none", default)]
404 #[doc = "Gluster transport: tcp or rdma"]
405 pub transport: Option<Transport>,
406 #[serde(rename = "type")]
407 #[doc = "Storage type."]
408 pub ty: Type,
409 #[serde(skip_serializing_if = "Option::is_none", default)]
410 #[doc = "RBD Id."]
411 pub username: Option<String>,
412 #[serde(skip_serializing_if = "Option::is_none", default)]
413 #[doc = "Volume group name."]
414 pub vgname: Option<String>,
415 #[serde(skip_serializing_if = "Option::is_none", default)]
416 #[doc = "Glusterfs Volume."]
417 pub volume: Option<String>,
418 #[serde(
419 flatten,
420 default,
421 skip_serializing_if = "::std::collections::HashMap::is_empty"
422 )]
423 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
424}
425#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
426pub enum Preallocation {
427 #[serde(rename = "falloc")]
428 Falloc,
429 #[serde(rename = "full")]
430 Full,
431 #[serde(rename = "metadata")]
432 Metadata,
433 #[serde(rename = "off")]
434 Off,
435}
436impl Default for Preallocation {
437 fn default() -> Self {
438 Self::Metadata
439 }
440}
441#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
442pub enum Smbversion {
443 #[serde(rename = "2.0")]
444 _20,
445 #[serde(rename = "2.1")]
446 _21,
447 #[serde(rename = "3")]
448 _3,
449 #[serde(rename = "3.0")]
450 _30,
451 #[serde(rename = "3.11")]
452 _311,
453 #[serde(rename = "default")]
454 Default,
455}
456impl Default for Smbversion {
457 fn default() -> Self {
458 Self::Default
459 }
460}
461#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
462pub enum Transport {
463 #[serde(rename = "rdma")]
464 Rdma,
465 #[serde(rename = "tcp")]
466 Tcp,
467 #[serde(rename = "unix")]
468 Unix,
469}
470#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
471pub enum Type {
472 #[serde(rename = "btrfs")]
473 Btrfs,
474 #[serde(rename = "cephfs")]
475 Cephfs,
476 #[serde(rename = "cifs")]
477 Cifs,
478 #[serde(rename = "dir")]
479 Dir,
480 #[serde(rename = "esxi")]
481 Esxi,
482 #[serde(rename = "glusterfs")]
483 Glusterfs,
484 #[serde(rename = "iscsi")]
485 Iscsi,
486 #[serde(rename = "iscsidirect")]
487 Iscsidirect,
488 #[serde(rename = "lvm")]
489 Lvm,
490 #[serde(rename = "lvmthin")]
491 Lvmthin,
492 #[serde(rename = "nfs")]
493 Nfs,
494 #[serde(rename = "pbs")]
495 Pbs,
496 #[serde(rename = "rbd")]
497 Rbd,
498 #[serde(rename = "zfs")]
499 Zfs,
500 #[serde(rename = "zfspool")]
501 Zfspool,
502}
503impl<T> StorageClient<T>
504where
505 T: crate::client::Client,
506{
507 pub fn storage(&self, storage: &str) -> storage::StorageClient<T> {
508 storage::StorageClient::<T>::new(self.client.clone(), &self.path, storage)
509 }
510}