proxmox_api/generated/access/users/userid/
token.rs1pub mod tokenid;
2pub struct TokenClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> TokenClient<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, "/token"),
14 }
15 }
16}
17impl<T> TokenClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Get user API tokens."]
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 GetOutputItems {
28 pub fn new(tokenid: String) -> Self {
29 Self {
30 tokenid,
31 comment: Default::default(),
32 expire: Default::default(),
33 privsep: Default::default(),
34 additional_properties: Default::default(),
35 }
36 }
37}
38#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
39pub struct GetOutputItems {
40 #[serde(skip_serializing_if = "Option::is_none", default)]
41 pub comment: Option<String>,
42 #[serde(skip_serializing_if = "Option::is_none", default)]
43 #[doc = "API token expiration date (seconds since epoch). '0' means no expiration date."]
44 pub expire: Option<()>,
45 #[serde(
46 serialize_with = "crate::types::serialize_bool_optional",
47 deserialize_with = "crate::types::deserialize_bool_optional"
48 )]
49 #[serde(skip_serializing_if = "Option::is_none", default)]
50 #[doc = "Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user."]
51 pub privsep: Option<bool>,
52 #[doc = "User-specific token identifier."]
53 pub tokenid: String,
54 #[serde(
55 flatten,
56 default,
57 skip_serializing_if = "::std::collections::HashMap::is_empty"
58 )]
59 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
60}
61impl<T> TokenClient<T>
62where
63 T: crate::client::Client,
64{
65 pub fn tokenid(&self, tokenid: &str) -> tokenid::TokenidClient<T> {
66 tokenid::TokenidClient::<T>::new(self.client.clone(), &self.path, tokenid)
67 }
68}