pve/nodes/node/
firewall.rs

1pub mod log;
2pub mod options;
3pub mod rules;
4
5#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, Default)]
6pub struct GetResponseItem {}
7
8#[derive(Debug, Clone)]
9pub struct FirewallClient<T> {
10    client: T,
11    path: String,
12}
13
14impl<T> FirewallClient<T>
15where
16    T: Clone,
17{
18    pub fn new(client: T, parent_path: &str) -> Self {
19        Self {
20            client,
21            path: format!("{}/{}", parent_path, "firewall"),
22        }
23    }
24
25    pub fn rules(&self) -> rules::RulesClient<T> {
26        rules::RulesClient::<T>::new(self.client.clone(), &self.path)
27    }
28
29    pub fn options(&self) -> options::OptionsClient<T> {
30        options::OptionsClient::<T>::new(self.client.clone(), &self.path)
31    }
32
33    pub fn log(&self) -> log::LogClient<T> {
34        log::LogClient::<T>::new(self.client.clone(), &self.path)
35    }
36}
37impl<T> FirewallClient<T>
38where
39    T: crate::client::HttpClient,
40{
41    #[doc = "Directory index."]
42    pub fn get(&self) -> Result<Vec<GetResponseItem>, T::Error> {
43        self.client.get(&self.path, &())
44    }
45}
46#[derive(Debug, Clone)]
47pub struct AsyncFirewallClient<T> {
48    client: T,
49    path: String,
50}
51
52impl<T> AsyncFirewallClient<T>
53where
54    T: Clone,
55{
56    pub fn new(client: T, parent_path: &str) -> Self {
57        Self {
58            client,
59            path: format!("{}/{}", parent_path, "firewall"),
60        }
61    }
62
63    pub fn rules(&self) -> rules::AsyncRulesClient<T> {
64        rules::AsyncRulesClient::<T>::new(self.client.clone(), &self.path)
65    }
66
67    pub fn options(&self) -> options::AsyncOptionsClient<T> {
68        options::AsyncOptionsClient::<T>::new(self.client.clone(), &self.path)
69    }
70
71    pub fn log(&self) -> log::AsyncLogClient<T> {
72        log::AsyncLogClient::<T>::new(self.client.clone(), &self.path)
73    }
74}
75impl<T> AsyncFirewallClient<T>
76where
77    T: crate::client::AsyncHttpClient,
78{
79    #[doc = "Directory index."]
80    pub async fn get(&self) -> Result<Vec<GetResponseItem>, T::Error> {
81        self.client.get(&self.path, &()).await
82    }
83}