proxmox_api/generated/access/
groups.rs1pub mod groupid;
2#[derive(Debug, Clone)]
3pub struct GroupsClient<T> {
4 client: T,
5 path: String,
6}
7impl<T> GroupsClient<T>
8where
9 T: crate::client::Client,
10{
11 pub fn new(client: T, parent_path: &str) -> Self {
12 Self {
13 client,
14 path: format!("{}{}", parent_path, "/groups"),
15 }
16 }
17}
18impl<T> GroupsClient<T>
19where
20 T: crate::client::Client,
21{
22 #[doc = "Group index."]
23 #[doc = ""]
24 #[doc = "The returned list is restricted to groups where you have 'User.Modify', 'Sys.Audit' or 'Group.Allocate' permissions on /access/groups/\\<group\\>."]
25 pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
26 let path = self.path.to_string();
27 let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
28 Ok(optional_vec.unwrap_or_default())
29 }
30}
31impl<T> GroupsClient<T>
32where
33 T: crate::client::Client,
34{
35 #[doc = "Create new group."]
36 #[doc = ""]
37 #[doc = "Permission check: perm(\"/access/groups\", [\"Group.Allocate\"])"]
38 pub async fn post(&self, params: PostParams) -> Result<(), T::Error> {
39 let path = self.path.to_string();
40 self.client.post(&path, ¶ms).await
41 }
42}
43impl GetOutputItems {
44 pub fn new(groupid: String) -> Self {
45 Self {
46 groupid,
47 comment: ::std::default::Default::default(),
48 users: ::std::default::Default::default(),
49 additional_properties: ::std::default::Default::default(),
50 }
51 }
52}
53#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
54pub struct GetOutputItems {
55 #[serde(skip_serializing_if = "Option::is_none", default)]
56 pub comment: Option<String>,
57 pub groupid: String,
58 #[serde(skip_serializing_if = "Option::is_none", default)]
59 #[doc = "list of users which form this group"]
60 #[doc = ""]
61 pub users: Option<String>,
62 #[serde(
63 flatten,
64 default,
65 skip_serializing_if = "::std::collections::HashMap::is_empty"
66 )]
67 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
68}
69impl PostParams {
70 pub fn new(groupid: String) -> Self {
71 Self {
72 groupid,
73 comment: ::std::default::Default::default(),
74 additional_properties: ::std::default::Default::default(),
75 }
76 }
77}
78#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
79pub struct PostParams {
80 #[serde(skip_serializing_if = "Option::is_none", default)]
81 pub comment: Option<String>,
82 pub groupid: String,
83 #[serde(
84 flatten,
85 default,
86 skip_serializing_if = "::std::collections::HashMap::is_empty"
87 )]
88 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
89}
90impl<T> GroupsClient<T>
91where
92 T: crate::client::Client,
93{
94 pub fn groupid(&self, groupid: &str) -> groupid::GroupidClient<T> {
95 groupid::GroupidClient::<T>::new(self.client.clone(), &self.path, groupid)
96 }
97}