proxmox_api/generated/access/
roles.rs1pub mod roleid;
2#[derive(Debug, Clone)]
3pub struct RolesClient<T> {
4 client: T,
5 path: String,
6}
7impl<T> RolesClient<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, "/roles"),
15 }
16 }
17}
18impl<T> RolesClient<T>
19where
20 T: crate::client::Client,
21{
22 #[doc = "Role index."]
23 #[doc = ""]
24 pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
25 let path = self.path.to_string();
26 let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
27 Ok(optional_vec.unwrap_or_default())
28 }
29}
30impl<T> RolesClient<T>
31where
32 T: crate::client::Client,
33{
34 #[doc = "Create new role."]
35 #[doc = ""]
36 #[doc = "Permission check: perm(\"/access\", [\"Sys.Modify\"])"]
37 pub async fn post(&self, params: PostParams) -> Result<(), T::Error> {
38 let path = self.path.to_string();
39 self.client.post(&path, ¶ms).await
40 }
41}
42impl GetOutputItems {
43 pub fn new(roleid: String) -> Self {
44 Self {
45 roleid,
46 privs: ::std::default::Default::default(),
47 special: ::std::default::Default::default(),
48 additional_properties: ::std::default::Default::default(),
49 }
50 }
51}
52#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
53pub struct GetOutputItems {
54 #[serde(skip_serializing_if = "Option::is_none", default)]
55 pub privs: Option<String>,
56 pub roleid: String,
57 #[serde(
58 serialize_with = "crate::types::serialize_bool_optional",
59 deserialize_with = "crate::types::deserialize_bool_optional"
60 )]
61 #[serde(skip_serializing_if = "Option::is_none", default)]
62 pub special: Option<bool>,
63 #[serde(
64 flatten,
65 default,
66 skip_serializing_if = "::std::collections::HashMap::is_empty"
67 )]
68 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
69}
70impl PostParams {
71 pub fn new(roleid: String) -> Self {
72 Self {
73 roleid,
74 privs: ::std::default::Default::default(),
75 additional_properties: ::std::default::Default::default(),
76 }
77 }
78}
79#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
80pub struct PostParams {
81 #[serde(skip_serializing_if = "Option::is_none", default)]
82 pub privs: Option<String>,
83 pub roleid: String,
84 #[serde(
85 flatten,
86 default,
87 skip_serializing_if = "::std::collections::HashMap::is_empty"
88 )]
89 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
90}
91impl<T> RolesClient<T>
92where
93 T: crate::client::Client,
94{
95 pub fn roleid(&self, roleid: &str) -> roleid::RoleidClient<T> {
96 roleid::RoleidClient::<T>::new(self.client.clone(), &self.path, roleid)
97 }
98}