proxmox_api/generated/cluster/firewall/ipset/
name.rs

1pub mod cidr;
2pub struct NameClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> NameClient<T>
7where
8    T: crate::client::Client,
9{
10    pub fn new(client: T, parent_path: &str, name: &str) -> Self {
11        Self {
12            client,
13            path: format!("{}/{}", parent_path, name),
14        }
15    }
16}
17impl<T> NameClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Delete IPSet"]
22    pub fn delete(&self, params: DeleteParams) -> Result<(), T::Error> {
23        let path = self.path.to_string();
24        self.client.delete(&path, &params)
25    }
26}
27impl<T> NameClient<T>
28where
29    T: crate::client::Client,
30{
31    #[doc = "List IPSet content"]
32    pub fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
33        let path = self.path.to_string();
34        self.client.get(&path, &())
35    }
36}
37impl<T> NameClient<T>
38where
39    T: crate::client::Client,
40{
41    #[doc = "Add IP or Network to IPSet."]
42    pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
43        let path = self.path.to_string();
44        self.client.post(&path, &params)
45    }
46}
47#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
48pub struct DeleteParams {
49    #[serde(
50        serialize_with = "crate::types::serialize_bool_optional",
51        deserialize_with = "crate::types::deserialize_bool_optional"
52    )]
53    #[serde(skip_serializing_if = "Option::is_none", default)]
54    #[doc = "Delete all members of the IPSet, if there are any."]
55    pub force: Option<bool>,
56    #[serde(
57        flatten,
58        default,
59        skip_serializing_if = "::std::collections::HashMap::is_empty"
60    )]
61    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
62}
63impl GetOutputItems {
64    pub fn new(cidr: String, digest: String) -> Self {
65        Self {
66            cidr,
67            digest,
68            comment: Default::default(),
69            nomatch: Default::default(),
70            additional_properties: Default::default(),
71        }
72    }
73}
74#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
75pub struct GetOutputItems {
76    pub cidr: String,
77    #[serde(skip_serializing_if = "Option::is_none", default)]
78    pub comment: Option<String>,
79    #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
80    pub digest: String,
81    #[serde(
82        serialize_with = "crate::types::serialize_bool_optional",
83        deserialize_with = "crate::types::deserialize_bool_optional"
84    )]
85    #[serde(skip_serializing_if = "Option::is_none", default)]
86    pub nomatch: Option<bool>,
87    #[serde(
88        flatten,
89        default,
90        skip_serializing_if = "::std::collections::HashMap::is_empty"
91    )]
92    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
93}
94impl PostParams {
95    pub fn new(cidr: String) -> Self {
96        Self {
97            cidr,
98            comment: Default::default(),
99            nomatch: Default::default(),
100            additional_properties: Default::default(),
101        }
102    }
103}
104#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
105pub struct PostParams {
106    #[doc = "Network/IP specification in CIDR format."]
107    pub cidr: String,
108    #[serde(skip_serializing_if = "Option::is_none", default)]
109    pub comment: Option<String>,
110    #[serde(
111        serialize_with = "crate::types::serialize_bool_optional",
112        deserialize_with = "crate::types::deserialize_bool_optional"
113    )]
114    #[serde(skip_serializing_if = "Option::is_none", default)]
115    pub nomatch: Option<bool>,
116    #[serde(
117        flatten,
118        default,
119        skip_serializing_if = "::std::collections::HashMap::is_empty"
120    )]
121    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
122}
123impl<T> NameClient<T>
124where
125    T: crate::client::Client,
126{
127    pub fn cidr(&self, cidr: &str) -> cidr::CidrClient<T> {
128        cidr::CidrClient::<T>::new(self.client.clone(), &self.path, cidr)
129    }
130}