1pub mod id;
2#[derive(Debug, Clone)]
3pub struct BackupClient<T> {
4 client: T,
5 path: String,
6}
7impl<T> BackupClient<T>
8where
9 T: crate::client::Client,
10{
11 pub fn new(client: T, parent_path: &str) -> Self {
12 Self {
13 client,
14 path: format!("{}{}", parent_path, "/backup"),
15 }
16 }
17}
18impl<T> BackupClient<T>
19where
20 T: crate::client::Client,
21{
22 #[doc = "List vzdump backup schedule."]
23 #[doc = ""]
24 #[doc = "Permission check: perm(\"/\", [\"Sys.Audit\"])"]
25 pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
26 let path = self.path.to_string();
27 let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
28 Ok(optional_vec.unwrap_or_default())
29 }
30}
31impl<T> BackupClient<T>
32where
33 T: crate::client::Client,
34{
35 #[doc = "Create new vzdump backup job."]
36 #[doc = ""]
37 #[doc = "Permission check: perm(\"/\", [\"Sys.Modify\"])"]
38 #[doc = "The 'tmpdir', 'dumpdir' and 'script' parameters are additionally restricted to the 'root@pam' user."]
39 pub async fn post(&self, params: PostParams) -> Result<(), T::Error> {
40 let path = self.path.to_string();
41 self.client.post(&path, ¶ms).await
42 }
43}
44impl GetOutputItems {
45 pub fn new(id: IdStr) -> Self {
46 Self {
47 id,
48 additional_properties: ::std::default::Default::default(),
49 }
50 }
51}
52#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
53pub struct GetOutputItems {
54 #[doc = "The job ID."]
55 #[doc = ""]
56 pub id: IdStr,
57 #[serde(
58 flatten,
59 default,
60 skip_serializing_if = "::std::collections::HashMap::is_empty"
61 )]
62 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
63}
64#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
65pub struct PostParams {
66 #[serde(
67 serialize_with = "crate::types::serialize_bool_optional",
68 deserialize_with = "crate::types::deserialize_bool_optional"
69 )]
70 #[serde(skip_serializing_if = "Option::is_none", default)]
71 #[doc = "Backup all known guest systems on this host."]
72 #[doc = ""]
73 pub all: Option<bool>,
74 #[serde(
75 serialize_with = "crate::types::serialize_unsigned_int_optional",
76 deserialize_with = "crate::types::deserialize_unsigned_int_optional"
77 )]
78 #[serde(skip_serializing_if = "Option::is_none", default)]
79 #[doc = "Limit I/O bandwidth (in KiB/s)."]
80 #[doc = ""]
81 pub bwlimit: Option<u64>,
82 #[serde(skip_serializing_if = "Option::is_none", default)]
83 #[doc = "Description for the Job."]
84 #[doc = ""]
85 pub comment: Option<CommentStr>,
86 #[serde(skip_serializing_if = "Option::is_none", default)]
87 #[doc = "Compress dump file."]
88 #[doc = ""]
89 pub compress: Option<Compress>,
90 #[serde(skip_serializing_if = "Option::is_none", default)]
91 #[doc = "Day of week selection."]
92 #[doc = ""]
93 pub dow: Option<String>,
94 #[serde(skip_serializing_if = "Option::is_none", default)]
95 #[doc = "Store resulting files to specified directory."]
96 #[doc = ""]
97 pub dumpdir: Option<String>,
98 #[serde(
99 serialize_with = "crate::types::serialize_bool_optional",
100 deserialize_with = "crate::types::deserialize_bool_optional"
101 )]
102 #[serde(skip_serializing_if = "Option::is_none", default)]
103 #[doc = "Enable or disable the job."]
104 #[doc = ""]
105 pub enabled: Option<bool>,
106 #[serde(skip_serializing_if = "Option::is_none", default)]
107 #[doc = "Exclude specified guest systems (assumes --all)"]
108 #[doc = ""]
109 pub exclude: Option<String>,
110 #[serde(rename = "exclude-path")]
111 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
112 #[doc = "Exclude certain files/directories (shell globs). Paths starting with '/' are anchored to the container's root, other paths match relative to each subdirectory."]
113 #[doc = ""]
114 pub exclude_path: Vec<String>,
115 #[serde(skip_serializing_if = "Option::is_none", default)]
116 #[doc = "Options for backup fleecing (VM only)."]
117 #[doc = ""]
118 pub fleecing: Option<String>,
119 #[serde(skip_serializing_if = "Option::is_none", default)]
120 #[doc = "Job ID (will be autogenerated)."]
121 #[doc = ""]
122 pub id: Option<String>,
123 #[serde(skip_serializing_if = "Option::is_none", default)]
124 #[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."]
125 #[doc = ""]
126 pub ionice: Option<IoniceInt>,
127 #[serde(skip_serializing_if = "Option::is_none", default)]
128 #[doc = "Maximal time to wait for the global lock (minutes)."]
129 #[doc = ""]
130 pub lockwait: Option<LockwaitInt>,
131 #[serde(skip_serializing_if = "Option::is_none", default)]
132 #[doc = "Deprecated: use notification targets/matchers instead. Specify when to send a notification mail"]
133 #[doc = ""]
134 pub mailnotification: Option<Mailnotification>,
135 #[serde(skip_serializing_if = "Option::is_none", default)]
136 #[doc = "Deprecated: Use notification targets/matchers instead. Comma-separated list of email addresses or users that should receive email notifications."]
137 #[doc = ""]
138 pub mailto: Option<String>,
139 #[serde(
140 serialize_with = "crate::types::serialize_non_zero_pos_int_optional",
141 deserialize_with = "crate::types::deserialize_non_zero_pos_int_optional"
142 )]
143 #[serde(skip_serializing_if = "Option::is_none", default)]
144 #[doc = "Deprecated: use 'prune-backups' instead. Maximal number of backup files per guest system."]
145 #[doc = ""]
146 pub maxfiles: Option<std::num::NonZeroU64>,
147 #[serde(skip_serializing_if = "Option::is_none", default)]
148 #[doc = "Backup mode."]
149 #[doc = ""]
150 pub mode: Option<Mode>,
151 #[serde(skip_serializing_if = "Option::is_none", default)]
152 #[doc = "Only run if executed on this node."]
153 #[doc = ""]
154 pub node: Option<String>,
155 #[serde(rename = "notes-template")]
156 #[serde(skip_serializing_if = "Option::is_none", default)]
157 #[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."]
158 #[doc = ""]
159 pub notes_template: Option<NotesTemplateStr>,
160 #[serde(rename = "notification-mode")]
161 #[serde(skip_serializing_if = "Option::is_none", default)]
162 #[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."]
163 #[doc = ""]
164 pub notification_mode: Option<NotificationMode>,
165 #[serde(rename = "pbs-change-detection-mode")]
166 #[serde(skip_serializing_if = "Option::is_none", default)]
167 #[doc = "PBS mode used to detect file changes and switch encoding format for container backups."]
168 #[doc = ""]
169 pub pbs_change_detection_mode: Option<PbsChangeDetectionMode>,
170 #[serde(skip_serializing_if = "Option::is_none", default)]
171 #[doc = "Other performance-related settings."]
172 #[doc = ""]
173 pub performance: Option<String>,
174 #[serde(
175 serialize_with = "crate::types::serialize_int_optional",
176 deserialize_with = "crate::types::deserialize_int_optional"
177 )]
178 #[serde(skip_serializing_if = "Option::is_none", default)]
179 #[doc = "Use pigz instead of gzip when N\\\\>0. N=1 uses half of cores, N\\\\>1 uses N as thread count."]
180 #[doc = ""]
181 pub pigz: Option<i64>,
182 #[serde(skip_serializing_if = "Option::is_none", default)]
183 #[doc = "Backup all known guest systems included in the specified pool."]
184 #[doc = ""]
185 pub pool: Option<String>,
186 #[serde(
187 serialize_with = "crate::types::serialize_bool_optional",
188 deserialize_with = "crate::types::deserialize_bool_optional"
189 )]
190 #[serde(skip_serializing_if = "Option::is_none", default)]
191 #[doc = "If true, mark backup(s) as protected."]
192 #[doc = ""]
193 pub protected: Option<bool>,
194 #[serde(rename = "prune-backups")]
195 #[serde(skip_serializing_if = "Option::is_none", default)]
196 #[doc = "Use these retention options instead of those from the storage configuration."]
197 #[doc = ""]
198 pub prune_backups: Option<String>,
199 #[serde(
200 serialize_with = "crate::types::serialize_bool_optional",
201 deserialize_with = "crate::types::deserialize_bool_optional"
202 )]
203 #[serde(skip_serializing_if = "Option::is_none", default)]
204 #[doc = "Be quiet."]
205 #[doc = ""]
206 pub quiet: Option<bool>,
207 #[serde(
208 serialize_with = "crate::types::serialize_bool_optional",
209 deserialize_with = "crate::types::deserialize_bool_optional"
210 )]
211 #[serde(skip_serializing_if = "Option::is_none", default)]
212 #[doc = "Prune older backups according to 'prune-backups'."]
213 #[doc = ""]
214 pub remove: Option<bool>,
215 #[serde(rename = "repeat-missed")]
216 #[serde(
217 serialize_with = "crate::types::serialize_bool_optional",
218 deserialize_with = "crate::types::deserialize_bool_optional"
219 )]
220 #[serde(skip_serializing_if = "Option::is_none", default)]
221 #[doc = "If true, the job will be run as soon as possible if it was missed while the scheduler was not running."]
222 #[doc = ""]
223 pub repeat_missed: Option<bool>,
224 #[serde(skip_serializing_if = "Option::is_none", default)]
225 #[doc = "Backup schedule. The format is a subset of `systemd` calendar events."]
226 #[doc = ""]
227 pub schedule: Option<ScheduleStr>,
228 #[serde(skip_serializing_if = "Option::is_none", default)]
229 #[doc = "Use specified hook script."]
230 #[doc = ""]
231 pub script: Option<String>,
232 #[serde(skip_serializing_if = "Option::is_none", default)]
233 #[doc = "Job Start time."]
234 #[doc = ""]
235 pub starttime: Option<StarttimeStr>,
236 #[serde(
237 serialize_with = "crate::types::serialize_bool_optional",
238 deserialize_with = "crate::types::deserialize_bool_optional"
239 )]
240 #[serde(skip_serializing_if = "Option::is_none", default)]
241 #[doc = "Exclude temporary files and logs."]
242 #[doc = ""]
243 pub stdexcludes: Option<bool>,
244 #[serde(
245 serialize_with = "crate::types::serialize_bool_optional",
246 deserialize_with = "crate::types::deserialize_bool_optional"
247 )]
248 #[serde(skip_serializing_if = "Option::is_none", default)]
249 #[doc = "Stop running backup jobs on this host."]
250 #[doc = ""]
251 pub stop: Option<bool>,
252 #[serde(skip_serializing_if = "Option::is_none", default)]
253 #[doc = "Maximal time to wait until a guest system is stopped (minutes)."]
254 #[doc = ""]
255 pub stopwait: Option<StopwaitInt>,
256 #[serde(skip_serializing_if = "Option::is_none", default)]
257 #[doc = "Store resulting file to this storage."]
258 #[doc = ""]
259 pub storage: Option<String>,
260 #[serde(skip_serializing_if = "Option::is_none", default)]
261 #[doc = "Store temporary files to specified directory."]
262 #[doc = ""]
263 pub tmpdir: Option<String>,
264 #[serde(skip_serializing_if = "Option::is_none", default)]
265 #[doc = "The ID of the guest system you want to backup."]
266 #[doc = ""]
267 pub vmid: Option<String>,
268 #[serde(skip_serializing_if = "Option::is_none", default)]
269 #[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."]
270 #[doc = ""]
271 pub zstd: Option<ZstdInt>,
272 #[serde(
273 flatten,
274 default,
275 skip_serializing_if = "::std::collections::HashMap::is_empty"
276 )]
277 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
278}
279#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq, Default)]
280#[doc = "Compress dump file."]
281#[doc = ""]
282pub enum Compress {
283 #[serde(rename = "0")]
284 #[default]
285 _0,
286 #[serde(rename = "1")]
287 _1,
288 #[serde(rename = "gzip")]
289 Gzip,
290 #[serde(rename = "lzo")]
291 Lzo,
292 #[serde(rename = "zstd")]
293 Zstd,
294}
295impl TryFrom<&str> for Compress {
296 type Error = String;
297 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
298 match value {
299 "0" => Ok(Self::_0),
300 "1" => Ok(Self::_1),
301 "gzip" => Ok(Self::Gzip),
302 "lzo" => Ok(Self::Lzo),
303 "zstd" => Ok(Self::Zstd),
304 v => Err(format!("Unknown variant {v}")),
305 }
306 }
307}
308#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq, Default)]
309#[doc = "Deprecated: use notification targets/matchers instead. Specify when to send a notification mail"]
310#[doc = ""]
311pub enum Mailnotification {
312 #[serde(rename = "always")]
313 #[default]
314 Always,
315 #[serde(rename = "failure")]
316 Failure,
317}
318impl TryFrom<&str> for Mailnotification {
319 type Error = String;
320 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
321 match value {
322 "always" => Ok(Self::Always),
323 "failure" => Ok(Self::Failure),
324 v => Err(format!("Unknown variant {v}")),
325 }
326 }
327}
328#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq, Default)]
329#[doc = "Backup mode."]
330#[doc = ""]
331pub enum Mode {
332 #[serde(rename = "snapshot")]
333 #[default]
334 Snapshot,
335 #[serde(rename = "stop")]
336 Stop,
337 #[serde(rename = "suspend")]
338 Suspend,
339}
340impl TryFrom<&str> for Mode {
341 type Error = String;
342 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
343 match value {
344 "snapshot" => Ok(Self::Snapshot),
345 "stop" => Ok(Self::Stop),
346 "suspend" => Ok(Self::Suspend),
347 v => Err(format!("Unknown variant {v}")),
348 }
349 }
350}
351#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq, Default)]
352#[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."]
353#[doc = ""]
354pub enum NotificationMode {
355 #[serde(rename = "auto")]
356 #[default]
357 Auto,
358 #[serde(rename = "legacy-sendmail")]
359 LegacySendmail,
360 #[serde(rename = "notification-system")]
361 NotificationSystem,
362}
363impl TryFrom<&str> for NotificationMode {
364 type Error = String;
365 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
366 match value {
367 "auto" => Ok(Self::Auto),
368 "legacy-sendmail" => Ok(Self::LegacySendmail),
369 "notification-system" => Ok(Self::NotificationSystem),
370 v => Err(format!("Unknown variant {v}")),
371 }
372 }
373}
374#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
375#[doc = "PBS mode used to detect file changes and switch encoding format for container backups."]
376#[doc = ""]
377pub enum PbsChangeDetectionMode {
378 #[serde(rename = "data")]
379 Data,
380 #[serde(rename = "legacy")]
381 Legacy,
382 #[serde(rename = "metadata")]
383 Metadata,
384}
385impl TryFrom<&str> for PbsChangeDetectionMode {
386 type Error = String;
387 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
388 match value {
389 "data" => Ok(Self::Data),
390 "legacy" => Ok(Self::Legacy),
391 "metadata" => Ok(Self::Metadata),
392 v => Err(format!("Unknown variant {v}")),
393 }
394 }
395}
396#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
397pub struct IoniceInt(i128);
398impl crate::types::bounded_integer::BoundedInteger for IoniceInt {
399 const MIN: Option<i128> = Some(0i128);
400 const MAX: Option<i128> = Some(8i128);
401 const DEFAULT: Option<i128> = Some(7i128);
402 const TYPE_DESCRIPTION: &'static str = "an integer between 0 and 8";
403 fn get(&self) -> i128 {
404 self.0
405 }
406 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
407 Self::validate(value)?;
408 Ok(Self(value))
409 }
410}
411impl std::convert::TryFrom<i128> for IoniceInt {
412 type Error = crate::types::bounded_integer::BoundedIntegerError;
413 fn try_from(value: i128) -> Result<Self, Self::Error> {
414 crate::types::bounded_integer::BoundedInteger::new(value)
415 }
416}
417impl ::serde::Serialize for IoniceInt {
418 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
419 where
420 S: ::serde::Serializer,
421 {
422 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
423 }
424}
425impl<'de> ::serde::Deserialize<'de> for IoniceInt {
426 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
427 where
428 D: ::serde::Deserializer<'de>,
429 {
430 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
431 }
432}
433#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
434pub struct LockwaitInt(i128);
435impl crate::types::bounded_integer::BoundedInteger for LockwaitInt {
436 const MIN: Option<i128> = Some(0i128);
437 const MAX: Option<i128> = None::<i128>;
438 const DEFAULT: Option<i128> = Some(180i128);
439 const TYPE_DESCRIPTION: &'static str = "an integer greater than or equal to 0";
440 fn get(&self) -> i128 {
441 self.0
442 }
443 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
444 Self::validate(value)?;
445 Ok(Self(value))
446 }
447}
448impl std::convert::TryFrom<i128> for LockwaitInt {
449 type Error = crate::types::bounded_integer::BoundedIntegerError;
450 fn try_from(value: i128) -> Result<Self, Self::Error> {
451 crate::types::bounded_integer::BoundedInteger::new(value)
452 }
453}
454impl ::serde::Serialize for LockwaitInt {
455 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
456 where
457 S: ::serde::Serializer,
458 {
459 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
460 }
461}
462impl<'de> ::serde::Deserialize<'de> for LockwaitInt {
463 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
464 where
465 D: ::serde::Deserializer<'de>,
466 {
467 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
468 }
469}
470#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
471pub struct StopwaitInt(i128);
472impl crate::types::bounded_integer::BoundedInteger for StopwaitInt {
473 const MIN: Option<i128> = Some(0i128);
474 const MAX: Option<i128> = None::<i128>;
475 const DEFAULT: Option<i128> = Some(10i128);
476 const TYPE_DESCRIPTION: &'static str = "an integer greater than or equal to 0";
477 fn get(&self) -> i128 {
478 self.0
479 }
480 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
481 Self::validate(value)?;
482 Ok(Self(value))
483 }
484}
485impl std::convert::TryFrom<i128> for StopwaitInt {
486 type Error = crate::types::bounded_integer::BoundedIntegerError;
487 fn try_from(value: i128) -> Result<Self, Self::Error> {
488 crate::types::bounded_integer::BoundedInteger::new(value)
489 }
490}
491impl ::serde::Serialize for StopwaitInt {
492 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
493 where
494 S: ::serde::Serializer,
495 {
496 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
497 }
498}
499impl<'de> ::serde::Deserialize<'de> for StopwaitInt {
500 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
501 where
502 D: ::serde::Deserializer<'de>,
503 {
504 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
505 }
506}
507#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
508pub struct ZstdInt(i128);
509impl crate::types::bounded_integer::BoundedInteger for ZstdInt {
510 const MIN: Option<i128> = None::<i128>;
511 const MAX: Option<i128> = None::<i128>;
512 const DEFAULT: Option<i128> = Some(1i128);
513 const TYPE_DESCRIPTION: &'static str = "a valid integer";
514 fn get(&self) -> i128 {
515 self.0
516 }
517 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
518 Self::validate(value)?;
519 Ok(Self(value))
520 }
521}
522impl std::convert::TryFrom<i128> for ZstdInt {
523 type Error = crate::types::bounded_integer::BoundedIntegerError;
524 fn try_from(value: i128) -> Result<Self, Self::Error> {
525 crate::types::bounded_integer::BoundedInteger::new(value)
526 }
527}
528impl ::serde::Serialize for ZstdInt {
529 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
530 where
531 S: ::serde::Serializer,
532 {
533 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
534 }
535}
536impl<'de> ::serde::Deserialize<'de> for ZstdInt {
537 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
538 where
539 D: ::serde::Deserializer<'de>,
540 {
541 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
542 }
543}
544#[derive(Debug, Clone, PartialEq, PartialOrd)]
545pub struct CommentStr {
546 value: String,
547}
548impl crate::types::bounded_string::BoundedString for CommentStr {
549 const MIN_LENGTH: Option<usize> = None::<usize>;
550 const MAX_LENGTH: Option<usize> = Some(512usize);
551 const DEFAULT: Option<&'static str> = None::<&'static str>;
552 const PATTERN: Option<&'static str> = None::<&'static str>;
553 const TYPE_DESCRIPTION: &'static str = "a string with length at most 512";
554 fn get_value(&self) -> &str {
555 &self.value
556 }
557 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
558 Self::validate(&value)?;
559 Ok(Self { value })
560 }
561}
562impl std::convert::TryFrom<String> for CommentStr {
563 type Error = crate::types::bounded_string::BoundedStringError;
564 fn try_from(value: String) -> Result<Self, Self::Error> {
565 crate::types::bounded_string::BoundedString::new(value)
566 }
567}
568impl ::serde::Serialize for CommentStr {
569 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
570 where
571 S: ::serde::Serializer,
572 {
573 crate::types::bounded_string::serialize_bounded_string(self, serializer)
574 }
575}
576impl<'de> ::serde::Deserialize<'de> for CommentStr {
577 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
578 where
579 D: ::serde::Deserializer<'de>,
580 {
581 crate::types::bounded_string::deserialize_bounded_string(deserializer)
582 }
583}
584#[derive(Debug, Clone, PartialEq, PartialOrd)]
585pub struct IdStr {
586 value: String,
587}
588impl crate::types::bounded_string::BoundedString for IdStr {
589 const MIN_LENGTH: Option<usize> = None::<usize>;
590 const MAX_LENGTH: Option<usize> = Some(50usize);
591 const DEFAULT: Option<&'static str> = None::<&'static str>;
592 const PATTERN: Option<&'static str> = Some("\\S+");
593 const TYPE_DESCRIPTION: &'static str = "a string with pattern r\"\\S+\" and length at most 50";
594 fn get_value(&self) -> &str {
595 &self.value
596 }
597 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
598 Self::validate(&value)?;
599 Ok(Self { value })
600 }
601}
602impl std::convert::TryFrom<String> for IdStr {
603 type Error = crate::types::bounded_string::BoundedStringError;
604 fn try_from(value: String) -> Result<Self, Self::Error> {
605 crate::types::bounded_string::BoundedString::new(value)
606 }
607}
608impl ::serde::Serialize for IdStr {
609 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
610 where
611 S: ::serde::Serializer,
612 {
613 crate::types::bounded_string::serialize_bounded_string(self, serializer)
614 }
615}
616impl<'de> ::serde::Deserialize<'de> for IdStr {
617 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
618 where
619 D: ::serde::Deserializer<'de>,
620 {
621 crate::types::bounded_string::deserialize_bounded_string(deserializer)
622 }
623}
624#[derive(Debug, Clone, PartialEq, PartialOrd)]
625pub struct NotesTemplateStr {
626 value: String,
627}
628impl crate::types::bounded_string::BoundedString for NotesTemplateStr {
629 const MIN_LENGTH: Option<usize> = None::<usize>;
630 const MAX_LENGTH: Option<usize> = Some(1024usize);
631 const DEFAULT: Option<&'static str> = None::<&'static str>;
632 const PATTERN: Option<&'static str> = None::<&'static str>;
633 const TYPE_DESCRIPTION: &'static str = "a string with length at most 1024";
634 fn get_value(&self) -> &str {
635 &self.value
636 }
637 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
638 Self::validate(&value)?;
639 Ok(Self { value })
640 }
641}
642impl std::convert::TryFrom<String> for NotesTemplateStr {
643 type Error = crate::types::bounded_string::BoundedStringError;
644 fn try_from(value: String) -> Result<Self, Self::Error> {
645 crate::types::bounded_string::BoundedString::new(value)
646 }
647}
648impl ::serde::Serialize for NotesTemplateStr {
649 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
650 where
651 S: ::serde::Serializer,
652 {
653 crate::types::bounded_string::serialize_bounded_string(self, serializer)
654 }
655}
656impl<'de> ::serde::Deserialize<'de> for NotesTemplateStr {
657 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
658 where
659 D: ::serde::Deserializer<'de>,
660 {
661 crate::types::bounded_string::deserialize_bounded_string(deserializer)
662 }
663}
664#[derive(Debug, Clone, PartialEq, PartialOrd)]
665pub struct ScheduleStr {
666 value: String,
667}
668impl crate::types::bounded_string::BoundedString for ScheduleStr {
669 const MIN_LENGTH: Option<usize> = None::<usize>;
670 const MAX_LENGTH: Option<usize> = Some(128usize);
671 const DEFAULT: Option<&'static str> = None::<&'static str>;
672 const PATTERN: Option<&'static str> = None::<&'static str>;
673 const TYPE_DESCRIPTION: &'static str = "a string with length at most 128";
674 fn get_value(&self) -> &str {
675 &self.value
676 }
677 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
678 Self::validate(&value)?;
679 Ok(Self { value })
680 }
681}
682impl std::convert::TryFrom<String> for ScheduleStr {
683 type Error = crate::types::bounded_string::BoundedStringError;
684 fn try_from(value: String) -> Result<Self, Self::Error> {
685 crate::types::bounded_string::BoundedString::new(value)
686 }
687}
688impl ::serde::Serialize for ScheduleStr {
689 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
690 where
691 S: ::serde::Serializer,
692 {
693 crate::types::bounded_string::serialize_bounded_string(self, serializer)
694 }
695}
696impl<'de> ::serde::Deserialize<'de> for ScheduleStr {
697 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
698 where
699 D: ::serde::Deserializer<'de>,
700 {
701 crate::types::bounded_string::deserialize_bounded_string(deserializer)
702 }
703}
704#[derive(Debug, Clone, PartialEq, PartialOrd)]
705pub struct StarttimeStr {
706 value: String,
707}
708impl crate::types::bounded_string::BoundedString for StarttimeStr {
709 const MIN_LENGTH: Option<usize> = None::<usize>;
710 const MAX_LENGTH: Option<usize> = None::<usize>;
711 const DEFAULT: Option<&'static str> = None::<&'static str>;
712 const PATTERN: Option<&'static str> = Some("\\d{1,2}:\\d{1,2}");
713 const TYPE_DESCRIPTION: &'static str =
714 "a string with pattern r\"\\d{1,2}:\\d{1,2}\" and no length constraints";
715 fn get_value(&self) -> &str {
716 &self.value
717 }
718 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
719 Self::validate(&value)?;
720 Ok(Self { value })
721 }
722}
723impl std::convert::TryFrom<String> for StarttimeStr {
724 type Error = crate::types::bounded_string::BoundedStringError;
725 fn try_from(value: String) -> Result<Self, Self::Error> {
726 crate::types::bounded_string::BoundedString::new(value)
727 }
728}
729impl ::serde::Serialize for StarttimeStr {
730 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
731 where
732 S: ::serde::Serializer,
733 {
734 crate::types::bounded_string::serialize_bounded_string(self, serializer)
735 }
736}
737impl<'de> ::serde::Deserialize<'de> for StarttimeStr {
738 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
739 where
740 D: ::serde::Deserializer<'de>,
741 {
742 crate::types::bounded_string::deserialize_bounded_string(deserializer)
743 }
744}
745impl<T> BackupClient<T>
746where
747 T: crate::client::Client,
748{
749 pub fn id(&self, id: &str) -> id::IdClient<T> {
750 id::IdClient::<T>::new(self.client.clone(), &self.path, id)
751 }
752}