From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <l.wagner@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id D4D0799C3B
 for <pve-devel@lists.proxmox.com>; Tue, 14 Nov 2023 14:00:46 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 182EA1FE27
 for <pve-devel@lists.proxmox.com>; Tue, 14 Nov 2023 14:00:15 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pve-devel@lists.proxmox.com>; Tue, 14 Nov 2023 14:00:12 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 1BB9C42996
 for <pve-devel@lists.proxmox.com>; Tue, 14 Nov 2023 14:00:12 +0100 (CET)
From: Lukas Wagner <l.wagner@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Tue, 14 Nov 2023 13:59:27 +0100
Message-Id: <20231114130000.565122-20-l.wagner@proxmox.com>
X-Mailer: git-send-email 2.39.2
In-Reply-To: <20231114130000.565122-1-l.wagner@proxmox.com>
References: <20231114130000.565122-1-l.wagner@proxmox.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.012 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 T_SCC_BODY_TEXT_LINE    -0.01 -
Subject: [pve-devel] [PATCH v2 proxmox-perl-rs 19/52] notify: add 'disable'
 parameter
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Tue, 14 Nov 2023 13:00:46 -0000

This parameter disables a matcher/a target.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
 common/src/notify.rs | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/common/src/notify.rs b/common/src/notify.rs
index 8a6d76e..a5ab754 100644
--- a/common/src/notify.rs
+++ b/common/src/notify.rs
@@ -147,6 +147,7 @@ mod export {
         from_address: Option<String>,
         author: Option<String>,
         comment: Option<String>,
+        disable: Option<bool>,
     ) -> Result<(), HttpError> {
         let mut config = this.config.lock().unwrap();
 
@@ -159,7 +160,7 @@ mod export {
                 from_address,
                 author,
                 comment,
-                filter: None,
+                disable,
             },
         )
     }
@@ -174,6 +175,7 @@ mod export {
         from_address: Option<String>,
         author: Option<String>,
         comment: Option<String>,
+        disable: Option<bool>,
         delete: Option<Vec<DeleteableSendmailProperty>>,
         digest: Option<&str>,
     ) -> Result<(), HttpError> {
@@ -189,6 +191,7 @@ mod export {
                 from_address,
                 author,
                 comment,
+                disable,
             },
             delete.as_deref(),
             digest.as_deref(),
@@ -228,6 +231,7 @@ mod export {
         server: String,
         token: String,
         comment: Option<String>,
+        disable: Option<bool>,
     ) -> Result<(), HttpError> {
         let mut config = this.config.lock().unwrap();
         api::gotify::add_endpoint(
@@ -236,6 +240,7 @@ mod export {
                 name: name.clone(),
                 server,
                 comment,
+                disable,
                 filter: None,
             },
             &GotifyPrivateConfig { name, token },
@@ -250,6 +255,7 @@ mod export {
         server: Option<String>,
         token: Option<String>,
         comment: Option<String>,
+        disable: Option<bool>,
         delete: Option<Vec<DeleteableGotifyProperty>>,
         digest: Option<&str>,
     ) -> Result<(), HttpError> {
@@ -259,7 +265,11 @@ mod export {
         api::gotify::update_endpoint(
             &mut config,
             name,
-            &GotifyConfigUpdater { server, comment },
+            &GotifyConfigUpdater {
+                server,
+                comment,
+                disable,
+            },
             &GotifyPrivateConfigUpdater { token },
             delete.as_deref(),
             digest.as_deref(),
@@ -307,6 +317,7 @@ mod export {
         from_address: String,
         author: Option<String>,
         comment: Option<String>,
+        disable: Option<bool>,
     ) -> Result<(), HttpError> {
         let mut config = this.config.lock().unwrap();
         api::smtp::add_endpoint(
@@ -322,6 +333,7 @@ mod export {
                 from_address,
                 author,
                 comment,
+                disable,
             },
             &SmtpPrivateConfig { name, password },
         )
@@ -342,6 +354,7 @@ mod export {
         from_address: Option<String>,
         author: Option<String>,
         comment: Option<String>,
+        disable: Option<bool>,
         delete: Option<Vec<DeleteableSmtpProperty>>,
         digest: Option<&str>,
     ) -> Result<(), HttpError> {
@@ -361,6 +374,7 @@ mod export {
                 from_address,
                 author,
                 comment,
+                disable,
             },
             &SmtpPrivateConfigUpdater { password },
             delete.as_deref(),
@@ -406,6 +420,7 @@ mod export {
         mode: Option<MatchModeOperator>,
         invert_match: Option<bool>,
         comment: Option<String>,
+        disable: Option<bool>,
     ) -> Result<(), HttpError> {
         let mut config = this.config.lock().unwrap();
         api::matcher::add_matcher(
@@ -419,6 +434,7 @@ mod export {
                 mode,
                 invert_match,
                 comment,
+                disable,
             },
         )
     }
@@ -435,6 +451,7 @@ mod export {
         mode: Option<MatchModeOperator>,
         invert_match: Option<bool>,
         comment: Option<String>,
+        disable: Option<bool>,
         delete: Option<Vec<DeleteableMatcherProperty>>,
         digest: Option<&str>,
     ) -> Result<(), HttpError> {
@@ -452,6 +469,7 @@ mod export {
                 mode,
                 invert_match,
                 comment,
+                disable,
             },
             delete.as_deref(),
             digest.as_deref(),
-- 
2.39.2