1pub mod database_admin {
18 use crate::Result;
19
20 pub type ClientBuilder =
34 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::DatabaseAdmin;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = DatabaseAdmin;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> gax::client_builder::Result<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 #[derive(Clone, Debug)]
53 pub(crate) struct RequestBuilder<R: std::default::Default> {
54 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
55 request: R,
56 options: gax::options::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(
64 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: gax::options::RequestOptions::default(),
70 }
71 }
72 }
73
74 #[derive(Clone, Debug)]
95 pub struct ListDatabases(RequestBuilder<crate::model::ListDatabasesRequest>);
96
97 impl ListDatabases {
98 pub(crate) fn new(
99 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
100 ) -> Self {
101 Self(RequestBuilder::new(stub))
102 }
103
104 pub fn with_request<V: Into<crate::model::ListDatabasesRequest>>(mut self, v: V) -> Self {
106 self.0.request = v.into();
107 self
108 }
109
110 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
112 self.0.options = v.into();
113 self
114 }
115
116 pub async fn send(self) -> Result<crate::model::ListDatabasesResponse> {
118 (*self.0.stub)
119 .list_databases(self.0.request, self.0.options)
120 .await
121 .map(gax::response::Response::into_body)
122 }
123
124 pub fn by_page(
126 self,
127 ) -> impl gax::paginator::Paginator<crate::model::ListDatabasesResponse, gax::error::Error>
128 {
129 use std::clone::Clone;
130 let token = self.0.request.page_token.clone();
131 let execute = move |token: String| {
132 let mut builder = self.clone();
133 builder.0.request = builder.0.request.set_page_token(token);
134 builder.send()
135 };
136 gax::paginator::internal::new_paginator(token, execute)
137 }
138
139 pub fn by_item(
141 self,
142 ) -> impl gax::paginator::ItemPaginator<crate::model::ListDatabasesResponse, gax::error::Error>
143 {
144 use gax::paginator::Paginator;
145 self.by_page().items()
146 }
147
148 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
152 self.0.request.parent = v.into();
153 self
154 }
155
156 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
158 self.0.request.page_size = v.into();
159 self
160 }
161
162 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
164 self.0.request.page_token = v.into();
165 self
166 }
167 }
168
169 #[doc(hidden)]
170 impl gax::options::internal::RequestBuilder for ListDatabases {
171 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
172 &mut self.0.options
173 }
174 }
175
176 #[derive(Clone, Debug)]
194 pub struct CreateDatabase(RequestBuilder<crate::model::CreateDatabaseRequest>);
195
196 impl CreateDatabase {
197 pub(crate) fn new(
198 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
199 ) -> Self {
200 Self(RequestBuilder::new(stub))
201 }
202
203 pub fn with_request<V: Into<crate::model::CreateDatabaseRequest>>(mut self, v: V) -> Self {
205 self.0.request = v.into();
206 self
207 }
208
209 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
211 self.0.options = v.into();
212 self
213 }
214
215 pub async fn send(self) -> Result<longrunning::model::Operation> {
222 (*self.0.stub)
223 .create_database(self.0.request, self.0.options)
224 .await
225 .map(gax::response::Response::into_body)
226 }
227
228 pub fn poller(
230 self,
231 ) -> impl lro::Poller<crate::model::Database, crate::model::CreateDatabaseMetadata>
232 {
233 type Operation = lro::internal::Operation<
234 crate::model::Database,
235 crate::model::CreateDatabaseMetadata,
236 >;
237 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
238 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
239
240 let stub = self.0.stub.clone();
241 let mut options = self.0.options.clone();
242 options.set_retry_policy(gax::retry_policy::NeverRetry);
243 let query = move |name| {
244 let stub = stub.clone();
245 let options = options.clone();
246 async {
247 let op = GetOperation::new(stub)
248 .set_name(name)
249 .with_options(options)
250 .send()
251 .await?;
252 Ok(Operation::new(op))
253 }
254 };
255
256 let start = move || async {
257 let op = self.send().await?;
258 Ok(Operation::new(op))
259 };
260
261 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
262 }
263
264 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
268 self.0.request.parent = v.into();
269 self
270 }
271
272 pub fn set_create_statement<T: Into<std::string::String>>(mut self, v: T) -> Self {
276 self.0.request.create_statement = v.into();
277 self
278 }
279
280 pub fn set_extra_statements<T, V>(mut self, v: T) -> Self
282 where
283 T: std::iter::IntoIterator<Item = V>,
284 V: std::convert::Into<std::string::String>,
285 {
286 use std::iter::Iterator;
287 self.0.request.extra_statements = v.into_iter().map(|i| i.into()).collect();
288 self
289 }
290
291 pub fn set_encryption_config<T>(mut self, v: T) -> Self
293 where
294 T: std::convert::Into<crate::model::EncryptionConfig>,
295 {
296 self.0.request.encryption_config = std::option::Option::Some(v.into());
297 self
298 }
299
300 pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
302 where
303 T: std::convert::Into<crate::model::EncryptionConfig>,
304 {
305 self.0.request.encryption_config = v.map(|x| x.into());
306 self
307 }
308
309 pub fn set_database_dialect<T: Into<crate::model::DatabaseDialect>>(
311 mut self,
312 v: T,
313 ) -> Self {
314 self.0.request.database_dialect = v.into();
315 self
316 }
317
318 pub fn set_proto_descriptors<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
320 self.0.request.proto_descriptors = v.into();
321 self
322 }
323 }
324
325 #[doc(hidden)]
326 impl gax::options::internal::RequestBuilder for CreateDatabase {
327 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
328 &mut self.0.options
329 }
330 }
331
332 #[derive(Clone, Debug)]
349 pub struct GetDatabase(RequestBuilder<crate::model::GetDatabaseRequest>);
350
351 impl GetDatabase {
352 pub(crate) fn new(
353 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
354 ) -> Self {
355 Self(RequestBuilder::new(stub))
356 }
357
358 pub fn with_request<V: Into<crate::model::GetDatabaseRequest>>(mut self, v: V) -> Self {
360 self.0.request = v.into();
361 self
362 }
363
364 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
366 self.0.options = v.into();
367 self
368 }
369
370 pub async fn send(self) -> Result<crate::model::Database> {
372 (*self.0.stub)
373 .get_database(self.0.request, self.0.options)
374 .await
375 .map(gax::response::Response::into_body)
376 }
377
378 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
382 self.0.request.name = v.into();
383 self
384 }
385 }
386
387 #[doc(hidden)]
388 impl gax::options::internal::RequestBuilder for GetDatabase {
389 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
390 &mut self.0.options
391 }
392 }
393
394 #[derive(Clone, Debug)]
412 pub struct UpdateDatabase(RequestBuilder<crate::model::UpdateDatabaseRequest>);
413
414 impl UpdateDatabase {
415 pub(crate) fn new(
416 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
417 ) -> Self {
418 Self(RequestBuilder::new(stub))
419 }
420
421 pub fn with_request<V: Into<crate::model::UpdateDatabaseRequest>>(mut self, v: V) -> Self {
423 self.0.request = v.into();
424 self
425 }
426
427 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
429 self.0.options = v.into();
430 self
431 }
432
433 pub async fn send(self) -> Result<longrunning::model::Operation> {
440 (*self.0.stub)
441 .update_database(self.0.request, self.0.options)
442 .await
443 .map(gax::response::Response::into_body)
444 }
445
446 pub fn poller(
448 self,
449 ) -> impl lro::Poller<crate::model::Database, crate::model::UpdateDatabaseMetadata>
450 {
451 type Operation = lro::internal::Operation<
452 crate::model::Database,
453 crate::model::UpdateDatabaseMetadata,
454 >;
455 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
456 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
457
458 let stub = self.0.stub.clone();
459 let mut options = self.0.options.clone();
460 options.set_retry_policy(gax::retry_policy::NeverRetry);
461 let query = move |name| {
462 let stub = stub.clone();
463 let options = options.clone();
464 async {
465 let op = GetOperation::new(stub)
466 .set_name(name)
467 .with_options(options)
468 .send()
469 .await?;
470 Ok(Operation::new(op))
471 }
472 };
473
474 let start = move || async {
475 let op = self.send().await?;
476 Ok(Operation::new(op))
477 };
478
479 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
480 }
481
482 pub fn set_database<T>(mut self, v: T) -> Self
486 where
487 T: std::convert::Into<crate::model::Database>,
488 {
489 self.0.request.database = std::option::Option::Some(v.into());
490 self
491 }
492
493 pub fn set_or_clear_database<T>(mut self, v: std::option::Option<T>) -> Self
497 where
498 T: std::convert::Into<crate::model::Database>,
499 {
500 self.0.request.database = v.map(|x| x.into());
501 self
502 }
503
504 pub fn set_update_mask<T>(mut self, v: T) -> Self
508 where
509 T: std::convert::Into<wkt::FieldMask>,
510 {
511 self.0.request.update_mask = std::option::Option::Some(v.into());
512 self
513 }
514
515 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
519 where
520 T: std::convert::Into<wkt::FieldMask>,
521 {
522 self.0.request.update_mask = v.map(|x| x.into());
523 self
524 }
525 }
526
527 #[doc(hidden)]
528 impl gax::options::internal::RequestBuilder for UpdateDatabase {
529 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
530 &mut self.0.options
531 }
532 }
533
534 #[derive(Clone, Debug)]
552 pub struct UpdateDatabaseDdl(RequestBuilder<crate::model::UpdateDatabaseDdlRequest>);
553
554 impl UpdateDatabaseDdl {
555 pub(crate) fn new(
556 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
557 ) -> Self {
558 Self(RequestBuilder::new(stub))
559 }
560
561 pub fn with_request<V: Into<crate::model::UpdateDatabaseDdlRequest>>(
563 mut self,
564 v: V,
565 ) -> Self {
566 self.0.request = v.into();
567 self
568 }
569
570 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
572 self.0.options = v.into();
573 self
574 }
575
576 pub async fn send(self) -> Result<longrunning::model::Operation> {
583 (*self.0.stub)
584 .update_database_ddl(self.0.request, self.0.options)
585 .await
586 .map(gax::response::Response::into_body)
587 }
588
589 pub fn poller(self) -> impl lro::Poller<(), crate::model::UpdateDatabaseDdlMetadata> {
591 type Operation =
592 lro::internal::Operation<wkt::Empty, crate::model::UpdateDatabaseDdlMetadata>;
593 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
594 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
595
596 let stub = self.0.stub.clone();
597 let mut options = self.0.options.clone();
598 options.set_retry_policy(gax::retry_policy::NeverRetry);
599 let query = move |name| {
600 let stub = stub.clone();
601 let options = options.clone();
602 async {
603 let op = GetOperation::new(stub)
604 .set_name(name)
605 .with_options(options)
606 .send()
607 .await?;
608 Ok(Operation::new(op))
609 }
610 };
611
612 let start = move || async {
613 let op = self.send().await?;
614 Ok(Operation::new(op))
615 };
616
617 lro::internal::new_unit_response_poller(
618 polling_error_policy,
619 polling_backoff_policy,
620 start,
621 query,
622 )
623 }
624
625 pub fn set_database<T: Into<std::string::String>>(mut self, v: T) -> Self {
629 self.0.request.database = v.into();
630 self
631 }
632
633 pub fn set_statements<T, V>(mut self, v: T) -> Self
637 where
638 T: std::iter::IntoIterator<Item = V>,
639 V: std::convert::Into<std::string::String>,
640 {
641 use std::iter::Iterator;
642 self.0.request.statements = v.into_iter().map(|i| i.into()).collect();
643 self
644 }
645
646 pub fn set_operation_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
648 self.0.request.operation_id = v.into();
649 self
650 }
651
652 pub fn set_proto_descriptors<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
654 self.0.request.proto_descriptors = v.into();
655 self
656 }
657
658 pub fn set_throughput_mode<T: Into<bool>>(mut self, v: T) -> Self {
660 self.0.request.throughput_mode = v.into();
661 self
662 }
663 }
664
665 #[doc(hidden)]
666 impl gax::options::internal::RequestBuilder for UpdateDatabaseDdl {
667 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
668 &mut self.0.options
669 }
670 }
671
672 #[derive(Clone, Debug)]
689 pub struct DropDatabase(RequestBuilder<crate::model::DropDatabaseRequest>);
690
691 impl DropDatabase {
692 pub(crate) fn new(
693 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
694 ) -> Self {
695 Self(RequestBuilder::new(stub))
696 }
697
698 pub fn with_request<V: Into<crate::model::DropDatabaseRequest>>(mut self, v: V) -> Self {
700 self.0.request = v.into();
701 self
702 }
703
704 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
706 self.0.options = v.into();
707 self
708 }
709
710 pub async fn send(self) -> Result<()> {
712 (*self.0.stub)
713 .drop_database(self.0.request, self.0.options)
714 .await
715 .map(gax::response::Response::into_body)
716 }
717
718 pub fn set_database<T: Into<std::string::String>>(mut self, v: T) -> Self {
722 self.0.request.database = v.into();
723 self
724 }
725 }
726
727 #[doc(hidden)]
728 impl gax::options::internal::RequestBuilder for DropDatabase {
729 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
730 &mut self.0.options
731 }
732 }
733
734 #[derive(Clone, Debug)]
751 pub struct GetDatabaseDdl(RequestBuilder<crate::model::GetDatabaseDdlRequest>);
752
753 impl GetDatabaseDdl {
754 pub(crate) fn new(
755 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
756 ) -> Self {
757 Self(RequestBuilder::new(stub))
758 }
759
760 pub fn with_request<V: Into<crate::model::GetDatabaseDdlRequest>>(mut self, v: V) -> Self {
762 self.0.request = v.into();
763 self
764 }
765
766 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
768 self.0.options = v.into();
769 self
770 }
771
772 pub async fn send(self) -> Result<crate::model::GetDatabaseDdlResponse> {
774 (*self.0.stub)
775 .get_database_ddl(self.0.request, self.0.options)
776 .await
777 .map(gax::response::Response::into_body)
778 }
779
780 pub fn set_database<T: Into<std::string::String>>(mut self, v: T) -> Self {
784 self.0.request.database = v.into();
785 self
786 }
787 }
788
789 #[doc(hidden)]
790 impl gax::options::internal::RequestBuilder for GetDatabaseDdl {
791 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
792 &mut self.0.options
793 }
794 }
795
796 #[derive(Clone, Debug)]
813 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
814
815 impl SetIamPolicy {
816 pub(crate) fn new(
817 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
818 ) -> Self {
819 Self(RequestBuilder::new(stub))
820 }
821
822 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
824 self.0.request = v.into();
825 self
826 }
827
828 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
830 self.0.options = v.into();
831 self
832 }
833
834 pub async fn send(self) -> Result<iam_v1::model::Policy> {
836 (*self.0.stub)
837 .set_iam_policy(self.0.request, self.0.options)
838 .await
839 .map(gax::response::Response::into_body)
840 }
841
842 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
846 self.0.request.resource = v.into();
847 self
848 }
849
850 pub fn set_policy<T>(mut self, v: T) -> Self
854 where
855 T: std::convert::Into<iam_v1::model::Policy>,
856 {
857 self.0.request.policy = std::option::Option::Some(v.into());
858 self
859 }
860
861 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
865 where
866 T: std::convert::Into<iam_v1::model::Policy>,
867 {
868 self.0.request.policy = v.map(|x| x.into());
869 self
870 }
871
872 pub fn set_update_mask<T>(mut self, v: T) -> Self
874 where
875 T: std::convert::Into<wkt::FieldMask>,
876 {
877 self.0.request.update_mask = std::option::Option::Some(v.into());
878 self
879 }
880
881 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
883 where
884 T: std::convert::Into<wkt::FieldMask>,
885 {
886 self.0.request.update_mask = v.map(|x| x.into());
887 self
888 }
889 }
890
891 #[doc(hidden)]
892 impl gax::options::internal::RequestBuilder for SetIamPolicy {
893 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
894 &mut self.0.options
895 }
896 }
897
898 #[derive(Clone, Debug)]
915 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
916
917 impl GetIamPolicy {
918 pub(crate) fn new(
919 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
920 ) -> Self {
921 Self(RequestBuilder::new(stub))
922 }
923
924 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
926 self.0.request = v.into();
927 self
928 }
929
930 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
932 self.0.options = v.into();
933 self
934 }
935
936 pub async fn send(self) -> Result<iam_v1::model::Policy> {
938 (*self.0.stub)
939 .get_iam_policy(self.0.request, self.0.options)
940 .await
941 .map(gax::response::Response::into_body)
942 }
943
944 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
948 self.0.request.resource = v.into();
949 self
950 }
951
952 pub fn set_options<T>(mut self, v: T) -> Self
954 where
955 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
956 {
957 self.0.request.options = std::option::Option::Some(v.into());
958 self
959 }
960
961 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
963 where
964 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
965 {
966 self.0.request.options = v.map(|x| x.into());
967 self
968 }
969 }
970
971 #[doc(hidden)]
972 impl gax::options::internal::RequestBuilder for GetIamPolicy {
973 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
974 &mut self.0.options
975 }
976 }
977
978 #[derive(Clone, Debug)]
995 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
996
997 impl TestIamPermissions {
998 pub(crate) fn new(
999 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1000 ) -> Self {
1001 Self(RequestBuilder::new(stub))
1002 }
1003
1004 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
1006 mut self,
1007 v: V,
1008 ) -> Self {
1009 self.0.request = v.into();
1010 self
1011 }
1012
1013 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1015 self.0.options = v.into();
1016 self
1017 }
1018
1019 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
1021 (*self.0.stub)
1022 .test_iam_permissions(self.0.request, self.0.options)
1023 .await
1024 .map(gax::response::Response::into_body)
1025 }
1026
1027 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1031 self.0.request.resource = v.into();
1032 self
1033 }
1034
1035 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1039 where
1040 T: std::iter::IntoIterator<Item = V>,
1041 V: std::convert::Into<std::string::String>,
1042 {
1043 use std::iter::Iterator;
1044 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1045 self
1046 }
1047 }
1048
1049 #[doc(hidden)]
1050 impl gax::options::internal::RequestBuilder for TestIamPermissions {
1051 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1052 &mut self.0.options
1053 }
1054 }
1055
1056 #[derive(Clone, Debug)]
1074 pub struct CreateBackup(RequestBuilder<crate::model::CreateBackupRequest>);
1075
1076 impl CreateBackup {
1077 pub(crate) fn new(
1078 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1079 ) -> Self {
1080 Self(RequestBuilder::new(stub))
1081 }
1082
1083 pub fn with_request<V: Into<crate::model::CreateBackupRequest>>(mut self, v: V) -> Self {
1085 self.0.request = v.into();
1086 self
1087 }
1088
1089 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1091 self.0.options = v.into();
1092 self
1093 }
1094
1095 pub async fn send(self) -> Result<longrunning::model::Operation> {
1102 (*self.0.stub)
1103 .create_backup(self.0.request, self.0.options)
1104 .await
1105 .map(gax::response::Response::into_body)
1106 }
1107
1108 pub fn poller(
1110 self,
1111 ) -> impl lro::Poller<crate::model::Backup, crate::model::CreateBackupMetadata> {
1112 type Operation =
1113 lro::internal::Operation<crate::model::Backup, crate::model::CreateBackupMetadata>;
1114 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1115 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1116
1117 let stub = self.0.stub.clone();
1118 let mut options = self.0.options.clone();
1119 options.set_retry_policy(gax::retry_policy::NeverRetry);
1120 let query = move |name| {
1121 let stub = stub.clone();
1122 let options = options.clone();
1123 async {
1124 let op = GetOperation::new(stub)
1125 .set_name(name)
1126 .with_options(options)
1127 .send()
1128 .await?;
1129 Ok(Operation::new(op))
1130 }
1131 };
1132
1133 let start = move || async {
1134 let op = self.send().await?;
1135 Ok(Operation::new(op))
1136 };
1137
1138 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1139 }
1140
1141 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1145 self.0.request.parent = v.into();
1146 self
1147 }
1148
1149 pub fn set_backup_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1153 self.0.request.backup_id = v.into();
1154 self
1155 }
1156
1157 pub fn set_backup<T>(mut self, v: T) -> Self
1161 where
1162 T: std::convert::Into<crate::model::Backup>,
1163 {
1164 self.0.request.backup = std::option::Option::Some(v.into());
1165 self
1166 }
1167
1168 pub fn set_or_clear_backup<T>(mut self, v: std::option::Option<T>) -> Self
1172 where
1173 T: std::convert::Into<crate::model::Backup>,
1174 {
1175 self.0.request.backup = v.map(|x| x.into());
1176 self
1177 }
1178
1179 pub fn set_encryption_config<T>(mut self, v: T) -> Self
1181 where
1182 T: std::convert::Into<crate::model::CreateBackupEncryptionConfig>,
1183 {
1184 self.0.request.encryption_config = std::option::Option::Some(v.into());
1185 self
1186 }
1187
1188 pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
1190 where
1191 T: std::convert::Into<crate::model::CreateBackupEncryptionConfig>,
1192 {
1193 self.0.request.encryption_config = v.map(|x| x.into());
1194 self
1195 }
1196 }
1197
1198 #[doc(hidden)]
1199 impl gax::options::internal::RequestBuilder for CreateBackup {
1200 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1201 &mut self.0.options
1202 }
1203 }
1204
1205 #[derive(Clone, Debug)]
1223 pub struct CopyBackup(RequestBuilder<crate::model::CopyBackupRequest>);
1224
1225 impl CopyBackup {
1226 pub(crate) fn new(
1227 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1228 ) -> Self {
1229 Self(RequestBuilder::new(stub))
1230 }
1231
1232 pub fn with_request<V: Into<crate::model::CopyBackupRequest>>(mut self, v: V) -> Self {
1234 self.0.request = v.into();
1235 self
1236 }
1237
1238 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1240 self.0.options = v.into();
1241 self
1242 }
1243
1244 pub async fn send(self) -> Result<longrunning::model::Operation> {
1251 (*self.0.stub)
1252 .copy_backup(self.0.request, self.0.options)
1253 .await
1254 .map(gax::response::Response::into_body)
1255 }
1256
1257 pub fn poller(
1259 self,
1260 ) -> impl lro::Poller<crate::model::Backup, crate::model::CopyBackupMetadata> {
1261 type Operation =
1262 lro::internal::Operation<crate::model::Backup, crate::model::CopyBackupMetadata>;
1263 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1264 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1265
1266 let stub = self.0.stub.clone();
1267 let mut options = self.0.options.clone();
1268 options.set_retry_policy(gax::retry_policy::NeverRetry);
1269 let query = move |name| {
1270 let stub = stub.clone();
1271 let options = options.clone();
1272 async {
1273 let op = GetOperation::new(stub)
1274 .set_name(name)
1275 .with_options(options)
1276 .send()
1277 .await?;
1278 Ok(Operation::new(op))
1279 }
1280 };
1281
1282 let start = move || async {
1283 let op = self.send().await?;
1284 Ok(Operation::new(op))
1285 };
1286
1287 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1288 }
1289
1290 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1294 self.0.request.parent = v.into();
1295 self
1296 }
1297
1298 pub fn set_backup_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1302 self.0.request.backup_id = v.into();
1303 self
1304 }
1305
1306 pub fn set_source_backup<T: Into<std::string::String>>(mut self, v: T) -> Self {
1310 self.0.request.source_backup = v.into();
1311 self
1312 }
1313
1314 pub fn set_expire_time<T>(mut self, v: T) -> Self
1318 where
1319 T: std::convert::Into<wkt::Timestamp>,
1320 {
1321 self.0.request.expire_time = std::option::Option::Some(v.into());
1322 self
1323 }
1324
1325 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
1329 where
1330 T: std::convert::Into<wkt::Timestamp>,
1331 {
1332 self.0.request.expire_time = v.map(|x| x.into());
1333 self
1334 }
1335
1336 pub fn set_encryption_config<T>(mut self, v: T) -> Self
1338 where
1339 T: std::convert::Into<crate::model::CopyBackupEncryptionConfig>,
1340 {
1341 self.0.request.encryption_config = std::option::Option::Some(v.into());
1342 self
1343 }
1344
1345 pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
1347 where
1348 T: std::convert::Into<crate::model::CopyBackupEncryptionConfig>,
1349 {
1350 self.0.request.encryption_config = v.map(|x| x.into());
1351 self
1352 }
1353 }
1354
1355 #[doc(hidden)]
1356 impl gax::options::internal::RequestBuilder for CopyBackup {
1357 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1358 &mut self.0.options
1359 }
1360 }
1361
1362 #[derive(Clone, Debug)]
1379 pub struct GetBackup(RequestBuilder<crate::model::GetBackupRequest>);
1380
1381 impl GetBackup {
1382 pub(crate) fn new(
1383 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1384 ) -> Self {
1385 Self(RequestBuilder::new(stub))
1386 }
1387
1388 pub fn with_request<V: Into<crate::model::GetBackupRequest>>(mut self, v: V) -> Self {
1390 self.0.request = v.into();
1391 self
1392 }
1393
1394 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1396 self.0.options = v.into();
1397 self
1398 }
1399
1400 pub async fn send(self) -> Result<crate::model::Backup> {
1402 (*self.0.stub)
1403 .get_backup(self.0.request, self.0.options)
1404 .await
1405 .map(gax::response::Response::into_body)
1406 }
1407
1408 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1412 self.0.request.name = v.into();
1413 self
1414 }
1415 }
1416
1417 #[doc(hidden)]
1418 impl gax::options::internal::RequestBuilder for GetBackup {
1419 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1420 &mut self.0.options
1421 }
1422 }
1423
1424 #[derive(Clone, Debug)]
1441 pub struct UpdateBackup(RequestBuilder<crate::model::UpdateBackupRequest>);
1442
1443 impl UpdateBackup {
1444 pub(crate) fn new(
1445 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1446 ) -> Self {
1447 Self(RequestBuilder::new(stub))
1448 }
1449
1450 pub fn with_request<V: Into<crate::model::UpdateBackupRequest>>(mut self, v: V) -> Self {
1452 self.0.request = v.into();
1453 self
1454 }
1455
1456 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1458 self.0.options = v.into();
1459 self
1460 }
1461
1462 pub async fn send(self) -> Result<crate::model::Backup> {
1464 (*self.0.stub)
1465 .update_backup(self.0.request, self.0.options)
1466 .await
1467 .map(gax::response::Response::into_body)
1468 }
1469
1470 pub fn set_backup<T>(mut self, v: T) -> Self
1474 where
1475 T: std::convert::Into<crate::model::Backup>,
1476 {
1477 self.0.request.backup = std::option::Option::Some(v.into());
1478 self
1479 }
1480
1481 pub fn set_or_clear_backup<T>(mut self, v: std::option::Option<T>) -> Self
1485 where
1486 T: std::convert::Into<crate::model::Backup>,
1487 {
1488 self.0.request.backup = v.map(|x| x.into());
1489 self
1490 }
1491
1492 pub fn set_update_mask<T>(mut self, v: T) -> Self
1496 where
1497 T: std::convert::Into<wkt::FieldMask>,
1498 {
1499 self.0.request.update_mask = std::option::Option::Some(v.into());
1500 self
1501 }
1502
1503 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1507 where
1508 T: std::convert::Into<wkt::FieldMask>,
1509 {
1510 self.0.request.update_mask = v.map(|x| x.into());
1511 self
1512 }
1513 }
1514
1515 #[doc(hidden)]
1516 impl gax::options::internal::RequestBuilder for UpdateBackup {
1517 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1518 &mut self.0.options
1519 }
1520 }
1521
1522 #[derive(Clone, Debug)]
1539 pub struct DeleteBackup(RequestBuilder<crate::model::DeleteBackupRequest>);
1540
1541 impl DeleteBackup {
1542 pub(crate) fn new(
1543 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1544 ) -> Self {
1545 Self(RequestBuilder::new(stub))
1546 }
1547
1548 pub fn with_request<V: Into<crate::model::DeleteBackupRequest>>(mut self, v: V) -> Self {
1550 self.0.request = v.into();
1551 self
1552 }
1553
1554 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1556 self.0.options = v.into();
1557 self
1558 }
1559
1560 pub async fn send(self) -> Result<()> {
1562 (*self.0.stub)
1563 .delete_backup(self.0.request, self.0.options)
1564 .await
1565 .map(gax::response::Response::into_body)
1566 }
1567
1568 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1572 self.0.request.name = v.into();
1573 self
1574 }
1575 }
1576
1577 #[doc(hidden)]
1578 impl gax::options::internal::RequestBuilder for DeleteBackup {
1579 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1580 &mut self.0.options
1581 }
1582 }
1583
1584 #[derive(Clone, Debug)]
1605 pub struct ListBackups(RequestBuilder<crate::model::ListBackupsRequest>);
1606
1607 impl ListBackups {
1608 pub(crate) fn new(
1609 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1610 ) -> Self {
1611 Self(RequestBuilder::new(stub))
1612 }
1613
1614 pub fn with_request<V: Into<crate::model::ListBackupsRequest>>(mut self, v: V) -> Self {
1616 self.0.request = v.into();
1617 self
1618 }
1619
1620 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1622 self.0.options = v.into();
1623 self
1624 }
1625
1626 pub async fn send(self) -> Result<crate::model::ListBackupsResponse> {
1628 (*self.0.stub)
1629 .list_backups(self.0.request, self.0.options)
1630 .await
1631 .map(gax::response::Response::into_body)
1632 }
1633
1634 pub fn by_page(
1636 self,
1637 ) -> impl gax::paginator::Paginator<crate::model::ListBackupsResponse, gax::error::Error>
1638 {
1639 use std::clone::Clone;
1640 let token = self.0.request.page_token.clone();
1641 let execute = move |token: String| {
1642 let mut builder = self.clone();
1643 builder.0.request = builder.0.request.set_page_token(token);
1644 builder.send()
1645 };
1646 gax::paginator::internal::new_paginator(token, execute)
1647 }
1648
1649 pub fn by_item(
1651 self,
1652 ) -> impl gax::paginator::ItemPaginator<crate::model::ListBackupsResponse, gax::error::Error>
1653 {
1654 use gax::paginator::Paginator;
1655 self.by_page().items()
1656 }
1657
1658 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1662 self.0.request.parent = v.into();
1663 self
1664 }
1665
1666 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1668 self.0.request.filter = v.into();
1669 self
1670 }
1671
1672 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1674 self.0.request.page_size = v.into();
1675 self
1676 }
1677
1678 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1680 self.0.request.page_token = v.into();
1681 self
1682 }
1683 }
1684
1685 #[doc(hidden)]
1686 impl gax::options::internal::RequestBuilder for ListBackups {
1687 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1688 &mut self.0.options
1689 }
1690 }
1691
1692 #[derive(Clone, Debug)]
1710 pub struct RestoreDatabase(RequestBuilder<crate::model::RestoreDatabaseRequest>);
1711
1712 impl RestoreDatabase {
1713 pub(crate) fn new(
1714 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1715 ) -> Self {
1716 Self(RequestBuilder::new(stub))
1717 }
1718
1719 pub fn with_request<V: Into<crate::model::RestoreDatabaseRequest>>(mut self, v: V) -> Self {
1721 self.0.request = v.into();
1722 self
1723 }
1724
1725 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1727 self.0.options = v.into();
1728 self
1729 }
1730
1731 pub async fn send(self) -> Result<longrunning::model::Operation> {
1738 (*self.0.stub)
1739 .restore_database(self.0.request, self.0.options)
1740 .await
1741 .map(gax::response::Response::into_body)
1742 }
1743
1744 pub fn poller(
1746 self,
1747 ) -> impl lro::Poller<crate::model::Database, crate::model::RestoreDatabaseMetadata>
1748 {
1749 type Operation = lro::internal::Operation<
1750 crate::model::Database,
1751 crate::model::RestoreDatabaseMetadata,
1752 >;
1753 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1754 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1755
1756 let stub = self.0.stub.clone();
1757 let mut options = self.0.options.clone();
1758 options.set_retry_policy(gax::retry_policy::NeverRetry);
1759 let query = move |name| {
1760 let stub = stub.clone();
1761 let options = options.clone();
1762 async {
1763 let op = GetOperation::new(stub)
1764 .set_name(name)
1765 .with_options(options)
1766 .send()
1767 .await?;
1768 Ok(Operation::new(op))
1769 }
1770 };
1771
1772 let start = move || async {
1773 let op = self.send().await?;
1774 Ok(Operation::new(op))
1775 };
1776
1777 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1778 }
1779
1780 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1784 self.0.request.parent = v.into();
1785 self
1786 }
1787
1788 pub fn set_database_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1792 self.0.request.database_id = v.into();
1793 self
1794 }
1795
1796 pub fn set_encryption_config<T>(mut self, v: T) -> Self
1798 where
1799 T: std::convert::Into<crate::model::RestoreDatabaseEncryptionConfig>,
1800 {
1801 self.0.request.encryption_config = std::option::Option::Some(v.into());
1802 self
1803 }
1804
1805 pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
1807 where
1808 T: std::convert::Into<crate::model::RestoreDatabaseEncryptionConfig>,
1809 {
1810 self.0.request.encryption_config = v.map(|x| x.into());
1811 self
1812 }
1813
1814 pub fn set_source<T: Into<Option<crate::model::restore_database_request::Source>>>(
1819 mut self,
1820 v: T,
1821 ) -> Self {
1822 self.0.request.source = v.into();
1823 self
1824 }
1825
1826 pub fn set_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1832 self.0.request = self.0.request.set_backup(v);
1833 self
1834 }
1835 }
1836
1837 #[doc(hidden)]
1838 impl gax::options::internal::RequestBuilder for RestoreDatabase {
1839 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1840 &mut self.0.options
1841 }
1842 }
1843
1844 #[derive(Clone, Debug)]
1865 pub struct ListDatabaseOperations(RequestBuilder<crate::model::ListDatabaseOperationsRequest>);
1866
1867 impl ListDatabaseOperations {
1868 pub(crate) fn new(
1869 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1870 ) -> Self {
1871 Self(RequestBuilder::new(stub))
1872 }
1873
1874 pub fn with_request<V: Into<crate::model::ListDatabaseOperationsRequest>>(
1876 mut self,
1877 v: V,
1878 ) -> Self {
1879 self.0.request = v.into();
1880 self
1881 }
1882
1883 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1885 self.0.options = v.into();
1886 self
1887 }
1888
1889 pub async fn send(self) -> Result<crate::model::ListDatabaseOperationsResponse> {
1891 (*self.0.stub)
1892 .list_database_operations(self.0.request, self.0.options)
1893 .await
1894 .map(gax::response::Response::into_body)
1895 }
1896
1897 pub fn by_page(
1899 self,
1900 ) -> impl gax::paginator::Paginator<
1901 crate::model::ListDatabaseOperationsResponse,
1902 gax::error::Error,
1903 > {
1904 use std::clone::Clone;
1905 let token = self.0.request.page_token.clone();
1906 let execute = move |token: String| {
1907 let mut builder = self.clone();
1908 builder.0.request = builder.0.request.set_page_token(token);
1909 builder.send()
1910 };
1911 gax::paginator::internal::new_paginator(token, execute)
1912 }
1913
1914 pub fn by_item(
1916 self,
1917 ) -> impl gax::paginator::ItemPaginator<
1918 crate::model::ListDatabaseOperationsResponse,
1919 gax::error::Error,
1920 > {
1921 use gax::paginator::Paginator;
1922 self.by_page().items()
1923 }
1924
1925 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1929 self.0.request.parent = v.into();
1930 self
1931 }
1932
1933 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1935 self.0.request.filter = v.into();
1936 self
1937 }
1938
1939 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1941 self.0.request.page_size = v.into();
1942 self
1943 }
1944
1945 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1947 self.0.request.page_token = v.into();
1948 self
1949 }
1950 }
1951
1952 #[doc(hidden)]
1953 impl gax::options::internal::RequestBuilder for ListDatabaseOperations {
1954 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1955 &mut self.0.options
1956 }
1957 }
1958
1959 #[derive(Clone, Debug)]
1980 pub struct ListBackupOperations(RequestBuilder<crate::model::ListBackupOperationsRequest>);
1981
1982 impl ListBackupOperations {
1983 pub(crate) fn new(
1984 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1985 ) -> Self {
1986 Self(RequestBuilder::new(stub))
1987 }
1988
1989 pub fn with_request<V: Into<crate::model::ListBackupOperationsRequest>>(
1991 mut self,
1992 v: V,
1993 ) -> Self {
1994 self.0.request = v.into();
1995 self
1996 }
1997
1998 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2000 self.0.options = v.into();
2001 self
2002 }
2003
2004 pub async fn send(self) -> Result<crate::model::ListBackupOperationsResponse> {
2006 (*self.0.stub)
2007 .list_backup_operations(self.0.request, self.0.options)
2008 .await
2009 .map(gax::response::Response::into_body)
2010 }
2011
2012 pub fn by_page(
2014 self,
2015 ) -> impl gax::paginator::Paginator<crate::model::ListBackupOperationsResponse, gax::error::Error>
2016 {
2017 use std::clone::Clone;
2018 let token = self.0.request.page_token.clone();
2019 let execute = move |token: String| {
2020 let mut builder = self.clone();
2021 builder.0.request = builder.0.request.set_page_token(token);
2022 builder.send()
2023 };
2024 gax::paginator::internal::new_paginator(token, execute)
2025 }
2026
2027 pub fn by_item(
2029 self,
2030 ) -> impl gax::paginator::ItemPaginator<
2031 crate::model::ListBackupOperationsResponse,
2032 gax::error::Error,
2033 > {
2034 use gax::paginator::Paginator;
2035 self.by_page().items()
2036 }
2037
2038 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2042 self.0.request.parent = v.into();
2043 self
2044 }
2045
2046 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2048 self.0.request.filter = v.into();
2049 self
2050 }
2051
2052 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2054 self.0.request.page_size = v.into();
2055 self
2056 }
2057
2058 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2060 self.0.request.page_token = v.into();
2061 self
2062 }
2063 }
2064
2065 #[doc(hidden)]
2066 impl gax::options::internal::RequestBuilder for ListBackupOperations {
2067 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2068 &mut self.0.options
2069 }
2070 }
2071
2072 #[derive(Clone, Debug)]
2093 pub struct ListDatabaseRoles(RequestBuilder<crate::model::ListDatabaseRolesRequest>);
2094
2095 impl ListDatabaseRoles {
2096 pub(crate) fn new(
2097 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2098 ) -> Self {
2099 Self(RequestBuilder::new(stub))
2100 }
2101
2102 pub fn with_request<V: Into<crate::model::ListDatabaseRolesRequest>>(
2104 mut self,
2105 v: V,
2106 ) -> Self {
2107 self.0.request = v.into();
2108 self
2109 }
2110
2111 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2113 self.0.options = v.into();
2114 self
2115 }
2116
2117 pub async fn send(self) -> Result<crate::model::ListDatabaseRolesResponse> {
2119 (*self.0.stub)
2120 .list_database_roles(self.0.request, self.0.options)
2121 .await
2122 .map(gax::response::Response::into_body)
2123 }
2124
2125 pub fn by_page(
2127 self,
2128 ) -> impl gax::paginator::Paginator<crate::model::ListDatabaseRolesResponse, gax::error::Error>
2129 {
2130 use std::clone::Clone;
2131 let token = self.0.request.page_token.clone();
2132 let execute = move |token: String| {
2133 let mut builder = self.clone();
2134 builder.0.request = builder.0.request.set_page_token(token);
2135 builder.send()
2136 };
2137 gax::paginator::internal::new_paginator(token, execute)
2138 }
2139
2140 pub fn by_item(
2142 self,
2143 ) -> impl gax::paginator::ItemPaginator<crate::model::ListDatabaseRolesResponse, gax::error::Error>
2144 {
2145 use gax::paginator::Paginator;
2146 self.by_page().items()
2147 }
2148
2149 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2153 self.0.request.parent = v.into();
2154 self
2155 }
2156
2157 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2159 self.0.request.page_size = v.into();
2160 self
2161 }
2162
2163 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2165 self.0.request.page_token = v.into();
2166 self
2167 }
2168 }
2169
2170 #[doc(hidden)]
2171 impl gax::options::internal::RequestBuilder for ListDatabaseRoles {
2172 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2173 &mut self.0.options
2174 }
2175 }
2176
2177 #[derive(Clone, Debug)]
2194 pub struct AddSplitPoints(RequestBuilder<crate::model::AddSplitPointsRequest>);
2195
2196 impl AddSplitPoints {
2197 pub(crate) fn new(
2198 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2199 ) -> Self {
2200 Self(RequestBuilder::new(stub))
2201 }
2202
2203 pub fn with_request<V: Into<crate::model::AddSplitPointsRequest>>(mut self, v: V) -> Self {
2205 self.0.request = v.into();
2206 self
2207 }
2208
2209 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2211 self.0.options = v.into();
2212 self
2213 }
2214
2215 pub async fn send(self) -> Result<crate::model::AddSplitPointsResponse> {
2217 (*self.0.stub)
2218 .add_split_points(self.0.request, self.0.options)
2219 .await
2220 .map(gax::response::Response::into_body)
2221 }
2222
2223 pub fn set_database<T: Into<std::string::String>>(mut self, v: T) -> Self {
2227 self.0.request.database = v.into();
2228 self
2229 }
2230
2231 pub fn set_split_points<T, V>(mut self, v: T) -> Self
2235 where
2236 T: std::iter::IntoIterator<Item = V>,
2237 V: std::convert::Into<crate::model::SplitPoints>,
2238 {
2239 use std::iter::Iterator;
2240 self.0.request.split_points = v.into_iter().map(|i| i.into()).collect();
2241 self
2242 }
2243
2244 pub fn set_initiator<T: Into<std::string::String>>(mut self, v: T) -> Self {
2246 self.0.request.initiator = v.into();
2247 self
2248 }
2249 }
2250
2251 #[doc(hidden)]
2252 impl gax::options::internal::RequestBuilder for AddSplitPoints {
2253 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2254 &mut self.0.options
2255 }
2256 }
2257
2258 #[derive(Clone, Debug)]
2275 pub struct CreateBackupSchedule(RequestBuilder<crate::model::CreateBackupScheduleRequest>);
2276
2277 impl CreateBackupSchedule {
2278 pub(crate) fn new(
2279 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2280 ) -> Self {
2281 Self(RequestBuilder::new(stub))
2282 }
2283
2284 pub fn with_request<V: Into<crate::model::CreateBackupScheduleRequest>>(
2286 mut self,
2287 v: V,
2288 ) -> Self {
2289 self.0.request = v.into();
2290 self
2291 }
2292
2293 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2295 self.0.options = v.into();
2296 self
2297 }
2298
2299 pub async fn send(self) -> Result<crate::model::BackupSchedule> {
2301 (*self.0.stub)
2302 .create_backup_schedule(self.0.request, self.0.options)
2303 .await
2304 .map(gax::response::Response::into_body)
2305 }
2306
2307 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2311 self.0.request.parent = v.into();
2312 self
2313 }
2314
2315 pub fn set_backup_schedule_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2319 self.0.request.backup_schedule_id = v.into();
2320 self
2321 }
2322
2323 pub fn set_backup_schedule<T>(mut self, v: T) -> Self
2327 where
2328 T: std::convert::Into<crate::model::BackupSchedule>,
2329 {
2330 self.0.request.backup_schedule = std::option::Option::Some(v.into());
2331 self
2332 }
2333
2334 pub fn set_or_clear_backup_schedule<T>(mut self, v: std::option::Option<T>) -> Self
2338 where
2339 T: std::convert::Into<crate::model::BackupSchedule>,
2340 {
2341 self.0.request.backup_schedule = v.map(|x| x.into());
2342 self
2343 }
2344 }
2345
2346 #[doc(hidden)]
2347 impl gax::options::internal::RequestBuilder for CreateBackupSchedule {
2348 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2349 &mut self.0.options
2350 }
2351 }
2352
2353 #[derive(Clone, Debug)]
2370 pub struct GetBackupSchedule(RequestBuilder<crate::model::GetBackupScheduleRequest>);
2371
2372 impl GetBackupSchedule {
2373 pub(crate) fn new(
2374 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2375 ) -> Self {
2376 Self(RequestBuilder::new(stub))
2377 }
2378
2379 pub fn with_request<V: Into<crate::model::GetBackupScheduleRequest>>(
2381 mut self,
2382 v: V,
2383 ) -> Self {
2384 self.0.request = v.into();
2385 self
2386 }
2387
2388 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2390 self.0.options = v.into();
2391 self
2392 }
2393
2394 pub async fn send(self) -> Result<crate::model::BackupSchedule> {
2396 (*self.0.stub)
2397 .get_backup_schedule(self.0.request, self.0.options)
2398 .await
2399 .map(gax::response::Response::into_body)
2400 }
2401
2402 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2406 self.0.request.name = v.into();
2407 self
2408 }
2409 }
2410
2411 #[doc(hidden)]
2412 impl gax::options::internal::RequestBuilder for GetBackupSchedule {
2413 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2414 &mut self.0.options
2415 }
2416 }
2417
2418 #[derive(Clone, Debug)]
2435 pub struct UpdateBackupSchedule(RequestBuilder<crate::model::UpdateBackupScheduleRequest>);
2436
2437 impl UpdateBackupSchedule {
2438 pub(crate) fn new(
2439 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2440 ) -> Self {
2441 Self(RequestBuilder::new(stub))
2442 }
2443
2444 pub fn with_request<V: Into<crate::model::UpdateBackupScheduleRequest>>(
2446 mut self,
2447 v: V,
2448 ) -> Self {
2449 self.0.request = v.into();
2450 self
2451 }
2452
2453 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2455 self.0.options = v.into();
2456 self
2457 }
2458
2459 pub async fn send(self) -> Result<crate::model::BackupSchedule> {
2461 (*self.0.stub)
2462 .update_backup_schedule(self.0.request, self.0.options)
2463 .await
2464 .map(gax::response::Response::into_body)
2465 }
2466
2467 pub fn set_backup_schedule<T>(mut self, v: T) -> Self
2471 where
2472 T: std::convert::Into<crate::model::BackupSchedule>,
2473 {
2474 self.0.request.backup_schedule = std::option::Option::Some(v.into());
2475 self
2476 }
2477
2478 pub fn set_or_clear_backup_schedule<T>(mut self, v: std::option::Option<T>) -> Self
2482 where
2483 T: std::convert::Into<crate::model::BackupSchedule>,
2484 {
2485 self.0.request.backup_schedule = v.map(|x| x.into());
2486 self
2487 }
2488
2489 pub fn set_update_mask<T>(mut self, v: T) -> Self
2493 where
2494 T: std::convert::Into<wkt::FieldMask>,
2495 {
2496 self.0.request.update_mask = std::option::Option::Some(v.into());
2497 self
2498 }
2499
2500 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2504 where
2505 T: std::convert::Into<wkt::FieldMask>,
2506 {
2507 self.0.request.update_mask = v.map(|x| x.into());
2508 self
2509 }
2510 }
2511
2512 #[doc(hidden)]
2513 impl gax::options::internal::RequestBuilder for UpdateBackupSchedule {
2514 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2515 &mut self.0.options
2516 }
2517 }
2518
2519 #[derive(Clone, Debug)]
2536 pub struct DeleteBackupSchedule(RequestBuilder<crate::model::DeleteBackupScheduleRequest>);
2537
2538 impl DeleteBackupSchedule {
2539 pub(crate) fn new(
2540 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2541 ) -> Self {
2542 Self(RequestBuilder::new(stub))
2543 }
2544
2545 pub fn with_request<V: Into<crate::model::DeleteBackupScheduleRequest>>(
2547 mut self,
2548 v: V,
2549 ) -> Self {
2550 self.0.request = v.into();
2551 self
2552 }
2553
2554 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2556 self.0.options = v.into();
2557 self
2558 }
2559
2560 pub async fn send(self) -> Result<()> {
2562 (*self.0.stub)
2563 .delete_backup_schedule(self.0.request, self.0.options)
2564 .await
2565 .map(gax::response::Response::into_body)
2566 }
2567
2568 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2572 self.0.request.name = v.into();
2573 self
2574 }
2575 }
2576
2577 #[doc(hidden)]
2578 impl gax::options::internal::RequestBuilder for DeleteBackupSchedule {
2579 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2580 &mut self.0.options
2581 }
2582 }
2583
2584 #[derive(Clone, Debug)]
2605 pub struct ListBackupSchedules(RequestBuilder<crate::model::ListBackupSchedulesRequest>);
2606
2607 impl ListBackupSchedules {
2608 pub(crate) fn new(
2609 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2610 ) -> Self {
2611 Self(RequestBuilder::new(stub))
2612 }
2613
2614 pub fn with_request<V: Into<crate::model::ListBackupSchedulesRequest>>(
2616 mut self,
2617 v: V,
2618 ) -> Self {
2619 self.0.request = v.into();
2620 self
2621 }
2622
2623 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2625 self.0.options = v.into();
2626 self
2627 }
2628
2629 pub async fn send(self) -> Result<crate::model::ListBackupSchedulesResponse> {
2631 (*self.0.stub)
2632 .list_backup_schedules(self.0.request, self.0.options)
2633 .await
2634 .map(gax::response::Response::into_body)
2635 }
2636
2637 pub fn by_page(
2639 self,
2640 ) -> impl gax::paginator::Paginator<crate::model::ListBackupSchedulesResponse, gax::error::Error>
2641 {
2642 use std::clone::Clone;
2643 let token = self.0.request.page_token.clone();
2644 let execute = move |token: String| {
2645 let mut builder = self.clone();
2646 builder.0.request = builder.0.request.set_page_token(token);
2647 builder.send()
2648 };
2649 gax::paginator::internal::new_paginator(token, execute)
2650 }
2651
2652 pub fn by_item(
2654 self,
2655 ) -> impl gax::paginator::ItemPaginator<
2656 crate::model::ListBackupSchedulesResponse,
2657 gax::error::Error,
2658 > {
2659 use gax::paginator::Paginator;
2660 self.by_page().items()
2661 }
2662
2663 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2667 self.0.request.parent = v.into();
2668 self
2669 }
2670
2671 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2673 self.0.request.page_size = v.into();
2674 self
2675 }
2676
2677 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2679 self.0.request.page_token = v.into();
2680 self
2681 }
2682 }
2683
2684 #[doc(hidden)]
2685 impl gax::options::internal::RequestBuilder for ListBackupSchedules {
2686 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2687 &mut self.0.options
2688 }
2689 }
2690
2691 #[derive(Clone, Debug)]
2712 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2713
2714 impl ListOperations {
2715 pub(crate) fn new(
2716 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2717 ) -> Self {
2718 Self(RequestBuilder::new(stub))
2719 }
2720
2721 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2723 mut self,
2724 v: V,
2725 ) -> Self {
2726 self.0.request = v.into();
2727 self
2728 }
2729
2730 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2732 self.0.options = v.into();
2733 self
2734 }
2735
2736 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2738 (*self.0.stub)
2739 .list_operations(self.0.request, self.0.options)
2740 .await
2741 .map(gax::response::Response::into_body)
2742 }
2743
2744 pub fn by_page(
2746 self,
2747 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2748 {
2749 use std::clone::Clone;
2750 let token = self.0.request.page_token.clone();
2751 let execute = move |token: String| {
2752 let mut builder = self.clone();
2753 builder.0.request = builder.0.request.set_page_token(token);
2754 builder.send()
2755 };
2756 gax::paginator::internal::new_paginator(token, execute)
2757 }
2758
2759 pub fn by_item(
2761 self,
2762 ) -> impl gax::paginator::ItemPaginator<
2763 longrunning::model::ListOperationsResponse,
2764 gax::error::Error,
2765 > {
2766 use gax::paginator::Paginator;
2767 self.by_page().items()
2768 }
2769
2770 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2772 self.0.request.name = v.into();
2773 self
2774 }
2775
2776 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2778 self.0.request.filter = v.into();
2779 self
2780 }
2781
2782 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2784 self.0.request.page_size = v.into();
2785 self
2786 }
2787
2788 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2790 self.0.request.page_token = v.into();
2791 self
2792 }
2793
2794 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2796 self.0.request.return_partial_success = v.into();
2797 self
2798 }
2799 }
2800
2801 #[doc(hidden)]
2802 impl gax::options::internal::RequestBuilder for ListOperations {
2803 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2804 &mut self.0.options
2805 }
2806 }
2807
2808 #[derive(Clone, Debug)]
2825 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2826
2827 impl GetOperation {
2828 pub(crate) fn new(
2829 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2830 ) -> Self {
2831 Self(RequestBuilder::new(stub))
2832 }
2833
2834 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2836 mut self,
2837 v: V,
2838 ) -> Self {
2839 self.0.request = v.into();
2840 self
2841 }
2842
2843 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2845 self.0.options = v.into();
2846 self
2847 }
2848
2849 pub async fn send(self) -> Result<longrunning::model::Operation> {
2851 (*self.0.stub)
2852 .get_operation(self.0.request, self.0.options)
2853 .await
2854 .map(gax::response::Response::into_body)
2855 }
2856
2857 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2859 self.0.request.name = v.into();
2860 self
2861 }
2862 }
2863
2864 #[doc(hidden)]
2865 impl gax::options::internal::RequestBuilder for GetOperation {
2866 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2867 &mut self.0.options
2868 }
2869 }
2870
2871 #[derive(Clone, Debug)]
2888 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2889
2890 impl DeleteOperation {
2891 pub(crate) fn new(
2892 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2893 ) -> Self {
2894 Self(RequestBuilder::new(stub))
2895 }
2896
2897 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2899 mut self,
2900 v: V,
2901 ) -> Self {
2902 self.0.request = v.into();
2903 self
2904 }
2905
2906 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2908 self.0.options = v.into();
2909 self
2910 }
2911
2912 pub async fn send(self) -> Result<()> {
2914 (*self.0.stub)
2915 .delete_operation(self.0.request, self.0.options)
2916 .await
2917 .map(gax::response::Response::into_body)
2918 }
2919
2920 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2922 self.0.request.name = v.into();
2923 self
2924 }
2925 }
2926
2927 #[doc(hidden)]
2928 impl gax::options::internal::RequestBuilder for DeleteOperation {
2929 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2930 &mut self.0.options
2931 }
2932 }
2933
2934 #[derive(Clone, Debug)]
2951 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2952
2953 impl CancelOperation {
2954 pub(crate) fn new(
2955 stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2956 ) -> Self {
2957 Self(RequestBuilder::new(stub))
2958 }
2959
2960 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2962 mut self,
2963 v: V,
2964 ) -> Self {
2965 self.0.request = v.into();
2966 self
2967 }
2968
2969 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2971 self.0.options = v.into();
2972 self
2973 }
2974
2975 pub async fn send(self) -> Result<()> {
2977 (*self.0.stub)
2978 .cancel_operation(self.0.request, self.0.options)
2979 .await
2980 .map(gax::response::Response::into_body)
2981 }
2982
2983 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2985 self.0.request.name = v.into();
2986 self
2987 }
2988 }
2989
2990 #[doc(hidden)]
2991 impl gax::options::internal::RequestBuilder for CancelOperation {
2992 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2993 &mut self.0.options
2994 }
2995 }
2996}