proxmox_api/generated/cluster/firewall/
groups.rs

1pub mod group;
2pub struct GroupsClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> GroupsClient<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, "/groups"),
14        }
15    }
16}
17impl<T> GroupsClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "List security groups."]
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> GroupsClient<T>
28where
29    T: crate::client::Client,
30{
31    #[doc = "Create new security group."]
32    pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
33        let path = self.path.to_string();
34        self.client.post(&path, &params)
35    }
36}
37impl GetOutputItems {
38    pub fn new(digest: String, group: String) -> Self {
39        Self {
40            digest,
41            group,
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 = "Security Group name."]
54    pub group: 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(group: String) -> Self {
64        Self {
65            group,
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 = "Security Group name."]
81    pub group: String,
82    #[serde(skip_serializing_if = "Option::is_none", default)]
83    #[doc = "Rename/update an existing security group. You can set 'rename' to the same value as 'name' to update the 'comment' of an existing group."]
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> GroupsClient<T>
93where
94    T: crate::client::Client,
95{
96    pub fn group(&self, group: &str) -> group::GroupClient<T> {
97        group::GroupClient::<T>::new(self.client.clone(), &self.path, group)
98    }
99}