proxmox_api/generated/cluster/firewall/
ipset.rs1pub mod name;
2pub struct IpsetClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> IpsetClient<T>
7where
8 T: crate::client::Client,
9{
10 pub fn new(client: T, parent_path: &str) -> Self {
11 Self {
12 client,
13 path: format!("{}{}", parent_path, "/ipset"),
14 }
15 }
16}
17impl<T> IpsetClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "List IPSets"]
22 pub fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
23 let path = self.path.to_string();
24 self.client.get(&path, &())
25 }
26}
27impl<T> IpsetClient<T>
28where
29 T: crate::client::Client,
30{
31 #[doc = "Create new IPSet"]
32 pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
33 let path = self.path.to_string();
34 self.client.post(&path, ¶ms)
35 }
36}
37impl GetOutputItems {
38 pub fn new(digest: String, name: String) -> Self {
39 Self {
40 digest,
41 name,
42 comment: Default::default(),
43 additional_properties: Default::default(),
44 }
45 }
46}
47#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
48pub struct GetOutputItems {
49 #[serde(skip_serializing_if = "Option::is_none", default)]
50 pub comment: Option<String>,
51 #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
52 pub digest: String,
53 #[doc = "IP set name."]
54 pub name: String,
55 #[serde(
56 flatten,
57 default,
58 skip_serializing_if = "::std::collections::HashMap::is_empty"
59 )]
60 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
61}
62impl PostParams {
63 pub fn new(name: String) -> Self {
64 Self {
65 name,
66 comment: Default::default(),
67 digest: Default::default(),
68 rename: Default::default(),
69 additional_properties: Default::default(),
70 }
71 }
72}
73#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
74pub struct PostParams {
75 #[serde(skip_serializing_if = "Option::is_none", default)]
76 pub comment: Option<String>,
77 #[serde(skip_serializing_if = "Option::is_none", default)]
78 #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
79 pub digest: Option<String>,
80 #[doc = "IP set name."]
81 pub name: String,
82 #[serde(skip_serializing_if = "Option::is_none", default)]
83 #[doc = "Rename an existing IPSet. You can set 'rename' to the same value as 'name' to update the 'comment' of an existing IPSet."]
84 pub rename: Option<String>,
85 #[serde(
86 flatten,
87 default,
88 skip_serializing_if = "::std::collections::HashMap::is_empty"
89 )]
90 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
91}
92impl<T> IpsetClient<T>
93where
94 T: crate::client::Client,
95{
96 pub fn name(&self, name: &str) -> name::NameClient<T> {
97 name::NameClient::<T>::new(self.client.clone(), &self.path, name)
98 }
99}