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