[pve-devel] [PATCH proxmox v2 09/20] notify: derive `api` for Deleteable*Property

Lukas Wagner l.wagner at proxmox.com
Fri Apr 19 16:17:12 CEST 2024


The API endpoints in Proxmox Backup Server require ApiType to be
implemented for any deserialized parameter.

Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner at proxmox.com>
---
 proxmox-notify/src/endpoints/gotify.rs   | 3 +++
 proxmox-notify/src/endpoints/sendmail.rs | 7 +++++++
 proxmox-notify/src/endpoints/smtp.rs     | 9 +++++++++
 proxmox-notify/src/matcher.rs            | 9 +++++++++
 4 files changed, 28 insertions(+)

diff --git a/proxmox-notify/src/endpoints/gotify.rs b/proxmox-notify/src/endpoints/gotify.rs
index afdfabc..ee8ca51 100644
--- a/proxmox-notify/src/endpoints/gotify.rs
+++ b/proxmox-notify/src/endpoints/gotify.rs
@@ -81,10 +81,13 @@ pub struct GotifyEndpoint {
     pub private_config: GotifyPrivateConfig,
 }
 
+#[api]
 #[derive(Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case")]
 pub enum DeleteableGotifyProperty {
+    /// Delete `comment`
     Comment,
+    /// Delete `disable`
     Disable,
 }
 
diff --git a/proxmox-notify/src/endpoints/sendmail.rs b/proxmox-notify/src/endpoints/sendmail.rs
index fa04002..47901ef 100644
--- a/proxmox-notify/src/endpoints/sendmail.rs
+++ b/proxmox-notify/src/endpoints/sendmail.rs
@@ -73,14 +73,21 @@ pub struct SendmailConfig {
     pub origin: Option<Origin>,
 }
 
+#[api]
 #[derive(Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case")]
 pub enum DeleteableSendmailProperty {
+    /// Delete `author`
     Author,
+    /// Delete `comment`
     Comment,
+    /// Delete `disable`
     Disable,
+    /// Delete `from-address`
     FromAddress,
+    /// Delete `mailto`
     Mailto,
+    /// Delete `mailto-user`
     MailtoUser,
 }
 
diff --git a/proxmox-notify/src/endpoints/smtp.rs b/proxmox-notify/src/endpoints/smtp.rs
index ded5baf..f04583a 100644
--- a/proxmox-notify/src/endpoints/smtp.rs
+++ b/proxmox-notify/src/endpoints/smtp.rs
@@ -104,16 +104,25 @@ pub struct SmtpConfig {
     pub origin: Option<Origin>,
 }
 
+#[api]
 #[derive(Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case")]
 pub enum DeleteableSmtpProperty {
+    /// Delete `author`
     Author,
+    /// Delete `comment`
     Comment,
+    /// Delete `disable`
     Disable,
+    /// Delete `mailto`
     Mailto,
+    /// Delete `mailto-user`
     MailtoUser,
+    /// Delete `password`
     Password,
+    /// Delete `port`
     Port,
+    /// Delete `username`
     Username,
 }
 
diff --git a/proxmox-notify/src/matcher.rs b/proxmox-notify/src/matcher.rs
index b387fef..2d30378 100644
--- a/proxmox-notify/src/matcher.rs
+++ b/proxmox-notify/src/matcher.rs
@@ -412,16 +412,25 @@ impl FromStr for CalendarMatcher {
     }
 }
 
+#[api]
 #[derive(Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case")]
 pub enum DeleteableMatcherProperty {
+    /// Delete `comment`
     Comment,
+    /// Delete `disable`
     Disable,
+    /// Delete `invert-match`
     InvertMatch,
+    /// Delete `match-calendar`
     MatchCalendar,
+    /// Delete `match-field`
     MatchField,
+    /// Delete `match-severity`
     MatchSeverity,
+    /// Delete `mode`
     Mode,
+    /// Delete `target`
     Target,
 }
 
-- 
2.39.2





More information about the pve-devel mailing list