[pbs-devel] [PATCH proxmox-backup v4 19/43] api-types: api: tape: add notification-mode parameter
Lukas Wagner
l.wagner at proxmox.com
Mon Apr 22 14:38:17 CEST 2024
Same as with datastores, this option determines whether we send
notifications the old way (send email via sendmail to a user's email
address) or the new way (emit matchable notification events to the
notification stack).
Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
Tested-by: Gabriel Goller <g.goller at proxmox.com>
Reviewed-by: Gabriel Goller <g.goller at proxmox.com>
---
pbs-api-types/src/jobs.rs | 8 +++++---
src/api2/config/tape_backup_job.rs | 8 ++++++++
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/pbs-api-types/src/jobs.rs b/pbs-api-types/src/jobs.rs
index 6fb9b187..868702bc 100644
--- a/pbs-api-types/src/jobs.rs
+++ b/pbs-api-types/src/jobs.rs
@@ -8,9 +8,9 @@ use serde::{Deserialize, Serialize};
use proxmox_schema::*;
use crate::{
- Authid, BackupNamespace, BackupType, RateLimitConfig, Userid, BACKUP_GROUP_SCHEMA,
- BACKUP_NAMESPACE_SCHEMA, BACKUP_NS_RE, DATASTORE_SCHEMA, DRIVE_NAME_SCHEMA,
- MEDIA_POOL_NAME_SCHEMA, NS_MAX_DEPTH_REDUCED_SCHEMA, PROXMOX_SAFE_ID_FORMAT,
+ Authid, BackupNamespace, BackupType, NotificationMode, RateLimitConfig, Userid,
+ BACKUP_GROUP_SCHEMA, BACKUP_NAMESPACE_SCHEMA, BACKUP_NS_RE, DATASTORE_SCHEMA,
+ DRIVE_NAME_SCHEMA, MEDIA_POOL_NAME_SCHEMA, NS_MAX_DEPTH_REDUCED_SCHEMA, PROXMOX_SAFE_ID_FORMAT,
PROXMOX_SAFE_ID_REGEX_STR, REMOTE_ID_SCHEMA, SINGLE_LINE_COMMENT_SCHEMA,
};
@@ -325,6 +325,8 @@ pub struct TapeBackupJobSetup {
#[serde(skip_serializing_if = "Option::is_none")]
pub notify_user: Option<Userid>,
#[serde(skip_serializing_if = "Option::is_none")]
+ pub notification_mode: Option<NotificationMode>,
+ #[serde(skip_serializing_if = "Option::is_none")]
pub group_filter: Option<Vec<GroupFilter>>,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ns: Option<BackupNamespace>,
diff --git a/src/api2/config/tape_backup_job.rs b/src/api2/config/tape_backup_job.rs
index 386ff530..e425cbb5 100644
--- a/src/api2/config/tape_backup_job.rs
+++ b/src/api2/config/tape_backup_job.rs
@@ -132,6 +132,8 @@ pub enum DeletableProperty {
LatestOnly,
/// Delete the 'notify-user' property
NotifyUser,
+ /// Delete the 'notification-mode' property
+ NotificationMode,
/// Delete the 'group_filter' property
GroupFilter,
/// Delete the 'max-depth' property
@@ -202,6 +204,9 @@ pub fn update_tape_backup_job(
DeletableProperty::NotifyUser => {
data.setup.notify_user = None;
}
+ DeletableProperty::NotificationMode => {
+ data.setup.notification_mode = None;
+ }
DeletableProperty::Schedule => {
data.schedule = None;
}
@@ -243,6 +248,9 @@ pub fn update_tape_backup_job(
if update.setup.notify_user.is_some() {
data.setup.notify_user = update.setup.notify_user;
}
+ if update.setup.notification_mode.is_some() {
+ data.setup.notification_mode = update.setup.notification_mode;
+ }
if update.setup.group_filter.is_some() {
data.setup.group_filter = update.setup.group_filter;
}
--
2.39.2
More information about the pbs-devel
mailing list