proxmox_api/generated/access/
roles.rs

1pub mod roleid;
2pub struct RolesClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> RolesClient<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, "/roles"),
14        }
15    }
16}
17impl<T> RolesClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Role index."]
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> RolesClient<T>
28where
29    T: crate::client::Client,
30{
31    #[doc = "Create new role."]
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(roleid: String) -> Self {
39        Self {
40            roleid,
41            privs: Default::default(),
42            special: 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 privs: Option<String>,
51    pub roleid: String,
52    #[serde(
53        serialize_with = "crate::types::serialize_bool_optional",
54        deserialize_with = "crate::types::deserialize_bool_optional"
55    )]
56    #[serde(skip_serializing_if = "Option::is_none", default)]
57    pub special: Option<bool>,
58    #[serde(
59        flatten,
60        default,
61        skip_serializing_if = "::std::collections::HashMap::is_empty"
62    )]
63    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
64}
65impl PostParams {
66    pub fn new(roleid: String) -> Self {
67        Self {
68            roleid,
69            privs: Default::default(),
70            additional_properties: Default::default(),
71        }
72    }
73}
74#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
75pub struct PostParams {
76    #[serde(skip_serializing_if = "Option::is_none", default)]
77    pub privs: Option<String>,
78    pub roleid: String,
79    #[serde(
80        flatten,
81        default,
82        skip_serializing_if = "::std::collections::HashMap::is_empty"
83    )]
84    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
85}
86impl<T> RolesClient<T>
87where
88    T: crate::client::Client,
89{
90    pub fn roleid(&self, roleid: &str) -> roleid::RoleidClient<T> {
91        roleid::RoleidClient::<T>::new(self.client.clone(), &self.path, roleid)
92    }
93}