proxmox_api/generated/access/tfa/userid/
id.rs

1pub struct IdClient<T> {
2    client: T,
3    path: String,
4}
5impl<T> IdClient<T>
6where
7    T: crate::client::Client,
8{
9    pub fn new(client: T, parent_path: &str, id: &str) -> Self {
10        Self {
11            client,
12            path: format!("{}/{}", parent_path, id),
13        }
14    }
15}
16impl<T> IdClient<T>
17where
18    T: crate::client::Client,
19{
20    #[doc = "Delete a TFA entry by ID."]
21    pub fn delete(&self, params: DeleteParams) -> Result<(), T::Error> {
22        let path = self.path.to_string();
23        self.client.delete(&path, &params)
24    }
25}
26impl<T> IdClient<T>
27where
28    T: crate::client::Client,
29{
30    #[doc = "Fetch a requested TFA entry if present."]
31    pub fn get(&self) -> Result<GetOutput, T::Error> {
32        let path = self.path.to_string();
33        self.client.get(&path, &())
34    }
35}
36impl<T> IdClient<T>
37where
38    T: crate::client::Client,
39{
40    #[doc = "Add a TFA entry for a user."]
41    pub fn put(&self, params: PutParams) -> Result<(), T::Error> {
42        let path = self.path.to_string();
43        self.client.put(&path, &params)
44    }
45}
46#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
47pub struct DeleteParams {
48    #[serde(skip_serializing_if = "Option::is_none", default)]
49    #[doc = "The current password of the user performing the change."]
50    pub password: Option<String>,
51    #[serde(
52        flatten,
53        default,
54        skip_serializing_if = "::std::collections::HashMap::is_empty"
55    )]
56    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
57}
58impl GetOutput {
59    pub fn new(created: u64, description: String, id: String, ty: Type) -> Self {
60        Self {
61            created,
62            description,
63            id,
64            ty,
65            enable: Default::default(),
66            additional_properties: Default::default(),
67        }
68    }
69}
70#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
71pub struct GetOutput {
72    #[serde(
73        serialize_with = "crate::types::serialize_int",
74        deserialize_with = "crate::types::deserialize_int"
75    )]
76    #[doc = "Creation time of this entry as unix epoch."]
77    pub created: u64,
78    #[doc = "User chosen description for this entry."]
79    pub description: String,
80    #[serde(
81        serialize_with = "crate::types::serialize_bool_optional",
82        deserialize_with = "crate::types::deserialize_bool_optional"
83    )]
84    #[serde(skip_serializing_if = "Option::is_none", default)]
85    #[doc = "Whether this TFA entry is currently enabled."]
86    pub enable: Option<bool>,
87    #[doc = "The id used to reference this entry."]
88    pub id: String,
89    #[serde(rename = "type")]
90    #[doc = "TFA Entry Type."]
91    pub ty: Type,
92    #[serde(
93        flatten,
94        default,
95        skip_serializing_if = "::std::collections::HashMap::is_empty"
96    )]
97    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
98}
99#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
100pub struct PutParams {
101    #[serde(skip_serializing_if = "Option::is_none", default)]
102    #[doc = "A description to distinguish multiple entries from one another"]
103    pub description: Option<String>,
104    #[serde(
105        serialize_with = "crate::types::serialize_bool_optional",
106        deserialize_with = "crate::types::deserialize_bool_optional"
107    )]
108    #[serde(skip_serializing_if = "Option::is_none", default)]
109    #[doc = "Whether the entry should be enabled for login."]
110    pub enable: Option<bool>,
111    #[serde(skip_serializing_if = "Option::is_none", default)]
112    #[doc = "The current password of the user performing the change."]
113    pub password: Option<String>,
114    #[serde(
115        flatten,
116        default,
117        skip_serializing_if = "::std::collections::HashMap::is_empty"
118    )]
119    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
120}
121#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
122pub enum Type {
123    #[serde(rename = "recovery")]
124    Recovery,
125    #[serde(rename = "totp")]
126    Totp,
127    #[serde(rename = "u2f")]
128    U2f,
129    #[serde(rename = "webauthn")]
130    Webauthn,
131    #[serde(rename = "yubico")]
132    Yubico,
133}