pve/nodes/node/qemu/vmid/
firewall.rs

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