From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 6ACD91FF142 for ; Mon, 16 Feb 2026 11:45:56 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id AEAC1DD45; Mon, 16 Feb 2026 11:45:18 +0100 (CET) From: Dietmar Maurer To: pve-devel@lists.proxmox.com Subject: [RFC proxmox 20/22] firewall-api-types: add DeletableFirewallRuleProperty enum Date: Mon, 16 Feb 2026 11:43:58 +0100 Message-ID: <20260216104401.3959270-21-dietmar@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260216104401.3959270-1-dietmar@proxmox.com> References: <20260216104401.3959270-1-dietmar@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -1.867 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 ENA_SUBJ_ODD_CASE 2.6 Subject has odd case KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Message-ID-Hash: WZDIH7CURWI3QZBBPIQZ26AE4ZLFXAZH X-Message-ID-Hash: WZDIH7CURWI3QZBBPIQZ26AE4ZLFXAZH X-MailFrom: dietmar@zilli.proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add a DeletableFirewallRuleProperty enum listing the optional FirewallRule properties that can be explicitly deleted via the update_rule API. Use kebab-case serialization to match the existing API conventions. Add the 'delete' parameter to the update_rule mock API handler to verify that the new type integrates correctly with the #[api] macro. Signed-off-by: Dietmar Maurer --- proxmox-firewall-api-types/src/lib.rs | 4 ++- proxmox-firewall-api-types/src/rule.rs | 43 +++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/proxmox-firewall-api-types/src/lib.rs b/proxmox-firewall-api-types/src/lib.rs index 25e260c3..0eebd727 100644 --- a/proxmox-firewall-api-types/src/lib.rs +++ b/proxmox-firewall-api-types/src/lib.rs @@ -39,4 +39,6 @@ pub use port::{ }; mod rule; -pub use rule::{FirewallRule, FirewallRuleType}; +pub use rule::{ + DeletableFirewallRuleProperty, FirewallRule, FirewallRuleListEntry, FirewallRuleType, +}; diff --git a/proxmox-firewall-api-types/src/rule.rs b/proxmox-firewall-api-types/src/rule.rs index d067c209..f22de9e9 100644 --- a/proxmox-firewall-api-types/src/rule.rs +++ b/proxmox-firewall-api-types/src/rule.rs @@ -160,6 +160,37 @@ pub struct FirewallRuleListEntry { pub rule: FirewallRule, } +#[api()] +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "kebab-case")] +/// Deletable property name +pub enum DeletableFirewallRuleProperty { + /// Delete the comment property. + Comment, + /// Delete the destination address property. + Dest, + /// Delete the destination port property. + DestPort, + /// Delete the enable property. + Enable, + /// Delete the group property. + Group, + /// Delete the ICMP type property. + IcmpType, + /// Delete the interface property. + Iface, + /// Delete the log property. + Log, + /// Delete the macro property. + Macro, + /// Delete the protocol property. + Proto, + /// Delete the source address property. + Source, + /// Delete the source port property. + Sport, +} + #[api] /// Rule type. #[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)] @@ -232,6 +263,7 @@ mod test { } #[cfg(test)] +#[allow(unused)] mod test_fake_server_client_api { use super::*; use anyhow::Error; @@ -273,9 +305,17 @@ mod test_fake_server_client_api { pos: { schema: FIREWALL_RULE_POS_SCHEMA, }, - digest: { + delete: { + description: "List of properties to delete.", + type: Array, optional: true, + items: { + type: DeletableFirewallRuleProperty, + } }, + digest: { + optional: true, + }, }, }, )] @@ -283,6 +323,7 @@ mod test_fake_server_client_api { pub fn update_rule( pos: u64, rule: FirewallRuleUpdater, + delete: Option>, digest: Option, ) -> Result<(), Error> { unimplemented!(); -- 2.47.3