proxmox_api/generated/access/
ticket.rs1pub struct TicketClient<T> {
2 client: T,
3 path: String,
4}
5impl<T> TicketClient<T>
6where
7 T: crate::client::Client,
8{
9 pub fn new(client: T, parent_path: &str) -> Self {
10 Self {
11 client,
12 path: format!("{}{}", parent_path, "/ticket"),
13 }
14 }
15}
16impl<T> TicketClient<T>
17where
18 T: crate::client::Client,
19{
20 #[doc = "Dummy. Useful for formatters which want to provide a login page."]
21 pub fn get(&self) -> Result<(), T::Error> {
22 let path = self.path.to_string();
23 self.client.get(&path, &())
24 }
25}
26impl<T> TicketClient<T>
27where
28 T: crate::client::Client,
29{
30 #[doc = "Create or verify authentication ticket."]
31 pub fn post(&self, params: PostParams) -> Result<PostOutput, T::Error> {
32 let path = self.path.to_string();
33 self.client.post(&path, ¶ms)
34 }
35}
36impl PostOutput {
37 pub fn new(username: String) -> Self {
38 Self {
39 username,
40 csrfpreventiontoken: Default::default(),
41 clustername: Default::default(),
42 ticket: Default::default(),
43 additional_properties: Default::default(),
44 }
45 }
46}
47#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
48pub struct PostOutput {
49 #[serde(rename = "CSRFPreventionToken")]
50 #[serde(skip_serializing_if = "Option::is_none", default)]
51 pub csrfpreventiontoken: Option<String>,
52 #[serde(skip_serializing_if = "Option::is_none", default)]
53 pub clustername: Option<String>,
54 #[serde(skip_serializing_if = "Option::is_none", default)]
55 pub ticket: Option<String>,
56 pub username: String,
57 #[serde(
58 flatten,
59 default,
60 skip_serializing_if = "::std::collections::HashMap::is_empty"
61 )]
62 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
63}
64impl PostParams {
65 pub fn new(password: String, username: String) -> Self {
66 Self {
67 password,
68 username,
69 new_format: Default::default(),
70 otp: Default::default(),
71 path: Default::default(),
72 privs: Default::default(),
73 realm: Default::default(),
74 tfa_challenge: Default::default(),
75 additional_properties: Default::default(),
76 }
77 }
78}
79#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
80pub struct PostParams {
81 #[serde(rename = "new-format")]
82 #[serde(
83 serialize_with = "crate::types::serialize_bool_optional",
84 deserialize_with = "crate::types::deserialize_bool_optional"
85 )]
86 #[serde(skip_serializing_if = "Option::is_none", default)]
87 #[doc = "This parameter is now ignored and assumed to be 1."]
88 pub new_format: Option<bool>,
89 #[serde(skip_serializing_if = "Option::is_none", default)]
90 #[doc = "One-time password for Two-factor authentication."]
91 pub otp: Option<String>,
92 #[doc = "The secret password. This can also be a valid ticket."]
93 pub password: String,
94 #[serde(skip_serializing_if = "Option::is_none", default)]
95 #[doc = "Verify ticket, and check if user have access 'privs' on 'path'"]
96 pub path: Option<String>,
97 #[serde(skip_serializing_if = "Option::is_none", default)]
98 #[doc = "Verify ticket, and check if user have access 'privs' on 'path'"]
99 pub privs: Option<String>,
100 #[serde(skip_serializing_if = "Option::is_none", default)]
101 #[doc = "You can optionally pass the realm using this parameter. Normally the realm is simply added to the username \\<username\\>@\\<relam\\>."]
102 pub realm: Option<String>,
103 #[serde(rename = "tfa-challenge")]
104 #[serde(skip_serializing_if = "Option::is_none", default)]
105 #[doc = "The signed TFA challenge string the user wants to respond to."]
106 pub tfa_challenge: Option<String>,
107 #[doc = "User name"]
108 pub username: String,
109 #[serde(
110 flatten,
111 default,
112 skip_serializing_if = "::std::collections::HashMap::is_empty"
113 )]
114 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
115}