From: Hannes Laimer <h.laimer@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox-datacenter-manager 3/4] pdm-client: add api methods for firewall options, rules and status endpoints
Date: Thu, 30 Oct 2025 15:34:05 +0100	[thread overview]
Message-ID: <20251030143406.193744-13-h.laimer@proxmox.com> (raw)
In-Reply-To: <20251030143406.193744-1-h.laimer@proxmox.com>
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
 lib/pdm-client/src/lib.rs | 133 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 133 insertions(+)
diff --git a/lib/pdm-client/src/lib.rs b/lib/pdm-client/src/lib.rs
index 0cab769..e0bdecb 100644
--- a/lib/pdm-client/src/lib.rs
+++ b/lib/pdm-client/src/lib.rs
@@ -391,6 +391,139 @@ impl<T: HttpApiClient> PdmClient<T> {
         Ok(self.0.get(&path).await?.expect_json()?.data)
     }
 
+    pub async fn pve_get_firewall_status(
+        &self,
+    ) -> Result<Vec<pdm_api_types::firewall::RemoteFirewallStatus>, Error> {
+        let path = "/api2/extjs/pve/firewall/status";
+        Ok(self.0.get(path).await?.expect_json()?.data)
+    }
+
+    pub async fn pve_cluster_firewall_status(
+        &self,
+        remote: &str,
+    ) -> Result<pdm_api_types::firewall::RemoteFirewallStatus, Error> {
+        let path = format!("/api2/extjs/pve/remotes/{remote}/firewall/status");
+        Ok(self.0.get(&path).await?.expect_json()?.data)
+    }
+
+    pub async fn pve_node_firewall_status(
+        &self,
+        remote: &str,
+        node: &str,
+    ) -> Result<pdm_api_types::firewall::NodeFirewallStatus, Error> {
+        let path = format!("/api2/extjs/pve/remotes/{remote}/nodes/{node}/firewall/status");
+        Ok(self.0.get(&path).await?.expect_json()?.data)
+    }
+
+    pub async fn pve_get_cluster_firewall_options(
+        &self,
+        remote: &str,
+    ) -> Result<pve_api_types::NodeFirewallOptions, Error> {
+        let path = format!("/api2/extjs/pve/remotes/{remote}/firewall/options");
+        Ok(self.0.get(&path).await?.expect_json()?.data)
+    }
+
+    pub async fn pve_get_node_firewall_options(
+        &self,
+        remote: &str,
+        node: &str,
+    ) -> Result<pve_api_types::NodeFirewallOptions, Error> {
+        let path = format!("/api2/extjs/pve/remotes/{remote}/nodes/{node}/firewall/options");
+        Ok(self.0.get(&path).await?.expect_json()?.data)
+    }
+
+    pub async fn pve_get_lxc_firewall_options(
+        &self,
+        remote: &str,
+        node: Option<&str>,
+        vmid: u32,
+    ) -> Result<pve_api_types::GuestFirewallOptions, Error> {
+        let path = ApiPathBuilder::new(format!(
+            "/api2/extjs/pve/remotes/{remote}/lxc/{vmid}/firewall/options"
+        ))
+        .maybe_arg("node", &node)
+        .build();
+        Ok(self.0.get(&path).await?.expect_json()?.data)
+    }
+
+    pub async fn pve_get_qemu_firewall_options(
+        &self,
+        remote: &str,
+        node: Option<&str>,
+        vmid: u32,
+    ) -> Result<pve_api_types::GuestFirewallOptions, Error> {
+        let path = ApiPathBuilder::new(format!(
+            "/api2/extjs/pve/remotes/{remote}/qemu/{vmid}/firewall/options"
+        ))
+        .maybe_arg("node", &node)
+        .build();
+        Ok(self.0.get(&path).await?.expect_json()?.data)
+    }
+
+    pub async fn pve_get_cluster_firewall_rules(
+        &self,
+        remote: &str,
+    ) -> Result<Vec<pve_api_types::ListFirewallRules>, Error> {
+        let path = format!("/api2/extjs/pve/remotes/{remote}/firewall/rules");
+        Ok(self.0.get(&path).await?.expect_json()?.data)
+    }
+
+    pub async fn pve_get_node_firewall_rules(
+        &self,
+        remote: &str,
+        node: &str,
+    ) -> Result<Vec<pve_api_types::ListFirewallRules>, Error> {
+        let path = format!("/api2/extjs/pve/remotes/{remote}/nodes/{node}/firewall/rules");
+        Ok(self.0.get(&path).await?.expect_json()?.data)
+    }
+
+    pub async fn pve_get_lxc_firewall_rules(
+        &self,
+        remote: &str,
+        node: Option<&str>,
+        vmid: u32,
+    ) -> Result<Vec<pve_api_types::ListFirewallRules>, Error> {
+        let path = ApiPathBuilder::new(format!(
+            "/api2/extjs/pve/remotes/{remote}/lxc/{vmid}/firewall/rules"
+        ))
+        .maybe_arg("node", &node)
+        .build();
+        Ok(self.0.get(&path).await?.expect_json()?.data)
+    }
+
+    pub async fn pve_get_qemu_firewall_rules(
+        &self,
+        remote: &str,
+        node: Option<&str>,
+        vmid: u32,
+    ) -> Result<Vec<pve_api_types::ListFirewallRules>, Error> {
+        let path = ApiPathBuilder::new(format!(
+            "/api2/extjs/pve/remotes/{remote}/qemu/{vmid}/firewall/rules"
+        ))
+        .maybe_arg("node", &node)
+        .build();
+        Ok(self.0.get(&path).await?.expect_json()?.data)
+    }
+
+    pub async fn pve_set_cluster_firewall_options(
+        &self,
+        remote: &str,
+        update: pve_api_types::UpdateClusterFirewallOptions,
+    ) -> Result<(), Error> {
+        let path = format!("/api2/extjs/pve/remotes/{remote}/firewall/options");
+        self.0.put(&path, &update).await?.nodata()
+    }
+
+    pub async fn pve_set_node_firewall_options(
+        &self,
+        remote: &str,
+        node: &str,
+        update: pve_api_types::UpdateNodeFirewallOptions,
+    ) -> Result<(), Error> {
+        let path = format!("/api2/extjs/pve/remotes/{remote}/nodes/{node}/firewall/options");
+        self.0.put(&path, &update).await?.nodata()
+    }
+
     pub async fn pve_node_rrddata(
         &self,
         remote: &str,
-- 
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply	other threads:[~2025-10-30 14:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-30 14:33 [pdm-devel] [PATCH proxmox{, -yew-comp, -datacenter-manager} 00/13] add basic integration of PVE firewall Hannes Laimer
2025-10-30 14:33 ` [pdm-devel] [PATCH proxmox 1/5] pve-api-types: update pve-api.json Hannes Laimer
2025-10-30 14:33 ` [pdm-devel] [PATCH proxmox 2/5] pve-api-types: add get/update firewall options endpoints Hannes Laimer
2025-10-30 14:33 ` [pdm-devel] [PATCH proxmox 3/5] pve-api-types: schema2rust: handle `macro` keyword like we do `type` Hannes Laimer
2025-10-30 14:33 ` [pdm-devel] [PATCH proxmox 4/5] pve-api-types: add list firewall rules endpoints Hannes Laimer
2025-10-30 14:33 ` [pdm-devel] [PATCH proxmox 5/5] pve-api-types: regenerate Hannes Laimer
2025-10-30 14:33 ` [pdm-devel] [PATCH proxmox-yew-comp 1/4] form: add helpers for extractig data out of schemas Hannes Laimer
2025-10-30 14:34 ` [pdm-devel] [PATCH proxmox-yew-comp 2/4] firewall: add FirewallContext Hannes Laimer
2025-10-30 14:34 ` [pdm-devel] [PATCH proxmox-yew-comp 3/4] firewall: add options edit form Hannes Laimer
2025-10-30 14:34 ` [pdm-devel] [PATCH proxmox-yew-comp 4/4] firewall: add rules table Hannes Laimer
2025-10-30 14:34 ` [pdm-devel] [PATCH proxmox-datacenter-manager 1/4] pdm-api-types: add firewall status types Hannes Laimer
2025-10-30 14:34 ` [pdm-devel] [PATCH proxmox-datacenter-manager 2/4] api: firewall: add option, rules and status endpoints Hannes Laimer
2025-10-30 14:34 ` Hannes Laimer [this message]
2025-10-30 14:34 ` [pdm-devel] [PATCH proxmox-datacenter-manager 4/4] ui: add firewall status tree 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=20251030143406.193744-13-h.laimer@proxmox.com \
    --to=h.laimer@proxmox.com \
    --cc=pdm-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.