1#[derive(Debug, Clone)]
2pub struct IdClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> IdClient<T>
7where
8 T: crate::client::Client,
9{
10 pub fn new(client: T, parent_path: &str, id: &str) -> Self {
11 Self {
12 client,
13 path: format!("{}/{}", parent_path, id),
14 }
15 }
16}
17impl<T> IdClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Delete realm-sync job definition."]
22 #[doc = ""]
23 #[doc = "Permission check: perm(\"/\", [\"Sys.Modify\"])"]
24 pub async fn delete(&self) -> Result<(), T::Error> {
25 let path = self.path.to_string();
26 self.client.delete(&path, &()).await
27 }
28}
29impl<T> IdClient<T>
30where
31 T: crate::client::Client,
32{
33 #[doc = "Read realm-sync job definition."]
34 #[doc = ""]
35 #[doc = "Permission check: perm(\"/\", [\"Sys.Audit\"])"]
36 pub async fn get(&self) -> Result<GetOutput, T::Error> {
37 let path = self.path.to_string();
38 self.client.get(&path, &()).await
39 }
40}
41impl<T> IdClient<T>
42where
43 T: crate::client::Client,
44{
45 #[doc = "Create new realm-sync job."]
46 #[doc = ""]
47 #[doc = "Permission check: and(perm(\"/access/realm/{realm}\", [\"Realm.AllocateUser\"]), perm(\"/access/groups\", [\"User.Modify\"]))"]
48 #[doc = "'Realm.AllocateUser' on '/access/realm/\\<realm\\>' and 'User.Modify' permissions to '/access/groups/'."]
49 pub async fn post(&self, params: PostParams) -> Result<(), T::Error> {
50 let path = self.path.to_string();
51 self.client.post(&path, ¶ms).await
52 }
53}
54impl<T> IdClient<T>
55where
56 T: crate::client::Client,
57{
58 #[doc = "Update realm-sync job definition."]
59 #[doc = ""]
60 #[doc = "Permission check: and(perm(\"/access/realm/{realm}\", [\"Realm.AllocateUser\"]), perm(\"/access/groups\", [\"User.Modify\"]))"]
61 #[doc = "'Realm.AllocateUser' on '/access/realm/\\<realm\\>' and 'User.Modify' permissions to '/access/groups/'."]
62 pub async fn put(&self, params: PutParams) -> Result<(), T::Error> {
63 let path = self.path.to_string();
64 self.client.put(&path, ¶ms).await
65 }
66}
67#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
68pub struct GetOutput {
69 #[serde(
70 flatten,
71 default,
72 skip_serializing_if = "::std::collections::HashMap::is_empty"
73 )]
74 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
75}
76impl PostParams {
77 pub fn new(schedule: ScheduleStr) -> Self {
78 Self {
79 schedule,
80 comment: ::std::default::Default::default(),
81 enable_new: ::std::default::Default::default(),
82 enabled: ::std::default::Default::default(),
83 realm: ::std::default::Default::default(),
84 remove_vanished: ::std::default::Default::default(),
85 scope: ::std::default::Default::default(),
86 additional_properties: ::std::default::Default::default(),
87 }
88 }
89}
90#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
91pub struct PostParams {
92 #[serde(skip_serializing_if = "Option::is_none", default)]
93 #[doc = "Description for the Job."]
94 #[doc = ""]
95 pub comment: Option<CommentStr>,
96 #[serde(rename = "enable-new")]
97 #[serde(
98 serialize_with = "crate::types::serialize_bool_optional",
99 deserialize_with = "crate::types::deserialize_bool_optional"
100 )]
101 #[serde(skip_serializing_if = "Option::is_none", default)]
102 #[doc = "Enable newly synced users immediately."]
103 #[doc = ""]
104 pub enable_new: Option<bool>,
105 #[serde(
106 serialize_with = "crate::types::serialize_bool_optional",
107 deserialize_with = "crate::types::deserialize_bool_optional"
108 )]
109 #[serde(skip_serializing_if = "Option::is_none", default)]
110 #[doc = "Determines if the job is enabled."]
111 #[doc = ""]
112 pub enabled: Option<bool>,
113 #[serde(skip_serializing_if = "Option::is_none", default)]
114 #[doc = "Authentication domain ID"]
115 #[doc = ""]
116 pub realm: Option<RealmStr>,
117 #[serde(rename = "remove-vanished")]
118 #[serde(skip_serializing_if = "Option::is_none", default)]
119 #[doc = "A semicolon-separated list of things to remove when they or the user vanishes during a sync. The following values are possible: 'entry' removes the user/group when not returned from the sync. 'properties' removes the set properties on existing user/group that do not appear in the source (even custom ones). 'acl' removes acls when the user/group is not returned from the sync. Instead of a list it also can be 'none' (the default)."]
120 #[doc = ""]
121 pub remove_vanished: Option<RemoveVanishedStr>,
122 #[doc = "Backup schedule. The format is a subset of `systemd` calendar events."]
123 #[doc = ""]
124 pub schedule: ScheduleStr,
125 #[serde(skip_serializing_if = "Option::is_none", default)]
126 #[doc = "Select what to sync."]
127 #[doc = ""]
128 pub scope: Option<Scope>,
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}
136impl PutParams {
137 pub fn new(schedule: ScheduleStr) -> Self {
138 Self {
139 schedule,
140 comment: ::std::default::Default::default(),
141 delete: ::std::default::Default::default(),
142 enable_new: ::std::default::Default::default(),
143 enabled: ::std::default::Default::default(),
144 remove_vanished: ::std::default::Default::default(),
145 scope: ::std::default::Default::default(),
146 additional_properties: ::std::default::Default::default(),
147 }
148 }
149}
150#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
151pub struct PutParams {
152 #[serde(skip_serializing_if = "Option::is_none", default)]
153 #[doc = "Description for the Job."]
154 #[doc = ""]
155 pub comment: Option<CommentStr>,
156 #[serde(skip_serializing_if = "Option::is_none", default)]
157 #[doc = "A list of settings you want to delete."]
158 #[doc = ""]
159 pub delete: Option<DeleteStr>,
160 #[serde(rename = "enable-new")]
161 #[serde(
162 serialize_with = "crate::types::serialize_bool_optional",
163 deserialize_with = "crate::types::deserialize_bool_optional"
164 )]
165 #[serde(skip_serializing_if = "Option::is_none", default)]
166 #[doc = "Enable newly synced users immediately."]
167 #[doc = ""]
168 pub enable_new: Option<bool>,
169 #[serde(
170 serialize_with = "crate::types::serialize_bool_optional",
171 deserialize_with = "crate::types::deserialize_bool_optional"
172 )]
173 #[serde(skip_serializing_if = "Option::is_none", default)]
174 #[doc = "Determines if the job is enabled."]
175 #[doc = ""]
176 pub enabled: Option<bool>,
177 #[serde(rename = "remove-vanished")]
178 #[serde(skip_serializing_if = "Option::is_none", default)]
179 #[doc = "A semicolon-separated list of things to remove when they or the user vanishes during a sync. The following values are possible: 'entry' removes the user/group when not returned from the sync. 'properties' removes the set properties on existing user/group that do not appear in the source (even custom ones). 'acl' removes acls when the user/group is not returned from the sync. Instead of a list it also can be 'none' (the default)."]
180 #[doc = ""]
181 pub remove_vanished: Option<RemoveVanishedStr>,
182 #[doc = "Backup schedule. The format is a subset of `systemd` calendar events."]
183 #[doc = ""]
184 pub schedule: ScheduleStr,
185 #[serde(skip_serializing_if = "Option::is_none", default)]
186 #[doc = "Select what to sync."]
187 #[doc = ""]
188 pub scope: Option<Scope>,
189 #[serde(
190 flatten,
191 default,
192 skip_serializing_if = "::std::collections::HashMap::is_empty"
193 )]
194 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
195}
196#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
197#[doc = "Select what to sync."]
198#[doc = ""]
199pub enum Scope {
200 #[serde(rename = "both")]
201 Both,
202 #[serde(rename = "groups")]
203 Groups,
204 #[serde(rename = "users")]
205 Users,
206}
207impl TryFrom<&str> for Scope {
208 type Error = String;
209 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
210 match value {
211 "both" => Ok(Self::Both),
212 "groups" => Ok(Self::Groups),
213 "users" => Ok(Self::Users),
214 v => Err(format!("Unknown variant {v}")),
215 }
216 }
217}
218#[derive(Debug, Clone, PartialEq, PartialOrd)]
219pub struct CommentStr {
220 value: String,
221}
222impl crate::types::bounded_string::BoundedString for CommentStr {
223 const MIN_LENGTH: Option<usize> = None::<usize>;
224 const MAX_LENGTH: Option<usize> = Some(512usize);
225 const DEFAULT: Option<&'static str> = None::<&'static str>;
226 const PATTERN: Option<&'static str> = None::<&'static str>;
227 const TYPE_DESCRIPTION: &'static str = "a string with length at most 512";
228 fn get_value(&self) -> &str {
229 &self.value
230 }
231 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
232 Self::validate(&value)?;
233 Ok(Self { value })
234 }
235}
236impl std::convert::TryFrom<String> for CommentStr {
237 type Error = crate::types::bounded_string::BoundedStringError;
238 fn try_from(value: String) -> Result<Self, Self::Error> {
239 crate::types::bounded_string::BoundedString::new(value)
240 }
241}
242impl ::serde::Serialize for CommentStr {
243 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
244 where
245 S: ::serde::Serializer,
246 {
247 crate::types::bounded_string::serialize_bounded_string(self, serializer)
248 }
249}
250impl<'de> ::serde::Deserialize<'de> for CommentStr {
251 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
252 where
253 D: ::serde::Deserializer<'de>,
254 {
255 crate::types::bounded_string::deserialize_bounded_string(deserializer)
256 }
257}
258#[derive(Debug, Clone, PartialEq, PartialOrd)]
259pub struct DeleteStr {
260 value: String,
261}
262impl crate::types::bounded_string::BoundedString for DeleteStr {
263 const MIN_LENGTH: Option<usize> = None::<usize>;
264 const MAX_LENGTH: Option<usize> = Some(4096usize);
265 const DEFAULT: Option<&'static str> = None::<&'static str>;
266 const PATTERN: Option<&'static str> = None::<&'static str>;
267 const TYPE_DESCRIPTION: &'static str = "a string with length at most 4096";
268 fn get_value(&self) -> &str {
269 &self.value
270 }
271 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
272 Self::validate(&value)?;
273 Ok(Self { value })
274 }
275}
276impl std::convert::TryFrom<String> for DeleteStr {
277 type Error = crate::types::bounded_string::BoundedStringError;
278 fn try_from(value: String) -> Result<Self, Self::Error> {
279 crate::types::bounded_string::BoundedString::new(value)
280 }
281}
282impl ::serde::Serialize for DeleteStr {
283 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
284 where
285 S: ::serde::Serializer,
286 {
287 crate::types::bounded_string::serialize_bounded_string(self, serializer)
288 }
289}
290impl<'de> ::serde::Deserialize<'de> for DeleteStr {
291 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
292 where
293 D: ::serde::Deserializer<'de>,
294 {
295 crate::types::bounded_string::deserialize_bounded_string(deserializer)
296 }
297}
298#[derive(Debug, Clone, PartialEq, PartialOrd)]
299pub struct RealmStr {
300 value: String,
301}
302impl crate::types::bounded_string::BoundedString for RealmStr {
303 const MIN_LENGTH: Option<usize> = None::<usize>;
304 const MAX_LENGTH: Option<usize> = Some(32usize);
305 const DEFAULT: Option<&'static str> = None::<&'static str>;
306 const PATTERN: Option<&'static str> = None::<&'static str>;
307 const TYPE_DESCRIPTION: &'static str = "a string with length at most 32";
308 fn get_value(&self) -> &str {
309 &self.value
310 }
311 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
312 Self::validate(&value)?;
313 Ok(Self { value })
314 }
315}
316impl std::convert::TryFrom<String> for RealmStr {
317 type Error = crate::types::bounded_string::BoundedStringError;
318 fn try_from(value: String) -> Result<Self, Self::Error> {
319 crate::types::bounded_string::BoundedString::new(value)
320 }
321}
322impl ::serde::Serialize for RealmStr {
323 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
324 where
325 S: ::serde::Serializer,
326 {
327 crate::types::bounded_string::serialize_bounded_string(self, serializer)
328 }
329}
330impl<'de> ::serde::Deserialize<'de> for RealmStr {
331 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
332 where
333 D: ::serde::Deserializer<'de>,
334 {
335 crate::types::bounded_string::deserialize_bounded_string(deserializer)
336 }
337}
338#[derive(Debug, Clone, PartialEq, PartialOrd)]
339pub struct RemoveVanishedStr {
340 value: String,
341}
342impl crate::types::bounded_string::BoundedString for RemoveVanishedStr {
343 const MIN_LENGTH: Option<usize> = None::<usize>;
344 const MAX_LENGTH: Option<usize> = None::<usize>;
345 const DEFAULT: Option<&'static str> = Some("none");
346 const PATTERN: Option<&'static str> =
347 Some("(?:(?:(?:acl|properties|entry);)*(?:acl|properties|entry))|none");
348 const TYPE_DESCRIPTION: &'static str = "a string with pattern r\"(?:(?:(?:acl|properties|entry);)*(?:acl|properties|entry))|none\" and no length constraints";
349 fn get_value(&self) -> &str {
350 &self.value
351 }
352 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
353 Self::validate(&value)?;
354 Ok(Self { value })
355 }
356}
357impl std::convert::TryFrom<String> for RemoveVanishedStr {
358 type Error = crate::types::bounded_string::BoundedStringError;
359 fn try_from(value: String) -> Result<Self, Self::Error> {
360 crate::types::bounded_string::BoundedString::new(value)
361 }
362}
363impl ::serde::Serialize for RemoveVanishedStr {
364 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
365 where
366 S: ::serde::Serializer,
367 {
368 crate::types::bounded_string::serialize_bounded_string(self, serializer)
369 }
370}
371impl<'de> ::serde::Deserialize<'de> for RemoveVanishedStr {
372 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
373 where
374 D: ::serde::Deserializer<'de>,
375 {
376 crate::types::bounded_string::deserialize_bounded_string(deserializer)
377 }
378}
379#[derive(Debug, Clone, PartialEq, PartialOrd)]
380pub struct ScheduleStr {
381 value: String,
382}
383impl crate::types::bounded_string::BoundedString for ScheduleStr {
384 const MIN_LENGTH: Option<usize> = None::<usize>;
385 const MAX_LENGTH: Option<usize> = Some(128usize);
386 const DEFAULT: Option<&'static str> = None::<&'static str>;
387 const PATTERN: Option<&'static str> = None::<&'static str>;
388 const TYPE_DESCRIPTION: &'static str = "a string with length at most 128";
389 fn get_value(&self) -> &str {
390 &self.value
391 }
392 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
393 Self::validate(&value)?;
394 Ok(Self { value })
395 }
396}
397impl std::convert::TryFrom<String> for ScheduleStr {
398 type Error = crate::types::bounded_string::BoundedStringError;
399 fn try_from(value: String) -> Result<Self, Self::Error> {
400 crate::types::bounded_string::BoundedString::new(value)
401 }
402}
403impl ::serde::Serialize for ScheduleStr {
404 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
405 where
406 S: ::serde::Serializer,
407 {
408 crate::types::bounded_string::serialize_bounded_string(self, serializer)
409 }
410}
411impl<'de> ::serde::Deserialize<'de> for ScheduleStr {
412 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
413 where
414 D: ::serde::Deserializer<'de>,
415 {
416 crate::types::bounded_string::deserialize_bounded_string(deserializer)
417 }
418}