1pub mod database_admin {
18 use crate::Result;
19 use std::sync::Arc;
20
21 pub type ClientBuilder =
35 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
36
37 pub(crate) mod client {
38 use super::super::super::client::DatabaseAdmin;
39 pub struct Factory;
40 impl gax::client_builder::internal::ClientFactory for Factory {
41 type Client = DatabaseAdmin;
42 type Credentials = gaxi::options::Credentials;
43 async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
44 Self::Client::new(config).await
45 }
46 }
47 }
48
49 #[derive(Clone, Debug)]
51 pub(crate) struct RequestBuilder<R: std::default::Default> {
52 stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
53 request: R,
54 options: gax::options::RequestOptions,
55 }
56
57 impl<R> RequestBuilder<R>
58 where
59 R: std::default::Default,
60 {
61 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
62 Self {
63 stub,
64 request: R::default(),
65 options: gax::options::RequestOptions::default(),
66 }
67 }
68 }
69
70 #[derive(Clone, Debug)]
72 pub struct ListDatabases(RequestBuilder<crate::model::ListDatabasesRequest>);
73
74 impl ListDatabases {
75 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
76 Self(RequestBuilder::new(stub))
77 }
78
79 pub fn with_request<V: Into<crate::model::ListDatabasesRequest>>(mut self, v: V) -> Self {
81 self.0.request = v.into();
82 self
83 }
84
85 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
87 self.0.options = v.into();
88 self
89 }
90
91 pub async fn send(self) -> Result<crate::model::ListDatabasesResponse> {
93 (*self.0.stub)
94 .list_databases(self.0.request, self.0.options)
95 .await
96 .map(gax::response::Response::into_body)
97 }
98
99 pub async fn paginator(
101 self,
102 ) -> impl gax::paginator::Paginator<crate::model::ListDatabasesResponse, gax::error::Error>
103 {
104 use std::clone::Clone;
105 let token = self.0.request.page_token.clone();
106 let execute = move |token: String| {
107 let mut builder = self.clone();
108 builder.0.request = builder.0.request.set_page_token(token);
109 builder.send()
110 };
111 gax::paginator::internal::new_paginator(token, execute)
112 }
113
114 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
116 self.0.request.parent = v.into();
117 self
118 }
119
120 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
122 self.0.request.page_size = v.into();
123 self
124 }
125
126 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
128 self.0.request.page_token = v.into();
129 self
130 }
131 }
132
133 #[doc(hidden)]
134 impl gax::options::internal::RequestBuilder for ListDatabases {
135 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
136 &mut self.0.options
137 }
138 }
139
140 #[derive(Clone, Debug)]
142 pub struct CreateDatabase(RequestBuilder<crate::model::CreateDatabaseRequest>);
143
144 impl CreateDatabase {
145 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
146 Self(RequestBuilder::new(stub))
147 }
148
149 pub fn with_request<V: Into<crate::model::CreateDatabaseRequest>>(mut self, v: V) -> Self {
151 self.0.request = v.into();
152 self
153 }
154
155 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
157 self.0.options = v.into();
158 self
159 }
160
161 pub async fn send(self) -> Result<longrunning::model::Operation> {
168 (*self.0.stub)
169 .create_database(self.0.request, self.0.options)
170 .await
171 .map(gax::response::Response::into_body)
172 }
173
174 pub fn poller(
176 self,
177 ) -> impl lro::Poller<crate::model::Database, crate::model::CreateDatabaseMetadata>
178 {
179 type Operation =
180 lro::Operation<crate::model::Database, crate::model::CreateDatabaseMetadata>;
181 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
182 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
183
184 let stub = self.0.stub.clone();
185 let mut options = self.0.options.clone();
186 options.set_retry_policy(gax::retry_policy::NeverRetry);
187 let query = move |name| {
188 let stub = stub.clone();
189 let options = options.clone();
190 async {
191 let op = GetOperation::new(stub)
192 .set_name(name)
193 .with_options(options)
194 .send()
195 .await?;
196 Ok(Operation::new(op))
197 }
198 };
199
200 let start = move || async {
201 let op = self.send().await?;
202 Ok(Operation::new(op))
203 };
204
205 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
206 }
207
208 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
210 self.0.request.parent = v.into();
211 self
212 }
213
214 pub fn set_create_statement<T: Into<std::string::String>>(mut self, v: T) -> Self {
216 self.0.request.create_statement = v.into();
217 self
218 }
219
220 pub fn set_encryption_config<
222 T: Into<std::option::Option<crate::model::EncryptionConfig>>,
223 >(
224 mut self,
225 v: T,
226 ) -> Self {
227 self.0.request.encryption_config = v.into();
228 self
229 }
230
231 pub fn set_database_dialect<T: Into<crate::model::DatabaseDialect>>(
233 mut self,
234 v: T,
235 ) -> Self {
236 self.0.request.database_dialect = v.into();
237 self
238 }
239
240 pub fn set_proto_descriptors<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
242 self.0.request.proto_descriptors = v.into();
243 self
244 }
245
246 pub fn set_extra_statements<T, V>(mut self, v: T) -> Self
248 where
249 T: std::iter::IntoIterator<Item = V>,
250 V: std::convert::Into<std::string::String>,
251 {
252 use std::iter::Iterator;
253 self.0.request.extra_statements = v.into_iter().map(|i| i.into()).collect();
254 self
255 }
256 }
257
258 #[doc(hidden)]
259 impl gax::options::internal::RequestBuilder for CreateDatabase {
260 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
261 &mut self.0.options
262 }
263 }
264
265 #[derive(Clone, Debug)]
267 pub struct GetDatabase(RequestBuilder<crate::model::GetDatabaseRequest>);
268
269 impl GetDatabase {
270 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
271 Self(RequestBuilder::new(stub))
272 }
273
274 pub fn with_request<V: Into<crate::model::GetDatabaseRequest>>(mut self, v: V) -> Self {
276 self.0.request = v.into();
277 self
278 }
279
280 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
282 self.0.options = v.into();
283 self
284 }
285
286 pub async fn send(self) -> Result<crate::model::Database> {
288 (*self.0.stub)
289 .get_database(self.0.request, self.0.options)
290 .await
291 .map(gax::response::Response::into_body)
292 }
293
294 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
296 self.0.request.name = v.into();
297 self
298 }
299 }
300
301 #[doc(hidden)]
302 impl gax::options::internal::RequestBuilder for GetDatabase {
303 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
304 &mut self.0.options
305 }
306 }
307
308 #[derive(Clone, Debug)]
310 pub struct UpdateDatabase(RequestBuilder<crate::model::UpdateDatabaseRequest>);
311
312 impl UpdateDatabase {
313 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
314 Self(RequestBuilder::new(stub))
315 }
316
317 pub fn with_request<V: Into<crate::model::UpdateDatabaseRequest>>(mut self, v: V) -> Self {
319 self.0.request = v.into();
320 self
321 }
322
323 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
325 self.0.options = v.into();
326 self
327 }
328
329 pub async fn send(self) -> Result<longrunning::model::Operation> {
336 (*self.0.stub)
337 .update_database(self.0.request, self.0.options)
338 .await
339 .map(gax::response::Response::into_body)
340 }
341
342 pub fn poller(
344 self,
345 ) -> impl lro::Poller<crate::model::Database, crate::model::UpdateDatabaseMetadata>
346 {
347 type Operation =
348 lro::Operation<crate::model::Database, crate::model::UpdateDatabaseMetadata>;
349 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
350 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
351
352 let stub = self.0.stub.clone();
353 let mut options = self.0.options.clone();
354 options.set_retry_policy(gax::retry_policy::NeverRetry);
355 let query = move |name| {
356 let stub = stub.clone();
357 let options = options.clone();
358 async {
359 let op = GetOperation::new(stub)
360 .set_name(name)
361 .with_options(options)
362 .send()
363 .await?;
364 Ok(Operation::new(op))
365 }
366 };
367
368 let start = move || async {
369 let op = self.send().await?;
370 Ok(Operation::new(op))
371 };
372
373 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
374 }
375
376 pub fn set_database<T: Into<std::option::Option<crate::model::Database>>>(
378 mut self,
379 v: T,
380 ) -> Self {
381 self.0.request.database = v.into();
382 self
383 }
384
385 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
387 mut self,
388 v: T,
389 ) -> Self {
390 self.0.request.update_mask = v.into();
391 self
392 }
393 }
394
395 #[doc(hidden)]
396 impl gax::options::internal::RequestBuilder for UpdateDatabase {
397 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
398 &mut self.0.options
399 }
400 }
401
402 #[derive(Clone, Debug)]
404 pub struct UpdateDatabaseDdl(RequestBuilder<crate::model::UpdateDatabaseDdlRequest>);
405
406 impl UpdateDatabaseDdl {
407 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
408 Self(RequestBuilder::new(stub))
409 }
410
411 pub fn with_request<V: Into<crate::model::UpdateDatabaseDdlRequest>>(
413 mut self,
414 v: V,
415 ) -> Self {
416 self.0.request = v.into();
417 self
418 }
419
420 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
422 self.0.options = v.into();
423 self
424 }
425
426 pub async fn send(self) -> Result<longrunning::model::Operation> {
433 (*self.0.stub)
434 .update_database_ddl(self.0.request, self.0.options)
435 .await
436 .map(gax::response::Response::into_body)
437 }
438
439 pub fn poller(
441 self,
442 ) -> impl lro::Poller<wkt::Empty, crate::model::UpdateDatabaseDdlMetadata> {
443 type Operation = lro::Operation<wkt::Empty, crate::model::UpdateDatabaseDdlMetadata>;
444 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
445 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
446
447 let stub = self.0.stub.clone();
448 let mut options = self.0.options.clone();
449 options.set_retry_policy(gax::retry_policy::NeverRetry);
450 let query = move |name| {
451 let stub = stub.clone();
452 let options = options.clone();
453 async {
454 let op = GetOperation::new(stub)
455 .set_name(name)
456 .with_options(options)
457 .send()
458 .await?;
459 Ok(Operation::new(op))
460 }
461 };
462
463 let start = move || async {
464 let op = self.send().await?;
465 Ok(Operation::new(op))
466 };
467
468 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
469 }
470
471 pub fn set_database<T: Into<std::string::String>>(mut self, v: T) -> Self {
473 self.0.request.database = v.into();
474 self
475 }
476
477 pub fn set_operation_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
479 self.0.request.operation_id = v.into();
480 self
481 }
482
483 pub fn set_proto_descriptors<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
485 self.0.request.proto_descriptors = v.into();
486 self
487 }
488
489 pub fn set_statements<T, V>(mut self, v: T) -> Self
491 where
492 T: std::iter::IntoIterator<Item = V>,
493 V: std::convert::Into<std::string::String>,
494 {
495 use std::iter::Iterator;
496 self.0.request.statements = v.into_iter().map(|i| i.into()).collect();
497 self
498 }
499 }
500
501 #[doc(hidden)]
502 impl gax::options::internal::RequestBuilder for UpdateDatabaseDdl {
503 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
504 &mut self.0.options
505 }
506 }
507
508 #[derive(Clone, Debug)]
510 pub struct DropDatabase(RequestBuilder<crate::model::DropDatabaseRequest>);
511
512 impl DropDatabase {
513 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
514 Self(RequestBuilder::new(stub))
515 }
516
517 pub fn with_request<V: Into<crate::model::DropDatabaseRequest>>(mut self, v: V) -> Self {
519 self.0.request = v.into();
520 self
521 }
522
523 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
525 self.0.options = v.into();
526 self
527 }
528
529 pub async fn send(self) -> Result<()> {
531 (*self.0.stub)
532 .drop_database(self.0.request, self.0.options)
533 .await
534 .map(gax::response::Response::into_body)
535 }
536
537 pub fn set_database<T: Into<std::string::String>>(mut self, v: T) -> Self {
539 self.0.request.database = v.into();
540 self
541 }
542 }
543
544 #[doc(hidden)]
545 impl gax::options::internal::RequestBuilder for DropDatabase {
546 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
547 &mut self.0.options
548 }
549 }
550
551 #[derive(Clone, Debug)]
553 pub struct GetDatabaseDdl(RequestBuilder<crate::model::GetDatabaseDdlRequest>);
554
555 impl GetDatabaseDdl {
556 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
557 Self(RequestBuilder::new(stub))
558 }
559
560 pub fn with_request<V: Into<crate::model::GetDatabaseDdlRequest>>(mut self, v: V) -> Self {
562 self.0.request = v.into();
563 self
564 }
565
566 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
568 self.0.options = v.into();
569 self
570 }
571
572 pub async fn send(self) -> Result<crate::model::GetDatabaseDdlResponse> {
574 (*self.0.stub)
575 .get_database_ddl(self.0.request, self.0.options)
576 .await
577 .map(gax::response::Response::into_body)
578 }
579
580 pub fn set_database<T: Into<std::string::String>>(mut self, v: T) -> Self {
582 self.0.request.database = v.into();
583 self
584 }
585 }
586
587 #[doc(hidden)]
588 impl gax::options::internal::RequestBuilder for GetDatabaseDdl {
589 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
590 &mut self.0.options
591 }
592 }
593
594 #[derive(Clone, Debug)]
596 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
597
598 impl SetIamPolicy {
599 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
600 Self(RequestBuilder::new(stub))
601 }
602
603 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
605 self.0.request = v.into();
606 self
607 }
608
609 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
611 self.0.options = v.into();
612 self
613 }
614
615 pub async fn send(self) -> Result<iam_v1::model::Policy> {
617 (*self.0.stub)
618 .set_iam_policy(self.0.request, self.0.options)
619 .await
620 .map(gax::response::Response::into_body)
621 }
622
623 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
625 self.0.request.resource = v.into();
626 self
627 }
628
629 pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
631 mut self,
632 v: T,
633 ) -> Self {
634 self.0.request.policy = v.into();
635 self
636 }
637
638 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
640 mut self,
641 v: T,
642 ) -> Self {
643 self.0.request.update_mask = v.into();
644 self
645 }
646 }
647
648 #[doc(hidden)]
649 impl gax::options::internal::RequestBuilder for SetIamPolicy {
650 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
651 &mut self.0.options
652 }
653 }
654
655 #[derive(Clone, Debug)]
657 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
658
659 impl GetIamPolicy {
660 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
661 Self(RequestBuilder::new(stub))
662 }
663
664 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
666 self.0.request = v.into();
667 self
668 }
669
670 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
672 self.0.options = v.into();
673 self
674 }
675
676 pub async fn send(self) -> Result<iam_v1::model::Policy> {
678 (*self.0.stub)
679 .get_iam_policy(self.0.request, self.0.options)
680 .await
681 .map(gax::response::Response::into_body)
682 }
683
684 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
686 self.0.request.resource = v.into();
687 self
688 }
689
690 pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
692 mut self,
693 v: T,
694 ) -> Self {
695 self.0.request.options = v.into();
696 self
697 }
698 }
699
700 #[doc(hidden)]
701 impl gax::options::internal::RequestBuilder for GetIamPolicy {
702 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
703 &mut self.0.options
704 }
705 }
706
707 #[derive(Clone, Debug)]
709 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
710
711 impl TestIamPermissions {
712 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
713 Self(RequestBuilder::new(stub))
714 }
715
716 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
718 mut self,
719 v: V,
720 ) -> Self {
721 self.0.request = v.into();
722 self
723 }
724
725 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
727 self.0.options = v.into();
728 self
729 }
730
731 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
733 (*self.0.stub)
734 .test_iam_permissions(self.0.request, self.0.options)
735 .await
736 .map(gax::response::Response::into_body)
737 }
738
739 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
741 self.0.request.resource = v.into();
742 self
743 }
744
745 pub fn set_permissions<T, V>(mut self, v: T) -> Self
747 where
748 T: std::iter::IntoIterator<Item = V>,
749 V: std::convert::Into<std::string::String>,
750 {
751 use std::iter::Iterator;
752 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
753 self
754 }
755 }
756
757 #[doc(hidden)]
758 impl gax::options::internal::RequestBuilder for TestIamPermissions {
759 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
760 &mut self.0.options
761 }
762 }
763
764 #[derive(Clone, Debug)]
766 pub struct CreateBackup(RequestBuilder<crate::model::CreateBackupRequest>);
767
768 impl CreateBackup {
769 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
770 Self(RequestBuilder::new(stub))
771 }
772
773 pub fn with_request<V: Into<crate::model::CreateBackupRequest>>(mut self, v: V) -> Self {
775 self.0.request = v.into();
776 self
777 }
778
779 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
781 self.0.options = v.into();
782 self
783 }
784
785 pub async fn send(self) -> Result<longrunning::model::Operation> {
792 (*self.0.stub)
793 .create_backup(self.0.request, self.0.options)
794 .await
795 .map(gax::response::Response::into_body)
796 }
797
798 pub fn poller(
800 self,
801 ) -> impl lro::Poller<crate::model::Backup, crate::model::CreateBackupMetadata> {
802 type Operation =
803 lro::Operation<crate::model::Backup, crate::model::CreateBackupMetadata>;
804 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
805 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
806
807 let stub = self.0.stub.clone();
808 let mut options = self.0.options.clone();
809 options.set_retry_policy(gax::retry_policy::NeverRetry);
810 let query = move |name| {
811 let stub = stub.clone();
812 let options = options.clone();
813 async {
814 let op = GetOperation::new(stub)
815 .set_name(name)
816 .with_options(options)
817 .send()
818 .await?;
819 Ok(Operation::new(op))
820 }
821 };
822
823 let start = move || async {
824 let op = self.send().await?;
825 Ok(Operation::new(op))
826 };
827
828 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
829 }
830
831 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
833 self.0.request.parent = v.into();
834 self
835 }
836
837 pub fn set_backup_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
839 self.0.request.backup_id = v.into();
840 self
841 }
842
843 pub fn set_backup<T: Into<std::option::Option<crate::model::Backup>>>(
845 mut self,
846 v: T,
847 ) -> Self {
848 self.0.request.backup = v.into();
849 self
850 }
851
852 pub fn set_encryption_config<
854 T: Into<std::option::Option<crate::model::CreateBackupEncryptionConfig>>,
855 >(
856 mut self,
857 v: T,
858 ) -> Self {
859 self.0.request.encryption_config = v.into();
860 self
861 }
862 }
863
864 #[doc(hidden)]
865 impl gax::options::internal::RequestBuilder for CreateBackup {
866 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
867 &mut self.0.options
868 }
869 }
870
871 #[derive(Clone, Debug)]
873 pub struct CopyBackup(RequestBuilder<crate::model::CopyBackupRequest>);
874
875 impl CopyBackup {
876 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
877 Self(RequestBuilder::new(stub))
878 }
879
880 pub fn with_request<V: Into<crate::model::CopyBackupRequest>>(mut self, v: V) -> Self {
882 self.0.request = v.into();
883 self
884 }
885
886 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
888 self.0.options = v.into();
889 self
890 }
891
892 pub async fn send(self) -> Result<longrunning::model::Operation> {
899 (*self.0.stub)
900 .copy_backup(self.0.request, self.0.options)
901 .await
902 .map(gax::response::Response::into_body)
903 }
904
905 pub fn poller(
907 self,
908 ) -> impl lro::Poller<crate::model::Backup, crate::model::CopyBackupMetadata> {
909 type Operation = lro::Operation<crate::model::Backup, crate::model::CopyBackupMetadata>;
910 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
911 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
912
913 let stub = self.0.stub.clone();
914 let mut options = self.0.options.clone();
915 options.set_retry_policy(gax::retry_policy::NeverRetry);
916 let query = move |name| {
917 let stub = stub.clone();
918 let options = options.clone();
919 async {
920 let op = GetOperation::new(stub)
921 .set_name(name)
922 .with_options(options)
923 .send()
924 .await?;
925 Ok(Operation::new(op))
926 }
927 };
928
929 let start = move || async {
930 let op = self.send().await?;
931 Ok(Operation::new(op))
932 };
933
934 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
935 }
936
937 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
939 self.0.request.parent = v.into();
940 self
941 }
942
943 pub fn set_backup_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
945 self.0.request.backup_id = v.into();
946 self
947 }
948
949 pub fn set_source_backup<T: Into<std::string::String>>(mut self, v: T) -> Self {
951 self.0.request.source_backup = v.into();
952 self
953 }
954
955 pub fn set_expire_time<T: Into<std::option::Option<wkt::Timestamp>>>(
957 mut self,
958 v: T,
959 ) -> Self {
960 self.0.request.expire_time = v.into();
961 self
962 }
963
964 pub fn set_encryption_config<
966 T: Into<std::option::Option<crate::model::CopyBackupEncryptionConfig>>,
967 >(
968 mut self,
969 v: T,
970 ) -> Self {
971 self.0.request.encryption_config = v.into();
972 self
973 }
974 }
975
976 #[doc(hidden)]
977 impl gax::options::internal::RequestBuilder for CopyBackup {
978 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
979 &mut self.0.options
980 }
981 }
982
983 #[derive(Clone, Debug)]
985 pub struct GetBackup(RequestBuilder<crate::model::GetBackupRequest>);
986
987 impl GetBackup {
988 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
989 Self(RequestBuilder::new(stub))
990 }
991
992 pub fn with_request<V: Into<crate::model::GetBackupRequest>>(mut self, v: V) -> Self {
994 self.0.request = v.into();
995 self
996 }
997
998 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1000 self.0.options = v.into();
1001 self
1002 }
1003
1004 pub async fn send(self) -> Result<crate::model::Backup> {
1006 (*self.0.stub)
1007 .get_backup(self.0.request, self.0.options)
1008 .await
1009 .map(gax::response::Response::into_body)
1010 }
1011
1012 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1014 self.0.request.name = v.into();
1015 self
1016 }
1017 }
1018
1019 #[doc(hidden)]
1020 impl gax::options::internal::RequestBuilder for GetBackup {
1021 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1022 &mut self.0.options
1023 }
1024 }
1025
1026 #[derive(Clone, Debug)]
1028 pub struct UpdateBackup(RequestBuilder<crate::model::UpdateBackupRequest>);
1029
1030 impl UpdateBackup {
1031 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
1032 Self(RequestBuilder::new(stub))
1033 }
1034
1035 pub fn with_request<V: Into<crate::model::UpdateBackupRequest>>(mut self, v: V) -> Self {
1037 self.0.request = v.into();
1038 self
1039 }
1040
1041 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1043 self.0.options = v.into();
1044 self
1045 }
1046
1047 pub async fn send(self) -> Result<crate::model::Backup> {
1049 (*self.0.stub)
1050 .update_backup(self.0.request, self.0.options)
1051 .await
1052 .map(gax::response::Response::into_body)
1053 }
1054
1055 pub fn set_backup<T: Into<std::option::Option<crate::model::Backup>>>(
1057 mut self,
1058 v: T,
1059 ) -> Self {
1060 self.0.request.backup = v.into();
1061 self
1062 }
1063
1064 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
1066 mut self,
1067 v: T,
1068 ) -> Self {
1069 self.0.request.update_mask = v.into();
1070 self
1071 }
1072 }
1073
1074 #[doc(hidden)]
1075 impl gax::options::internal::RequestBuilder for UpdateBackup {
1076 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1077 &mut self.0.options
1078 }
1079 }
1080
1081 #[derive(Clone, Debug)]
1083 pub struct DeleteBackup(RequestBuilder<crate::model::DeleteBackupRequest>);
1084
1085 impl DeleteBackup {
1086 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
1087 Self(RequestBuilder::new(stub))
1088 }
1089
1090 pub fn with_request<V: Into<crate::model::DeleteBackupRequest>>(mut self, v: V) -> Self {
1092 self.0.request = v.into();
1093 self
1094 }
1095
1096 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1098 self.0.options = v.into();
1099 self
1100 }
1101
1102 pub async fn send(self) -> Result<()> {
1104 (*self.0.stub)
1105 .delete_backup(self.0.request, self.0.options)
1106 .await
1107 .map(gax::response::Response::into_body)
1108 }
1109
1110 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1112 self.0.request.name = v.into();
1113 self
1114 }
1115 }
1116
1117 #[doc(hidden)]
1118 impl gax::options::internal::RequestBuilder for DeleteBackup {
1119 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1120 &mut self.0.options
1121 }
1122 }
1123
1124 #[derive(Clone, Debug)]
1126 pub struct ListBackups(RequestBuilder<crate::model::ListBackupsRequest>);
1127
1128 impl ListBackups {
1129 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
1130 Self(RequestBuilder::new(stub))
1131 }
1132
1133 pub fn with_request<V: Into<crate::model::ListBackupsRequest>>(mut self, v: V) -> Self {
1135 self.0.request = v.into();
1136 self
1137 }
1138
1139 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1141 self.0.options = v.into();
1142 self
1143 }
1144
1145 pub async fn send(self) -> Result<crate::model::ListBackupsResponse> {
1147 (*self.0.stub)
1148 .list_backups(self.0.request, self.0.options)
1149 .await
1150 .map(gax::response::Response::into_body)
1151 }
1152
1153 pub async fn paginator(
1155 self,
1156 ) -> impl gax::paginator::Paginator<crate::model::ListBackupsResponse, gax::error::Error>
1157 {
1158 use std::clone::Clone;
1159 let token = self.0.request.page_token.clone();
1160 let execute = move |token: String| {
1161 let mut builder = self.clone();
1162 builder.0.request = builder.0.request.set_page_token(token);
1163 builder.send()
1164 };
1165 gax::paginator::internal::new_paginator(token, execute)
1166 }
1167
1168 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1170 self.0.request.parent = v.into();
1171 self
1172 }
1173
1174 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1176 self.0.request.filter = v.into();
1177 self
1178 }
1179
1180 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1182 self.0.request.page_size = v.into();
1183 self
1184 }
1185
1186 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1188 self.0.request.page_token = v.into();
1189 self
1190 }
1191 }
1192
1193 #[doc(hidden)]
1194 impl gax::options::internal::RequestBuilder for ListBackups {
1195 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1196 &mut self.0.options
1197 }
1198 }
1199
1200 #[derive(Clone, Debug)]
1202 pub struct RestoreDatabase(RequestBuilder<crate::model::RestoreDatabaseRequest>);
1203
1204 impl RestoreDatabase {
1205 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
1206 Self(RequestBuilder::new(stub))
1207 }
1208
1209 pub fn with_request<V: Into<crate::model::RestoreDatabaseRequest>>(mut self, v: V) -> Self {
1211 self.0.request = v.into();
1212 self
1213 }
1214
1215 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1217 self.0.options = v.into();
1218 self
1219 }
1220
1221 pub async fn send(self) -> Result<longrunning::model::Operation> {
1228 (*self.0.stub)
1229 .restore_database(self.0.request, self.0.options)
1230 .await
1231 .map(gax::response::Response::into_body)
1232 }
1233
1234 pub fn poller(
1236 self,
1237 ) -> impl lro::Poller<crate::model::Database, crate::model::RestoreDatabaseMetadata>
1238 {
1239 type Operation =
1240 lro::Operation<crate::model::Database, crate::model::RestoreDatabaseMetadata>;
1241 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1242 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1243
1244 let stub = self.0.stub.clone();
1245 let mut options = self.0.options.clone();
1246 options.set_retry_policy(gax::retry_policy::NeverRetry);
1247 let query = move |name| {
1248 let stub = stub.clone();
1249 let options = options.clone();
1250 async {
1251 let op = GetOperation::new(stub)
1252 .set_name(name)
1253 .with_options(options)
1254 .send()
1255 .await?;
1256 Ok(Operation::new(op))
1257 }
1258 };
1259
1260 let start = move || async {
1261 let op = self.send().await?;
1262 Ok(Operation::new(op))
1263 };
1264
1265 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1266 }
1267
1268 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1270 self.0.request.parent = v.into();
1271 self
1272 }
1273
1274 pub fn set_database_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1276 self.0.request.database_id = v.into();
1277 self
1278 }
1279
1280 pub fn set_encryption_config<
1282 T: Into<std::option::Option<crate::model::RestoreDatabaseEncryptionConfig>>,
1283 >(
1284 mut self,
1285 v: T,
1286 ) -> Self {
1287 self.0.request.encryption_config = v.into();
1288 self
1289 }
1290
1291 pub fn set_source<T: Into<Option<crate::model::restore_database_request::Source>>>(
1296 mut self,
1297 v: T,
1298 ) -> Self {
1299 self.0.request.source = v.into();
1300 self
1301 }
1302
1303 pub fn set_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1309 self.0.request = self.0.request.set_backup(v);
1310 self
1311 }
1312 }
1313
1314 #[doc(hidden)]
1315 impl gax::options::internal::RequestBuilder for RestoreDatabase {
1316 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1317 &mut self.0.options
1318 }
1319 }
1320
1321 #[derive(Clone, Debug)]
1323 pub struct ListDatabaseOperations(RequestBuilder<crate::model::ListDatabaseOperationsRequest>);
1324
1325 impl ListDatabaseOperations {
1326 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
1327 Self(RequestBuilder::new(stub))
1328 }
1329
1330 pub fn with_request<V: Into<crate::model::ListDatabaseOperationsRequest>>(
1332 mut self,
1333 v: V,
1334 ) -> Self {
1335 self.0.request = v.into();
1336 self
1337 }
1338
1339 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1341 self.0.options = v.into();
1342 self
1343 }
1344
1345 pub async fn send(self) -> Result<crate::model::ListDatabaseOperationsResponse> {
1347 (*self.0.stub)
1348 .list_database_operations(self.0.request, self.0.options)
1349 .await
1350 .map(gax::response::Response::into_body)
1351 }
1352
1353 pub async fn paginator(
1355 self,
1356 ) -> impl gax::paginator::Paginator<
1357 crate::model::ListDatabaseOperationsResponse,
1358 gax::error::Error,
1359 > {
1360 use std::clone::Clone;
1361 let token = self.0.request.page_token.clone();
1362 let execute = move |token: String| {
1363 let mut builder = self.clone();
1364 builder.0.request = builder.0.request.set_page_token(token);
1365 builder.send()
1366 };
1367 gax::paginator::internal::new_paginator(token, execute)
1368 }
1369
1370 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1372 self.0.request.parent = v.into();
1373 self
1374 }
1375
1376 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1378 self.0.request.filter = v.into();
1379 self
1380 }
1381
1382 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1384 self.0.request.page_size = v.into();
1385 self
1386 }
1387
1388 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1390 self.0.request.page_token = v.into();
1391 self
1392 }
1393 }
1394
1395 #[doc(hidden)]
1396 impl gax::options::internal::RequestBuilder for ListDatabaseOperations {
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 ListBackupOperations(RequestBuilder<crate::model::ListBackupOperationsRequest>);
1405
1406 impl ListBackupOperations {
1407 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
1408 Self(RequestBuilder::new(stub))
1409 }
1410
1411 pub fn with_request<V: Into<crate::model::ListBackupOperationsRequest>>(
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::ListBackupOperationsResponse> {
1428 (*self.0.stub)
1429 .list_backup_operations(self.0.request, self.0.options)
1430 .await
1431 .map(gax::response::Response::into_body)
1432 }
1433
1434 pub async fn paginator(
1436 self,
1437 ) -> impl gax::paginator::Paginator<crate::model::ListBackupOperationsResponse, gax::error::Error>
1438 {
1439 use std::clone::Clone;
1440 let token = self.0.request.page_token.clone();
1441 let execute = move |token: String| {
1442 let mut builder = self.clone();
1443 builder.0.request = builder.0.request.set_page_token(token);
1444 builder.send()
1445 };
1446 gax::paginator::internal::new_paginator(token, execute)
1447 }
1448
1449 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1451 self.0.request.parent = v.into();
1452 self
1453 }
1454
1455 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1457 self.0.request.filter = v.into();
1458 self
1459 }
1460
1461 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1463 self.0.request.page_size = v.into();
1464 self
1465 }
1466
1467 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1469 self.0.request.page_token = v.into();
1470 self
1471 }
1472 }
1473
1474 #[doc(hidden)]
1475 impl gax::options::internal::RequestBuilder for ListBackupOperations {
1476 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1477 &mut self.0.options
1478 }
1479 }
1480
1481 #[derive(Clone, Debug)]
1483 pub struct ListDatabaseRoles(RequestBuilder<crate::model::ListDatabaseRolesRequest>);
1484
1485 impl ListDatabaseRoles {
1486 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
1487 Self(RequestBuilder::new(stub))
1488 }
1489
1490 pub fn with_request<V: Into<crate::model::ListDatabaseRolesRequest>>(
1492 mut self,
1493 v: V,
1494 ) -> Self {
1495 self.0.request = v.into();
1496 self
1497 }
1498
1499 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1501 self.0.options = v.into();
1502 self
1503 }
1504
1505 pub async fn send(self) -> Result<crate::model::ListDatabaseRolesResponse> {
1507 (*self.0.stub)
1508 .list_database_roles(self.0.request, self.0.options)
1509 .await
1510 .map(gax::response::Response::into_body)
1511 }
1512
1513 pub async fn paginator(
1515 self,
1516 ) -> impl gax::paginator::Paginator<crate::model::ListDatabaseRolesResponse, gax::error::Error>
1517 {
1518 use std::clone::Clone;
1519 let token = self.0.request.page_token.clone();
1520 let execute = move |token: String| {
1521 let mut builder = self.clone();
1522 builder.0.request = builder.0.request.set_page_token(token);
1523 builder.send()
1524 };
1525 gax::paginator::internal::new_paginator(token, execute)
1526 }
1527
1528 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1530 self.0.request.parent = v.into();
1531 self
1532 }
1533
1534 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1536 self.0.request.page_size = v.into();
1537 self
1538 }
1539
1540 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1542 self.0.request.page_token = v.into();
1543 self
1544 }
1545 }
1546
1547 #[doc(hidden)]
1548 impl gax::options::internal::RequestBuilder for ListDatabaseRoles {
1549 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1550 &mut self.0.options
1551 }
1552 }
1553
1554 #[derive(Clone, Debug)]
1556 pub struct AddSplitPoints(RequestBuilder<crate::model::AddSplitPointsRequest>);
1557
1558 impl AddSplitPoints {
1559 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
1560 Self(RequestBuilder::new(stub))
1561 }
1562
1563 pub fn with_request<V: Into<crate::model::AddSplitPointsRequest>>(mut self, v: V) -> Self {
1565 self.0.request = v.into();
1566 self
1567 }
1568
1569 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1571 self.0.options = v.into();
1572 self
1573 }
1574
1575 pub async fn send(self) -> Result<crate::model::AddSplitPointsResponse> {
1577 (*self.0.stub)
1578 .add_split_points(self.0.request, self.0.options)
1579 .await
1580 .map(gax::response::Response::into_body)
1581 }
1582
1583 pub fn set_database<T: Into<std::string::String>>(mut self, v: T) -> Self {
1585 self.0.request.database = v.into();
1586 self
1587 }
1588
1589 pub fn set_initiator<T: Into<std::string::String>>(mut self, v: T) -> Self {
1591 self.0.request.initiator = v.into();
1592 self
1593 }
1594
1595 pub fn set_split_points<T, V>(mut self, v: T) -> Self
1597 where
1598 T: std::iter::IntoIterator<Item = V>,
1599 V: std::convert::Into<crate::model::SplitPoints>,
1600 {
1601 use std::iter::Iterator;
1602 self.0.request.split_points = v.into_iter().map(|i| i.into()).collect();
1603 self
1604 }
1605 }
1606
1607 #[doc(hidden)]
1608 impl gax::options::internal::RequestBuilder for AddSplitPoints {
1609 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1610 &mut self.0.options
1611 }
1612 }
1613
1614 #[derive(Clone, Debug)]
1616 pub struct CreateBackupSchedule(RequestBuilder<crate::model::CreateBackupScheduleRequest>);
1617
1618 impl CreateBackupSchedule {
1619 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
1620 Self(RequestBuilder::new(stub))
1621 }
1622
1623 pub fn with_request<V: Into<crate::model::CreateBackupScheduleRequest>>(
1625 mut self,
1626 v: V,
1627 ) -> Self {
1628 self.0.request = v.into();
1629 self
1630 }
1631
1632 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1634 self.0.options = v.into();
1635 self
1636 }
1637
1638 pub async fn send(self) -> Result<crate::model::BackupSchedule> {
1640 (*self.0.stub)
1641 .create_backup_schedule(self.0.request, self.0.options)
1642 .await
1643 .map(gax::response::Response::into_body)
1644 }
1645
1646 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1648 self.0.request.parent = v.into();
1649 self
1650 }
1651
1652 pub fn set_backup_schedule_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1654 self.0.request.backup_schedule_id = v.into();
1655 self
1656 }
1657
1658 pub fn set_backup_schedule<T: Into<std::option::Option<crate::model::BackupSchedule>>>(
1660 mut self,
1661 v: T,
1662 ) -> Self {
1663 self.0.request.backup_schedule = v.into();
1664 self
1665 }
1666 }
1667
1668 #[doc(hidden)]
1669 impl gax::options::internal::RequestBuilder for CreateBackupSchedule {
1670 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1671 &mut self.0.options
1672 }
1673 }
1674
1675 #[derive(Clone, Debug)]
1677 pub struct GetBackupSchedule(RequestBuilder<crate::model::GetBackupScheduleRequest>);
1678
1679 impl GetBackupSchedule {
1680 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
1681 Self(RequestBuilder::new(stub))
1682 }
1683
1684 pub fn with_request<V: Into<crate::model::GetBackupScheduleRequest>>(
1686 mut self,
1687 v: V,
1688 ) -> Self {
1689 self.0.request = v.into();
1690 self
1691 }
1692
1693 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1695 self.0.options = v.into();
1696 self
1697 }
1698
1699 pub async fn send(self) -> Result<crate::model::BackupSchedule> {
1701 (*self.0.stub)
1702 .get_backup_schedule(self.0.request, self.0.options)
1703 .await
1704 .map(gax::response::Response::into_body)
1705 }
1706
1707 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1709 self.0.request.name = v.into();
1710 self
1711 }
1712 }
1713
1714 #[doc(hidden)]
1715 impl gax::options::internal::RequestBuilder for GetBackupSchedule {
1716 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1717 &mut self.0.options
1718 }
1719 }
1720
1721 #[derive(Clone, Debug)]
1723 pub struct UpdateBackupSchedule(RequestBuilder<crate::model::UpdateBackupScheduleRequest>);
1724
1725 impl UpdateBackupSchedule {
1726 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
1727 Self(RequestBuilder::new(stub))
1728 }
1729
1730 pub fn with_request<V: Into<crate::model::UpdateBackupScheduleRequest>>(
1732 mut self,
1733 v: V,
1734 ) -> Self {
1735 self.0.request = v.into();
1736 self
1737 }
1738
1739 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1741 self.0.options = v.into();
1742 self
1743 }
1744
1745 pub async fn send(self) -> Result<crate::model::BackupSchedule> {
1747 (*self.0.stub)
1748 .update_backup_schedule(self.0.request, self.0.options)
1749 .await
1750 .map(gax::response::Response::into_body)
1751 }
1752
1753 pub fn set_backup_schedule<T: Into<std::option::Option<crate::model::BackupSchedule>>>(
1755 mut self,
1756 v: T,
1757 ) -> Self {
1758 self.0.request.backup_schedule = v.into();
1759 self
1760 }
1761
1762 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
1764 mut self,
1765 v: T,
1766 ) -> Self {
1767 self.0.request.update_mask = v.into();
1768 self
1769 }
1770 }
1771
1772 #[doc(hidden)]
1773 impl gax::options::internal::RequestBuilder for UpdateBackupSchedule {
1774 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1775 &mut self.0.options
1776 }
1777 }
1778
1779 #[derive(Clone, Debug)]
1781 pub struct DeleteBackupSchedule(RequestBuilder<crate::model::DeleteBackupScheduleRequest>);
1782
1783 impl DeleteBackupSchedule {
1784 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
1785 Self(RequestBuilder::new(stub))
1786 }
1787
1788 pub fn with_request<V: Into<crate::model::DeleteBackupScheduleRequest>>(
1790 mut self,
1791 v: V,
1792 ) -> Self {
1793 self.0.request = v.into();
1794 self
1795 }
1796
1797 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1799 self.0.options = v.into();
1800 self
1801 }
1802
1803 pub async fn send(self) -> Result<()> {
1805 (*self.0.stub)
1806 .delete_backup_schedule(self.0.request, self.0.options)
1807 .await
1808 .map(gax::response::Response::into_body)
1809 }
1810
1811 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1813 self.0.request.name = v.into();
1814 self
1815 }
1816 }
1817
1818 #[doc(hidden)]
1819 impl gax::options::internal::RequestBuilder for DeleteBackupSchedule {
1820 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1821 &mut self.0.options
1822 }
1823 }
1824
1825 #[derive(Clone, Debug)]
1827 pub struct ListBackupSchedules(RequestBuilder<crate::model::ListBackupSchedulesRequest>);
1828
1829 impl ListBackupSchedules {
1830 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
1831 Self(RequestBuilder::new(stub))
1832 }
1833
1834 pub fn with_request<V: Into<crate::model::ListBackupSchedulesRequest>>(
1836 mut self,
1837 v: V,
1838 ) -> Self {
1839 self.0.request = v.into();
1840 self
1841 }
1842
1843 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1845 self.0.options = v.into();
1846 self
1847 }
1848
1849 pub async fn send(self) -> Result<crate::model::ListBackupSchedulesResponse> {
1851 (*self.0.stub)
1852 .list_backup_schedules(self.0.request, self.0.options)
1853 .await
1854 .map(gax::response::Response::into_body)
1855 }
1856
1857 pub async fn paginator(
1859 self,
1860 ) -> impl gax::paginator::Paginator<crate::model::ListBackupSchedulesResponse, gax::error::Error>
1861 {
1862 use std::clone::Clone;
1863 let token = self.0.request.page_token.clone();
1864 let execute = move |token: String| {
1865 let mut builder = self.clone();
1866 builder.0.request = builder.0.request.set_page_token(token);
1867 builder.send()
1868 };
1869 gax::paginator::internal::new_paginator(token, execute)
1870 }
1871
1872 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1874 self.0.request.parent = v.into();
1875 self
1876 }
1877
1878 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1880 self.0.request.page_size = v.into();
1881 self
1882 }
1883
1884 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1886 self.0.request.page_token = v.into();
1887 self
1888 }
1889 }
1890
1891 #[doc(hidden)]
1892 impl gax::options::internal::RequestBuilder for ListBackupSchedules {
1893 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1894 &mut self.0.options
1895 }
1896 }
1897
1898 #[derive(Clone, Debug)]
1900 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1901
1902 impl ListOperations {
1903 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
1904 Self(RequestBuilder::new(stub))
1905 }
1906
1907 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1909 mut self,
1910 v: V,
1911 ) -> Self {
1912 self.0.request = v.into();
1913 self
1914 }
1915
1916 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1918 self.0.options = v.into();
1919 self
1920 }
1921
1922 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1924 (*self.0.stub)
1925 .list_operations(self.0.request, self.0.options)
1926 .await
1927 .map(gax::response::Response::into_body)
1928 }
1929
1930 pub async fn paginator(
1932 self,
1933 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1934 {
1935 use std::clone::Clone;
1936 let token = self.0.request.page_token.clone();
1937 let execute = move |token: String| {
1938 let mut builder = self.clone();
1939 builder.0.request = builder.0.request.set_page_token(token);
1940 builder.send()
1941 };
1942 gax::paginator::internal::new_paginator(token, execute)
1943 }
1944
1945 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1947 self.0.request.name = v.into();
1948 self
1949 }
1950
1951 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1953 self.0.request.filter = v.into();
1954 self
1955 }
1956
1957 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1959 self.0.request.page_size = v.into();
1960 self
1961 }
1962
1963 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1965 self.0.request.page_token = v.into();
1966 self
1967 }
1968 }
1969
1970 #[doc(hidden)]
1971 impl gax::options::internal::RequestBuilder for ListOperations {
1972 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1973 &mut self.0.options
1974 }
1975 }
1976
1977 #[derive(Clone, Debug)]
1979 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1980
1981 impl GetOperation {
1982 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
1983 Self(RequestBuilder::new(stub))
1984 }
1985
1986 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1988 mut self,
1989 v: V,
1990 ) -> Self {
1991 self.0.request = v.into();
1992 self
1993 }
1994
1995 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1997 self.0.options = v.into();
1998 self
1999 }
2000
2001 pub async fn send(self) -> Result<longrunning::model::Operation> {
2003 (*self.0.stub)
2004 .get_operation(self.0.request, self.0.options)
2005 .await
2006 .map(gax::response::Response::into_body)
2007 }
2008
2009 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2011 self.0.request.name = v.into();
2012 self
2013 }
2014 }
2015
2016 #[doc(hidden)]
2017 impl gax::options::internal::RequestBuilder for GetOperation {
2018 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2019 &mut self.0.options
2020 }
2021 }
2022
2023 #[derive(Clone, Debug)]
2025 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2026
2027 impl DeleteOperation {
2028 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
2029 Self(RequestBuilder::new(stub))
2030 }
2031
2032 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2034 mut self,
2035 v: V,
2036 ) -> Self {
2037 self.0.request = v.into();
2038 self
2039 }
2040
2041 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2043 self.0.options = v.into();
2044 self
2045 }
2046
2047 pub async fn send(self) -> Result<()> {
2049 (*self.0.stub)
2050 .delete_operation(self.0.request, self.0.options)
2051 .await
2052 .map(gax::response::Response::into_body)
2053 }
2054
2055 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2057 self.0.request.name = v.into();
2058 self
2059 }
2060 }
2061
2062 #[doc(hidden)]
2063 impl gax::options::internal::RequestBuilder for DeleteOperation {
2064 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2065 &mut self.0.options
2066 }
2067 }
2068
2069 #[derive(Clone, Debug)]
2071 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2072
2073 impl CancelOperation {
2074 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatabaseAdmin>) -> Self {
2075 Self(RequestBuilder::new(stub))
2076 }
2077
2078 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2080 mut self,
2081 v: V,
2082 ) -> Self {
2083 self.0.request = v.into();
2084 self
2085 }
2086
2087 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2089 self.0.options = v.into();
2090 self
2091 }
2092
2093 pub async fn send(self) -> Result<()> {
2095 (*self.0.stub)
2096 .cancel_operation(self.0.request, self.0.options)
2097 .await
2098 .map(gax::response::Response::into_body)
2099 }
2100
2101 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2103 self.0.request.name = v.into();
2104 self
2105 }
2106 }
2107
2108 #[doc(hidden)]
2109 impl gax::options::internal::RequestBuilder for CancelOperation {
2110 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2111 &mut self.0.options
2112 }
2113 }
2114}