forked from proxmox-mirrors/proxmox
notify: derive Deserialize/Serialize for Notification struct
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com> Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
1a40d34083
commit
c55f37b8c4
@ -159,9 +159,11 @@ pub trait Endpoint {
|
||||
fn disabled(&self) -> bool;
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub enum Content {
|
||||
/// Title and body will be rendered as a template
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
Template {
|
||||
/// Name of the used template
|
||||
template_name: String,
|
||||
@ -169,6 +171,7 @@ pub enum Content {
|
||||
data: Value,
|
||||
},
|
||||
#[cfg(feature = "mail-forwarder")]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
ForwardedMail {
|
||||
/// Raw mail contents
|
||||
raw: Vec<u8>,
|
||||
@ -182,7 +185,8 @@ pub enum Content {
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub struct Metadata {
|
||||
/// Notification severity
|
||||
severity: Severity,
|
||||
@ -192,7 +196,8 @@ pub struct Metadata {
|
||||
additional_fields: HashMap<String, String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
/// Notification which can be sent
|
||||
pub struct Notification {
|
||||
/// Notification content
|
||||
|
Loading…
Reference in New Issue
Block a user