1pub mod storage;
2#[derive(Debug, Clone)]
3pub struct StorageClient<T> {
4 client: T,
5 path: String,
6}
7impl<T> StorageClient<T>
8where
9 T: crate::client::Client,
10{
11 pub fn new(client: T) -> Self {
12 Self {
13 client,
14 path: "/storage".to_string(),
15 }
16 }
17}
18impl<T> StorageClient<T>
19where
20 T: crate::client::Client,
21{
22 #[doc = "Storage index."]
23 #[doc = ""]
24 #[doc = "Only list entries where you have 'Datastore.Audit' or 'Datastore.AllocateSpace' permissions on '/storage/\\<storage\\>'"]
25 pub async fn get(&self, params: GetParams) -> Result<Vec<GetOutputItems>, T::Error> {
26 let path = self.path.to_string();
27 let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, ¶ms).await?;
28 Ok(optional_vec.unwrap_or_default())
29 }
30}
31impl<T> StorageClient<T>
32where
33 T: crate::client::Client,
34{
35 #[doc = "Create a new storage."]
36 #[doc = ""]
37 #[doc = "Permission check: perm(\"/storage\", [\"Datastore.Allocate\"])"]
38 pub async fn post(&self, params: PostParams) -> Result<PostOutput, T::Error> {
39 let path = self.path.to_string();
40 self.client.post(&path, ¶ms).await
41 }
42}
43#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
44pub struct ConfigPostOutputConfig {
45 #[serde(rename = "encryption-key")]
46 #[serde(skip_serializing_if = "Option::is_none", default)]
47 #[doc = "The, possibly auto-generated, encryption-key."]
48 #[doc = ""]
49 pub encryption_key: Option<String>,
50 #[serde(
51 flatten,
52 default,
53 skip_serializing_if = "::std::collections::HashMap::is_empty"
54 )]
55 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
56}
57impl GetOutputItems {
58 pub fn new(storage: String) -> Self {
59 Self {
60 storage,
61 additional_properties: ::std::default::Default::default(),
62 }
63 }
64}
65#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
66pub struct GetOutputItems {
67 pub storage: String,
68 #[serde(
69 flatten,
70 default,
71 skip_serializing_if = "::std::collections::HashMap::is_empty"
72 )]
73 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
74}
75#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
76pub struct GetParams {
77 #[serde(rename = "type")]
78 #[serde(skip_serializing_if = "Option::is_none", default)]
79 #[doc = "Only list storage of specific type"]
80 #[doc = ""]
81 pub ty: Option<Type>,
82 #[serde(
83 flatten,
84 default,
85 skip_serializing_if = "::std::collections::HashMap::is_empty"
86 )]
87 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
88}
89impl PostOutput {
90 pub fn new(storage: String, ty: Type) -> Self {
91 Self {
92 storage,
93 ty,
94 config: ::std::default::Default::default(),
95 additional_properties: ::std::default::Default::default(),
96 }
97 }
98}
99#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
100pub struct PostOutput {
101 #[serde(skip_serializing_if = "Option::is_none", default)]
102 #[doc = "Partial, possibly server generated, configuration properties."]
103 #[doc = ""]
104 pub config: Option<ConfigPostOutputConfig>,
105 #[doc = "The ID of the created storage."]
106 #[doc = ""]
107 pub storage: String,
108 #[serde(rename = "type")]
109 #[doc = "The type of the created storage."]
110 #[doc = ""]
111 pub ty: Type,
112 #[serde(
113 flatten,
114 default,
115 skip_serializing_if = "::std::collections::HashMap::is_empty"
116 )]
117 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
118}
119impl PostParams {
120 pub fn new(storage: String, ty: Type) -> Self {
121 Self {
122 storage,
123 ty,
124 authsupported: ::std::default::Default::default(),
125 base: ::std::default::Default::default(),
126 blocksize: ::std::default::Default::default(),
127 bwlimit: ::std::default::Default::default(),
128 comstar_hg: ::std::default::Default::default(),
129 comstar_tg: ::std::default::Default::default(),
130 content: ::std::default::Default::default(),
131 content_dirs: ::std::default::Default::default(),
132 create_base_path: ::std::default::Default::default(),
133 create_subdirs: ::std::default::Default::default(),
134 data_pool: ::std::default::Default::default(),
135 datastore: ::std::default::Default::default(),
136 disable: ::std::default::Default::default(),
137 domain: ::std::default::Default::default(),
138 encryption_key: ::std::default::Default::default(),
139 export: ::std::default::Default::default(),
140 fingerprint: ::std::default::Default::default(),
141 format: ::std::default::Default::default(),
142 fs_name: ::std::default::Default::default(),
143 fuse: ::std::default::Default::default(),
144 is_mountpoint: ::std::default::Default::default(),
145 iscsiprovider: ::std::default::Default::default(),
146 keyring: ::std::default::Default::default(),
147 krbd: ::std::default::Default::default(),
148 lio_tpg: ::std::default::Default::default(),
149 master_pubkey: ::std::default::Default::default(),
150 max_protected_backups: ::std::default::Default::default(),
151 mkdir: ::std::default::Default::default(),
152 monhost: ::std::default::Default::default(),
153 mountpoint: ::std::default::Default::default(),
154 namespace: ::std::default::Default::default(),
155 nocow: ::std::default::Default::default(),
156 nodes: ::std::default::Default::default(),
157 nowritecache: ::std::default::Default::default(),
158 options: ::std::default::Default::default(),
159 password: ::std::default::Default::default(),
160 path: ::std::default::Default::default(),
161 pool: ::std::default::Default::default(),
162 port: ::std::default::Default::default(),
163 portal: ::std::default::Default::default(),
164 preallocation: ::std::default::Default::default(),
165 prune_backups: ::std::default::Default::default(),
166 saferemove: ::std::default::Default::default(),
167 saferemove_stepsize: ::std::default::Default::default(),
168 saferemove_throughput: ::std::default::Default::default(),
169 server: ::std::default::Default::default(),
170 share: ::std::default::Default::default(),
171 shared: ::std::default::Default::default(),
172 skip_cert_verification: ::std::default::Default::default(),
173 smbversion: ::std::default::Default::default(),
174 snapshot_as_volume_chain: ::std::default::Default::default(),
175 sparse: ::std::default::Default::default(),
176 subdir: ::std::default::Default::default(),
177 tagged_only: ::std::default::Default::default(),
178 target: ::std::default::Default::default(),
179 thinpool: ::std::default::Default::default(),
180 username: ::std::default::Default::default(),
181 vgname: ::std::default::Default::default(),
182 zfs_base_path: ::std::default::Default::default(),
183 additional_properties: ::std::default::Default::default(),
184 }
185 }
186}
187#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
188pub struct PostParams {
189 #[serde(skip_serializing_if = "Option::is_none", default)]
190 #[doc = "Authsupported."]
191 #[doc = ""]
192 pub authsupported: Option<String>,
193 #[serde(skip_serializing_if = "Option::is_none", default)]
194 #[doc = "Base volume. This volume is automatically activated."]
195 #[doc = ""]
196 pub base: Option<String>,
197 #[serde(skip_serializing_if = "Option::is_none", default)]
198 #[doc = "block size"]
199 #[doc = ""]
200 pub blocksize: Option<String>,
201 #[serde(skip_serializing_if = "Option::is_none", default)]
202 #[doc = "Set I/O bandwidth limit for various operations (in KiB/s)."]
203 #[doc = ""]
204 pub bwlimit: Option<String>,
205 #[serde(skip_serializing_if = "Option::is_none", default)]
206 #[doc = "host group for comstar views"]
207 #[doc = ""]
208 pub comstar_hg: Option<String>,
209 #[serde(skip_serializing_if = "Option::is_none", default)]
210 #[doc = "target group for comstar views"]
211 #[doc = ""]
212 pub comstar_tg: Option<String>,
213 #[serde(skip_serializing_if = "Option::is_none", default)]
214 #[doc = "Allowed content types."]
215 #[doc = ""]
216 #[doc = "NOTE: the value 'rootdir' is used for Containers, and value 'images' for VMs."]
217 #[doc = ""]
218 pub content: Option<String>,
219 #[serde(rename = "content-dirs")]
220 #[serde(skip_serializing_if = "Option::is_none", default)]
221 #[doc = "Overrides for default content type directories."]
222 #[doc = ""]
223 pub content_dirs: Option<String>,
224 #[serde(rename = "create-base-path")]
225 #[serde(
226 serialize_with = "crate::types::serialize_bool_optional",
227 deserialize_with = "crate::types::deserialize_bool_optional"
228 )]
229 #[serde(skip_serializing_if = "Option::is_none", default)]
230 #[doc = "Create the base directory if it doesn't exist."]
231 #[doc = ""]
232 pub create_base_path: Option<bool>,
233 #[serde(rename = "create-subdirs")]
234 #[serde(
235 serialize_with = "crate::types::serialize_bool_optional",
236 deserialize_with = "crate::types::deserialize_bool_optional"
237 )]
238 #[serde(skip_serializing_if = "Option::is_none", default)]
239 #[doc = "Populate the directory with the default structure."]
240 #[doc = ""]
241 pub create_subdirs: Option<bool>,
242 #[serde(rename = "data-pool")]
243 #[serde(skip_serializing_if = "Option::is_none", default)]
244 #[doc = "Data Pool (for erasure coding only)"]
245 #[doc = ""]
246 pub data_pool: Option<String>,
247 #[serde(skip_serializing_if = "Option::is_none", default)]
248 #[doc = "Proxmox Backup Server datastore name."]
249 #[doc = ""]
250 pub datastore: Option<String>,
251 #[serde(
252 serialize_with = "crate::types::serialize_bool_optional",
253 deserialize_with = "crate::types::deserialize_bool_optional"
254 )]
255 #[serde(skip_serializing_if = "Option::is_none", default)]
256 #[doc = "Flag to disable the storage."]
257 #[doc = ""]
258 pub disable: Option<bool>,
259 #[serde(skip_serializing_if = "Option::is_none", default)]
260 #[doc = "CIFS domain."]
261 #[doc = ""]
262 pub domain: Option<DomainStr>,
263 #[serde(rename = "encryption-key")]
264 #[serde(skip_serializing_if = "Option::is_none", default)]
265 #[doc = "Encryption key. Use 'autogen' to generate one automatically without passphrase."]
266 #[doc = ""]
267 pub encryption_key: Option<String>,
268 #[serde(skip_serializing_if = "Option::is_none", default)]
269 #[doc = "NFS export path."]
270 #[doc = ""]
271 pub export: Option<String>,
272 #[serde(skip_serializing_if = "Option::is_none", default)]
273 #[doc = "Certificate SHA 256 fingerprint."]
274 #[doc = ""]
275 pub fingerprint: Option<FingerprintStr>,
276 #[serde(skip_serializing_if = "Option::is_none", default)]
277 #[doc = "Default image format."]
278 #[doc = ""]
279 pub format: Option<Format>,
280 #[serde(rename = "fs-name")]
281 #[serde(skip_serializing_if = "Option::is_none", default)]
282 #[doc = "The Ceph filesystem name."]
283 #[doc = ""]
284 pub fs_name: Option<String>,
285 #[serde(
286 serialize_with = "crate::types::serialize_bool_optional",
287 deserialize_with = "crate::types::deserialize_bool_optional"
288 )]
289 #[serde(skip_serializing_if = "Option::is_none", default)]
290 #[doc = "Mount CephFS through FUSE."]
291 #[doc = ""]
292 pub fuse: Option<bool>,
293 #[serde(skip_serializing_if = "Option::is_none", default)]
294 #[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."]
295 #[doc = ""]
296 pub is_mountpoint: Option<String>,
297 #[serde(skip_serializing_if = "Option::is_none", default)]
298 #[doc = "iscsi provider"]
299 #[doc = ""]
300 pub iscsiprovider: Option<String>,
301 #[serde(skip_serializing_if = "Option::is_none", default)]
302 #[doc = "Client keyring contents (for external clusters)."]
303 #[doc = ""]
304 pub keyring: Option<String>,
305 #[serde(
306 serialize_with = "crate::types::serialize_bool_optional",
307 deserialize_with = "crate::types::deserialize_bool_optional"
308 )]
309 #[serde(skip_serializing_if = "Option::is_none", default)]
310 #[doc = "Always access rbd through krbd kernel module."]
311 #[doc = ""]
312 pub krbd: Option<bool>,
313 #[serde(skip_serializing_if = "Option::is_none", default)]
314 #[doc = "target portal group for Linux LIO targets"]
315 #[doc = ""]
316 pub lio_tpg: Option<String>,
317 #[serde(rename = "master-pubkey")]
318 #[serde(skip_serializing_if = "Option::is_none", default)]
319 #[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."]
320 #[doc = ""]
321 pub master_pubkey: Option<String>,
322 #[serde(rename = "max-protected-backups")]
323 #[serde(skip_serializing_if = "Option::is_none", default)]
324 #[doc = "Maximal number of protected backups per guest. Use '-1' for unlimited."]
325 #[doc = ""]
326 pub max_protected_backups: Option<MaxProtectedBackupsInt>,
327 #[serde(
328 serialize_with = "crate::types::serialize_bool_optional",
329 deserialize_with = "crate::types::deserialize_bool_optional"
330 )]
331 #[serde(skip_serializing_if = "Option::is_none", default)]
332 #[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."]
333 #[doc = ""]
334 pub mkdir: Option<bool>,
335 #[serde(skip_serializing_if = "Option::is_none", default)]
336 #[doc = "IP addresses of monitors (for external clusters)."]
337 #[doc = ""]
338 pub monhost: Option<String>,
339 #[serde(skip_serializing_if = "Option::is_none", default)]
340 #[doc = "mount point"]
341 #[doc = ""]
342 pub mountpoint: Option<String>,
343 #[serde(skip_serializing_if = "Option::is_none", default)]
344 #[doc = "Namespace."]
345 #[doc = ""]
346 pub namespace: Option<String>,
347 #[serde(
348 serialize_with = "crate::types::serialize_bool_optional",
349 deserialize_with = "crate::types::deserialize_bool_optional"
350 )]
351 #[serde(skip_serializing_if = "Option::is_none", default)]
352 #[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."]
353 #[doc = ""]
354 pub nocow: Option<bool>,
355 #[serde(skip_serializing_if = "Option::is_none", default)]
356 #[doc = "List of nodes for which the storage configuration applies."]
357 #[doc = ""]
358 pub nodes: Option<String>,
359 #[serde(
360 serialize_with = "crate::types::serialize_bool_optional",
361 deserialize_with = "crate::types::deserialize_bool_optional"
362 )]
363 #[serde(skip_serializing_if = "Option::is_none", default)]
364 #[doc = "disable write caching on the target"]
365 #[doc = ""]
366 pub nowritecache: Option<bool>,
367 #[serde(skip_serializing_if = "Option::is_none", default)]
368 #[doc = "NFS/CIFS mount options (see 'man nfs' or 'man mount.cifs')"]
369 #[doc = ""]
370 pub options: Option<String>,
371 #[serde(skip_serializing_if = "Option::is_none", default)]
372 #[doc = "Password for accessing the share/datastore."]
373 #[doc = ""]
374 pub password: Option<PasswordStr>,
375 #[serde(skip_serializing_if = "Option::is_none", default)]
376 #[doc = "File system path."]
377 #[doc = ""]
378 pub path: Option<String>,
379 #[serde(skip_serializing_if = "Option::is_none", default)]
380 #[doc = "Pool."]
381 #[doc = ""]
382 pub pool: Option<String>,
383 #[serde(skip_serializing_if = "Option::is_none", default)]
384 #[doc = "Use this port to connect to the storage instead of the default one (for example, with PBS or ESXi). For NFS and CIFS, use the 'options' option to configure the port via the mount options."]
385 #[doc = ""]
386 pub port: Option<PortInt>,
387 #[serde(skip_serializing_if = "Option::is_none", default)]
388 #[doc = "iSCSI portal (IP or DNS name with optional port)."]
389 #[doc = ""]
390 pub portal: Option<String>,
391 #[serde(skip_serializing_if = "Option::is_none", default)]
392 #[doc = "Preallocation mode for raw and qcow2 images. Using 'metadata' on raw images results in preallocation=off."]
393 #[doc = ""]
394 pub preallocation: Option<Preallocation>,
395 #[serde(rename = "prune-backups")]
396 #[serde(skip_serializing_if = "Option::is_none", default)]
397 #[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."]
398 #[doc = ""]
399 pub prune_backups: Option<String>,
400 #[serde(
401 serialize_with = "crate::types::serialize_bool_optional",
402 deserialize_with = "crate::types::deserialize_bool_optional"
403 )]
404 #[serde(skip_serializing_if = "Option::is_none", default)]
405 #[doc = "Zero-out data when removing LVs."]
406 #[doc = ""]
407 pub saferemove: Option<bool>,
408 #[serde(rename = "saferemove-stepsize")]
409 #[serde(skip_serializing_if = "Option::is_none", default)]
410 #[doc = "Wipe step size in MiB. It will be capped to the maximum supported by the storage."]
411 #[doc = ""]
412 pub saferemove_stepsize: Option<SaferemoveStepsizeInt>,
413 #[serde(skip_serializing_if = "Option::is_none", default)]
414 #[doc = "Wipe throughput (cstream -t parameter value)."]
415 #[doc = ""]
416 pub saferemove_throughput: Option<String>,
417 #[serde(skip_serializing_if = "Option::is_none", default)]
418 #[doc = "Server IP or DNS name."]
419 #[doc = ""]
420 pub server: Option<String>,
421 #[serde(skip_serializing_if = "Option::is_none", default)]
422 #[doc = "CIFS share."]
423 #[doc = ""]
424 pub share: Option<String>,
425 #[serde(
426 serialize_with = "crate::types::serialize_bool_optional",
427 deserialize_with = "crate::types::deserialize_bool_optional"
428 )]
429 #[serde(skip_serializing_if = "Option::is_none", default)]
430 #[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!"]
431 #[doc = ""]
432 pub shared: Option<bool>,
433 #[serde(rename = "skip-cert-verification")]
434 #[serde(
435 serialize_with = "crate::types::serialize_bool_optional",
436 deserialize_with = "crate::types::deserialize_bool_optional"
437 )]
438 #[serde(skip_serializing_if = "Option::is_none", default)]
439 #[doc = "Disable TLS certificate verification, only enable on fully trusted networks!"]
440 #[doc = ""]
441 pub skip_cert_verification: Option<bool>,
442 #[serde(skip_serializing_if = "Option::is_none", default)]
443 #[doc = "SMB protocol version. 'default' if not set, negotiates the highest SMB2+ version supported by both the client and server."]
444 #[doc = ""]
445 pub smbversion: Option<Smbversion>,
446 #[serde(rename = "snapshot-as-volume-chain")]
447 #[serde(
448 serialize_with = "crate::types::serialize_bool_optional",
449 deserialize_with = "crate::types::deserialize_bool_optional"
450 )]
451 #[serde(skip_serializing_if = "Option::is_none", default)]
452 #[doc = "Enable support for creating storage-vendor agnostic snapshot through volume backing-chains."]
453 #[doc = ""]
454 pub snapshot_as_volume_chain: Option<bool>,
455 #[serde(
456 serialize_with = "crate::types::serialize_bool_optional",
457 deserialize_with = "crate::types::deserialize_bool_optional"
458 )]
459 #[serde(skip_serializing_if = "Option::is_none", default)]
460 #[doc = "use sparse volumes"]
461 #[doc = ""]
462 pub sparse: Option<bool>,
463 #[doc = "The storage identifier."]
464 #[doc = ""]
465 pub storage: String,
466 #[serde(skip_serializing_if = "Option::is_none", default)]
467 #[doc = "Subdir to mount."]
468 #[doc = ""]
469 pub subdir: Option<String>,
470 #[serde(
471 serialize_with = "crate::types::serialize_bool_optional",
472 deserialize_with = "crate::types::deserialize_bool_optional"
473 )]
474 #[serde(skip_serializing_if = "Option::is_none", default)]
475 #[doc = "Only use logical volumes tagged with 'pve-vm-ID'."]
476 #[doc = ""]
477 pub tagged_only: Option<bool>,
478 #[serde(skip_serializing_if = "Option::is_none", default)]
479 #[doc = "iSCSI target."]
480 #[doc = ""]
481 pub target: Option<String>,
482 #[serde(skip_serializing_if = "Option::is_none", default)]
483 #[doc = "LVM thin pool LV name."]
484 #[doc = ""]
485 pub thinpool: Option<String>,
486 #[serde(rename = "type")]
487 #[doc = "Storage type."]
488 #[doc = ""]
489 pub ty: Type,
490 #[serde(skip_serializing_if = "Option::is_none", default)]
491 #[doc = "RBD Id."]
492 #[doc = ""]
493 pub username: Option<String>,
494 #[serde(skip_serializing_if = "Option::is_none", default)]
495 #[doc = "Volume group name."]
496 #[doc = ""]
497 pub vgname: Option<String>,
498 #[serde(rename = "zfs-base-path")]
499 #[serde(skip_serializing_if = "Option::is_none", default)]
500 #[doc = "Base path where to look for the created ZFS block devices. Set automatically during creation if not specified. Usually '/dev/zvol'."]
501 #[doc = ""]
502 pub zfs_base_path: Option<String>,
503 #[serde(
504 flatten,
505 default,
506 skip_serializing_if = "::std::collections::HashMap::is_empty"
507 )]
508 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
509}
510#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
511#[doc = "Default image format."]
512#[doc = ""]
513pub enum Format {
514 #[serde(rename = "qcow2")]
515 Qcow2,
516 #[serde(rename = "raw")]
517 Raw,
518 #[serde(rename = "subvol")]
519 Subvol,
520 #[serde(rename = "vmdk")]
521 Vmdk,
522}
523impl TryFrom<&str> for Format {
524 type Error = String;
525 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
526 match value {
527 "qcow2" => Ok(Self::Qcow2),
528 "raw" => Ok(Self::Raw),
529 "subvol" => Ok(Self::Subvol),
530 "vmdk" => Ok(Self::Vmdk),
531 v => Err(format!("Unknown variant {v}")),
532 }
533 }
534}
535#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq, Default)]
536#[doc = "Preallocation mode for raw and qcow2 images. Using 'metadata' on raw images results in preallocation=off."]
537#[doc = ""]
538pub enum Preallocation {
539 #[serde(rename = "falloc")]
540 Falloc,
541 #[serde(rename = "full")]
542 Full,
543 #[serde(rename = "metadata")]
544 #[default]
545 Metadata,
546 #[serde(rename = "off")]
547 Off,
548}
549impl TryFrom<&str> for Preallocation {
550 type Error = String;
551 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
552 match value {
553 "falloc" => Ok(Self::Falloc),
554 "full" => Ok(Self::Full),
555 "metadata" => Ok(Self::Metadata),
556 "off" => Ok(Self::Off),
557 v => Err(format!("Unknown variant {v}")),
558 }
559 }
560}
561#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq, Default)]
562#[doc = "SMB protocol version. 'default' if not set, negotiates the highest SMB2+ version supported by both the client and server."]
563#[doc = ""]
564pub enum Smbversion {
565 #[serde(rename = "2.0")]
566 _20,
567 #[serde(rename = "2.1")]
568 _21,
569 #[serde(rename = "3")]
570 _3,
571 #[serde(rename = "3.0")]
572 _30,
573 #[serde(rename = "3.11")]
574 _311,
575 #[serde(rename = "default")]
576 #[default]
577 Default,
578}
579impl TryFrom<&str> for Smbversion {
580 type Error = String;
581 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
582 match value {
583 "2.0" => Ok(Self::_20),
584 "2.1" => Ok(Self::_21),
585 "3" => Ok(Self::_3),
586 "3.0" => Ok(Self::_30),
587 "3.11" => Ok(Self::_311),
588 "default" => Ok(Self::Default),
589 v => Err(format!("Unknown variant {v}")),
590 }
591 }
592}
593#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
594#[doc = "Only list storage of specific type"]
595#[doc = ""]
596pub enum Type {
597 #[serde(rename = "btrfs")]
598 Btrfs,
599 #[serde(rename = "cephfs")]
600 Cephfs,
601 #[serde(rename = "cifs")]
602 Cifs,
603 #[serde(rename = "dir")]
604 Dir,
605 #[serde(rename = "esxi")]
606 Esxi,
607 #[serde(rename = "iscsi")]
608 Iscsi,
609 #[serde(rename = "iscsidirect")]
610 Iscsidirect,
611 #[serde(rename = "lvm")]
612 Lvm,
613 #[serde(rename = "lvmthin")]
614 Lvmthin,
615 #[serde(rename = "nfs")]
616 Nfs,
617 #[serde(rename = "pbs")]
618 Pbs,
619 #[serde(rename = "rbd")]
620 Rbd,
621 #[serde(rename = "zfs")]
622 Zfs,
623 #[serde(rename = "zfspool")]
624 Zfspool,
625}
626impl TryFrom<&str> for Type {
627 type Error = String;
628 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
629 match value {
630 "btrfs" => Ok(Self::Btrfs),
631 "cephfs" => Ok(Self::Cephfs),
632 "cifs" => Ok(Self::Cifs),
633 "dir" => Ok(Self::Dir),
634 "esxi" => Ok(Self::Esxi),
635 "iscsi" => Ok(Self::Iscsi),
636 "iscsidirect" => Ok(Self::Iscsidirect),
637 "lvm" => Ok(Self::Lvm),
638 "lvmthin" => Ok(Self::Lvmthin),
639 "nfs" => Ok(Self::Nfs),
640 "pbs" => Ok(Self::Pbs),
641 "rbd" => Ok(Self::Rbd),
642 "zfs" => Ok(Self::Zfs),
643 "zfspool" => Ok(Self::Zfspool),
644 v => Err(format!("Unknown variant {v}")),
645 }
646 }
647}
648#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
649pub struct MaxProtectedBackupsInt(i128);
650impl crate::types::bounded_integer::BoundedInteger for MaxProtectedBackupsInt {
651 const MIN: Option<i128> = Some(-1i128);
652 const MAX: Option<i128> = None::<i128>;
653 const DEFAULT: Option<i128> = None::<i128>;
654 const TYPE_DESCRIPTION: &'static str = "an integer greater than or equal to -1";
655 fn get(&self) -> i128 {
656 self.0
657 }
658 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
659 Self::validate(value)?;
660 Ok(Self(value))
661 }
662}
663impl std::convert::TryFrom<i128> for MaxProtectedBackupsInt {
664 type Error = crate::types::bounded_integer::BoundedIntegerError;
665 fn try_from(value: i128) -> Result<Self, Self::Error> {
666 crate::types::bounded_integer::BoundedInteger::new(value)
667 }
668}
669impl ::serde::Serialize for MaxProtectedBackupsInt {
670 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
671 where
672 S: ::serde::Serializer,
673 {
674 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
675 }
676}
677impl<'de> ::serde::Deserialize<'de> for MaxProtectedBackupsInt {
678 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
679 where
680 D: ::serde::Deserializer<'de>,
681 {
682 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
683 }
684}
685#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
686pub struct PortInt(i128);
687impl crate::types::bounded_integer::BoundedInteger for PortInt {
688 const MIN: Option<i128> = Some(1i128);
689 const MAX: Option<i128> = Some(65535i128);
690 const DEFAULT: Option<i128> = None::<i128>;
691 const TYPE_DESCRIPTION: &'static str = "an integer between 1 and 65535";
692 fn get(&self) -> i128 {
693 self.0
694 }
695 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
696 Self::validate(value)?;
697 Ok(Self(value))
698 }
699}
700impl std::convert::TryFrom<i128> for PortInt {
701 type Error = crate::types::bounded_integer::BoundedIntegerError;
702 fn try_from(value: i128) -> Result<Self, Self::Error> {
703 crate::types::bounded_integer::BoundedInteger::new(value)
704 }
705}
706impl ::serde::Serialize for PortInt {
707 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
708 where
709 S: ::serde::Serializer,
710 {
711 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
712 }
713}
714impl<'de> ::serde::Deserialize<'de> for PortInt {
715 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
716 where
717 D: ::serde::Deserializer<'de>,
718 {
719 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
720 }
721}
722#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
723pub struct SaferemoveStepsizeInt(i128);
724impl crate::types::bounded_integer::BoundedInteger for SaferemoveStepsizeInt {
725 const MIN: Option<i128> = None::<i128>;
726 const MAX: Option<i128> = None::<i128>;
727 const DEFAULT: Option<i128> = Some(32i128);
728 const TYPE_DESCRIPTION: &'static str = "a valid integer";
729 fn get(&self) -> i128 {
730 self.0
731 }
732 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
733 Self::validate(value)?;
734 Ok(Self(value))
735 }
736}
737impl std::convert::TryFrom<i128> for SaferemoveStepsizeInt {
738 type Error = crate::types::bounded_integer::BoundedIntegerError;
739 fn try_from(value: i128) -> Result<Self, Self::Error> {
740 crate::types::bounded_integer::BoundedInteger::new(value)
741 }
742}
743impl ::serde::Serialize for SaferemoveStepsizeInt {
744 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
745 where
746 S: ::serde::Serializer,
747 {
748 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
749 }
750}
751impl<'de> ::serde::Deserialize<'de> for SaferemoveStepsizeInt {
752 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
753 where
754 D: ::serde::Deserializer<'de>,
755 {
756 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
757 }
758}
759#[derive(Debug, Clone, PartialEq, PartialOrd)]
760pub struct DomainStr {
761 value: String,
762}
763impl crate::types::bounded_string::BoundedString for DomainStr {
764 const MIN_LENGTH: Option<usize> = None::<usize>;
765 const MAX_LENGTH: Option<usize> = Some(256usize);
766 const DEFAULT: Option<&'static str> = None::<&'static str>;
767 const PATTERN: Option<&'static str> = None::<&'static str>;
768 const TYPE_DESCRIPTION: &'static str = "a string with length at most 256";
769 fn get_value(&self) -> &str {
770 &self.value
771 }
772 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
773 Self::validate(&value)?;
774 Ok(Self { value })
775 }
776}
777impl std::convert::TryFrom<String> for DomainStr {
778 type Error = crate::types::bounded_string::BoundedStringError;
779 fn try_from(value: String) -> Result<Self, Self::Error> {
780 crate::types::bounded_string::BoundedString::new(value)
781 }
782}
783impl ::serde::Serialize for DomainStr {
784 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
785 where
786 S: ::serde::Serializer,
787 {
788 crate::types::bounded_string::serialize_bounded_string(self, serializer)
789 }
790}
791impl<'de> ::serde::Deserialize<'de> for DomainStr {
792 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
793 where
794 D: ::serde::Deserializer<'de>,
795 {
796 crate::types::bounded_string::deserialize_bounded_string(deserializer)
797 }
798}
799#[derive(Debug, Clone, PartialEq, PartialOrd)]
800pub struct FingerprintStr {
801 value: String,
802}
803impl crate::types::bounded_string::BoundedString for FingerprintStr {
804 const MIN_LENGTH: Option<usize> = None::<usize>;
805 const MAX_LENGTH: Option<usize> = None::<usize>;
806 const DEFAULT: Option<&'static str> = None::<&'static str>;
807 const PATTERN: Option<&'static str> = Some("([A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2}");
808 const TYPE_DESCRIPTION: &'static str =
809 "a string with pattern r\"([A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2}\" and no length constraints";
810 fn get_value(&self) -> &str {
811 &self.value
812 }
813 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
814 Self::validate(&value)?;
815 Ok(Self { value })
816 }
817}
818impl std::convert::TryFrom<String> for FingerprintStr {
819 type Error = crate::types::bounded_string::BoundedStringError;
820 fn try_from(value: String) -> Result<Self, Self::Error> {
821 crate::types::bounded_string::BoundedString::new(value)
822 }
823}
824impl ::serde::Serialize for FingerprintStr {
825 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
826 where
827 S: ::serde::Serializer,
828 {
829 crate::types::bounded_string::serialize_bounded_string(self, serializer)
830 }
831}
832impl<'de> ::serde::Deserialize<'de> for FingerprintStr {
833 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
834 where
835 D: ::serde::Deserializer<'de>,
836 {
837 crate::types::bounded_string::deserialize_bounded_string(deserializer)
838 }
839}
840#[derive(Debug, Clone, PartialEq, PartialOrd)]
841pub struct PasswordStr {
842 value: String,
843}
844impl crate::types::bounded_string::BoundedString for PasswordStr {
845 const MIN_LENGTH: Option<usize> = None::<usize>;
846 const MAX_LENGTH: Option<usize> = Some(256usize);
847 const DEFAULT: Option<&'static str> = None::<&'static str>;
848 const PATTERN: Option<&'static str> = None::<&'static str>;
849 const TYPE_DESCRIPTION: &'static str = "a string with length at most 256";
850 fn get_value(&self) -> &str {
851 &self.value
852 }
853 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
854 Self::validate(&value)?;
855 Ok(Self { value })
856 }
857}
858impl std::convert::TryFrom<String> for PasswordStr {
859 type Error = crate::types::bounded_string::BoundedStringError;
860 fn try_from(value: String) -> Result<Self, Self::Error> {
861 crate::types::bounded_string::BoundedString::new(value)
862 }
863}
864impl ::serde::Serialize for PasswordStr {
865 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
866 where
867 S: ::serde::Serializer,
868 {
869 crate::types::bounded_string::serialize_bounded_string(self, serializer)
870 }
871}
872impl<'de> ::serde::Deserialize<'de> for PasswordStr {
873 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
874 where
875 D: ::serde::Deserializer<'de>,
876 {
877 crate::types::bounded_string::deserialize_bounded_string(deserializer)
878 }
879}
880impl<T> StorageClient<T>
881where
882 T: crate::client::Client,
883{
884 pub fn storage(&self, storage: &str) -> storage::StorageClient<T> {
885 storage::StorageClient::<T>::new(self.client.clone(), &self.path, storage)
886 }
887}