api: datastore: allow to set "verify-new" option over API

Until now, one could only set this by editing the configuration file
manually.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-11-06 14:08:01 +01:00
parent beeadb8a4b
commit ad53c1d6dd
1 changed files with 12 additions and 0 deletions

View File

@ -196,6 +196,8 @@ pub enum DeletableProperty {
keep_monthly, keep_monthly,
/// Delete the keep-yearly property /// Delete the keep-yearly property
keep_yearly, keep_yearly,
/// Delete the verify-new property
verify_new,
/// Delete the notify-user property /// Delete the notify-user property
notify_user, notify_user,
/// Delete the notify property /// Delete the notify property
@ -253,6 +255,12 @@ pub enum DeletableProperty {
optional: true, optional: true,
schema: PRUNE_SCHEMA_KEEP_YEARLY, schema: PRUNE_SCHEMA_KEEP_YEARLY,
}, },
"verify-new": {
description: "If enabled, all new backups will be verified right after completion.",
type: bool,
optional: true,
default: false,
},
delete: { delete: {
description: "List of properties to delete.", description: "List of properties to delete.",
type: Array, type: Array,
@ -283,6 +291,7 @@ pub fn update_datastore(
keep_weekly: Option<u64>, keep_weekly: Option<u64>,
keep_monthly: Option<u64>, keep_monthly: Option<u64>,
keep_yearly: Option<u64>, keep_yearly: Option<u64>,
verify_new: Option<bool>,
notify: Option<String>, notify: Option<String>,
notify_user: Option<Userid>, notify_user: Option<Userid>,
delete: Option<Vec<DeletableProperty>>, delete: Option<Vec<DeletableProperty>>,
@ -313,6 +322,7 @@ pub fn update_datastore(
DeletableProperty::keep_weekly => { data.keep_weekly = None; }, DeletableProperty::keep_weekly => { data.keep_weekly = None; },
DeletableProperty::keep_monthly => { data.keep_monthly = None; }, DeletableProperty::keep_monthly => { data.keep_monthly = None; },
DeletableProperty::keep_yearly => { data.keep_yearly = None; }, DeletableProperty::keep_yearly => { data.keep_yearly = None; },
DeletableProperty::verify_new => { data.verify_new = None; },
DeletableProperty::notify => { data.notify = None; }, DeletableProperty::notify => { data.notify = None; },
DeletableProperty::notify_user => { data.notify_user = None; }, DeletableProperty::notify_user => { data.notify_user = None; },
} }
@ -356,6 +366,8 @@ pub fn update_datastore(
data.notify = Some(notify_str); data.notify = Some(notify_str);
} }
} }
if verify_new.is_some() { data.verify_new = verify_new; }
if notify_user.is_some() { data.notify_user = notify_user; } if notify_user.is_some() { data.notify_user = notify_user; }
config.set_data(&name, "datastore", &data)?; config.set_data(&name, "datastore", &data)?;