1#[derive(Debug, Clone)]
2pub struct DefaultsClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> DefaultsClient<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, "/defaults"),
14 }
15 }
16}
17impl<T> DefaultsClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Get the currently configured vzdump defaults."]
22 #[doc = ""]
23 #[doc = "The user needs 'Datastore.Audit' or 'Datastore.AllocateSpace' permissions for the specified storage (or default storage if none specified). Some properties are only returned when the user has 'Sys.Audit' permissions for the node."]
24 pub async fn get(&self, params: GetParams) -> Result<GetOutput, T::Error> {
25 let path = self.path.to_string();
26 self.client.get(&path, ¶ms).await
27 }
28}
29#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
30pub struct GetOutput {
31 #[serde(
32 serialize_with = "crate::types::serialize_bool_optional",
33 deserialize_with = "crate::types::deserialize_bool_optional"
34 )]
35 #[serde(skip_serializing_if = "Option::is_none", default)]
36 #[doc = "Backup all known guest systems on this host."]
37 #[doc = ""]
38 pub all: Option<bool>,
39 #[serde(
40 serialize_with = "crate::types::serialize_unsigned_int_optional",
41 deserialize_with = "crate::types::deserialize_unsigned_int_optional"
42 )]
43 #[serde(skip_serializing_if = "Option::is_none", default)]
44 #[doc = "Limit I/O bandwidth (in KiB/s)."]
45 #[doc = ""]
46 pub bwlimit: Option<u64>,
47 #[serde(skip_serializing_if = "Option::is_none", default)]
48 #[doc = "Compress dump file."]
49 #[doc = ""]
50 pub compress: Option<Compress>,
51 #[serde(skip_serializing_if = "Option::is_none", default)]
52 #[doc = "Store resulting files to specified directory."]
53 #[doc = ""]
54 pub dumpdir: Option<String>,
55 #[serde(skip_serializing_if = "Option::is_none", default)]
56 #[doc = "Exclude specified guest systems (assumes --all)"]
57 #[doc = ""]
58 pub exclude: Option<String>,
59 #[serde(rename = "exclude-path")]
60 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
61 #[doc = "Exclude certain files/directories (shell globs). Paths starting with '/' are anchored to the container's root, other paths match relative to each subdirectory."]
62 #[doc = ""]
63 pub exclude_path: Vec<String>,
64 #[serde(skip_serializing_if = "Option::is_none", default)]
65 #[doc = "Options for backup fleecing (VM only)."]
66 #[doc = ""]
67 pub fleecing: Option<String>,
68 #[serde(skip_serializing_if = "Option::is_none", default)]
69 #[doc = "Set IO priority when using the BFQ scheduler. For snapshot and suspend mode backups of VMs, this only affects the compressor. A value of 8 means the idle priority is used, otherwise the best-effort priority is used with the specified value."]
70 #[doc = ""]
71 pub ionice: Option<IoniceInt>,
72 #[serde(skip_serializing_if = "Option::is_none", default)]
73 #[doc = "Maximal time to wait for the global lock (minutes)."]
74 #[doc = ""]
75 pub lockwait: Option<LockwaitInt>,
76 #[serde(skip_serializing_if = "Option::is_none", default)]
77 #[doc = "Deprecated: use notification targets/matchers instead. Specify when to send a notification mail"]
78 #[doc = ""]
79 pub mailnotification: Option<Mailnotification>,
80 #[serde(skip_serializing_if = "Option::is_none", default)]
81 #[doc = "Deprecated: Use notification targets/matchers instead. Comma-separated list of email addresses or users that should receive email notifications."]
82 #[doc = ""]
83 pub mailto: Option<String>,
84 #[serde(
85 serialize_with = "crate::types::serialize_non_zero_pos_int_optional",
86 deserialize_with = "crate::types::deserialize_non_zero_pos_int_optional"
87 )]
88 #[serde(skip_serializing_if = "Option::is_none", default)]
89 #[doc = "Deprecated: use 'prune-backups' instead. Maximal number of backup files per guest system."]
90 #[doc = ""]
91 pub maxfiles: Option<std::num::NonZeroU64>,
92 #[serde(skip_serializing_if = "Option::is_none", default)]
93 #[doc = "Backup mode."]
94 #[doc = ""]
95 pub mode: Option<Mode>,
96 #[serde(skip_serializing_if = "Option::is_none", default)]
97 #[doc = "Only run if executed on this node."]
98 #[doc = ""]
99 pub node: Option<String>,
100 #[serde(rename = "notes-template")]
101 #[serde(skip_serializing_if = "Option::is_none", default)]
102 #[doc = "Template string for generating notes for the backup(s). It can contain variables which will be replaced by their values. Currently supported are {{cluster}}, {{guestname}}, {{node}}, and {{vmid}}, but more might be added in the future. Needs to be a single line, newline and backslash need to be escaped as '\\n' and '\\\\' respectively."]
103 #[doc = ""]
104 pub notes_template: Option<NotesTemplateStr>,
105 #[serde(rename = "notification-mode")]
106 #[serde(skip_serializing_if = "Option::is_none", default)]
107 #[doc = "Determine which notification system to use. If set to 'legacy-sendmail', vzdump will consider the mailto/mailnotification parameters and send emails to the specified address(es) via the 'sendmail' command. If set to 'notification-system', a notification will be sent via PVE's notification system, and the mailto and mailnotification will be ignored. If set to 'auto' (default setting), an email will be sent if mailto is set, and the notification system will be used if not."]
108 #[doc = ""]
109 pub notification_mode: Option<NotificationMode>,
110 #[serde(rename = "pbs-change-detection-mode")]
111 #[serde(skip_serializing_if = "Option::is_none", default)]
112 #[doc = "PBS mode used to detect file changes and switch encoding format for container backups."]
113 #[doc = ""]
114 pub pbs_change_detection_mode: Option<PbsChangeDetectionMode>,
115 #[serde(skip_serializing_if = "Option::is_none", default)]
116 #[doc = "Other performance-related settings."]
117 #[doc = ""]
118 pub performance: Option<String>,
119 #[serde(
120 serialize_with = "crate::types::serialize_int_optional",
121 deserialize_with = "crate::types::deserialize_int_optional"
122 )]
123 #[serde(skip_serializing_if = "Option::is_none", default)]
124 #[doc = "Use pigz instead of gzip when N\\\\>0. N=1 uses half of cores, N\\\\>1 uses N as thread count."]
125 #[doc = ""]
126 pub pigz: Option<i64>,
127 #[serde(skip_serializing_if = "Option::is_none", default)]
128 #[doc = "Backup all known guest systems included in the specified pool."]
129 #[doc = ""]
130 pub pool: Option<String>,
131 #[serde(
132 serialize_with = "crate::types::serialize_bool_optional",
133 deserialize_with = "crate::types::deserialize_bool_optional"
134 )]
135 #[serde(skip_serializing_if = "Option::is_none", default)]
136 #[doc = "If true, mark backup(s) as protected."]
137 #[doc = ""]
138 pub protected: Option<bool>,
139 #[serde(rename = "prune-backups")]
140 #[serde(skip_serializing_if = "Option::is_none", default)]
141 #[doc = "Use these retention options instead of those from the storage configuration."]
142 #[doc = ""]
143 pub prune_backups: Option<String>,
144 #[serde(
145 serialize_with = "crate::types::serialize_bool_optional",
146 deserialize_with = "crate::types::deserialize_bool_optional"
147 )]
148 #[serde(skip_serializing_if = "Option::is_none", default)]
149 #[doc = "Be quiet."]
150 #[doc = ""]
151 pub quiet: Option<bool>,
152 #[serde(
153 serialize_with = "crate::types::serialize_bool_optional",
154 deserialize_with = "crate::types::deserialize_bool_optional"
155 )]
156 #[serde(skip_serializing_if = "Option::is_none", default)]
157 #[doc = "Prune older backups according to 'prune-backups'."]
158 #[doc = ""]
159 pub remove: Option<bool>,
160 #[serde(skip_serializing_if = "Option::is_none", default)]
161 #[doc = "Use specified hook script."]
162 #[doc = ""]
163 pub script: Option<String>,
164 #[serde(
165 serialize_with = "crate::types::serialize_bool_optional",
166 deserialize_with = "crate::types::deserialize_bool_optional"
167 )]
168 #[serde(skip_serializing_if = "Option::is_none", default)]
169 #[doc = "Exclude temporary files and logs."]
170 #[doc = ""]
171 pub stdexcludes: Option<bool>,
172 #[serde(
173 serialize_with = "crate::types::serialize_bool_optional",
174 deserialize_with = "crate::types::deserialize_bool_optional"
175 )]
176 #[serde(skip_serializing_if = "Option::is_none", default)]
177 #[doc = "Stop running backup jobs on this host."]
178 #[doc = ""]
179 pub stop: Option<bool>,
180 #[serde(skip_serializing_if = "Option::is_none", default)]
181 #[doc = "Maximal time to wait until a guest system is stopped (minutes)."]
182 #[doc = ""]
183 pub stopwait: Option<StopwaitInt>,
184 #[serde(skip_serializing_if = "Option::is_none", default)]
185 #[doc = "Store resulting file to this storage."]
186 #[doc = ""]
187 pub storage: Option<String>,
188 #[serde(skip_serializing_if = "Option::is_none", default)]
189 #[doc = "Store temporary files to specified directory."]
190 #[doc = ""]
191 pub tmpdir: Option<String>,
192 #[serde(skip_serializing_if = "Option::is_none", default)]
193 #[doc = "The ID of the guest system you want to backup."]
194 #[doc = ""]
195 pub vmid: Option<String>,
196 #[serde(skip_serializing_if = "Option::is_none", default)]
197 #[doc = "Zstd threads. N=0 uses half of the available cores, if N is set to a value bigger than 0, N is used as thread count."]
198 #[doc = ""]
199 pub zstd: Option<ZstdInt>,
200}
201#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
202pub struct GetParams {
203 #[serde(skip_serializing_if = "Option::is_none", default)]
204 #[doc = "The storage identifier."]
205 #[doc = ""]
206 pub storage: Option<String>,
207 #[serde(
208 flatten,
209 default,
210 skip_serializing_if = "::std::collections::HashMap::is_empty"
211 )]
212 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
213}
214#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq, Default)]
215#[doc = "Compress dump file."]
216#[doc = ""]
217pub enum Compress {
218 #[serde(rename = "0")]
219 #[default]
220 _0,
221 #[serde(rename = "1")]
222 _1,
223 #[serde(rename = "gzip")]
224 Gzip,
225 #[serde(rename = "lzo")]
226 Lzo,
227 #[serde(rename = "zstd")]
228 Zstd,
229}
230impl TryFrom<&str> for Compress {
231 type Error = String;
232 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
233 match value {
234 "0" => Ok(Self::_0),
235 "1" => Ok(Self::_1),
236 "gzip" => Ok(Self::Gzip),
237 "lzo" => Ok(Self::Lzo),
238 "zstd" => Ok(Self::Zstd),
239 v => Err(format!("Unknown variant {v}")),
240 }
241 }
242}
243#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq, Default)]
244#[doc = "Deprecated: use notification targets/matchers instead. Specify when to send a notification mail"]
245#[doc = ""]
246pub enum Mailnotification {
247 #[serde(rename = "always")]
248 #[default]
249 Always,
250 #[serde(rename = "failure")]
251 Failure,
252}
253impl TryFrom<&str> for Mailnotification {
254 type Error = String;
255 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
256 match value {
257 "always" => Ok(Self::Always),
258 "failure" => Ok(Self::Failure),
259 v => Err(format!("Unknown variant {v}")),
260 }
261 }
262}
263#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq, Default)]
264#[doc = "Backup mode."]
265#[doc = ""]
266pub enum Mode {
267 #[serde(rename = "snapshot")]
268 #[default]
269 Snapshot,
270 #[serde(rename = "stop")]
271 Stop,
272 #[serde(rename = "suspend")]
273 Suspend,
274}
275impl TryFrom<&str> for Mode {
276 type Error = String;
277 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
278 match value {
279 "snapshot" => Ok(Self::Snapshot),
280 "stop" => Ok(Self::Stop),
281 "suspend" => Ok(Self::Suspend),
282 v => Err(format!("Unknown variant {v}")),
283 }
284 }
285}
286#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq, Default)]
287#[doc = "Determine which notification system to use. If set to 'legacy-sendmail', vzdump will consider the mailto/mailnotification parameters and send emails to the specified address(es) via the 'sendmail' command. If set to 'notification-system', a notification will be sent via PVE's notification system, and the mailto and mailnotification will be ignored. If set to 'auto' (default setting), an email will be sent if mailto is set, and the notification system will be used if not."]
288#[doc = ""]
289pub enum NotificationMode {
290 #[serde(rename = "auto")]
291 #[default]
292 Auto,
293 #[serde(rename = "legacy-sendmail")]
294 LegacySendmail,
295 #[serde(rename = "notification-system")]
296 NotificationSystem,
297}
298impl TryFrom<&str> for NotificationMode {
299 type Error = String;
300 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
301 match value {
302 "auto" => Ok(Self::Auto),
303 "legacy-sendmail" => Ok(Self::LegacySendmail),
304 "notification-system" => Ok(Self::NotificationSystem),
305 v => Err(format!("Unknown variant {v}")),
306 }
307 }
308}
309#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
310#[doc = "PBS mode used to detect file changes and switch encoding format for container backups."]
311#[doc = ""]
312pub enum PbsChangeDetectionMode {
313 #[serde(rename = "data")]
314 Data,
315 #[serde(rename = "legacy")]
316 Legacy,
317 #[serde(rename = "metadata")]
318 Metadata,
319}
320impl TryFrom<&str> for PbsChangeDetectionMode {
321 type Error = String;
322 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
323 match value {
324 "data" => Ok(Self::Data),
325 "legacy" => Ok(Self::Legacy),
326 "metadata" => Ok(Self::Metadata),
327 v => Err(format!("Unknown variant {v}")),
328 }
329 }
330}
331#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
332pub struct IoniceInt(i128);
333impl crate::types::bounded_integer::BoundedInteger for IoniceInt {
334 const MIN: Option<i128> = Some(0i128);
335 const MAX: Option<i128> = Some(8i128);
336 const DEFAULT: Option<i128> = Some(7i128);
337 const TYPE_DESCRIPTION: &'static str = "an integer between 0 and 8";
338 fn get(&self) -> i128 {
339 self.0
340 }
341 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
342 Self::validate(value)?;
343 Ok(Self(value))
344 }
345}
346impl std::convert::TryFrom<i128> for IoniceInt {
347 type Error = crate::types::bounded_integer::BoundedIntegerError;
348 fn try_from(value: i128) -> Result<Self, Self::Error> {
349 crate::types::bounded_integer::BoundedInteger::new(value)
350 }
351}
352impl ::serde::Serialize for IoniceInt {
353 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
354 where
355 S: ::serde::Serializer,
356 {
357 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
358 }
359}
360impl<'de> ::serde::Deserialize<'de> for IoniceInt {
361 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
362 where
363 D: ::serde::Deserializer<'de>,
364 {
365 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
366 }
367}
368#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
369pub struct LockwaitInt(i128);
370impl crate::types::bounded_integer::BoundedInteger for LockwaitInt {
371 const MIN: Option<i128> = Some(0i128);
372 const MAX: Option<i128> = None::<i128>;
373 const DEFAULT: Option<i128> = Some(180i128);
374 const TYPE_DESCRIPTION: &'static str = "an integer greater than or equal to 0";
375 fn get(&self) -> i128 {
376 self.0
377 }
378 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
379 Self::validate(value)?;
380 Ok(Self(value))
381 }
382}
383impl std::convert::TryFrom<i128> for LockwaitInt {
384 type Error = crate::types::bounded_integer::BoundedIntegerError;
385 fn try_from(value: i128) -> Result<Self, Self::Error> {
386 crate::types::bounded_integer::BoundedInteger::new(value)
387 }
388}
389impl ::serde::Serialize for LockwaitInt {
390 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
391 where
392 S: ::serde::Serializer,
393 {
394 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
395 }
396}
397impl<'de> ::serde::Deserialize<'de> for LockwaitInt {
398 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
399 where
400 D: ::serde::Deserializer<'de>,
401 {
402 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
403 }
404}
405#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
406pub struct StopwaitInt(i128);
407impl crate::types::bounded_integer::BoundedInteger for StopwaitInt {
408 const MIN: Option<i128> = Some(0i128);
409 const MAX: Option<i128> = None::<i128>;
410 const DEFAULT: Option<i128> = Some(10i128);
411 const TYPE_DESCRIPTION: &'static str = "an integer greater than or equal to 0";
412 fn get(&self) -> i128 {
413 self.0
414 }
415 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
416 Self::validate(value)?;
417 Ok(Self(value))
418 }
419}
420impl std::convert::TryFrom<i128> for StopwaitInt {
421 type Error = crate::types::bounded_integer::BoundedIntegerError;
422 fn try_from(value: i128) -> Result<Self, Self::Error> {
423 crate::types::bounded_integer::BoundedInteger::new(value)
424 }
425}
426impl ::serde::Serialize for StopwaitInt {
427 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
428 where
429 S: ::serde::Serializer,
430 {
431 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
432 }
433}
434impl<'de> ::serde::Deserialize<'de> for StopwaitInt {
435 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
436 where
437 D: ::serde::Deserializer<'de>,
438 {
439 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
440 }
441}
442#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
443pub struct ZstdInt(i128);
444impl crate::types::bounded_integer::BoundedInteger for ZstdInt {
445 const MIN: Option<i128> = None::<i128>;
446 const MAX: Option<i128> = None::<i128>;
447 const DEFAULT: Option<i128> = Some(1i128);
448 const TYPE_DESCRIPTION: &'static str = "a valid integer";
449 fn get(&self) -> i128 {
450 self.0
451 }
452 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
453 Self::validate(value)?;
454 Ok(Self(value))
455 }
456}
457impl std::convert::TryFrom<i128> for ZstdInt {
458 type Error = crate::types::bounded_integer::BoundedIntegerError;
459 fn try_from(value: i128) -> Result<Self, Self::Error> {
460 crate::types::bounded_integer::BoundedInteger::new(value)
461 }
462}
463impl ::serde::Serialize for ZstdInt {
464 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
465 where
466 S: ::serde::Serializer,
467 {
468 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
469 }
470}
471impl<'de> ::serde::Deserialize<'de> for ZstdInt {
472 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
473 where
474 D: ::serde::Deserializer<'de>,
475 {
476 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
477 }
478}
479#[derive(Debug, Clone, PartialEq, PartialOrd)]
480pub struct NotesTemplateStr {
481 value: String,
482}
483impl crate::types::bounded_string::BoundedString for NotesTemplateStr {
484 const MIN_LENGTH: Option<usize> = None::<usize>;
485 const MAX_LENGTH: Option<usize> = Some(1024usize);
486 const DEFAULT: Option<&'static str> = None::<&'static str>;
487 const PATTERN: Option<&'static str> = None::<&'static str>;
488 const TYPE_DESCRIPTION: &'static str = "a string with length at most 1024";
489 fn get_value(&self) -> &str {
490 &self.value
491 }
492 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
493 Self::validate(&value)?;
494 Ok(Self { value })
495 }
496}
497impl std::convert::TryFrom<String> for NotesTemplateStr {
498 type Error = crate::types::bounded_string::BoundedStringError;
499 fn try_from(value: String) -> Result<Self, Self::Error> {
500 crate::types::bounded_string::BoundedString::new(value)
501 }
502}
503impl ::serde::Serialize for NotesTemplateStr {
504 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
505 where
506 S: ::serde::Serializer,
507 {
508 crate::types::bounded_string::serialize_bounded_string(self, serializer)
509 }
510}
511impl<'de> ::serde::Deserialize<'de> for NotesTemplateStr {
512 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
513 where
514 D: ::serde::Deserializer<'de>,
515 {
516 crate::types::bounded_string::deserialize_bounded_string(deserializer)
517 }
518}