1pub mod database_admin {
18 use crate::Result;
19 use std::sync::Arc;
20
21 #[derive(Clone, Debug)]
23 pub struct RequestBuilder<R: std::default::Default> {
24 stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>,
25 request: R,
26 options: gax::options::RequestOptions,
27 }
28
29 impl<R> RequestBuilder<R>
30 where
31 R: std::default::Default,
32 {
33 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
34 Self {
35 stub,
36 request: R::default(),
37 options: gax::options::RequestOptions::default(),
38 }
39 }
40 }
41
42 #[derive(Clone, Debug)]
44 pub struct ListDatabases(RequestBuilder<crate::model::ListDatabasesRequest>);
45
46 impl ListDatabases {
47 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
48 Self(RequestBuilder::new(stub))
49 }
50
51 pub fn with_request<V: Into<crate::model::ListDatabasesRequest>>(mut self, v: V) -> Self {
53 self.0.request = v.into();
54 self
55 }
56
57 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
59 self.0.options = v.into();
60 self
61 }
62
63 pub async fn send(self) -> Result<crate::model::ListDatabasesResponse> {
65 (*self.0.stub)
66 .list_databases(self.0.request, self.0.options)
67 .await
68 }
69
70 #[cfg(feature = "unstable-stream")]
72 pub async fn stream(
73 self,
74 ) -> gax::paginator::Paginator<crate::model::ListDatabasesResponse, gax::error::Error>
75 {
76 let token = gax::paginator::extract_token(&self.0.request.page_token);
77 let execute = move |token: String| {
78 let mut builder = self.clone();
79 builder.0.request = builder.0.request.set_page_token(token);
80 builder.send()
81 };
82 gax::paginator::Paginator::new(token, execute)
83 }
84
85 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
87 self.0.request.parent = v.into();
88 self
89 }
90
91 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
93 self.0.request.page_size = v.into();
94 self
95 }
96
97 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
99 self.0.request.page_token = v.into();
100 self
101 }
102 }
103
104 impl gax::options::RequestBuilder for ListDatabases {
105 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
106 &mut self.0.options
107 }
108 }
109
110 #[derive(Clone, Debug)]
112 pub struct CreateDatabase(RequestBuilder<crate::model::CreateDatabaseRequest>);
113
114 impl CreateDatabase {
115 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
116 Self(RequestBuilder::new(stub))
117 }
118
119 pub fn with_request<V: Into<crate::model::CreateDatabaseRequest>>(mut self, v: V) -> Self {
121 self.0.request = v.into();
122 self
123 }
124
125 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
127 self.0.options = v.into();
128 self
129 }
130
131 pub async fn send(self) -> Result<longrunning::model::Operation> {
138 (*self.0.stub)
139 .create_database(self.0.request, self.0.options)
140 .await
141 }
142
143 pub fn poller(
145 self,
146 ) -> impl lro::Poller<crate::model::Database, crate::model::CreateDatabaseMetadata>
147 {
148 type Operation =
149 lro::Operation<crate::model::Database, crate::model::CreateDatabaseMetadata>;
150 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
151 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
152
153 let stub = self.0.stub.clone();
154 let mut options = self.0.options.clone();
155 options.set_retry_policy(gax::retry_policy::NeverRetry);
156 let query = move |name| {
157 let stub = stub.clone();
158 let options = options.clone();
159 async {
160 let op = GetOperation::new(stub)
161 .set_name(name)
162 .with_options(options)
163 .send()
164 .await?;
165 Ok(Operation::new(op))
166 }
167 };
168
169 let start = move || async {
170 let op = self.send().await?;
171 Ok(Operation::new(op))
172 };
173
174 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
175 }
176
177 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
179 self.0.request.parent = v.into();
180 self
181 }
182
183 pub fn set_create_statement<T: Into<std::string::String>>(mut self, v: T) -> Self {
185 self.0.request.create_statement = v.into();
186 self
187 }
188
189 pub fn set_encryption_config<
191 T: Into<std::option::Option<crate::model::EncryptionConfig>>,
192 >(
193 mut self,
194 v: T,
195 ) -> Self {
196 self.0.request.encryption_config = v.into();
197 self
198 }
199
200 pub fn set_database_dialect<T: Into<crate::model::DatabaseDialect>>(
202 mut self,
203 v: T,
204 ) -> Self {
205 self.0.request.database_dialect = v.into();
206 self
207 }
208
209 pub fn set_proto_descriptors<T: Into<bytes::Bytes>>(mut self, v: T) -> Self {
211 self.0.request.proto_descriptors = v.into();
212 self
213 }
214
215 pub fn set_extra_statements<T, V>(mut self, v: T) -> Self
217 where
218 T: std::iter::IntoIterator<Item = V>,
219 V: std::convert::Into<std::string::String>,
220 {
221 use std::iter::Iterator;
222 self.0.request.extra_statements = v.into_iter().map(|i| i.into()).collect();
223 self
224 }
225 }
226
227 impl gax::options::RequestBuilder for CreateDatabase {
228 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
229 &mut self.0.options
230 }
231 }
232
233 #[derive(Clone, Debug)]
235 pub struct GetDatabase(RequestBuilder<crate::model::GetDatabaseRequest>);
236
237 impl GetDatabase {
238 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
239 Self(RequestBuilder::new(stub))
240 }
241
242 pub fn with_request<V: Into<crate::model::GetDatabaseRequest>>(mut self, v: V) -> Self {
244 self.0.request = v.into();
245 self
246 }
247
248 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
250 self.0.options = v.into();
251 self
252 }
253
254 pub async fn send(self) -> Result<crate::model::Database> {
256 (*self.0.stub)
257 .get_database(self.0.request, self.0.options)
258 .await
259 }
260
261 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
263 self.0.request.name = v.into();
264 self
265 }
266 }
267
268 impl gax::options::RequestBuilder for GetDatabase {
269 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
270 &mut self.0.options
271 }
272 }
273
274 #[derive(Clone, Debug)]
276 pub struct UpdateDatabase(RequestBuilder<crate::model::UpdateDatabaseRequest>);
277
278 impl UpdateDatabase {
279 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
280 Self(RequestBuilder::new(stub))
281 }
282
283 pub fn with_request<V: Into<crate::model::UpdateDatabaseRequest>>(mut self, v: V) -> Self {
285 self.0.request = v.into();
286 self
287 }
288
289 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
291 self.0.options = v.into();
292 self
293 }
294
295 pub async fn send(self) -> Result<longrunning::model::Operation> {
302 (*self.0.stub)
303 .update_database(self.0.request, self.0.options)
304 .await
305 }
306
307 pub fn poller(
309 self,
310 ) -> impl lro::Poller<crate::model::Database, crate::model::UpdateDatabaseMetadata>
311 {
312 type Operation =
313 lro::Operation<crate::model::Database, crate::model::UpdateDatabaseMetadata>;
314 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
315 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
316
317 let stub = self.0.stub.clone();
318 let mut options = self.0.options.clone();
319 options.set_retry_policy(gax::retry_policy::NeverRetry);
320 let query = move |name| {
321 let stub = stub.clone();
322 let options = options.clone();
323 async {
324 let op = GetOperation::new(stub)
325 .set_name(name)
326 .with_options(options)
327 .send()
328 .await?;
329 Ok(Operation::new(op))
330 }
331 };
332
333 let start = move || async {
334 let op = self.send().await?;
335 Ok(Operation::new(op))
336 };
337
338 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
339 }
340
341 pub fn set_database<T: Into<std::option::Option<crate::model::Database>>>(
343 mut self,
344 v: T,
345 ) -> Self {
346 self.0.request.database = v.into();
347 self
348 }
349
350 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
352 mut self,
353 v: T,
354 ) -> Self {
355 self.0.request.update_mask = v.into();
356 self
357 }
358 }
359
360 impl gax::options::RequestBuilder for UpdateDatabase {
361 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
362 &mut self.0.options
363 }
364 }
365
366 #[derive(Clone, Debug)]
368 pub struct UpdateDatabaseDdl(RequestBuilder<crate::model::UpdateDatabaseDdlRequest>);
369
370 impl UpdateDatabaseDdl {
371 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
372 Self(RequestBuilder::new(stub))
373 }
374
375 pub fn with_request<V: Into<crate::model::UpdateDatabaseDdlRequest>>(
377 mut self,
378 v: V,
379 ) -> Self {
380 self.0.request = v.into();
381 self
382 }
383
384 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
386 self.0.options = v.into();
387 self
388 }
389
390 pub async fn send(self) -> Result<longrunning::model::Operation> {
397 (*self.0.stub)
398 .update_database_ddl(self.0.request, self.0.options)
399 .await
400 }
401
402 pub fn poller(
404 self,
405 ) -> impl lro::Poller<wkt::Empty, crate::model::UpdateDatabaseDdlMetadata> {
406 type Operation = lro::Operation<wkt::Empty, crate::model::UpdateDatabaseDdlMetadata>;
407 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
408 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
409
410 let stub = self.0.stub.clone();
411 let mut options = self.0.options.clone();
412 options.set_retry_policy(gax::retry_policy::NeverRetry);
413 let query = move |name| {
414 let stub = stub.clone();
415 let options = options.clone();
416 async {
417 let op = GetOperation::new(stub)
418 .set_name(name)
419 .with_options(options)
420 .send()
421 .await?;
422 Ok(Operation::new(op))
423 }
424 };
425
426 let start = move || async {
427 let op = self.send().await?;
428 Ok(Operation::new(op))
429 };
430
431 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
432 }
433
434 pub fn set_database<T: Into<std::string::String>>(mut self, v: T) -> Self {
436 self.0.request.database = v.into();
437 self
438 }
439
440 pub fn set_operation_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
442 self.0.request.operation_id = v.into();
443 self
444 }
445
446 pub fn set_proto_descriptors<T: Into<bytes::Bytes>>(mut self, v: T) -> Self {
448 self.0.request.proto_descriptors = v.into();
449 self
450 }
451
452 pub fn set_statements<T, V>(mut self, v: T) -> Self
454 where
455 T: std::iter::IntoIterator<Item = V>,
456 V: std::convert::Into<std::string::String>,
457 {
458 use std::iter::Iterator;
459 self.0.request.statements = v.into_iter().map(|i| i.into()).collect();
460 self
461 }
462 }
463
464 impl gax::options::RequestBuilder for UpdateDatabaseDdl {
465 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
466 &mut self.0.options
467 }
468 }
469
470 #[derive(Clone, Debug)]
472 pub struct DropDatabase(RequestBuilder<crate::model::DropDatabaseRequest>);
473
474 impl DropDatabase {
475 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
476 Self(RequestBuilder::new(stub))
477 }
478
479 pub fn with_request<V: Into<crate::model::DropDatabaseRequest>>(mut self, v: V) -> Self {
481 self.0.request = v.into();
482 self
483 }
484
485 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
487 self.0.options = v.into();
488 self
489 }
490
491 pub async fn send(self) -> Result<wkt::Empty> {
493 (*self.0.stub)
494 .drop_database(self.0.request, self.0.options)
495 .await
496 }
497
498 pub fn set_database<T: Into<std::string::String>>(mut self, v: T) -> Self {
500 self.0.request.database = v.into();
501 self
502 }
503 }
504
505 impl gax::options::RequestBuilder for DropDatabase {
506 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
507 &mut self.0.options
508 }
509 }
510
511 #[derive(Clone, Debug)]
513 pub struct GetDatabaseDdl(RequestBuilder<crate::model::GetDatabaseDdlRequest>);
514
515 impl GetDatabaseDdl {
516 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
517 Self(RequestBuilder::new(stub))
518 }
519
520 pub fn with_request<V: Into<crate::model::GetDatabaseDdlRequest>>(mut self, v: V) -> Self {
522 self.0.request = v.into();
523 self
524 }
525
526 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
528 self.0.options = v.into();
529 self
530 }
531
532 pub async fn send(self) -> Result<crate::model::GetDatabaseDdlResponse> {
534 (*self.0.stub)
535 .get_database_ddl(self.0.request, self.0.options)
536 .await
537 }
538
539 pub fn set_database<T: Into<std::string::String>>(mut self, v: T) -> Self {
541 self.0.request.database = v.into();
542 self
543 }
544 }
545
546 impl gax::options::RequestBuilder for GetDatabaseDdl {
547 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
548 &mut self.0.options
549 }
550 }
551
552 #[derive(Clone, Debug)]
554 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
555
556 impl SetIamPolicy {
557 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
558 Self(RequestBuilder::new(stub))
559 }
560
561 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
563 self.0.request = v.into();
564 self
565 }
566
567 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
569 self.0.options = v.into();
570 self
571 }
572
573 pub async fn send(self) -> Result<iam_v1::model::Policy> {
575 (*self.0.stub)
576 .set_iam_policy(self.0.request, self.0.options)
577 .await
578 }
579
580 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
582 self.0.request.resource = v.into();
583 self
584 }
585
586 pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
588 mut self,
589 v: T,
590 ) -> Self {
591 self.0.request.policy = v.into();
592 self
593 }
594
595 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
597 mut self,
598 v: T,
599 ) -> Self {
600 self.0.request.update_mask = v.into();
601 self
602 }
603 }
604
605 impl gax::options::RequestBuilder for SetIamPolicy {
606 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
607 &mut self.0.options
608 }
609 }
610
611 #[derive(Clone, Debug)]
613 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
614
615 impl GetIamPolicy {
616 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
617 Self(RequestBuilder::new(stub))
618 }
619
620 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
622 self.0.request = v.into();
623 self
624 }
625
626 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
628 self.0.options = v.into();
629 self
630 }
631
632 pub async fn send(self) -> Result<iam_v1::model::Policy> {
634 (*self.0.stub)
635 .get_iam_policy(self.0.request, self.0.options)
636 .await
637 }
638
639 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
641 self.0.request.resource = v.into();
642 self
643 }
644
645 pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
647 mut self,
648 v: T,
649 ) -> Self {
650 self.0.request.options = v.into();
651 self
652 }
653 }
654
655 impl gax::options::RequestBuilder for GetIamPolicy {
656 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
657 &mut self.0.options
658 }
659 }
660
661 #[derive(Clone, Debug)]
663 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
664
665 impl TestIamPermissions {
666 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
667 Self(RequestBuilder::new(stub))
668 }
669
670 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
672 mut self,
673 v: V,
674 ) -> Self {
675 self.0.request = v.into();
676 self
677 }
678
679 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
681 self.0.options = v.into();
682 self
683 }
684
685 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
687 (*self.0.stub)
688 .test_iam_permissions(self.0.request, self.0.options)
689 .await
690 }
691
692 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
694 self.0.request.resource = v.into();
695 self
696 }
697
698 pub fn set_permissions<T, V>(mut self, v: T) -> Self
700 where
701 T: std::iter::IntoIterator<Item = V>,
702 V: std::convert::Into<std::string::String>,
703 {
704 use std::iter::Iterator;
705 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
706 self
707 }
708 }
709
710 impl gax::options::RequestBuilder for TestIamPermissions {
711 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
712 &mut self.0.options
713 }
714 }
715
716 #[derive(Clone, Debug)]
718 pub struct CreateBackup(RequestBuilder<crate::model::CreateBackupRequest>);
719
720 impl CreateBackup {
721 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
722 Self(RequestBuilder::new(stub))
723 }
724
725 pub fn with_request<V: Into<crate::model::CreateBackupRequest>>(mut self, v: V) -> Self {
727 self.0.request = v.into();
728 self
729 }
730
731 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
733 self.0.options = v.into();
734 self
735 }
736
737 pub async fn send(self) -> Result<longrunning::model::Operation> {
744 (*self.0.stub)
745 .create_backup(self.0.request, self.0.options)
746 .await
747 }
748
749 pub fn poller(
751 self,
752 ) -> impl lro::Poller<crate::model::Backup, crate::model::CreateBackupMetadata> {
753 type Operation =
754 lro::Operation<crate::model::Backup, crate::model::CreateBackupMetadata>;
755 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
756 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
757
758 let stub = self.0.stub.clone();
759 let mut options = self.0.options.clone();
760 options.set_retry_policy(gax::retry_policy::NeverRetry);
761 let query = move |name| {
762 let stub = stub.clone();
763 let options = options.clone();
764 async {
765 let op = GetOperation::new(stub)
766 .set_name(name)
767 .with_options(options)
768 .send()
769 .await?;
770 Ok(Operation::new(op))
771 }
772 };
773
774 let start = move || async {
775 let op = self.send().await?;
776 Ok(Operation::new(op))
777 };
778
779 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
780 }
781
782 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
784 self.0.request.parent = v.into();
785 self
786 }
787
788 pub fn set_backup_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
790 self.0.request.backup_id = v.into();
791 self
792 }
793
794 pub fn set_backup<T: Into<std::option::Option<crate::model::Backup>>>(
796 mut self,
797 v: T,
798 ) -> Self {
799 self.0.request.backup = v.into();
800 self
801 }
802
803 pub fn set_encryption_config<
805 T: Into<std::option::Option<crate::model::CreateBackupEncryptionConfig>>,
806 >(
807 mut self,
808 v: T,
809 ) -> Self {
810 self.0.request.encryption_config = v.into();
811 self
812 }
813 }
814
815 impl gax::options::RequestBuilder for CreateBackup {
816 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
817 &mut self.0.options
818 }
819 }
820
821 #[derive(Clone, Debug)]
823 pub struct CopyBackup(RequestBuilder<crate::model::CopyBackupRequest>);
824
825 impl CopyBackup {
826 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
827 Self(RequestBuilder::new(stub))
828 }
829
830 pub fn with_request<V: Into<crate::model::CopyBackupRequest>>(mut self, v: V) -> Self {
832 self.0.request = v.into();
833 self
834 }
835
836 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
838 self.0.options = v.into();
839 self
840 }
841
842 pub async fn send(self) -> Result<longrunning::model::Operation> {
849 (*self.0.stub)
850 .copy_backup(self.0.request, self.0.options)
851 .await
852 }
853
854 pub fn poller(
856 self,
857 ) -> impl lro::Poller<crate::model::Backup, crate::model::CopyBackupMetadata> {
858 type Operation = lro::Operation<crate::model::Backup, crate::model::CopyBackupMetadata>;
859 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
860 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
861
862 let stub = self.0.stub.clone();
863 let mut options = self.0.options.clone();
864 options.set_retry_policy(gax::retry_policy::NeverRetry);
865 let query = move |name| {
866 let stub = stub.clone();
867 let options = options.clone();
868 async {
869 let op = GetOperation::new(stub)
870 .set_name(name)
871 .with_options(options)
872 .send()
873 .await?;
874 Ok(Operation::new(op))
875 }
876 };
877
878 let start = move || async {
879 let op = self.send().await?;
880 Ok(Operation::new(op))
881 };
882
883 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
884 }
885
886 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
888 self.0.request.parent = v.into();
889 self
890 }
891
892 pub fn set_backup_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
894 self.0.request.backup_id = v.into();
895 self
896 }
897
898 pub fn set_source_backup<T: Into<std::string::String>>(mut self, v: T) -> Self {
900 self.0.request.source_backup = v.into();
901 self
902 }
903
904 pub fn set_expire_time<T: Into<std::option::Option<wkt::Timestamp>>>(
906 mut self,
907 v: T,
908 ) -> Self {
909 self.0.request.expire_time = v.into();
910 self
911 }
912
913 pub fn set_encryption_config<
915 T: Into<std::option::Option<crate::model::CopyBackupEncryptionConfig>>,
916 >(
917 mut self,
918 v: T,
919 ) -> Self {
920 self.0.request.encryption_config = v.into();
921 self
922 }
923 }
924
925 impl gax::options::RequestBuilder for CopyBackup {
926 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
927 &mut self.0.options
928 }
929 }
930
931 #[derive(Clone, Debug)]
933 pub struct GetBackup(RequestBuilder<crate::model::GetBackupRequest>);
934
935 impl GetBackup {
936 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
937 Self(RequestBuilder::new(stub))
938 }
939
940 pub fn with_request<V: Into<crate::model::GetBackupRequest>>(mut self, v: V) -> Self {
942 self.0.request = v.into();
943 self
944 }
945
946 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
948 self.0.options = v.into();
949 self
950 }
951
952 pub async fn send(self) -> Result<crate::model::Backup> {
954 (*self.0.stub)
955 .get_backup(self.0.request, self.0.options)
956 .await
957 }
958
959 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
961 self.0.request.name = v.into();
962 self
963 }
964 }
965
966 impl gax::options::RequestBuilder for GetBackup {
967 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
968 &mut self.0.options
969 }
970 }
971
972 #[derive(Clone, Debug)]
974 pub struct UpdateBackup(RequestBuilder<crate::model::UpdateBackupRequest>);
975
976 impl UpdateBackup {
977 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
978 Self(RequestBuilder::new(stub))
979 }
980
981 pub fn with_request<V: Into<crate::model::UpdateBackupRequest>>(mut self, v: V) -> Self {
983 self.0.request = v.into();
984 self
985 }
986
987 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
989 self.0.options = v.into();
990 self
991 }
992
993 pub async fn send(self) -> Result<crate::model::Backup> {
995 (*self.0.stub)
996 .update_backup(self.0.request, self.0.options)
997 .await
998 }
999
1000 pub fn set_backup<T: Into<std::option::Option<crate::model::Backup>>>(
1002 mut self,
1003 v: T,
1004 ) -> Self {
1005 self.0.request.backup = v.into();
1006 self
1007 }
1008
1009 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
1011 mut self,
1012 v: T,
1013 ) -> Self {
1014 self.0.request.update_mask = v.into();
1015 self
1016 }
1017 }
1018
1019 impl gax::options::RequestBuilder for UpdateBackup {
1020 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1021 &mut self.0.options
1022 }
1023 }
1024
1025 #[derive(Clone, Debug)]
1027 pub struct DeleteBackup(RequestBuilder<crate::model::DeleteBackupRequest>);
1028
1029 impl DeleteBackup {
1030 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
1031 Self(RequestBuilder::new(stub))
1032 }
1033
1034 pub fn with_request<V: Into<crate::model::DeleteBackupRequest>>(mut self, v: V) -> Self {
1036 self.0.request = v.into();
1037 self
1038 }
1039
1040 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1042 self.0.options = v.into();
1043 self
1044 }
1045
1046 pub async fn send(self) -> Result<wkt::Empty> {
1048 (*self.0.stub)
1049 .delete_backup(self.0.request, self.0.options)
1050 .await
1051 }
1052
1053 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1055 self.0.request.name = v.into();
1056 self
1057 }
1058 }
1059
1060 impl gax::options::RequestBuilder for DeleteBackup {
1061 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1062 &mut self.0.options
1063 }
1064 }
1065
1066 #[derive(Clone, Debug)]
1068 pub struct ListBackups(RequestBuilder<crate::model::ListBackupsRequest>);
1069
1070 impl ListBackups {
1071 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
1072 Self(RequestBuilder::new(stub))
1073 }
1074
1075 pub fn with_request<V: Into<crate::model::ListBackupsRequest>>(mut self, v: V) -> Self {
1077 self.0.request = v.into();
1078 self
1079 }
1080
1081 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1083 self.0.options = v.into();
1084 self
1085 }
1086
1087 pub async fn send(self) -> Result<crate::model::ListBackupsResponse> {
1089 (*self.0.stub)
1090 .list_backups(self.0.request, self.0.options)
1091 .await
1092 }
1093
1094 #[cfg(feature = "unstable-stream")]
1096 pub async fn stream(
1097 self,
1098 ) -> gax::paginator::Paginator<crate::model::ListBackupsResponse, gax::error::Error>
1099 {
1100 let token = gax::paginator::extract_token(&self.0.request.page_token);
1101 let execute = move |token: String| {
1102 let mut builder = self.clone();
1103 builder.0.request = builder.0.request.set_page_token(token);
1104 builder.send()
1105 };
1106 gax::paginator::Paginator::new(token, execute)
1107 }
1108
1109 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1111 self.0.request.parent = v.into();
1112 self
1113 }
1114
1115 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1117 self.0.request.filter = v.into();
1118 self
1119 }
1120
1121 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1123 self.0.request.page_size = v.into();
1124 self
1125 }
1126
1127 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1129 self.0.request.page_token = v.into();
1130 self
1131 }
1132 }
1133
1134 impl gax::options::RequestBuilder for ListBackups {
1135 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1136 &mut self.0.options
1137 }
1138 }
1139
1140 #[derive(Clone, Debug)]
1142 pub struct RestoreDatabase(RequestBuilder<crate::model::RestoreDatabaseRequest>);
1143
1144 impl RestoreDatabase {
1145 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
1146 Self(RequestBuilder::new(stub))
1147 }
1148
1149 pub fn with_request<V: Into<crate::model::RestoreDatabaseRequest>>(mut self, v: V) -> Self {
1151 self.0.request = v.into();
1152 self
1153 }
1154
1155 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1157 self.0.options = v.into();
1158 self
1159 }
1160
1161 pub async fn send(self) -> Result<longrunning::model::Operation> {
1168 (*self.0.stub)
1169 .restore_database(self.0.request, self.0.options)
1170 .await
1171 }
1172
1173 pub fn poller(
1175 self,
1176 ) -> impl lro::Poller<crate::model::Database, crate::model::RestoreDatabaseMetadata>
1177 {
1178 type Operation =
1179 lro::Operation<crate::model::Database, crate::model::RestoreDatabaseMetadata>;
1180 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
1181 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1182
1183 let stub = self.0.stub.clone();
1184 let mut options = self.0.options.clone();
1185 options.set_retry_policy(gax::retry_policy::NeverRetry);
1186 let query = move |name| {
1187 let stub = stub.clone();
1188 let options = options.clone();
1189 async {
1190 let op = GetOperation::new(stub)
1191 .set_name(name)
1192 .with_options(options)
1193 .send()
1194 .await?;
1195 Ok(Operation::new(op))
1196 }
1197 };
1198
1199 let start = move || async {
1200 let op = self.send().await?;
1201 Ok(Operation::new(op))
1202 };
1203
1204 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
1205 }
1206
1207 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1209 self.0.request.parent = v.into();
1210 self
1211 }
1212
1213 pub fn set_database_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1215 self.0.request.database_id = v.into();
1216 self
1217 }
1218
1219 pub fn set_encryption_config<
1221 T: Into<std::option::Option<crate::model::RestoreDatabaseEncryptionConfig>>,
1222 >(
1223 mut self,
1224 v: T,
1225 ) -> Self {
1226 self.0.request.encryption_config = v.into();
1227 self
1228 }
1229
1230 pub fn set_source<T: Into<Option<crate::model::restore_database_request::Source>>>(
1232 mut self,
1233 v: T,
1234 ) -> Self {
1235 self.0.request.source = v.into();
1236 self
1237 }
1238 }
1239
1240 impl gax::options::RequestBuilder for RestoreDatabase {
1241 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1242 &mut self.0.options
1243 }
1244 }
1245
1246 #[derive(Clone, Debug)]
1248 pub struct ListDatabaseOperations(RequestBuilder<crate::model::ListDatabaseOperationsRequest>);
1249
1250 impl ListDatabaseOperations {
1251 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
1252 Self(RequestBuilder::new(stub))
1253 }
1254
1255 pub fn with_request<V: Into<crate::model::ListDatabaseOperationsRequest>>(
1257 mut self,
1258 v: V,
1259 ) -> Self {
1260 self.0.request = v.into();
1261 self
1262 }
1263
1264 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1266 self.0.options = v.into();
1267 self
1268 }
1269
1270 pub async fn send(self) -> Result<crate::model::ListDatabaseOperationsResponse> {
1272 (*self.0.stub)
1273 .list_database_operations(self.0.request, self.0.options)
1274 .await
1275 }
1276
1277 #[cfg(feature = "unstable-stream")]
1279 pub async fn stream(
1280 self,
1281 ) -> gax::paginator::Paginator<
1282 crate::model::ListDatabaseOperationsResponse,
1283 gax::error::Error,
1284 > {
1285 let token = gax::paginator::extract_token(&self.0.request.page_token);
1286 let execute = move |token: String| {
1287 let mut builder = self.clone();
1288 builder.0.request = builder.0.request.set_page_token(token);
1289 builder.send()
1290 };
1291 gax::paginator::Paginator::new(token, execute)
1292 }
1293
1294 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1296 self.0.request.parent = v.into();
1297 self
1298 }
1299
1300 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1302 self.0.request.filter = v.into();
1303 self
1304 }
1305
1306 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1308 self.0.request.page_size = v.into();
1309 self
1310 }
1311
1312 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1314 self.0.request.page_token = v.into();
1315 self
1316 }
1317 }
1318
1319 impl gax::options::RequestBuilder for ListDatabaseOperations {
1320 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1321 &mut self.0.options
1322 }
1323 }
1324
1325 #[derive(Clone, Debug)]
1327 pub struct ListBackupOperations(RequestBuilder<crate::model::ListBackupOperationsRequest>);
1328
1329 impl ListBackupOperations {
1330 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
1331 Self(RequestBuilder::new(stub))
1332 }
1333
1334 pub fn with_request<V: Into<crate::model::ListBackupOperationsRequest>>(
1336 mut self,
1337 v: V,
1338 ) -> Self {
1339 self.0.request = v.into();
1340 self
1341 }
1342
1343 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1345 self.0.options = v.into();
1346 self
1347 }
1348
1349 pub async fn send(self) -> Result<crate::model::ListBackupOperationsResponse> {
1351 (*self.0.stub)
1352 .list_backup_operations(self.0.request, self.0.options)
1353 .await
1354 }
1355
1356 #[cfg(feature = "unstable-stream")]
1358 pub async fn stream(
1359 self,
1360 ) -> gax::paginator::Paginator<crate::model::ListBackupOperationsResponse, gax::error::Error>
1361 {
1362 let token = gax::paginator::extract_token(&self.0.request.page_token);
1363 let execute = move |token: String| {
1364 let mut builder = self.clone();
1365 builder.0.request = builder.0.request.set_page_token(token);
1366 builder.send()
1367 };
1368 gax::paginator::Paginator::new(token, execute)
1369 }
1370
1371 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1373 self.0.request.parent = v.into();
1374 self
1375 }
1376
1377 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1379 self.0.request.filter = v.into();
1380 self
1381 }
1382
1383 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1385 self.0.request.page_size = v.into();
1386 self
1387 }
1388
1389 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1391 self.0.request.page_token = v.into();
1392 self
1393 }
1394 }
1395
1396 impl gax::options::RequestBuilder for ListBackupOperations {
1397 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1398 &mut self.0.options
1399 }
1400 }
1401
1402 #[derive(Clone, Debug)]
1404 pub struct ListDatabaseRoles(RequestBuilder<crate::model::ListDatabaseRolesRequest>);
1405
1406 impl ListDatabaseRoles {
1407 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
1408 Self(RequestBuilder::new(stub))
1409 }
1410
1411 pub fn with_request<V: Into<crate::model::ListDatabaseRolesRequest>>(
1413 mut self,
1414 v: V,
1415 ) -> Self {
1416 self.0.request = v.into();
1417 self
1418 }
1419
1420 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1422 self.0.options = v.into();
1423 self
1424 }
1425
1426 pub async fn send(self) -> Result<crate::model::ListDatabaseRolesResponse> {
1428 (*self.0.stub)
1429 .list_database_roles(self.0.request, self.0.options)
1430 .await
1431 }
1432
1433 #[cfg(feature = "unstable-stream")]
1435 pub async fn stream(
1436 self,
1437 ) -> gax::paginator::Paginator<crate::model::ListDatabaseRolesResponse, gax::error::Error>
1438 {
1439 let token = gax::paginator::extract_token(&self.0.request.page_token);
1440 let execute = move |token: String| {
1441 let mut builder = self.clone();
1442 builder.0.request = builder.0.request.set_page_token(token);
1443 builder.send()
1444 };
1445 gax::paginator::Paginator::new(token, execute)
1446 }
1447
1448 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1450 self.0.request.parent = v.into();
1451 self
1452 }
1453
1454 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1456 self.0.request.page_size = v.into();
1457 self
1458 }
1459
1460 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1462 self.0.request.page_token = v.into();
1463 self
1464 }
1465 }
1466
1467 impl gax::options::RequestBuilder for ListDatabaseRoles {
1468 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1469 &mut self.0.options
1470 }
1471 }
1472
1473 #[derive(Clone, Debug)]
1475 pub struct AddSplitPoints(RequestBuilder<crate::model::AddSplitPointsRequest>);
1476
1477 impl AddSplitPoints {
1478 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
1479 Self(RequestBuilder::new(stub))
1480 }
1481
1482 pub fn with_request<V: Into<crate::model::AddSplitPointsRequest>>(mut self, v: V) -> Self {
1484 self.0.request = v.into();
1485 self
1486 }
1487
1488 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1490 self.0.options = v.into();
1491 self
1492 }
1493
1494 pub async fn send(self) -> Result<crate::model::AddSplitPointsResponse> {
1496 (*self.0.stub)
1497 .add_split_points(self.0.request, self.0.options)
1498 .await
1499 }
1500
1501 pub fn set_database<T: Into<std::string::String>>(mut self, v: T) -> Self {
1503 self.0.request.database = v.into();
1504 self
1505 }
1506
1507 pub fn set_initiator<T: Into<std::string::String>>(mut self, v: T) -> Self {
1509 self.0.request.initiator = v.into();
1510 self
1511 }
1512
1513 pub fn set_split_points<T, V>(mut self, v: T) -> Self
1515 where
1516 T: std::iter::IntoIterator<Item = V>,
1517 V: std::convert::Into<crate::model::SplitPoints>,
1518 {
1519 use std::iter::Iterator;
1520 self.0.request.split_points = v.into_iter().map(|i| i.into()).collect();
1521 self
1522 }
1523 }
1524
1525 impl gax::options::RequestBuilder for AddSplitPoints {
1526 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1527 &mut self.0.options
1528 }
1529 }
1530
1531 #[derive(Clone, Debug)]
1533 pub struct CreateBackupSchedule(RequestBuilder<crate::model::CreateBackupScheduleRequest>);
1534
1535 impl CreateBackupSchedule {
1536 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
1537 Self(RequestBuilder::new(stub))
1538 }
1539
1540 pub fn with_request<V: Into<crate::model::CreateBackupScheduleRequest>>(
1542 mut self,
1543 v: V,
1544 ) -> Self {
1545 self.0.request = v.into();
1546 self
1547 }
1548
1549 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1551 self.0.options = v.into();
1552 self
1553 }
1554
1555 pub async fn send(self) -> Result<crate::model::BackupSchedule> {
1557 (*self.0.stub)
1558 .create_backup_schedule(self.0.request, self.0.options)
1559 .await
1560 }
1561
1562 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1564 self.0.request.parent = v.into();
1565 self
1566 }
1567
1568 pub fn set_backup_schedule_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1570 self.0.request.backup_schedule_id = v.into();
1571 self
1572 }
1573
1574 pub fn set_backup_schedule<T: Into<std::option::Option<crate::model::BackupSchedule>>>(
1576 mut self,
1577 v: T,
1578 ) -> Self {
1579 self.0.request.backup_schedule = v.into();
1580 self
1581 }
1582 }
1583
1584 impl gax::options::RequestBuilder for CreateBackupSchedule {
1585 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1586 &mut self.0.options
1587 }
1588 }
1589
1590 #[derive(Clone, Debug)]
1592 pub struct GetBackupSchedule(RequestBuilder<crate::model::GetBackupScheduleRequest>);
1593
1594 impl GetBackupSchedule {
1595 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
1596 Self(RequestBuilder::new(stub))
1597 }
1598
1599 pub fn with_request<V: Into<crate::model::GetBackupScheduleRequest>>(
1601 mut self,
1602 v: V,
1603 ) -> Self {
1604 self.0.request = v.into();
1605 self
1606 }
1607
1608 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1610 self.0.options = v.into();
1611 self
1612 }
1613
1614 pub async fn send(self) -> Result<crate::model::BackupSchedule> {
1616 (*self.0.stub)
1617 .get_backup_schedule(self.0.request, self.0.options)
1618 .await
1619 }
1620
1621 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1623 self.0.request.name = v.into();
1624 self
1625 }
1626 }
1627
1628 impl gax::options::RequestBuilder for GetBackupSchedule {
1629 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1630 &mut self.0.options
1631 }
1632 }
1633
1634 #[derive(Clone, Debug)]
1636 pub struct UpdateBackupSchedule(RequestBuilder<crate::model::UpdateBackupScheduleRequest>);
1637
1638 impl UpdateBackupSchedule {
1639 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
1640 Self(RequestBuilder::new(stub))
1641 }
1642
1643 pub fn with_request<V: Into<crate::model::UpdateBackupScheduleRequest>>(
1645 mut self,
1646 v: V,
1647 ) -> Self {
1648 self.0.request = v.into();
1649 self
1650 }
1651
1652 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1654 self.0.options = v.into();
1655 self
1656 }
1657
1658 pub async fn send(self) -> Result<crate::model::BackupSchedule> {
1660 (*self.0.stub)
1661 .update_backup_schedule(self.0.request, self.0.options)
1662 .await
1663 }
1664
1665 pub fn set_backup_schedule<T: Into<std::option::Option<crate::model::BackupSchedule>>>(
1667 mut self,
1668 v: T,
1669 ) -> Self {
1670 self.0.request.backup_schedule = v.into();
1671 self
1672 }
1673
1674 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
1676 mut self,
1677 v: T,
1678 ) -> Self {
1679 self.0.request.update_mask = v.into();
1680 self
1681 }
1682 }
1683
1684 impl gax::options::RequestBuilder for UpdateBackupSchedule {
1685 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1686 &mut self.0.options
1687 }
1688 }
1689
1690 #[derive(Clone, Debug)]
1692 pub struct DeleteBackupSchedule(RequestBuilder<crate::model::DeleteBackupScheduleRequest>);
1693
1694 impl DeleteBackupSchedule {
1695 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
1696 Self(RequestBuilder::new(stub))
1697 }
1698
1699 pub fn with_request<V: Into<crate::model::DeleteBackupScheduleRequest>>(
1701 mut self,
1702 v: V,
1703 ) -> Self {
1704 self.0.request = v.into();
1705 self
1706 }
1707
1708 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1710 self.0.options = v.into();
1711 self
1712 }
1713
1714 pub async fn send(self) -> Result<wkt::Empty> {
1716 (*self.0.stub)
1717 .delete_backup_schedule(self.0.request, self.0.options)
1718 .await
1719 }
1720
1721 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1723 self.0.request.name = v.into();
1724 self
1725 }
1726 }
1727
1728 impl gax::options::RequestBuilder for DeleteBackupSchedule {
1729 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1730 &mut self.0.options
1731 }
1732 }
1733
1734 #[derive(Clone, Debug)]
1736 pub struct ListBackupSchedules(RequestBuilder<crate::model::ListBackupSchedulesRequest>);
1737
1738 impl ListBackupSchedules {
1739 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
1740 Self(RequestBuilder::new(stub))
1741 }
1742
1743 pub fn with_request<V: Into<crate::model::ListBackupSchedulesRequest>>(
1745 mut self,
1746 v: V,
1747 ) -> Self {
1748 self.0.request = v.into();
1749 self
1750 }
1751
1752 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1754 self.0.options = v.into();
1755 self
1756 }
1757
1758 pub async fn send(self) -> Result<crate::model::ListBackupSchedulesResponse> {
1760 (*self.0.stub)
1761 .list_backup_schedules(self.0.request, self.0.options)
1762 .await
1763 }
1764
1765 #[cfg(feature = "unstable-stream")]
1767 pub async fn stream(
1768 self,
1769 ) -> gax::paginator::Paginator<crate::model::ListBackupSchedulesResponse, gax::error::Error>
1770 {
1771 let token = gax::paginator::extract_token(&self.0.request.page_token);
1772 let execute = move |token: String| {
1773 let mut builder = self.clone();
1774 builder.0.request = builder.0.request.set_page_token(token);
1775 builder.send()
1776 };
1777 gax::paginator::Paginator::new(token, execute)
1778 }
1779
1780 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1782 self.0.request.parent = v.into();
1783 self
1784 }
1785
1786 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1788 self.0.request.page_size = v.into();
1789 self
1790 }
1791
1792 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1794 self.0.request.page_token = v.into();
1795 self
1796 }
1797 }
1798
1799 impl gax::options::RequestBuilder for ListBackupSchedules {
1800 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1801 &mut self.0.options
1802 }
1803 }
1804
1805 #[derive(Clone, Debug)]
1807 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1808
1809 impl ListOperations {
1810 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
1811 Self(RequestBuilder::new(stub))
1812 }
1813
1814 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1816 mut self,
1817 v: V,
1818 ) -> Self {
1819 self.0.request = v.into();
1820 self
1821 }
1822
1823 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1825 self.0.options = v.into();
1826 self
1827 }
1828
1829 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1831 (*self.0.stub)
1832 .list_operations(self.0.request, self.0.options)
1833 .await
1834 }
1835
1836 #[cfg(feature = "unstable-stream")]
1838 pub async fn stream(
1839 self,
1840 ) -> gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1841 {
1842 let token = gax::paginator::extract_token(&self.0.request.page_token);
1843 let execute = move |token: String| {
1844 let mut builder = self.clone();
1845 builder.0.request = builder.0.request.set_page_token(token);
1846 builder.send()
1847 };
1848 gax::paginator::Paginator::new(token, execute)
1849 }
1850
1851 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1853 self.0.request.name = v.into();
1854 self
1855 }
1856
1857 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1859 self.0.request.filter = v.into();
1860 self
1861 }
1862
1863 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1865 self.0.request.page_size = v.into();
1866 self
1867 }
1868
1869 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1871 self.0.request.page_token = v.into();
1872 self
1873 }
1874 }
1875
1876 impl gax::options::RequestBuilder for ListOperations {
1877 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1878 &mut self.0.options
1879 }
1880 }
1881
1882 #[derive(Clone, Debug)]
1884 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1885
1886 impl GetOperation {
1887 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
1888 Self(RequestBuilder::new(stub))
1889 }
1890
1891 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1893 mut self,
1894 v: V,
1895 ) -> Self {
1896 self.0.request = v.into();
1897 self
1898 }
1899
1900 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1902 self.0.options = v.into();
1903 self
1904 }
1905
1906 pub async fn send(self) -> Result<longrunning::model::Operation> {
1908 (*self.0.stub)
1909 .get_operation(self.0.request, self.0.options)
1910 .await
1911 }
1912
1913 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1915 self.0.request.name = v.into();
1916 self
1917 }
1918 }
1919
1920 impl gax::options::RequestBuilder for GetOperation {
1921 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1922 &mut self.0.options
1923 }
1924 }
1925
1926 #[derive(Clone, Debug)]
1928 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1929
1930 impl DeleteOperation {
1931 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
1932 Self(RequestBuilder::new(stub))
1933 }
1934
1935 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1937 mut self,
1938 v: V,
1939 ) -> Self {
1940 self.0.request = v.into();
1941 self
1942 }
1943
1944 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1946 self.0.options = v.into();
1947 self
1948 }
1949
1950 pub async fn send(self) -> Result<wkt::Empty> {
1952 (*self.0.stub)
1953 .delete_operation(self.0.request, self.0.options)
1954 .await
1955 }
1956
1957 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1959 self.0.request.name = v.into();
1960 self
1961 }
1962 }
1963
1964 impl gax::options::RequestBuilder for DeleteOperation {
1965 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1966 &mut self.0.options
1967 }
1968 }
1969
1970 #[derive(Clone, Debug)]
1972 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1973
1974 impl CancelOperation {
1975 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatabaseAdmin>) -> Self {
1976 Self(RequestBuilder::new(stub))
1977 }
1978
1979 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1981 mut self,
1982 v: V,
1983 ) -> Self {
1984 self.0.request = v.into();
1985 self
1986 }
1987
1988 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1990 self.0.options = v.into();
1991 self
1992 }
1993
1994 pub async fn send(self) -> Result<wkt::Empty> {
1996 (*self.0.stub)
1997 .cancel_operation(self.0.request, self.0.options)
1998 .await
1999 }
2000
2001 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2003 self.0.request.name = v.into();
2004 self
2005 }
2006 }
2007
2008 impl gax::options::RequestBuilder for CancelOperation {
2009 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2010 &mut self.0.options
2011 }
2012 }
2013}