From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Dietmar Maurer <dietmar@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [RFC proxmox 09/22] firewall-api-types: add FirewallRef type
Date: Thu, 12 Mar 2026 11:36:18 +0100 [thread overview]
Message-ID: <ifr6ufc3el745l7eissiu6jzmkulv74soeazspmx6wol3gjiaq@47bfopwarwn6> (raw)
In-Reply-To: <20260216104401.3959270-10-dietmar@proxmox.com>
On Mon, Feb 16, 2026 at 11:43:47AM +0100, Dietmar Maurer wrote:
> Introduce FirewallRef struct and FirewallRefType enum for representing
> firewall address references (aliases and ipsets) with their metadata
> (name, reference string, scope, and optional comment).
>
> The FirewallRefType enum includes an UnknownEnumValue variant behind
> the "enum-fallback" feature flag for forward compatibility with
> unknown variants.
>
> Extracted from Perl API.
>
> Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
> ---
> .../src/firewall_ref.rs | 62 +++++++++++++++++++
> proxmox-firewall-api-types/src/lib.rs | 3 +
> 2 files changed, 65 insertions(+)
> create mode 100644 proxmox-firewall-api-types/src/firewall_ref.rs
>
> diff --git a/proxmox-firewall-api-types/src/firewall_ref.rs b/proxmox-firewall-api-types/src/firewall_ref.rs
> new file mode 100644
> index 00000000..483e57ce
> --- /dev/null
> +++ b/proxmox-firewall-api-types/src/firewall_ref.rs
> @@ -0,0 +1,62 @@
> +use serde::{Deserialize, Serialize};
> +
> +#[cfg(feature = "enum-fallback")]
> +use proxmox_fixed_string::FixedString;
> +use proxmox_schema::api;
> +
> +#[api]
> +/// Firewall address reference type (ipset or alias).
> +#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
> +pub enum FirewallRefType {
> + #[serde(rename = "alias")]
> + /// alias.
> + Alias,
> + #[serde(rename = "ipset")]
> + /// ipset.
> + Ipset,
> + /// Unknown variants for forward compatibility.
> + #[cfg(feature = "enum-fallback")]
> + #[serde(untagged)]
> + UnknownEnumValue(FixedString),
> +}
> +
> +#[api(
> + properties: {
> + comment: {
> + optional: true,
> + type: String,
> + description: "Descriptive comment",
> + },
> + name: {
> + type: String,
> + description: "The name of the alias or ipset.",
> + },
> + "ref": {
> + type: String,
> + description: "The reference string used in firewall rules.",
> + },
> + scope: {
> + type: String,
> + description: "The scope of the reference (e.g., SDN).",
> + },
> + type: {
> + type: FirewallRefType,
> + },
> + },
> +)]
> +/// Firewall address reference information.
> +#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
> +pub struct FirewallRef {
> + #[serde(default, skip_serializing_if = "Option::is_none")]
> + pub comment: Option<String>,
> +
> + pub name: String,
> +
> + #[serde(rename = "ref")]
> + pub r#ref: String,
While I'm not strictly against this - wouldn't it be "simpler" to just
rename this to `reference` in the rust type, since we already need the
`serde(rename)` anyway?
Having a user of this type use `foo.r#ref` in the code feels a bit
awkward.
> +
> + pub scope: String,
> +
> + #[serde(rename = "type")]
> + pub ty: FirewallRefType,
> +}
> diff --git a/proxmox-firewall-api-types/src/lib.rs b/proxmox-firewall-api-types/src/lib.rs
> index ef672bfe..993115d8 100644
> --- a/proxmox-firewall-api-types/src/lib.rs
> +++ b/proxmox-firewall-api-types/src/lib.rs
> @@ -17,3 +17,6 @@ pub use guest_options::FirewallGuestOptions;
>
> mod node_options;
> pub use node_options::FirewallNodeOptions;
> +
> +mod firewall_ref;
> +pub use firewall_ref::{FirewallRef, FirewallRefType};
> --
> 2.47.3
next prev parent reply other threads:[~2026-03-12 10:36 UTC|newest]
Thread overview: 41+ 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-03-12 10:17 ` Wolfgang Bumiller
2026-02-16 10:43 ` [RFC proxmox 04/22] firewall-api-types: add logging types Dietmar Maurer
2026-03-02 12:24 ` Stefan Hanreich
2026-03-05 7:04 ` Dietmar Maurer
2026-03-12 10:22 ` Wolfgang Bumiller
2026-03-12 10:31 ` Wolfgang Bumiller
2026-02-16 10:43 ` [RFC proxmox 05/22] firewall-api-types: add FirewallClusterOptions Dietmar Maurer
2026-03-02 12:27 ` Stefan Hanreich
2026-03-05 7:06 ` 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-03-12 10:36 ` Wolfgang Bumiller [this message]
2026-03-12 10:41 ` Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 10/22] firewall-api-types: add FirewallPortList types Dietmar Maurer
2026-03-02 12:17 ` Stefan Hanreich
2026-03-05 7:02 ` Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 11/22] firewall-api-types: add FirewallIcmpType Dietmar Maurer
2026-03-12 10:51 ` Wolfgang Bumiller
2026-02-16 10:43 ` [RFC proxmox 12/22] firewall-api-types: add FirewallIpsetReference type Dietmar Maurer
2026-03-02 12:39 ` Stefan Hanreich
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-03-12 13:24 ` Wolfgang Bumiller
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 ` [RFC proxmox 20/22] firewall-api-types: add DeletableFirewallRuleProperty enum Dietmar Maurer
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
2026-03-02 13:55 ` Stefan Hanreich
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=ifr6ufc3el745l7eissiu6jzmkulv74soeazspmx6wol3gjiaq@47bfopwarwn6 \
--to=w.bumiller@proxmox.com \
--cc=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