1use crate::httpx::request::OnBehalfOfInfo;
20use crate::mgmtx;
21use crate::mgmtx::bucket_settings::BucketSettings;
22use crate::mgmtx::user::{Group, User};
23use crate::retry::{RetryStrategy, DEFAULT_RETRY_STRATEGY};
24use std::sync::Arc;
25
26#[derive(Debug, Clone)]
27#[non_exhaustive]
28pub struct GetCollectionManifestOptions<'a> {
29 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
30 pub bucket_name: &'a str,
31
32 pub retry_strategy: Arc<dyn RetryStrategy>,
33}
34
35impl<'a> GetCollectionManifestOptions<'a> {
36 pub fn new(bucket_name: &'a str) -> Self {
37 Self {
38 on_behalf_of_info: None,
39 bucket_name,
40 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
41 }
42 }
43
44 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
45 self.retry_strategy = retry_strategy;
46 self
47 }
48
49 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
50 self.on_behalf_of_info = Some(on_behalf_of_info);
51 self
52 }
53}
54
55impl<'a> From<&GetCollectionManifestOptions<'a>>
56 for mgmtx::options::GetCollectionManifestOptions<'a>
57{
58 fn from(opts: &GetCollectionManifestOptions<'a>) -> Self {
59 Self {
60 on_behalf_of_info: opts.on_behalf_of_info,
61 bucket_name: opts.bucket_name,
62 }
63 }
64}
65
66#[derive(Debug, Clone)]
67#[non_exhaustive]
68pub struct CreateScopeOptions<'a> {
69 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
70 pub bucket_name: &'a str,
71 pub scope_name: &'a str,
72
73 pub retry_strategy: Arc<dyn RetryStrategy>,
74}
75
76impl<'a> CreateScopeOptions<'a> {
77 pub fn new(bucket_name: &'a str, scope_name: &'a str) -> Self {
78 Self {
79 on_behalf_of_info: None,
80 bucket_name,
81 scope_name,
82 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
83 }
84 }
85
86 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
87 self.retry_strategy = retry_strategy;
88 self
89 }
90
91 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
92 self.on_behalf_of_info = Some(on_behalf_of_info);
93 self
94 }
95}
96
97impl<'a> From<&CreateScopeOptions<'a>> for mgmtx::options::CreateScopeOptions<'a> {
98 fn from(opts: &CreateScopeOptions<'a>) -> Self {
99 Self {
100 on_behalf_of_info: opts.on_behalf_of_info,
101 bucket_name: opts.bucket_name,
102 scope_name: opts.scope_name,
103 }
104 }
105}
106
107#[derive(Debug, Clone)]
108#[non_exhaustive]
109pub struct DeleteScopeOptions<'a> {
110 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
111 pub bucket_name: &'a str,
112 pub scope_name: &'a str,
113
114 pub retry_strategy: Arc<dyn RetryStrategy>,
115}
116
117impl<'a> DeleteScopeOptions<'a> {
118 pub fn new(bucket_name: &'a str, scope_name: &'a str) -> Self {
119 Self {
120 on_behalf_of_info: None,
121 bucket_name,
122 scope_name,
123 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
124 }
125 }
126
127 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
128 self.retry_strategy = retry_strategy;
129 self
130 }
131
132 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
133 self.on_behalf_of_info = Some(on_behalf_of_info);
134 self
135 }
136}
137
138impl<'a> From<&DeleteScopeOptions<'a>> for mgmtx::options::DeleteScopeOptions<'a> {
139 fn from(opts: &DeleteScopeOptions<'a>) -> Self {
140 Self {
141 on_behalf_of_info: opts.on_behalf_of_info,
142 bucket_name: opts.bucket_name,
143 scope_name: opts.scope_name,
144 }
145 }
146}
147
148#[derive(Debug, Clone)]
149#[non_exhaustive]
150pub struct CreateCollectionOptions<'a> {
151 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
152 pub bucket_name: &'a str,
153 pub scope_name: &'a str,
154 pub collection_name: &'a str,
155 pub max_ttl: Option<i32>,
156 pub history_enabled: Option<bool>,
157
158 pub retry_strategy: Arc<dyn RetryStrategy>,
159}
160
161impl<'a> CreateCollectionOptions<'a> {
162 pub fn new(bucket_name: &'a str, scope_name: &'a str, collection_name: &'a str) -> Self {
163 Self {
164 on_behalf_of_info: None,
165 bucket_name,
166 scope_name,
167 collection_name,
168 max_ttl: None,
169 history_enabled: None,
170 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
171 }
172 }
173
174 pub fn max_ttl(mut self, max_ttl: i32) -> Self {
175 self.max_ttl = Some(max_ttl);
176 self
177 }
178
179 pub fn history_enabled(mut self, history_enabled: bool) -> Self {
180 self.history_enabled = Some(history_enabled);
181 self
182 }
183
184 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
185 self.retry_strategy = retry_strategy;
186 self
187 }
188
189 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
190 self.on_behalf_of_info = Some(on_behalf_of_info);
191 self
192 }
193}
194
195impl<'a> From<&CreateCollectionOptions<'a>> for mgmtx::options::CreateCollectionOptions<'a> {
196 fn from(opts: &CreateCollectionOptions<'a>) -> Self {
197 Self {
198 on_behalf_of_info: opts.on_behalf_of_info,
199 bucket_name: opts.bucket_name,
200 scope_name: opts.scope_name,
201 collection_name: opts.collection_name,
202 max_ttl: opts.max_ttl,
203 history_enabled: opts.history_enabled,
204 }
205 }
206}
207
208#[derive(Debug, Clone)]
209#[non_exhaustive]
210pub struct UpdateCollectionOptions<'a> {
211 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
212 pub bucket_name: &'a str,
213 pub scope_name: &'a str,
214 pub collection_name: &'a str,
215 pub max_ttl: Option<i32>,
216 pub history_enabled: Option<bool>,
217
218 pub retry_strategy: Arc<dyn RetryStrategy>,
219}
220
221impl<'a> UpdateCollectionOptions<'a> {
222 pub fn new(bucket_name: &'a str, scope_name: &'a str, collection_name: &'a str) -> Self {
223 Self {
224 on_behalf_of_info: None,
225 bucket_name,
226 scope_name,
227 collection_name,
228 max_ttl: None,
229 history_enabled: None,
230 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
231 }
232 }
233
234 pub fn max_ttl(mut self, max_ttl: i32) -> Self {
235 self.max_ttl = Some(max_ttl);
236 self
237 }
238
239 pub fn history_enabled(mut self, history_enabled: bool) -> Self {
240 self.history_enabled = Some(history_enabled);
241 self
242 }
243
244 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
245 self.retry_strategy = retry_strategy;
246 self
247 }
248
249 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
250 self.on_behalf_of_info = Some(on_behalf_of_info);
251 self
252 }
253}
254
255impl<'a> From<&UpdateCollectionOptions<'a>> for mgmtx::options::UpdateCollectionOptions<'a> {
256 fn from(opts: &UpdateCollectionOptions<'a>) -> Self {
257 Self {
258 on_behalf_of_info: opts.on_behalf_of_info,
259 bucket_name: opts.bucket_name,
260 scope_name: opts.scope_name,
261 collection_name: opts.collection_name,
262 max_ttl: opts.max_ttl,
263 history_enabled: opts.history_enabled,
264 }
265 }
266}
267
268#[derive(Debug, Clone)]
269#[non_exhaustive]
270pub struct DeleteCollectionOptions<'a> {
271 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
272 pub bucket_name: &'a str,
273 pub scope_name: &'a str,
274 pub collection_name: &'a str,
275
276 pub retry_strategy: Arc<dyn RetryStrategy>,
277}
278
279impl<'a> DeleteCollectionOptions<'a> {
280 pub fn new(bucket_name: &'a str, scope_name: &'a str, collection_name: &'a str) -> Self {
281 Self {
282 on_behalf_of_info: None,
283 bucket_name,
284 scope_name,
285 collection_name,
286 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
287 }
288 }
289
290 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
291 self.retry_strategy = retry_strategy;
292 self
293 }
294
295 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
296 self.on_behalf_of_info = Some(on_behalf_of_info);
297 self
298 }
299}
300
301impl<'a> From<&DeleteCollectionOptions<'a>> for mgmtx::options::DeleteCollectionOptions<'a> {
302 fn from(opts: &DeleteCollectionOptions<'a>) -> Self {
303 Self {
304 on_behalf_of_info: opts.on_behalf_of_info,
305 bucket_name: opts.bucket_name,
306 scope_name: opts.scope_name,
307 collection_name: opts.collection_name,
308 }
309 }
310}
311
312#[derive(Debug, Clone)]
313#[non_exhaustive]
314pub struct EnsureManifestOptions<'a> {
315 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
316 pub bucket_name: &'a str,
317 pub manifest_uid: u64,
318}
319
320impl<'a> EnsureManifestOptions<'a> {
321 pub fn new(bucket_name: &'a str, manifest_uid: u64) -> Self {
322 Self {
323 on_behalf_of_info: None,
324 bucket_name,
325 manifest_uid,
326 }
327 }
328
329 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
330 self.on_behalf_of_info = Some(on_behalf_of_info);
331 self
332 }
333}
334
335#[derive(Debug, Clone)]
336#[non_exhaustive]
337pub struct GetAllBucketsOptions<'a> {
338 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
339
340 pub retry_strategy: Arc<dyn RetryStrategy>,
341}
342
343impl<'a> GetAllBucketsOptions<'a> {
344 pub fn new() -> Self {
345 Self {
346 on_behalf_of_info: None,
347 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
348 }
349 }
350
351 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
352 self.retry_strategy = retry_strategy;
353 self
354 }
355
356 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
357 self.on_behalf_of_info = Some(on_behalf_of_info);
358 self
359 }
360}
361
362impl Default for GetAllBucketsOptions<'_> {
363 fn default() -> Self {
364 Self::new()
365 }
366}
367
368impl<'a> From<&GetAllBucketsOptions<'a>> for mgmtx::options::GetAllBucketsOptions<'a> {
369 fn from(opts: &GetAllBucketsOptions<'a>) -> Self {
370 Self {
371 on_behalf_of_info: opts.on_behalf_of_info,
372 }
373 }
374}
375
376#[derive(Debug, Clone)]
377#[non_exhaustive]
378pub struct GetBucketOptions<'a> {
379 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
380 pub bucket_name: &'a str,
381
382 pub retry_strategy: Arc<dyn RetryStrategy>,
383}
384
385impl<'a> GetBucketOptions<'a> {
386 pub fn new(bucket_name: &'a str) -> Self {
387 Self {
388 on_behalf_of_info: None,
389 bucket_name,
390 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
391 }
392 }
393
394 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
395 self.retry_strategy = retry_strategy;
396 self
397 }
398
399 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
400 self.on_behalf_of_info = Some(on_behalf_of_info);
401 self
402 }
403}
404
405impl<'a> From<&GetBucketOptions<'a>> for mgmtx::options::GetBucketOptions<'a> {
406 fn from(opts: &GetBucketOptions<'a>) -> Self {
407 Self {
408 on_behalf_of_info: opts.on_behalf_of_info,
409 bucket_name: opts.bucket_name,
410 }
411 }
412}
413
414#[derive(Debug, Clone)]
415#[non_exhaustive]
416pub struct CreateBucketOptions<'a> {
417 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
418 pub bucket_name: &'a str,
419 pub bucket_settings: &'a BucketSettings,
420
421 pub retry_strategy: Arc<dyn RetryStrategy>,
422}
423
424impl<'a> CreateBucketOptions<'a> {
425 pub fn new(bucket_name: &'a str, bucket_settings: &'a BucketSettings) -> Self {
426 Self {
427 on_behalf_of_info: None,
428 bucket_name,
429 bucket_settings,
430 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
431 }
432 }
433
434 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
435 self.retry_strategy = retry_strategy;
436 self
437 }
438
439 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
440 self.on_behalf_of_info = Some(on_behalf_of_info);
441 self
442 }
443}
444
445impl<'a> From<&CreateBucketOptions<'a>> for mgmtx::options::CreateBucketOptions<'a> {
446 fn from(opts: &CreateBucketOptions<'a>) -> Self {
447 Self {
448 on_behalf_of_info: opts.on_behalf_of_info,
449 bucket_name: opts.bucket_name,
450 bucket_settings: opts.bucket_settings,
451 }
452 }
453}
454
455#[derive(Debug, Clone)]
456#[non_exhaustive]
457pub struct UpdateBucketOptions<'a> {
458 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
459 pub bucket_name: &'a str,
460 pub bucket_settings: &'a BucketSettings,
461
462 pub retry_strategy: Arc<dyn RetryStrategy>,
463}
464
465impl<'a> UpdateBucketOptions<'a> {
466 pub fn new(bucket_name: &'a str, bucket_settings: &'a BucketSettings) -> Self {
467 Self {
468 on_behalf_of_info: None,
469 bucket_name,
470 bucket_settings,
471 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
472 }
473 }
474
475 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
476 self.retry_strategy = retry_strategy;
477 self
478 }
479
480 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
481 self.on_behalf_of_info = Some(on_behalf_of_info);
482 self
483 }
484}
485
486impl<'a> From<&UpdateBucketOptions<'a>> for mgmtx::options::UpdateBucketOptions<'a> {
487 fn from(opts: &UpdateBucketOptions<'a>) -> Self {
488 Self {
489 on_behalf_of_info: opts.on_behalf_of_info,
490 bucket_name: opts.bucket_name,
491 bucket_settings: opts.bucket_settings,
492 }
493 }
494}
495
496#[derive(Debug, Clone)]
497#[non_exhaustive]
498pub struct DeleteBucketOptions<'a> {
499 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
500 pub bucket_name: &'a str,
501
502 pub retry_strategy: Arc<dyn RetryStrategy>,
503}
504
505impl<'a> DeleteBucketOptions<'a> {
506 pub fn new(bucket_name: &'a str) -> Self {
507 Self {
508 on_behalf_of_info: None,
509 bucket_name,
510 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
511 }
512 }
513
514 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
515 self.retry_strategy = retry_strategy;
516 self
517 }
518
519 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
520 self.on_behalf_of_info = Some(on_behalf_of_info);
521 self
522 }
523}
524
525impl<'a> From<&DeleteBucketOptions<'a>> for mgmtx::options::DeleteBucketOptions<'a> {
526 fn from(opts: &DeleteBucketOptions<'a>) -> Self {
527 Self {
528 on_behalf_of_info: opts.on_behalf_of_info,
529 bucket_name: opts.bucket_name,
530 }
531 }
532}
533
534#[derive(Debug, Clone)]
535#[non_exhaustive]
536pub struct FlushBucketOptions<'a> {
537 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
538 pub bucket_name: &'a str,
539
540 pub retry_strategy: Arc<dyn RetryStrategy>,
541}
542
543impl<'a> FlushBucketOptions<'a> {
544 pub fn new(bucket_name: &'a str) -> Self {
545 Self {
546 on_behalf_of_info: None,
547 bucket_name,
548 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
549 }
550 }
551
552 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
553 self.retry_strategy = retry_strategy;
554 self
555 }
556
557 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
558 self.on_behalf_of_info = Some(on_behalf_of_info);
559 self
560 }
561}
562
563impl<'a> From<&FlushBucketOptions<'a>> for mgmtx::options::FlushBucketOptions<'a> {
564 fn from(opts: &FlushBucketOptions<'a>) -> Self {
565 Self {
566 on_behalf_of_info: opts.on_behalf_of_info,
567 bucket_name: opts.bucket_name,
568 }
569 }
570}
571
572#[derive(Debug, Clone)]
573#[non_exhaustive]
574pub struct EnsureBucketOptions<'a> {
575 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
576 pub bucket_name: &'a str,
577 pub bucket_uuid: Option<&'a str>,
578 pub want_missing: bool,
579}
580
581impl<'a> EnsureBucketOptions<'a> {
582 pub fn new(bucket_name: &'a str, want_missing: bool) -> Self {
583 Self {
584 on_behalf_of_info: None,
585 bucket_name,
586 bucket_uuid: None,
587 want_missing,
588 }
589 }
590
591 pub fn bucket_uuid(mut self, bucket_uuid: &'a str) -> Self {
592 self.bucket_uuid = Some(bucket_uuid);
593 self
594 }
595
596 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
597 self.on_behalf_of_info = Some(on_behalf_of_info);
598 self
599 }
600}
601
602#[derive(Debug, Clone)]
603#[non_exhaustive]
604pub struct GetUserOptions<'a> {
605 pub username: &'a str,
606 pub auth_domain: &'a str,
607 pub on_behalf_of: Option<&'a OnBehalfOfInfo>,
608 pub retry_strategy: Arc<dyn RetryStrategy>,
609}
610
611impl<'a> GetUserOptions<'a> {
612 pub fn new(username: &'a str, auth_domain: &'a str) -> Self {
613 Self {
614 username,
615 auth_domain,
616 on_behalf_of: None,
617 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
618 }
619 }
620
621 pub fn on_behalf_of(mut self, on_behalf_of: &'a OnBehalfOfInfo) -> Self {
622 self.on_behalf_of = Some(on_behalf_of);
623 self
624 }
625
626 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
627 self.retry_strategy = retry_strategy;
628 self
629 }
630}
631
632impl<'a> From<&GetUserOptions<'a>> for mgmtx::options::GetUserOptions<'a> {
633 fn from(opts: &GetUserOptions<'a>) -> Self {
634 Self {
635 username: opts.username,
636 auth_domain: opts.auth_domain,
637 on_behalf_of_info: opts.on_behalf_of,
638 }
639 }
640}
641
642#[derive(Debug, Clone)]
643#[non_exhaustive]
644pub struct GetAllUsersOptions<'a> {
645 pub auth_domain: &'a str,
646 pub on_behalf_of: Option<&'a OnBehalfOfInfo>,
647 pub retry_strategy: Arc<dyn RetryStrategy>,
648}
649
650impl<'a> GetAllUsersOptions<'a> {
651 pub fn new(auth_domain: &'a str) -> Self {
652 Self {
653 auth_domain,
654 on_behalf_of: None,
655 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
656 }
657 }
658
659 pub fn on_behalf_of(mut self, on_behalf_of: &'a OnBehalfOfInfo) -> Self {
660 self.on_behalf_of = Some(on_behalf_of);
661 self
662 }
663
664 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
665 self.retry_strategy = retry_strategy;
666 self
667 }
668}
669
670impl<'a> From<&GetAllUsersOptions<'a>> for mgmtx::options::GetAllUsersOptions<'a> {
671 fn from(opts: &GetAllUsersOptions<'a>) -> Self {
672 Self {
673 auth_domain: opts.auth_domain,
674 on_behalf_of_info: opts.on_behalf_of,
675 }
676 }
677}
678
679#[derive(Debug, Clone)]
680#[non_exhaustive]
681pub struct UpsertUserOptions<'a> {
682 pub user: &'a User,
683 pub auth_domain: &'a str,
684 pub on_behalf_of: Option<&'a OnBehalfOfInfo>,
685 pub retry_strategy: Arc<dyn RetryStrategy>,
686}
687
688impl<'a> UpsertUserOptions<'a> {
689 pub fn new(user: &'a User, auth_domain: &'a str) -> Self {
690 Self {
691 user,
692 auth_domain,
693 on_behalf_of: None,
694 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
695 }
696 }
697
698 pub fn on_behalf_of(mut self, on_behalf_of: &'a OnBehalfOfInfo) -> Self {
699 self.on_behalf_of = Some(on_behalf_of);
700 self
701 }
702
703 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
704 self.retry_strategy = retry_strategy;
705 self
706 }
707}
708
709impl<'a> From<&UpsertUserOptions<'a>> for mgmtx::options::UpsertUserOptions<'a> {
710 fn from(opts: &UpsertUserOptions<'a>) -> Self {
711 Self {
712 user: opts.user,
713 auth_domain: opts.auth_domain,
714 on_behalf_of_info: opts.on_behalf_of,
715 }
716 }
717}
718
719#[derive(Debug, Clone)]
720#[non_exhaustive]
721pub struct DeleteUserOptions<'a> {
722 pub username: &'a str,
723 pub auth_domain: &'a str,
724 pub on_behalf_of: Option<&'a OnBehalfOfInfo>,
725 pub retry_strategy: Arc<dyn RetryStrategy>,
726}
727
728impl<'a> DeleteUserOptions<'a> {
729 pub fn new(username: &'a str, auth_domain: &'a str) -> Self {
730 Self {
731 username,
732 auth_domain,
733 on_behalf_of: None,
734 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
735 }
736 }
737
738 pub fn on_behalf_of(mut self, on_behalf_of: &'a OnBehalfOfInfo) -> Self {
739 self.on_behalf_of = Some(on_behalf_of);
740 self
741 }
742
743 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
744 self.retry_strategy = retry_strategy;
745 self
746 }
747}
748
749impl<'a> From<&DeleteUserOptions<'a>> for mgmtx::options::DeleteUserOptions<'a> {
750 fn from(opts: &DeleteUserOptions<'a>) -> Self {
751 Self {
752 username: opts.username,
753 auth_domain: opts.auth_domain,
754 on_behalf_of_info: opts.on_behalf_of,
755 }
756 }
757}
758
759#[derive(Debug, Clone)]
760#[non_exhaustive]
761pub struct GetRolesOptions<'a> {
762 pub permission: Option<&'a str>,
763 pub on_behalf_of: Option<&'a OnBehalfOfInfo>,
764 pub retry_strategy: Arc<dyn RetryStrategy>,
765}
766
767impl Default for GetRolesOptions<'_> {
768 fn default() -> Self {
769 Self::new()
770 }
771}
772
773impl<'a> GetRolesOptions<'a> {
774 pub fn new() -> Self {
775 Self {
776 permission: None,
777 on_behalf_of: None,
778 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
779 }
780 }
781
782 pub fn permission(mut self, permission: &'a str) -> Self {
783 self.permission = Some(permission);
784 self
785 }
786
787 pub fn on_behalf_of(mut self, on_behalf_of: &'a OnBehalfOfInfo) -> Self {
788 self.on_behalf_of = Some(on_behalf_of);
789 self
790 }
791
792 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
793 self.retry_strategy = retry_strategy;
794 self
795 }
796}
797
798impl<'a> From<&GetRolesOptions<'a>> for mgmtx::options::GetRolesOptions<'a> {
799 fn from(opts: &GetRolesOptions<'a>) -> Self {
800 Self {
801 on_behalf_of_info: opts.on_behalf_of,
802 permission: opts.permission,
803 }
804 }
805}
806
807#[derive(Debug, Clone)]
808#[non_exhaustive]
809pub struct GetGroupOptions<'a> {
810 pub group_name: &'a str,
811 pub on_behalf_of: Option<&'a OnBehalfOfInfo>,
812 pub retry_strategy: Arc<dyn RetryStrategy>,
813}
814
815impl<'a> GetGroupOptions<'a> {
816 pub fn new(group_name: &'a str) -> Self {
817 Self {
818 group_name,
819 on_behalf_of: None,
820 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
821 }
822 }
823
824 pub fn on_behalf_of(mut self, on_behalf_of: &'a OnBehalfOfInfo) -> Self {
825 self.on_behalf_of = Some(on_behalf_of);
826 self
827 }
828
829 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
830 self.retry_strategy = retry_strategy;
831 self
832 }
833}
834
835impl<'a> From<&GetGroupOptions<'a>> for mgmtx::options::GetGroupOptions<'a> {
836 fn from(opts: &GetGroupOptions<'a>) -> Self {
837 Self {
838 group_name: opts.group_name,
839 on_behalf_of_info: opts.on_behalf_of,
840 }
841 }
842}
843
844#[derive(Debug, Clone)]
845#[non_exhaustive]
846pub struct GetAllGroupsOptions<'a> {
847 pub on_behalf_of: Option<&'a OnBehalfOfInfo>,
848 pub retry_strategy: Arc<dyn RetryStrategy>,
849}
850
851impl Default for GetAllGroupsOptions<'_> {
852 fn default() -> Self {
853 Self::new()
854 }
855}
856
857impl<'a> GetAllGroupsOptions<'a> {
858 pub fn new() -> Self {
859 Self {
860 on_behalf_of: None,
861 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
862 }
863 }
864
865 pub fn on_behalf_of(mut self, on_behalf_of: &'a OnBehalfOfInfo) -> Self {
866 self.on_behalf_of = Some(on_behalf_of);
867 self
868 }
869
870 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
871 self.retry_strategy = retry_strategy;
872 self
873 }
874}
875
876impl<'a> From<&GetAllGroupsOptions<'a>> for mgmtx::options::GetAllGroupsOptions<'a> {
877 fn from(opts: &GetAllGroupsOptions<'a>) -> Self {
878 Self {
879 on_behalf_of_info: opts.on_behalf_of,
880 }
881 }
882}
883
884#[derive(Debug, Clone)]
885#[non_exhaustive]
886pub struct UpsertGroupOptions<'a> {
887 pub group: &'a Group,
888 pub on_behalf_of: Option<&'a OnBehalfOfInfo>,
889 pub retry_strategy: Arc<dyn RetryStrategy>,
890}
891
892impl<'a> UpsertGroupOptions<'a> {
893 pub fn new(group: &'a Group) -> Self {
894 Self {
895 group,
896 on_behalf_of: None,
897 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
898 }
899 }
900
901 pub fn on_behalf_of(mut self, on_behalf_of: &'a OnBehalfOfInfo) -> Self {
902 self.on_behalf_of = Some(on_behalf_of);
903 self
904 }
905
906 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
907 self.retry_strategy = retry_strategy;
908 self
909 }
910}
911
912impl<'a> From<&UpsertGroupOptions<'a>> for mgmtx::options::UpsertGroupOptions<'a> {
913 fn from(opts: &UpsertGroupOptions<'a>) -> Self {
914 Self {
915 group: opts.group,
916 on_behalf_of_info: opts.on_behalf_of,
917 }
918 }
919}
920
921#[derive(Debug, Clone)]
922#[non_exhaustive]
923pub struct DeleteGroupOptions<'a> {
924 pub group_name: &'a str,
925 pub on_behalf_of: Option<&'a OnBehalfOfInfo>,
926 pub retry_strategy: Arc<dyn RetryStrategy>,
927}
928
929impl<'a> DeleteGroupOptions<'a> {
930 pub fn new(group_name: &'a str) -> Self {
931 Self {
932 group_name,
933 on_behalf_of: None,
934 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
935 }
936 }
937
938 pub fn on_behalf_of(mut self, on_behalf_of: &'a OnBehalfOfInfo) -> Self {
939 self.on_behalf_of = Some(on_behalf_of);
940 self
941 }
942
943 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
944 self.retry_strategy = retry_strategy;
945 self
946 }
947}
948
949impl<'a> From<&DeleteGroupOptions<'a>> for mgmtx::options::DeleteGroupOptions<'a> {
950 fn from(opts: &DeleteGroupOptions<'a>) -> Self {
951 Self {
952 group_name: opts.group_name,
953 on_behalf_of_info: opts.on_behalf_of,
954 }
955 }
956}
957
958#[derive(Debug, Clone)]
959#[non_exhaustive]
960pub struct ChangePasswordOptions<'a> {
961 pub new_password: &'a str,
962 pub on_behalf_of: Option<&'a OnBehalfOfInfo>,
963 pub retry_strategy: Arc<dyn RetryStrategy>,
964}
965
966impl<'a> ChangePasswordOptions<'a> {
967 pub fn new(new_password: &'a str) -> Self {
968 Self {
969 new_password,
970 on_behalf_of: None,
971 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
972 }
973 }
974
975 pub fn on_behalf_of(mut self, on_behalf_of: &'a OnBehalfOfInfo) -> Self {
976 self.on_behalf_of = Some(on_behalf_of);
977 self
978 }
979
980 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
981 self.retry_strategy = retry_strategy;
982 self
983 }
984}
985
986impl<'a> From<&ChangePasswordOptions<'a>> for mgmtx::options::ChangePasswordOptions<'a> {
987 fn from(opts: &ChangePasswordOptions<'a>) -> Self {
988 Self {
989 new_password: opts.new_password,
990 on_behalf_of_info: opts.on_behalf_of,
991 }
992 }
993}
994
995#[derive(Debug, Clone)]
996#[non_exhaustive]
997pub struct EnsureUserOptions<'a> {
998 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
999 pub username: &'a str,
1000 pub auth_domain: &'a str,
1001 pub want_missing: bool,
1002}
1003
1004impl<'a> EnsureUserOptions<'a> {
1005 pub fn new(username: &'a str, auth_domain: &'a str, want_missing: bool) -> Self {
1006 Self {
1007 on_behalf_of_info: None,
1008 username,
1009 auth_domain,
1010 want_missing,
1011 }
1012 }
1013
1014 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
1015 self.on_behalf_of_info = Some(on_behalf_of_info);
1016 self
1017 }
1018}
1019
1020#[derive(Debug, Clone)]
1021#[non_exhaustive]
1022pub struct EnsureGroupOptions<'a> {
1023 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
1024 pub group_name: &'a str,
1025 pub want_missing: bool,
1026}
1027
1028impl<'a> EnsureGroupOptions<'a> {
1029 pub fn new(group_name: &'a str, want_missing: bool) -> Self {
1030 Self {
1031 on_behalf_of_info: None,
1032 group_name,
1033 want_missing,
1034 }
1035 }
1036
1037 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
1038 self.on_behalf_of_info = Some(on_behalf_of_info);
1039 self
1040 }
1041}
1042
1043#[derive(Debug, Clone)]
1044#[non_exhaustive]
1045pub struct GetFullClusterConfigOptions<'a> {
1046 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
1047
1048 pub retry_strategy: Arc<dyn RetryStrategy>,
1049}
1050
1051impl<'a> Default for GetFullClusterConfigOptions<'a> {
1052 fn default() -> Self {
1053 Self::new()
1054 }
1055}
1056
1057impl<'a> GetFullClusterConfigOptions<'a> {
1058 pub fn new() -> Self {
1059 Self {
1060 on_behalf_of_info: None,
1061 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
1062 }
1063 }
1064
1065 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
1066 self.retry_strategy = retry_strategy;
1067 self
1068 }
1069
1070 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
1071 self.on_behalf_of_info = Some(on_behalf_of_info);
1072 self
1073 }
1074}
1075
1076impl<'a> From<&GetFullClusterConfigOptions<'a>>
1077 for mgmtx::options::GetFullClusterConfigOptions<'a>
1078{
1079 fn from(opts: &GetFullClusterConfigOptions<'a>) -> Self {
1080 Self {
1081 on_behalf_of_info: opts.on_behalf_of_info,
1082 }
1083 }
1084}
1085
1086#[derive(Debug, Clone)]
1087#[non_exhaustive]
1088pub struct GetFullBucketConfigOptions<'a> {
1089 pub bucket_name: &'a str,
1090 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
1091
1092 pub retry_strategy: Arc<dyn RetryStrategy>,
1093}
1094
1095impl<'a> GetFullBucketConfigOptions<'a> {
1096 pub fn new(bucket_name: &'a str) -> Self {
1097 Self {
1098 bucket_name,
1099 on_behalf_of_info: None,
1100 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
1101 }
1102 }
1103
1104 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
1105 self.retry_strategy = retry_strategy;
1106 self
1107 }
1108
1109 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
1110 self.on_behalf_of_info = Some(on_behalf_of_info);
1111 self
1112 }
1113}
1114
1115impl<'a> From<&GetFullBucketConfigOptions<'a>> for mgmtx::options::GetFullBucketConfigOptions<'a> {
1116 fn from(opts: &GetFullBucketConfigOptions<'a>) -> Self {
1117 Self {
1118 bucket_name: opts.bucket_name,
1119 on_behalf_of_info: opts.on_behalf_of_info,
1120 }
1121 }
1122}
1123
1124#[derive(Debug, Clone)]
1125#[non_exhaustive]
1126pub struct LoadSampleBucketOptions<'a> {
1127 pub bucket_name: &'a str,
1128 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
1129
1130 pub retry_strategy: Arc<dyn RetryStrategy>,
1131}
1132
1133impl<'a> LoadSampleBucketOptions<'a> {
1134 pub fn new(bucket_name: &'a str) -> Self {
1135 Self {
1136 bucket_name,
1137 on_behalf_of_info: None,
1138 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
1139 }
1140 }
1141
1142 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
1143 self.retry_strategy = retry_strategy;
1144 self
1145 }
1146
1147 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
1148 self.on_behalf_of_info = Some(on_behalf_of_info);
1149 self
1150 }
1151}
1152
1153impl<'a> From<&LoadSampleBucketOptions<'a>> for mgmtx::options::LoadSampleBucketOptions<'a> {
1154 fn from(opts: &LoadSampleBucketOptions<'a>) -> Self {
1155 Self {
1156 bucket_name: opts.bucket_name,
1157 on_behalf_of_info: opts.on_behalf_of_info,
1158 }
1159 }
1160}
1161
1162#[derive(Debug, Clone)]
1163#[non_exhaustive]
1164pub struct IndexStatusOptions<'a> {
1165 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
1166
1167 pub retry_strategy: Arc<dyn RetryStrategy>,
1168}
1169
1170impl<'a> Default for IndexStatusOptions<'a> {
1171 fn default() -> Self {
1172 Self::new()
1173 }
1174}
1175
1176impl<'a> IndexStatusOptions<'a> {
1177 pub fn new() -> Self {
1178 Self {
1179 on_behalf_of_info: None,
1180 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
1181 }
1182 }
1183
1184 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
1185 self.retry_strategy = retry_strategy;
1186 self
1187 }
1188}
1189
1190impl<'a> From<&IndexStatusOptions<'a>> for mgmtx::options::IndexStatusOptions<'a> {
1191 fn from(opts: &IndexStatusOptions<'a>) -> Self {
1192 Self {
1193 on_behalf_of_info: opts.on_behalf_of_info,
1194 }
1195 }
1196}
1197
1198#[derive(Debug, Clone)]
1199#[non_exhaustive]
1200pub struct GetAutoFailoverSettingsOptions<'a> {
1201 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
1202
1203 pub retry_strategy: Arc<dyn RetryStrategy>,
1204}
1205
1206impl<'a> Default for GetAutoFailoverSettingsOptions<'a> {
1207 fn default() -> Self {
1208 Self::new()
1209 }
1210}
1211
1212impl<'a> GetAutoFailoverSettingsOptions<'a> {
1213 pub fn new() -> Self {
1214 Self {
1215 on_behalf_of_info: None,
1216 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
1217 }
1218 }
1219
1220 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
1221 self.retry_strategy = retry_strategy;
1222 self
1223 }
1224
1225 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
1226 self.on_behalf_of_info = Some(on_behalf_of_info);
1227 self
1228 }
1229}
1230
1231impl<'a> From<&GetAutoFailoverSettingsOptions<'a>>
1232 for mgmtx::options::GetAutoFailoverSettingsOptions<'a>
1233{
1234 fn from(opts: &GetAutoFailoverSettingsOptions<'a>) -> Self {
1235 Self {
1236 on_behalf_of_info: opts.on_behalf_of_info,
1237 }
1238 }
1239}
1240
1241#[derive(Debug, Clone)]
1242#[non_exhaustive]
1243pub struct GetBucketStatsOptions<'a> {
1244 pub bucket_name: &'a str,
1245 pub on_behalf_of_info: Option<&'a OnBehalfOfInfo>,
1246
1247 pub retry_strategy: Arc<dyn RetryStrategy>,
1248}
1249
1250impl<'a> GetBucketStatsOptions<'a> {
1251 pub fn new(bucket_name: &'a str) -> Self {
1252 Self {
1253 bucket_name,
1254 on_behalf_of_info: None,
1255 retry_strategy: DEFAULT_RETRY_STRATEGY.clone(),
1256 }
1257 }
1258
1259 pub fn retry_strategy(mut self, retry_strategy: Arc<dyn RetryStrategy>) -> Self {
1260 self.retry_strategy = retry_strategy;
1261 self
1262 }
1263
1264 pub fn on_behalf_of_info(mut self, on_behalf_of_info: &'a OnBehalfOfInfo) -> Self {
1265 self.on_behalf_of_info = Some(on_behalf_of_info);
1266 self
1267 }
1268}
1269
1270impl<'a> From<&GetBucketStatsOptions<'a>> for mgmtx::options::GetBucketStatsOptions<'a> {
1271 fn from(opts: &GetBucketStatsOptions<'a>) -> Self {
1272 Self {
1273 bucket_name: opts.bucket_name,
1274 on_behalf_of_info: opts.on_behalf_of_info,
1275 }
1276 }
1277}