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(