proxmox_api/generated/access/
permissions.rs1#[derive(Debug, Clone)]
2pub struct PermissionsClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> PermissionsClient<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, "/permissions"),
14 }
15 }
16}
17impl<T> PermissionsClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Retrieve effective permissions of given user/token."]
22 #[doc = ""]
23 #[doc = "Each user/token is allowed to dump their own permissions (or that of owned tokens). A user can dump the permissions of another user or their tokens if they have 'Sys.Audit' permission on /access."]
24 pub async fn get(&self, params: GetParams) -> Result<GetOutput, T::Error> {
25 let path = self.path.to_string();
26 self.client.get(&path, ¶ms).await
27 }
28}
29#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
30pub struct GetOutput {
31 #[serde(
32 flatten,
33 default,
34 skip_serializing_if = "::std::collections::HashMap::is_empty"
35 )]
36 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
37}
38#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
39pub struct GetParams {
40 #[serde(skip_serializing_if = "Option::is_none", default)]
41 #[doc = "Only dump this specific path, not the whole tree."]
42 #[doc = ""]
43 pub path: Option<String>,
44 #[serde(skip_serializing_if = "Option::is_none", default)]
45 #[doc = "User ID or full API token ID"]
46 #[doc = ""]
47 pub userid: Option<UseridStr>,
48 #[serde(
49 flatten,
50 default,
51 skip_serializing_if = "::std::collections::HashMap::is_empty"
52 )]
53 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
54}
55#[derive(Debug, Clone, PartialEq, PartialOrd)]
56pub struct UseridStr {
57 value: String,
58}
59impl crate::types::bounded_string::BoundedString for UseridStr {
60 const MIN_LENGTH: Option<usize> = None::<usize>;
61 const MAX_LENGTH: Option<usize> = None::<usize>;
62 const DEFAULT: Option<&'static str> = None::<&'static str>;
63 const PATTERN: Option<&'static str> = Some(
64 "(?^:^(?^:[^\\s:/]+)\\@(?^:[A-Za-z][A-Za-z0-9\\.\\-_]+)(?:!(?^:[A-Za-z][A-Za-z0-9\\.\\-_]+))?$)",
65 );
66 const TYPE_DESCRIPTION: &'static str = "a string with pattern r\"(?^:^(?^:[^\\s:/]+)\\@(?^:[A-Za-z][A-Za-z0-9\\.\\-_]+)(?:!(?^:[A-Za-z][A-Za-z0-9\\.\\-_]+))?$)\" and no length constraints";
67 fn get_value(&self) -> &str {
68 &self.value
69 }
70 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
71 Self::validate(&value)?;
72 Ok(Self { value })
73 }
74}
75impl std::convert::TryFrom<String> for UseridStr {
76 type Error = crate::types::bounded_string::BoundedStringError;
77 fn try_from(value: String) -> Result<Self, Self::Error> {
78 crate::types::bounded_string::BoundedString::new(value)
79 }
80}
81impl ::serde::Serialize for UseridStr {
82 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
83 where
84 S: ::serde::Serializer,
85 {
86 crate::types::bounded_string::serialize_bounded_string(self, serializer)
87 }
88}
89impl<'de> ::serde::Deserialize<'de> for UseridStr {
90 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
91 where
92 D: ::serde::Deserializer<'de>,
93 {
94 crate::types::bounded_string::deserialize_bounded_string(deserializer)
95 }
96}