From: Dietmar Maurer <dietmar@proxmox.com>
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 [thread overview]
Message-ID: <20260216104401.3959270-21-dietmar@proxmox.com> (raw)
In-Reply-To: <20260216104401.3959270-1-dietmar@proxmox.com>
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 <dietmar@proxmox.com>
---
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<Vec<DeletableFirewallRuleProperty>>,
digest: Option<ConfigDigest>,
) -> Result<(), Error> {
unimplemented!();
--
2.47.3
next prev parent reply other threads:[~2026-02-16 10:45 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-16 10:43 [RFC proxmox 00/22] New crate for firewall api types Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 01/22] firewall-api-types: add new " Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 02/22] firewall-api-types: add README.md Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 03/22] firewall-api-types: add firewall policy types Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 04/22] firewall-api-types: add logging types Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 05/22] firewall-api-types: add FirewallClusterOptions Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 06/22] firewall-api-types: add FirewallGuestOptions Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 07/22] firewall-api-types: add FirewallConntrackHelper enum Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 08/22] firewall-api-types: add FirewallNodeOptions struct Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 09/22] firewall-api-types: add FirewallRef type Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 10/22] firewall-api-types: add FirewallPortList types Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 11/22] firewall-api-types: add FirewallIcmpType Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 12/22] firewall-api-types: add FirewallIpsetReference type Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 13/22] firewall-api-types: add FirewallAliasReference type Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 14/22] firewall-api-types: add firewall address types Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 15/22] firewall-api-types: add FirewallRule type Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 16/22] firewall-api-types: use ConfigDigest from proxmox-config-digest crate Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 17/22] firewall-api-types: use COMMENT_SCHEMA from proxmox-schema crate Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 18/22] firewall-api-types: add FirewallRuleUpdater type Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 19/22] firewall-api-types: refactor FirewallRule and add FirewallRuleListEntry Dietmar Maurer
2026-02-16 10:43 ` Dietmar Maurer [this message]
2026-02-16 10:43 ` [RFC proxmox 21/22] firewall-api-types: add FirewallAliasEntry API type Dietmar Maurer
2026-02-16 10:44 ` [RFC proxmox 22/22] firewall-api-types: add FirewallIpsetListEntry and FirewallIpsetEntry api types Dietmar Maurer
2026-02-17 6:17 ` [RFC proxmox 00/22] New crate for firewall " Hannes Laimer
2026-02-17 6:39 ` Dietmar Maurer
2026-02-17 8:17 ` Hannes Laimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260216104401.3959270-21-dietmar@proxmox.com \
--to=dietmar@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox