proxmox_api/generated/cluster/backup/
id.rs

1pub mod included_volumes;
2pub struct IdClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> IdClient<T>
7where
8    T: crate::client::Client,
9{
10    pub fn new(client: T, parent_path: &str, id: &str) -> Self {
11        Self {
12            client,
13            path: format!("{}/{}", parent_path, id),
14        }
15    }
16}
17impl<T> IdClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Delete vzdump backup job definition."]
22    pub fn delete(&self) -> Result<(), T::Error> {
23        let path = self.path.to_string();
24        self.client.delete(&path, &())
25    }
26}
27impl<T> IdClient<T>
28where
29    T: crate::client::Client,
30{
31    #[doc = "Read vzdump backup job definition."]
32    pub fn get(&self) -> Result<GetOutput, T::Error> {
33        let path = self.path.to_string();
34        self.client.get(&path, &())
35    }
36}
37impl<T> IdClient<T>
38where
39    T: crate::client::Client,
40{
41    #[doc = "Update vzdump backup job definition."]
42    pub fn put(&self, params: PutParams) -> Result<(), T::Error> {
43        let path = self.path.to_string();
44        self.client.put(&path, &params)
45    }
46}
47#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
48pub struct GetOutput {
49    #[serde(
50        flatten,
51        default,
52        skip_serializing_if = "::std::collections::HashMap::is_empty"
53    )]
54    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
55}
56#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
57pub struct PutParams {
58    #[serde(
59        serialize_with = "crate::types::serialize_bool_optional",
60        deserialize_with = "crate::types::deserialize_bool_optional"
61    )]
62    #[serde(skip_serializing_if = "Option::is_none", default)]
63    #[doc = "Backup all known guest systems on this host."]
64    pub all: Option<bool>,
65    #[serde(
66        serialize_with = "crate::types::serialize_int_optional",
67        deserialize_with = "crate::types::deserialize_int_optional"
68    )]
69    #[serde(skip_serializing_if = "Option::is_none", default)]
70    #[doc = "Limit I/O bandwidth (in KiB/s)."]
71    pub bwlimit: Option<u64>,
72    #[serde(skip_serializing_if = "Option::is_none", default)]
73    #[doc = "Description for the Job."]
74    pub comment: Option<String>,
75    #[serde(skip_serializing_if = "Option::is_none", default)]
76    #[doc = "Compress dump file."]
77    pub compress: Option<Compress>,
78    #[serde(skip_serializing_if = "Option::is_none", default)]
79    #[doc = "A list of settings you want to delete."]
80    pub delete: Option<String>,
81    #[serde(skip_serializing_if = "Option::is_none", default)]
82    #[doc = "Day of week selection."]
83    pub dow: Option<String>,
84    #[serde(skip_serializing_if = "Option::is_none", default)]
85    #[doc = "Store resulting files to specified directory."]
86    pub dumpdir: Option<String>,
87    #[serde(skip_serializing_if = "Option::is_none", default)]
88    #[doc = "Enable or disable the job."]
89    pub enabled: Option<()>,
90    #[serde(skip_serializing_if = "Option::is_none", default)]
91    #[doc = "Exclude specified guest systems (assumes --all)"]
92    pub exclude: Option<String>,
93    #[serde(rename = "exclude-path")]
94    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
95    #[doc = "Exclude certain files/directories (shell globs). Paths starting with '/' are anchored to the container's root, other paths match relative to each subdirectory."]
96    pub exclude_path: Vec<String>,
97    #[serde(
98        serialize_with = "crate::types::serialize_int_optional",
99        deserialize_with = "crate::types::deserialize_int_optional"
100    )]
101    #[serde(skip_serializing_if = "Option::is_none", default)]
102    #[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."]
103    pub ionice: Option<u64>,
104    #[serde(
105        serialize_with = "crate::types::serialize_int_optional",
106        deserialize_with = "crate::types::deserialize_int_optional"
107    )]
108    #[serde(skip_serializing_if = "Option::is_none", default)]
109    #[doc = "Maximal time to wait for the global lock (minutes)."]
110    pub lockwait: Option<u64>,
111    #[serde(skip_serializing_if = "Option::is_none", default)]
112    #[doc = "Deprecated: use notification targets/matchers instead. Specify when to send a notification mail"]
113    pub mailnotification: Option<Mailnotification>,
114    #[serde(skip_serializing_if = "Option::is_none", default)]
115    #[doc = "Deprecated: Use notification targets/matchers instead. Comma-separated list of email addresses or users that should receive email notifications."]
116    pub mailto: Option<String>,
117    #[serde(
118        serialize_with = "crate::types::serialize_int_optional",
119        deserialize_with = "crate::types::deserialize_int_optional"
120    )]
121    #[serde(skip_serializing_if = "Option::is_none", default)]
122    #[doc = "Deprecated: use 'prune-backups' instead. Maximal number of backup files per guest system."]
123    pub maxfiles: Option<u64>,
124    #[serde(skip_serializing_if = "Option::is_none", default)]
125    #[doc = "Backup mode."]
126    pub mode: Option<Mode>,
127    #[serde(skip_serializing_if = "Option::is_none", default)]
128    #[doc = "Only run if executed on this node."]
129    pub node: Option<String>,
130    #[serde(rename = "notes-template")]
131    #[serde(skip_serializing_if = "Option::is_none", default)]
132    #[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."]
133    pub notes_template: Option<String>,
134    #[serde(rename = "notification-mode")]
135    #[serde(skip_serializing_if = "Option::is_none", default)]
136    #[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."]
137    pub notification_mode: Option<NotificationMode>,
138    #[serde(rename = "notification-policy")]
139    #[serde(skip_serializing_if = "Option::is_none", default)]
140    #[doc = "Deprecated: Do not use"]
141    pub notification_policy: Option<NotificationPolicy>,
142    #[serde(rename = "notification-target")]
143    #[serde(skip_serializing_if = "Option::is_none", default)]
144    #[doc = "Deprecated: Do not use"]
145    pub notification_target: Option<String>,
146    #[serde(skip_serializing_if = "Option::is_none", default)]
147    #[doc = "Other performance-related settings."]
148    pub performance: Option<String>,
149    #[serde(
150        serialize_with = "crate::types::serialize_int_optional",
151        deserialize_with = "crate::types::deserialize_int_optional"
152    )]
153    #[serde(skip_serializing_if = "Option::is_none", default)]
154    #[doc = "Use pigz instead of gzip when N\\>0. N=1 uses half of cores, N\\>1 uses N as thread count."]
155    pub pigz: Option<u64>,
156    #[serde(skip_serializing_if = "Option::is_none", default)]
157    #[doc = "Backup all known guest systems included in the specified pool."]
158    pub pool: Option<String>,
159    #[serde(
160        serialize_with = "crate::types::serialize_bool_optional",
161        deserialize_with = "crate::types::deserialize_bool_optional"
162    )]
163    #[serde(skip_serializing_if = "Option::is_none", default)]
164    #[doc = "If true, mark backup(s) as protected."]
165    pub protected: Option<bool>,
166    #[serde(rename = "prune-backups")]
167    #[serde(skip_serializing_if = "Option::is_none", default)]
168    #[doc = "Use these retention options instead of those from the storage configuration."]
169    pub prune_backups: Option<String>,
170    #[serde(
171        serialize_with = "crate::types::serialize_bool_optional",
172        deserialize_with = "crate::types::deserialize_bool_optional"
173    )]
174    #[serde(skip_serializing_if = "Option::is_none", default)]
175    #[doc = "Be quiet."]
176    pub quiet: Option<bool>,
177    #[serde(
178        serialize_with = "crate::types::serialize_bool_optional",
179        deserialize_with = "crate::types::deserialize_bool_optional"
180    )]
181    #[serde(skip_serializing_if = "Option::is_none", default)]
182    #[doc = "Prune older backups according to 'prune-backups'."]
183    pub remove: Option<bool>,
184    #[serde(rename = "repeat-missed")]
185    #[serde(
186        serialize_with = "crate::types::serialize_bool_optional",
187        deserialize_with = "crate::types::deserialize_bool_optional"
188    )]
189    #[serde(skip_serializing_if = "Option::is_none", default)]
190    #[doc = "If true, the job will be run as soon as possible if it was missed while the scheduler was not running."]
191    pub repeat_missed: Option<bool>,
192    #[serde(skip_serializing_if = "Option::is_none", default)]
193    #[doc = "Backup schedule. The format is a subset of `systemd` calendar events."]
194    pub schedule: Option<String>,
195    #[serde(skip_serializing_if = "Option::is_none", default)]
196    #[doc = "Use specified hook script."]
197    pub script: Option<String>,
198    #[serde(skip_serializing_if = "Option::is_none", default)]
199    #[doc = "Job Start time."]
200    pub starttime: Option<String>,
201    #[serde(
202        serialize_with = "crate::types::serialize_bool_optional",
203        deserialize_with = "crate::types::deserialize_bool_optional"
204    )]
205    #[serde(skip_serializing_if = "Option::is_none", default)]
206    #[doc = "Exclude temporary files and logs."]
207    pub stdexcludes: Option<bool>,
208    #[serde(
209        serialize_with = "crate::types::serialize_bool_optional",
210        deserialize_with = "crate::types::deserialize_bool_optional"
211    )]
212    #[serde(skip_serializing_if = "Option::is_none", default)]
213    #[doc = "Stop running backup jobs on this host."]
214    pub stop: Option<bool>,
215    #[serde(
216        serialize_with = "crate::types::serialize_int_optional",
217        deserialize_with = "crate::types::deserialize_int_optional"
218    )]
219    #[serde(skip_serializing_if = "Option::is_none", default)]
220    #[doc = "Maximal time to wait until a guest system is stopped (minutes)."]
221    pub stopwait: Option<u64>,
222    #[serde(skip_serializing_if = "Option::is_none", default)]
223    #[doc = "Store resulting file to this storage."]
224    pub storage: Option<String>,
225    #[serde(skip_serializing_if = "Option::is_none", default)]
226    #[doc = "Store temporary files to specified directory."]
227    pub tmpdir: Option<String>,
228    #[serde(skip_serializing_if = "Option::is_none", default)]
229    #[doc = "The ID of the guest system you want to backup."]
230    pub vmid: Option<String>,
231    #[serde(
232        serialize_with = "crate::types::serialize_int_optional",
233        deserialize_with = "crate::types::deserialize_int_optional"
234    )]
235    #[serde(skip_serializing_if = "Option::is_none", default)]
236    #[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."]
237    pub zstd: Option<u64>,
238    #[serde(
239        flatten,
240        default,
241        skip_serializing_if = "::std::collections::HashMap::is_empty"
242    )]
243    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
244}
245#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
246pub enum Compress {
247    #[serde(rename = "0")]
248    _0,
249    #[serde(rename = "1")]
250    _1,
251    #[serde(rename = "gzip")]
252    Gzip,
253    #[serde(rename = "lzo")]
254    Lzo,
255    #[serde(rename = "zstd")]
256    Zstd,
257}
258impl Default for Compress {
259    fn default() -> Self {
260        Self::_0
261    }
262}
263#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
264pub enum Mailnotification {
265    #[serde(rename = "always")]
266    Always,
267    #[serde(rename = "failure")]
268    Failure,
269}
270impl Default for Mailnotification {
271    fn default() -> Self {
272        Self::Always
273    }
274}
275#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
276pub enum Mode {
277    #[serde(rename = "snapshot")]
278    Snapshot,
279    #[serde(rename = "stop")]
280    Stop,
281    #[serde(rename = "suspend")]
282    Suspend,
283}
284impl Default for Mode {
285    fn default() -> Self {
286        Self::Snapshot
287    }
288}
289#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
290pub enum NotificationMode {
291    #[serde(rename = "auto")]
292    Auto,
293    #[serde(rename = "legacy-sendmail")]
294    LegacySendmail,
295    #[serde(rename = "notification-system")]
296    NotificationSystem,
297}
298impl Default for NotificationMode {
299    fn default() -> Self {
300        Self::Auto
301    }
302}
303#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
304pub enum NotificationPolicy {
305    #[serde(rename = "always")]
306    Always,
307    #[serde(rename = "failure")]
308    Failure,
309    #[serde(rename = "never")]
310    Never,
311}
312impl Default for NotificationPolicy {
313    fn default() -> Self {
314        Self::Always
315    }
316}
317impl<T> IdClient<T>
318where
319    T: crate::client::Client,
320{
321    pub fn included_volumes(&self) -> included_volumes::IncludedVolumesClient<T> {
322        included_volumes::IncludedVolumesClient::<T>::new(self.client.clone(), &self.path)
323    }
324}