api: tape/backup: fix namespace/max-depth parameters

by adding the 'default' serde hint and renaming 'recursion_depth' to
'max_depth' (to be in line with sync job config)

also add the logic to actually add/update the tape backup job config

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak
2022-05-13 09:06:11 +02:00
parent 1e37156a6b
commit 12d334615b
3 changed files with 20 additions and 5 deletions

View File

@ -134,6 +134,10 @@ pub enum DeletableProperty {
NotifyUser,
/// Delete the 'group_filter' property
GroupFilter,
/// Delete the 'max-depth' property
MaxDepth,
/// Delete the 'ns' property
Ns,
}
#[api(
@ -207,6 +211,12 @@ pub fn update_tape_backup_job(
DeletableProperty::GroupFilter => {
data.setup.group_filter = None;
}
DeletableProperty::MaxDepth => {
data.setup.max_depth = None;
}
DeletableProperty::Ns => {
data.setup.ns = None;
}
}
}
}
@ -236,6 +246,12 @@ pub fn update_tape_backup_job(
if update.setup.group_filter.is_some() {
data.setup.group_filter = update.setup.group_filter;
}
if update.setup.ns.is_some() {
data.setup.ns = update.setup.ns;
}
if update.setup.max_depth.is_some() {
data.setup.max_depth = update.setup.max_depth;
}
let schedule_changed = data.schedule != update.schedule;
if update.schedule.is_some() {