proxmox_api/generated/access/
tfa.rs1pub mod userid;
2pub struct TfaClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> TfaClient<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, "/tfa"),
14 }
15 }
16}
17impl<T> TfaClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "List TFA configurations of users."]
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 EntriesGetOutputItemsEntriesItems {
28 pub fn new(created: u64, description: String, id: String, ty: Type) -> Self {
29 Self {
30 created,
31 description,
32 id,
33 ty,
34 enable: Default::default(),
35 additional_properties: Default::default(),
36 }
37 }
38}
39#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
40pub struct EntriesGetOutputItemsEntriesItems {
41 #[serde(
42 serialize_with = "crate::types::serialize_int",
43 deserialize_with = "crate::types::deserialize_int"
44 )]
45 #[doc = "Creation time of this entry as unix epoch."]
46 pub created: u64,
47 #[doc = "User chosen description for this entry."]
48 pub description: String,
49 #[serde(
50 serialize_with = "crate::types::serialize_bool_optional",
51 deserialize_with = "crate::types::deserialize_bool_optional"
52 )]
53 #[serde(skip_serializing_if = "Option::is_none", default)]
54 #[doc = "Whether this TFA entry is currently enabled."]
55 pub enable: Option<bool>,
56 #[doc = "The id used to reference this entry."]
57 pub id: String,
58 #[serde(rename = "type")]
59 #[doc = "TFA Entry Type."]
60 pub ty: Type,
61 #[serde(
62 flatten,
63 default,
64 skip_serializing_if = "::std::collections::HashMap::is_empty"
65 )]
66 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
67}
68impl GetOutputItems {
69 pub fn new(entries: Vec<EntriesGetOutputItemsEntriesItems>, userid: String) -> Self {
70 Self {
71 entries,
72 userid,
73 tfa_locked_until: Default::default(),
74 totp_locked: Default::default(),
75 additional_properties: Default::default(),
76 }
77 }
78}
79#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
80pub struct GetOutputItems {
81 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
82 pub entries: Vec<EntriesGetOutputItemsEntriesItems>,
83 #[serde(rename = "tfa-locked-until")]
84 #[serde(
85 serialize_with = "crate::types::serialize_int_optional",
86 deserialize_with = "crate::types::deserialize_int_optional"
87 )]
88 #[serde(skip_serializing_if = "Option::is_none", default)]
89 #[doc = "Contains a timestamp until when a user is locked out of 2nd factors."]
90 pub tfa_locked_until: Option<u64>,
91 #[serde(rename = "totp-locked")]
92 #[serde(
93 serialize_with = "crate::types::serialize_bool_optional",
94 deserialize_with = "crate::types::deserialize_bool_optional"
95 )]
96 #[serde(skip_serializing_if = "Option::is_none", default)]
97 #[doc = "True if the user is currently locked out of TOTP factors."]
98 pub totp_locked: Option<bool>,
99 #[doc = "User this entry belongs to."]
100 pub userid: String,
101 #[serde(
102 flatten,
103 default,
104 skip_serializing_if = "::std::collections::HashMap::is_empty"
105 )]
106 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
107}
108#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
109pub enum Type {
110 #[serde(rename = "recovery")]
111 Recovery,
112 #[serde(rename = "totp")]
113 Totp,
114 #[serde(rename = "u2f")]
115 U2f,
116 #[serde(rename = "webauthn")]
117 Webauthn,
118 #[serde(rename = "yubico")]
119 Yubico,
120}
121impl<T> TfaClient<T>
122where
123 T: crate::client::Client,
124{
125 pub fn userid(&self, userid: &str) -> userid::UseridClient<T> {
126 userid::UseridClient::<T>::new(self.client.clone(), &self.path, userid)
127 }
128}