comment inline
On 2/16/26 11:45 AM, Dietmar Maurer wrote:
> +#[api(
> + properties: {
> + ebtables: {
> + default: true,
> + optional: true,
> + },
> + enable: {
> + default: 0,
> + minimum: 0,
> + optional: true,
> + type: Integer,
> + },
> + log_ratelimit: {
> + format:
> &ApiStringFormat::PropertyString(&FirewallLogRateLimit::API_SCHEMA),
> + optional: true,
> + type: String,
> + },
> + policy_forward: {
> + optional: true,
> + type: FirewallFWPolicy,
> + },
> + policy_in: {
> + optional: true,
> + type: FirewallIOPolicy,
> + },
> + policy_out: {
> + optional: true,
> + type: FirewallIOPolicy,
> + },
> + },
> +)]
> +/// Cluster Firewall Options
> +#[derive(Debug, serde::Deserialize, serde::Serialize)]
> +pub struct FirewallClusterOptions {
> + /// Enable ebtables rules cluster wide.
> + #[serde(deserialize_with = "proxmox_serde::perl::deserialize_bool")]
> + #[serde(default, skip_serializing_if = "Option::is_none")]
> + pub ebtables: Option<bool>,
> +
> + /// Enable or disable the firewall cluster wide.
> + #[serde(deserialize_with = "proxmox_serde::perl::deserialize_u64")]
> + #[serde(default, skip_serializing_if = "Option::is_none")]
> + pub enable: Option<u64>,
> +
> + /// Log ratelimiting settings
> + #[serde(default, skip_serializing_if = "Option::is_none")]
> + pub log_ratelimit: Option<String>,
> +
> + #[serde(default, skip_serializing_if = "Option::is_none")]
> + pub policy_forward: Option<FirewallFWPolicy>,
> +
> + #[serde(default, skip_serializing_if = "Option::is_none")]
> + pub policy_in: Option<FirewallIOPolicy>,
> +
> + #[serde(default, skip_serializing_if = "Option::is_none")]
> + pub policy_out: Option<FirewallIOPolicy>,
> +}
The configuration options all have default values, if unset. Might make
sense to add helper methods that return them if the fields are unset,
similar to how its done in ve-config? [1]. Applies to the other option
structs as well.
[1]
https://git.proxmox.com/?p=proxmox-ve-rs.git;a=blob;f=proxmox-ve-config/src/firewall/cluster.rs;h=69d3bcd6d9cd97e01bcb8847ff1a609f40e455a6;hb=HEAD#l20