1pub mod tfa;
2pub mod token;
3pub mod unlock_tfa;
4#[derive(Debug, Clone)]
5pub struct UseridClient<T> {
6 client: T,
7 path: String,
8}
9impl<T> UseridClient<T>
10where
11 T: crate::client::Client,
12{
13 pub fn new(client: T, parent_path: &str, userid: &str) -> Self {
14 Self {
15 client,
16 path: format!("{}/{}", parent_path, userid),
17 }
18 }
19}
20impl<T> UseridClient<T>
21where
22 T: crate::client::Client,
23{
24 #[doc = "Delete user."]
25 #[doc = ""]
26 #[doc = "Permission check: and(userid-param(\"Realm.AllocateUser\"), userid-group([\"User.Modify\"]))"]
27 pub async fn delete(&self) -> Result<(), T::Error> {
28 let path = self.path.to_string();
29 self.client.delete(&path, &()).await
30 }
31}
32impl<T> UseridClient<T>
33where
34 T: crate::client::Client,
35{
36 #[doc = "Get user configuration."]
37 #[doc = ""]
38 #[doc = "Permission check: userid-group([\"User.Modify\", \"Sys.Audit\"])"]
39 pub async fn get(&self) -> Result<GetOutput, T::Error> {
40 let path = self.path.to_string();
41 self.client.get(&path, &()).await
42 }
43}
44impl<T> UseridClient<T>
45where
46 T: crate::client::Client,
47{
48 #[doc = "Update user configuration."]
49 #[doc = ""]
50 #[doc = "Permission check: userid-group([\"User.Modify\"], groups_param=\"update\")"]
51 pub async fn put(&self, params: PutParams) -> Result<(), T::Error> {
52 let path = self.path.to_string();
53 self.client.put(&path, ¶ms).await
54 }
55}
56#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
57pub struct GetOutput {
58 #[serde(skip_serializing_if = "Option::is_none", default)]
59 pub comment: Option<CommentStr>,
60 #[serde(skip_serializing_if = "Option::is_none", default)]
61 pub email: Option<EmailStr>,
62 #[serde(
63 serialize_with = "crate::types::serialize_bool_optional",
64 deserialize_with = "crate::types::deserialize_bool_optional"
65 )]
66 #[serde(skip_serializing_if = "Option::is_none", default)]
67 #[doc = "Enable the account (default). You can set this to '0' to disable the account"]
68 #[doc = ""]
69 pub enable: Option<bool>,
70 #[serde(
71 serialize_with = "crate::types::serialize_unsigned_int_optional",
72 deserialize_with = "crate::types::deserialize_unsigned_int_optional"
73 )]
74 #[serde(skip_serializing_if = "Option::is_none", default)]
75 #[doc = "Account expiration date (seconds since epoch). '0' means no expiration date."]
76 #[doc = ""]
77 pub expire: Option<u64>,
78 #[serde(skip_serializing_if = "Option::is_none", default)]
79 pub firstname: Option<FirstnameStr>,
80 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
81 pub groups: Vec<String>,
82 #[serde(skip_serializing_if = "Option::is_none", default)]
83 #[doc = "Keys for two factor auth (yubico)."]
84 #[doc = ""]
85 pub keys: Option<KeysStr>,
86 #[serde(skip_serializing_if = "Option::is_none", default)]
87 pub lastname: Option<LastnameStr>,
88 #[serde(skip_serializing_if = "Option::is_none", default)]
89 pub tokens: Option<TokensGetOutputTokens>,
90}
91#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
92pub struct PutParams {
93 #[serde(
94 serialize_with = "crate::types::serialize_bool_optional",
95 deserialize_with = "crate::types::deserialize_bool_optional"
96 )]
97 #[serde(skip_serializing_if = "Option::is_none", default)]
98 pub append: Option<bool>,
99 #[serde(skip_serializing_if = "Option::is_none", default)]
100 pub comment: Option<CommentStr>,
101 #[serde(skip_serializing_if = "Option::is_none", default)]
102 pub email: Option<EmailStr>,
103 #[serde(
104 serialize_with = "crate::types::serialize_bool_optional",
105 deserialize_with = "crate::types::deserialize_bool_optional"
106 )]
107 #[serde(skip_serializing_if = "Option::is_none", default)]
108 #[doc = "Enable the account (default). You can set this to '0' to disable the account"]
109 #[doc = ""]
110 pub enable: Option<bool>,
111 #[serde(
112 serialize_with = "crate::types::serialize_unsigned_int_optional",
113 deserialize_with = "crate::types::deserialize_unsigned_int_optional"
114 )]
115 #[serde(skip_serializing_if = "Option::is_none", default)]
116 #[doc = "Account expiration date (seconds since epoch). '0' means no expiration date."]
117 #[doc = ""]
118 pub expire: Option<u64>,
119 #[serde(skip_serializing_if = "Option::is_none", default)]
120 pub firstname: Option<FirstnameStr>,
121 #[serde(skip_serializing_if = "Option::is_none", default)]
122 pub groups: Option<String>,
123 #[serde(skip_serializing_if = "Option::is_none", default)]
124 #[doc = "Keys for two factor auth (yubico)."]
125 #[doc = ""]
126 pub keys: Option<KeysStr>,
127 #[serde(skip_serializing_if = "Option::is_none", default)]
128 pub lastname: Option<LastnameStr>,
129 #[serde(
130 flatten,
131 default,
132 skip_serializing_if = "::std::collections::HashMap::is_empty"
133 )]
134 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
135}
136#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
137pub struct AdditionalPropertiesGetOutputTokens {
138 #[serde(skip_serializing_if = "Option::is_none", default)]
139 pub comment: Option<String>,
140 #[serde(
141 serialize_with = "crate::types::serialize_unsigned_int_optional",
142 deserialize_with = "crate::types::deserialize_unsigned_int_optional"
143 )]
144 #[serde(skip_serializing_if = "Option::is_none", default)]
145 #[doc = "API token expiration date (seconds since epoch). '0' means no expiration date."]
146 #[doc = ""]
147 pub expire: Option<u64>,
148 #[serde(
149 serialize_with = "crate::types::serialize_bool_optional",
150 deserialize_with = "crate::types::deserialize_bool_optional"
151 )]
152 #[serde(skip_serializing_if = "Option::is_none", default)]
153 #[doc = "Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user."]
154 #[doc = ""]
155 pub privsep: Option<bool>,
156 #[serde(
157 flatten,
158 default,
159 skip_serializing_if = "::std::collections::HashMap::is_empty"
160 )]
161 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
162}
163#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
164pub struct TokensGetOutputTokens {
165 #[serde(
166 flatten,
167 default,
168 skip_serializing_if = "::std::collections::HashMap::is_empty"
169 )]
170 pub additional_properties:
171 ::std::collections::HashMap<String, AdditionalPropertiesGetOutputTokens>,
172}
173#[derive(Debug, Clone, PartialEq, PartialOrd)]
174pub struct CommentStr {
175 value: String,
176}
177impl crate::types::bounded_string::BoundedString for CommentStr {
178 const MIN_LENGTH: Option<usize> = None::<usize>;
179 const MAX_LENGTH: Option<usize> = Some(2048usize);
180 const DEFAULT: Option<&'static str> = None::<&'static str>;
181 const PATTERN: Option<&'static str> = None::<&'static str>;
182 const TYPE_DESCRIPTION: &'static str = "a string with length at most 2048";
183 fn get_value(&self) -> &str {
184 &self.value
185 }
186 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
187 Self::validate(&value)?;
188 Ok(Self { value })
189 }
190}
191impl std::convert::TryFrom<String> for CommentStr {
192 type Error = crate::types::bounded_string::BoundedStringError;
193 fn try_from(value: String) -> Result<Self, Self::Error> {
194 crate::types::bounded_string::BoundedString::new(value)
195 }
196}
197impl ::serde::Serialize for CommentStr {
198 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
199 where
200 S: ::serde::Serializer,
201 {
202 crate::types::bounded_string::serialize_bounded_string(self, serializer)
203 }
204}
205impl<'de> ::serde::Deserialize<'de> for CommentStr {
206 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
207 where
208 D: ::serde::Deserializer<'de>,
209 {
210 crate::types::bounded_string::deserialize_bounded_string(deserializer)
211 }
212}
213#[derive(Debug, Clone, PartialEq, PartialOrd)]
214pub struct EmailStr {
215 value: String,
216}
217impl crate::types::bounded_string::BoundedString for EmailStr {
218 const MIN_LENGTH: Option<usize> = None::<usize>;
219 const MAX_LENGTH: Option<usize> = Some(254usize);
220 const DEFAULT: Option<&'static str> = None::<&'static str>;
221 const PATTERN: Option<&'static str> = None::<&'static str>;
222 const TYPE_DESCRIPTION: &'static str = "a string with length at most 254";
223 fn get_value(&self) -> &str {
224 &self.value
225 }
226 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
227 Self::validate(&value)?;
228 Ok(Self { value })
229 }
230}
231impl std::convert::TryFrom<String> for EmailStr {
232 type Error = crate::types::bounded_string::BoundedStringError;
233 fn try_from(value: String) -> Result<Self, Self::Error> {
234 crate::types::bounded_string::BoundedString::new(value)
235 }
236}
237impl ::serde::Serialize for EmailStr {
238 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
239 where
240 S: ::serde::Serializer,
241 {
242 crate::types::bounded_string::serialize_bounded_string(self, serializer)
243 }
244}
245impl<'de> ::serde::Deserialize<'de> for EmailStr {
246 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
247 where
248 D: ::serde::Deserializer<'de>,
249 {
250 crate::types::bounded_string::deserialize_bounded_string(deserializer)
251 }
252}
253#[derive(Debug, Clone, PartialEq, PartialOrd)]
254pub struct FirstnameStr {
255 value: String,
256}
257impl crate::types::bounded_string::BoundedString for FirstnameStr {
258 const MIN_LENGTH: Option<usize> = None::<usize>;
259 const MAX_LENGTH: Option<usize> = Some(1024usize);
260 const DEFAULT: Option<&'static str> = None::<&'static str>;
261 const PATTERN: Option<&'static str> = None::<&'static str>;
262 const TYPE_DESCRIPTION: &'static str = "a string with length at most 1024";
263 fn get_value(&self) -> &str {
264 &self.value
265 }
266 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
267 Self::validate(&value)?;
268 Ok(Self { value })
269 }
270}
271impl std::convert::TryFrom<String> for FirstnameStr {
272 type Error = crate::types::bounded_string::BoundedStringError;
273 fn try_from(value: String) -> Result<Self, Self::Error> {
274 crate::types::bounded_string::BoundedString::new(value)
275 }
276}
277impl ::serde::Serialize for FirstnameStr {
278 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
279 where
280 S: ::serde::Serializer,
281 {
282 crate::types::bounded_string::serialize_bounded_string(self, serializer)
283 }
284}
285impl<'de> ::serde::Deserialize<'de> for FirstnameStr {
286 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
287 where
288 D: ::serde::Deserializer<'de>,
289 {
290 crate::types::bounded_string::deserialize_bounded_string(deserializer)
291 }
292}
293#[derive(Debug, Clone, PartialEq, PartialOrd)]
294pub struct KeysStr {
295 value: String,
296}
297impl crate::types::bounded_string::BoundedString for KeysStr {
298 const MIN_LENGTH: Option<usize> = None::<usize>;
299 const MAX_LENGTH: Option<usize> = None::<usize>;
300 const DEFAULT: Option<&'static str> = None::<&'static str>;
301 const PATTERN: Option<&'static str> = Some("[0-9a-zA-Z!=]{0,4096}");
302 const TYPE_DESCRIPTION: &'static str =
303 "a string with pattern r\"[0-9a-zA-Z!=]{0,4096}\" and no length constraints";
304 fn get_value(&self) -> &str {
305 &self.value
306 }
307 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
308 Self::validate(&value)?;
309 Ok(Self { value })
310 }
311}
312impl std::convert::TryFrom<String> for KeysStr {
313 type Error = crate::types::bounded_string::BoundedStringError;
314 fn try_from(value: String) -> Result<Self, Self::Error> {
315 crate::types::bounded_string::BoundedString::new(value)
316 }
317}
318impl ::serde::Serialize for KeysStr {
319 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
320 where
321 S: ::serde::Serializer,
322 {
323 crate::types::bounded_string::serialize_bounded_string(self, serializer)
324 }
325}
326impl<'de> ::serde::Deserialize<'de> for KeysStr {
327 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
328 where
329 D: ::serde::Deserializer<'de>,
330 {
331 crate::types::bounded_string::deserialize_bounded_string(deserializer)
332 }
333}
334#[derive(Debug, Clone, PartialEq, PartialOrd)]
335pub struct LastnameStr {
336 value: String,
337}
338impl crate::types::bounded_string::BoundedString for LastnameStr {
339 const MIN_LENGTH: Option<usize> = None::<usize>;
340 const MAX_LENGTH: Option<usize> = Some(1024usize);
341 const DEFAULT: Option<&'static str> = None::<&'static str>;
342 const PATTERN: Option<&'static str> = None::<&'static str>;
343 const TYPE_DESCRIPTION: &'static str = "a string with length at most 1024";
344 fn get_value(&self) -> &str {
345 &self.value
346 }
347 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
348 Self::validate(&value)?;
349 Ok(Self { value })
350 }
351}
352impl std::convert::TryFrom<String> for LastnameStr {
353 type Error = crate::types::bounded_string::BoundedStringError;
354 fn try_from(value: String) -> Result<Self, Self::Error> {
355 crate::types::bounded_string::BoundedString::new(value)
356 }
357}
358impl ::serde::Serialize for LastnameStr {
359 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
360 where
361 S: ::serde::Serializer,
362 {
363 crate::types::bounded_string::serialize_bounded_string(self, serializer)
364 }
365}
366impl<'de> ::serde::Deserialize<'de> for LastnameStr {
367 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
368 where
369 D: ::serde::Deserializer<'de>,
370 {
371 crate::types::bounded_string::deserialize_bounded_string(deserializer)
372 }
373}
374impl<T> UseridClient<T>
375where
376 T: crate::client::Client,
377{
378 pub fn tfa(&self) -> tfa::TfaClient<T> {
379 tfa::TfaClient::<T>::new(self.client.clone(), &self.path)
380 }
381}
382impl<T> UseridClient<T>
383where
384 T: crate::client::Client,
385{
386 pub fn unlock_tfa(&self) -> unlock_tfa::UnlockTfaClient<T> {
387 unlock_tfa::UnlockTfaClient::<T>::new(self.client.clone(), &self.path)
388 }
389}
390impl<T> UseridClient<T>
391where
392 T: crate::client::Client,
393{
394 pub fn token(&self) -> token::TokenClient<T> {
395 token::TokenClient::<T>::new(self.client.clone(), &self.path)
396 }
397}