From 9152a0077f6b4ea061fa5410bc2a8f50757890df Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Fri, 5 Mar 2021 09:45:30 +0100 Subject: [PATCH] config/tape_job: add notify-user config to tape jobs Signed-off-by: Dominik Csapak Signed-off-by: Dietmar Maurer --- src/api2/config/tape_backup_job.rs | 10 ++++++++++ src/config/tape_job.rs | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/src/api2/config/tape_backup_job.rs b/src/api2/config/tape_backup_job.rs index 6b116af6..caea4e18 100644 --- a/src/api2/config/tape_backup_job.rs +++ b/src/api2/config/tape_backup_job.rs @@ -8,6 +8,7 @@ use proxmox::tools::fs::open_file_locked; use crate::{ api2::types::{ Authid, + Userid, JOB_ID_SCHEMA, DATASTORE_SCHEMA, DRIVE_NAME_SCHEMA, @@ -149,6 +150,8 @@ pub enum DeletableProperty { ExportMediaSet, /// Delete the 'latest-only' property LatestOnly, + /// Delete the 'notify-user' property + NotifyUser, } #[api( @@ -185,6 +188,10 @@ pub enum DeletableProperty { type: bool, optional: true, }, + "notify-user": { + optional: true, + type: Userid, + }, comment: { optional: true, schema: SINGLE_LINE_COMMENT_SCHEMA, @@ -220,6 +227,7 @@ pub fn update_tape_backup_job( eject_media: Option, export_media_set: Option, latest_only: Option, + notify_user: Option, comment: Option, schedule: Option, delete: Option>, @@ -242,6 +250,7 @@ pub fn update_tape_backup_job( DeletableProperty::EjectMedia => { data.setup.eject_media = None; }, DeletableProperty::ExportMediaSet => { data.setup.export_media_set = None; }, DeletableProperty::LatestOnly => { data.setup.latest_only = None; }, + DeletableProperty::NotifyUser => { data.setup.notify_user = None; }, DeletableProperty::Schedule => { data.schedule = None; }, DeletableProperty::Comment => { data.comment = None; }, } @@ -255,6 +264,7 @@ pub fn update_tape_backup_job( if eject_media.is_some() { data.setup.eject_media = eject_media; }; if export_media_set.is_some() { data.setup.export_media_set = export_media_set; } if latest_only.is_some() { data.setup.latest_only = latest_only; } + if notify_user.is_some() { data.setup.notify_user = notify_user; } if schedule.is_some() { data.schedule = schedule; } diff --git a/src/config/tape_job.rs b/src/config/tape_job.rs index 5b250117..f9c6205d 100644 --- a/src/config/tape_job.rs +++ b/src/config/tape_job.rs @@ -16,6 +16,7 @@ use proxmox::api::{ use proxmox::tools::{fs::replace_file, fs::CreateOptions}; use crate::api2::types::{ + Userid, JOB_ID_SCHEMA, DATASTORE_SCHEMA, DRIVE_NAME_SCHEMA, @@ -55,6 +56,10 @@ lazy_static! { type: bool, optional: true, }, + "notify-user": { + optional: true, + type: Userid, + }, } )] #[serde(rename_all="kebab-case")] @@ -70,6 +75,9 @@ pub struct TapeBackupJobSetup { pub export_media_set: Option, #[serde(skip_serializing_if="Option::is_none")] pub latest_only: Option, + /// Send job email notification to this user + #[serde(skip_serializing_if="Option::is_none")] + pub notify_user: Option, } #[api(