1pub mod cloud_redis_cluster {
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::CloudRedisCluster;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = CloudRedisCluster;
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::CloudRedisCluster>,
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::CloudRedisCluster>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: gax::options::RequestOptions::default(),
70 }
71 }
72 }
73
74 #[derive(Clone, Debug)]
96 pub struct ListClusters(RequestBuilder<crate::model::ListClustersRequest>);
97
98 impl ListClusters {
99 pub(crate) fn new(
100 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
101 ) -> Self {
102 Self(RequestBuilder::new(stub))
103 }
104
105 pub fn with_request<V: Into<crate::model::ListClustersRequest>>(mut self, v: V) -> Self {
107 self.0.request = v.into();
108 self
109 }
110
111 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
113 self.0.options = v.into();
114 self
115 }
116
117 pub async fn send(self) -> Result<crate::model::ListClustersResponse> {
119 (*self.0.stub)
120 .list_clusters(self.0.request, self.0.options)
121 .await
122 .map(gax::response::Response::into_body)
123 }
124
125 pub fn by_page(
127 self,
128 ) -> impl gax::paginator::Paginator<crate::model::ListClustersResponse, gax::error::Error>
129 {
130 use std::clone::Clone;
131 let token = self.0.request.page_token.clone();
132 let execute = move |token: String| {
133 let mut builder = self.clone();
134 builder.0.request = builder.0.request.set_page_token(token);
135 builder.send()
136 };
137 gax::paginator::internal::new_paginator(token, execute)
138 }
139
140 pub fn by_item(
142 self,
143 ) -> impl gax::paginator::ItemPaginator<crate::model::ListClustersResponse, gax::error::Error>
144 {
145 use gax::paginator::Paginator;
146 self.by_page().items()
147 }
148
149 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
153 self.0.request.parent = v.into();
154 self
155 }
156
157 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
159 self.0.request.page_size = v.into();
160 self
161 }
162
163 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
165 self.0.request.page_token = v.into();
166 self
167 }
168 }
169
170 #[doc(hidden)]
171 impl gax::options::internal::RequestBuilder for ListClusters {
172 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
173 &mut self.0.options
174 }
175 }
176
177 #[derive(Clone, Debug)]
195 pub struct GetCluster(RequestBuilder<crate::model::GetClusterRequest>);
196
197 impl GetCluster {
198 pub(crate) fn new(
199 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
200 ) -> Self {
201 Self(RequestBuilder::new(stub))
202 }
203
204 pub fn with_request<V: Into<crate::model::GetClusterRequest>>(mut self, v: V) -> Self {
206 self.0.request = v.into();
207 self
208 }
209
210 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
212 self.0.options = v.into();
213 self
214 }
215
216 pub async fn send(self) -> Result<crate::model::Cluster> {
218 (*self.0.stub)
219 .get_cluster(self.0.request, self.0.options)
220 .await
221 .map(gax::response::Response::into_body)
222 }
223
224 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
228 self.0.request.name = v.into();
229 self
230 }
231 }
232
233 #[doc(hidden)]
234 impl gax::options::internal::RequestBuilder for GetCluster {
235 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
236 &mut self.0.options
237 }
238 }
239
240 #[derive(Clone, Debug)]
259 pub struct UpdateCluster(RequestBuilder<crate::model::UpdateClusterRequest>);
260
261 impl UpdateCluster {
262 pub(crate) fn new(
263 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
264 ) -> Self {
265 Self(RequestBuilder::new(stub))
266 }
267
268 pub fn with_request<V: Into<crate::model::UpdateClusterRequest>>(mut self, v: V) -> Self {
270 self.0.request = v.into();
271 self
272 }
273
274 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
276 self.0.options = v.into();
277 self
278 }
279
280 pub async fn send(self) -> Result<longrunning::model::Operation> {
287 (*self.0.stub)
288 .update_cluster(self.0.request, self.0.options)
289 .await
290 .map(gax::response::Response::into_body)
291 }
292
293 pub fn poller(self) -> impl lro::Poller<crate::model::Cluster, wkt::Any> {
295 type Operation = lro::internal::Operation<crate::model::Cluster, wkt::Any>;
296 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
297 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
298
299 let stub = self.0.stub.clone();
300 let mut options = self.0.options.clone();
301 options.set_retry_policy(gax::retry_policy::NeverRetry);
302 let query = move |name| {
303 let stub = stub.clone();
304 let options = options.clone();
305 async {
306 let op = GetOperation::new(stub)
307 .set_name(name)
308 .with_options(options)
309 .send()
310 .await?;
311 Ok(Operation::new(op))
312 }
313 };
314
315 let start = move || async {
316 let op = self.send().await?;
317 Ok(Operation::new(op))
318 };
319
320 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
321 }
322
323 pub fn set_update_mask<T>(mut self, v: T) -> Self
327 where
328 T: std::convert::Into<wkt::FieldMask>,
329 {
330 self.0.request.update_mask = std::option::Option::Some(v.into());
331 self
332 }
333
334 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
338 where
339 T: std::convert::Into<wkt::FieldMask>,
340 {
341 self.0.request.update_mask = v.map(|x| x.into());
342 self
343 }
344
345 pub fn set_cluster<T>(mut self, v: T) -> Self
349 where
350 T: std::convert::Into<crate::model::Cluster>,
351 {
352 self.0.request.cluster = std::option::Option::Some(v.into());
353 self
354 }
355
356 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
360 where
361 T: std::convert::Into<crate::model::Cluster>,
362 {
363 self.0.request.cluster = v.map(|x| x.into());
364 self
365 }
366
367 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
369 self.0.request.request_id = v.into();
370 self
371 }
372 }
373
374 #[doc(hidden)]
375 impl gax::options::internal::RequestBuilder for UpdateCluster {
376 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
377 &mut self.0.options
378 }
379 }
380
381 #[derive(Clone, Debug)]
400 pub struct DeleteCluster(RequestBuilder<crate::model::DeleteClusterRequest>);
401
402 impl DeleteCluster {
403 pub(crate) fn new(
404 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
405 ) -> Self {
406 Self(RequestBuilder::new(stub))
407 }
408
409 pub fn with_request<V: Into<crate::model::DeleteClusterRequest>>(mut self, v: V) -> Self {
411 self.0.request = v.into();
412 self
413 }
414
415 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
417 self.0.options = v.into();
418 self
419 }
420
421 pub async fn send(self) -> Result<longrunning::model::Operation> {
428 (*self.0.stub)
429 .delete_cluster(self.0.request, self.0.options)
430 .await
431 .map(gax::response::Response::into_body)
432 }
433
434 pub fn poller(self) -> impl lro::Poller<(), wkt::Any> {
436 type Operation = lro::internal::Operation<wkt::Empty, wkt::Any>;
437 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
438 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
439
440 let stub = self.0.stub.clone();
441 let mut options = self.0.options.clone();
442 options.set_retry_policy(gax::retry_policy::NeverRetry);
443 let query = move |name| {
444 let stub = stub.clone();
445 let options = options.clone();
446 async {
447 let op = GetOperation::new(stub)
448 .set_name(name)
449 .with_options(options)
450 .send()
451 .await?;
452 Ok(Operation::new(op))
453 }
454 };
455
456 let start = move || async {
457 let op = self.send().await?;
458 Ok(Operation::new(op))
459 };
460
461 lro::internal::new_unit_response_poller(
462 polling_error_policy,
463 polling_backoff_policy,
464 start,
465 query,
466 )
467 }
468
469 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
473 self.0.request.name = v.into();
474 self
475 }
476
477 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
479 self.0.request.request_id = v.into();
480 self
481 }
482 }
483
484 #[doc(hidden)]
485 impl gax::options::internal::RequestBuilder for DeleteCluster {
486 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
487 &mut self.0.options
488 }
489 }
490
491 #[derive(Clone, Debug)]
510 pub struct CreateCluster(RequestBuilder<crate::model::CreateClusterRequest>);
511
512 impl CreateCluster {
513 pub(crate) fn new(
514 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
515 ) -> Self {
516 Self(RequestBuilder::new(stub))
517 }
518
519 pub fn with_request<V: Into<crate::model::CreateClusterRequest>>(mut self, v: V) -> Self {
521 self.0.request = v.into();
522 self
523 }
524
525 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
527 self.0.options = v.into();
528 self
529 }
530
531 pub async fn send(self) -> Result<longrunning::model::Operation> {
538 (*self.0.stub)
539 .create_cluster(self.0.request, self.0.options)
540 .await
541 .map(gax::response::Response::into_body)
542 }
543
544 pub fn poller(self) -> impl lro::Poller<crate::model::Cluster, wkt::Any> {
546 type Operation = lro::internal::Operation<crate::model::Cluster, wkt::Any>;
547 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
548 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
549
550 let stub = self.0.stub.clone();
551 let mut options = self.0.options.clone();
552 options.set_retry_policy(gax::retry_policy::NeverRetry);
553 let query = move |name| {
554 let stub = stub.clone();
555 let options = options.clone();
556 async {
557 let op = GetOperation::new(stub)
558 .set_name(name)
559 .with_options(options)
560 .send()
561 .await?;
562 Ok(Operation::new(op))
563 }
564 };
565
566 let start = move || async {
567 let op = self.send().await?;
568 Ok(Operation::new(op))
569 };
570
571 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
572 }
573
574 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
578 self.0.request.parent = v.into();
579 self
580 }
581
582 pub fn set_cluster_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
586 self.0.request.cluster_id = v.into();
587 self
588 }
589
590 pub fn set_cluster<T>(mut self, v: T) -> Self
594 where
595 T: std::convert::Into<crate::model::Cluster>,
596 {
597 self.0.request.cluster = std::option::Option::Some(v.into());
598 self
599 }
600
601 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
605 where
606 T: std::convert::Into<crate::model::Cluster>,
607 {
608 self.0.request.cluster = v.map(|x| x.into());
609 self
610 }
611
612 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
614 self.0.request.request_id = v.into();
615 self
616 }
617 }
618
619 #[doc(hidden)]
620 impl gax::options::internal::RequestBuilder for CreateCluster {
621 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
622 &mut self.0.options
623 }
624 }
625
626 #[derive(Clone, Debug)]
644 pub struct GetClusterCertificateAuthority(
645 RequestBuilder<crate::model::GetClusterCertificateAuthorityRequest>,
646 );
647
648 impl GetClusterCertificateAuthority {
649 pub(crate) fn new(
650 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
651 ) -> Self {
652 Self(RequestBuilder::new(stub))
653 }
654
655 pub fn with_request<V: Into<crate::model::GetClusterCertificateAuthorityRequest>>(
657 mut self,
658 v: V,
659 ) -> Self {
660 self.0.request = v.into();
661 self
662 }
663
664 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
666 self.0.options = v.into();
667 self
668 }
669
670 pub async fn send(self) -> Result<crate::model::CertificateAuthority> {
672 (*self.0.stub)
673 .get_cluster_certificate_authority(self.0.request, self.0.options)
674 .await
675 .map(gax::response::Response::into_body)
676 }
677
678 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
682 self.0.request.name = v.into();
683 self
684 }
685 }
686
687 #[doc(hidden)]
688 impl gax::options::internal::RequestBuilder for GetClusterCertificateAuthority {
689 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
690 &mut self.0.options
691 }
692 }
693
694 #[derive(Clone, Debug)]
713 pub struct RescheduleClusterMaintenance(
714 RequestBuilder<crate::model::RescheduleClusterMaintenanceRequest>,
715 );
716
717 impl RescheduleClusterMaintenance {
718 pub(crate) fn new(
719 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
720 ) -> Self {
721 Self(RequestBuilder::new(stub))
722 }
723
724 pub fn with_request<V: Into<crate::model::RescheduleClusterMaintenanceRequest>>(
726 mut self,
727 v: V,
728 ) -> Self {
729 self.0.request = v.into();
730 self
731 }
732
733 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
735 self.0.options = v.into();
736 self
737 }
738
739 pub async fn send(self) -> Result<longrunning::model::Operation> {
746 (*self.0.stub)
747 .reschedule_cluster_maintenance(self.0.request, self.0.options)
748 .await
749 .map(gax::response::Response::into_body)
750 }
751
752 pub fn poller(self) -> impl lro::Poller<crate::model::Cluster, wkt::Any> {
754 type Operation = lro::internal::Operation<crate::model::Cluster, wkt::Any>;
755 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
756 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
757
758 let stub = self.0.stub.clone();
759 let mut options = self.0.options.clone();
760 options.set_retry_policy(gax::retry_policy::NeverRetry);
761 let query = move |name| {
762 let stub = stub.clone();
763 let options = options.clone();
764 async {
765 let op = GetOperation::new(stub)
766 .set_name(name)
767 .with_options(options)
768 .send()
769 .await?;
770 Ok(Operation::new(op))
771 }
772 };
773
774 let start = move || async {
775 let op = self.send().await?;
776 Ok(Operation::new(op))
777 };
778
779 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
780 }
781
782 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
786 self.0.request.name = v.into();
787 self
788 }
789
790 pub fn set_reschedule_type<
794 T: Into<crate::model::reschedule_cluster_maintenance_request::RescheduleType>,
795 >(
796 mut self,
797 v: T,
798 ) -> Self {
799 self.0.request.reschedule_type = v.into();
800 self
801 }
802
803 pub fn set_schedule_time<T>(mut self, v: T) -> Self
805 where
806 T: std::convert::Into<wkt::Timestamp>,
807 {
808 self.0.request.schedule_time = std::option::Option::Some(v.into());
809 self
810 }
811
812 pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
814 where
815 T: std::convert::Into<wkt::Timestamp>,
816 {
817 self.0.request.schedule_time = v.map(|x| x.into());
818 self
819 }
820 }
821
822 #[doc(hidden)]
823 impl gax::options::internal::RequestBuilder for RescheduleClusterMaintenance {
824 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
825 &mut self.0.options
826 }
827 }
828
829 #[derive(Clone, Debug)]
851 pub struct ListBackupCollections(RequestBuilder<crate::model::ListBackupCollectionsRequest>);
852
853 impl ListBackupCollections {
854 pub(crate) fn new(
855 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
856 ) -> Self {
857 Self(RequestBuilder::new(stub))
858 }
859
860 pub fn with_request<V: Into<crate::model::ListBackupCollectionsRequest>>(
862 mut self,
863 v: V,
864 ) -> Self {
865 self.0.request = v.into();
866 self
867 }
868
869 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
871 self.0.options = v.into();
872 self
873 }
874
875 pub async fn send(self) -> Result<crate::model::ListBackupCollectionsResponse> {
877 (*self.0.stub)
878 .list_backup_collections(self.0.request, self.0.options)
879 .await
880 .map(gax::response::Response::into_body)
881 }
882
883 pub fn by_page(
885 self,
886 ) -> impl gax::paginator::Paginator<crate::model::ListBackupCollectionsResponse, gax::error::Error>
887 {
888 use std::clone::Clone;
889 let token = self.0.request.page_token.clone();
890 let execute = move |token: String| {
891 let mut builder = self.clone();
892 builder.0.request = builder.0.request.set_page_token(token);
893 builder.send()
894 };
895 gax::paginator::internal::new_paginator(token, execute)
896 }
897
898 pub fn by_item(
900 self,
901 ) -> impl gax::paginator::ItemPaginator<
902 crate::model::ListBackupCollectionsResponse,
903 gax::error::Error,
904 > {
905 use gax::paginator::Paginator;
906 self.by_page().items()
907 }
908
909 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
913 self.0.request.parent = v.into();
914 self
915 }
916
917 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
919 self.0.request.page_size = v.into();
920 self
921 }
922
923 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
925 self.0.request.page_token = v.into();
926 self
927 }
928 }
929
930 #[doc(hidden)]
931 impl gax::options::internal::RequestBuilder for ListBackupCollections {
932 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
933 &mut self.0.options
934 }
935 }
936
937 #[derive(Clone, Debug)]
955 pub struct GetBackupCollection(RequestBuilder<crate::model::GetBackupCollectionRequest>);
956
957 impl GetBackupCollection {
958 pub(crate) fn new(
959 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
960 ) -> Self {
961 Self(RequestBuilder::new(stub))
962 }
963
964 pub fn with_request<V: Into<crate::model::GetBackupCollectionRequest>>(
966 mut self,
967 v: V,
968 ) -> Self {
969 self.0.request = v.into();
970 self
971 }
972
973 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
975 self.0.options = v.into();
976 self
977 }
978
979 pub async fn send(self) -> Result<crate::model::BackupCollection> {
981 (*self.0.stub)
982 .get_backup_collection(self.0.request, self.0.options)
983 .await
984 .map(gax::response::Response::into_body)
985 }
986
987 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
991 self.0.request.name = v.into();
992 self
993 }
994 }
995
996 #[doc(hidden)]
997 impl gax::options::internal::RequestBuilder for GetBackupCollection {
998 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
999 &mut self.0.options
1000 }
1001 }
1002
1003 #[derive(Clone, Debug)]
1025 pub struct ListBackups(RequestBuilder<crate::model::ListBackupsRequest>);
1026
1027 impl ListBackups {
1028 pub(crate) fn new(
1029 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
1030 ) -> Self {
1031 Self(RequestBuilder::new(stub))
1032 }
1033
1034 pub fn with_request<V: Into<crate::model::ListBackupsRequest>>(mut self, v: V) -> Self {
1036 self.0.request = v.into();
1037 self
1038 }
1039
1040 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1042 self.0.options = v.into();
1043 self
1044 }
1045
1046 pub async fn send(self) -> Result<crate::model::ListBackupsResponse> {
1048 (*self.0.stub)
1049 .list_backups(self.0.request, self.0.options)
1050 .await
1051 .map(gax::response::Response::into_body)
1052 }
1053
1054 pub fn by_page(
1056 self,
1057 ) -> impl gax::paginator::Paginator<crate::model::ListBackupsResponse, gax::error::Error>
1058 {
1059 use std::clone::Clone;
1060 let token = self.0.request.page_token.clone();
1061 let execute = move |token: String| {
1062 let mut builder = self.clone();
1063 builder.0.request = builder.0.request.set_page_token(token);
1064 builder.send()
1065 };
1066 gax::paginator::internal::new_paginator(token, execute)
1067 }
1068
1069 pub fn by_item(
1071 self,
1072 ) -> impl gax::paginator::ItemPaginator<crate::model::ListBackupsResponse, gax::error::Error>
1073 {
1074 use gax::paginator::Paginator;
1075 self.by_page().items()
1076 }
1077
1078 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1082 self.0.request.parent = v.into();
1083 self
1084 }
1085
1086 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1088 self.0.request.page_size = v.into();
1089 self
1090 }
1091
1092 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1094 self.0.request.page_token = v.into();
1095 self
1096 }
1097 }
1098
1099 #[doc(hidden)]
1100 impl gax::options::internal::RequestBuilder for ListBackups {
1101 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1102 &mut self.0.options
1103 }
1104 }
1105
1106 #[derive(Clone, Debug)]
1124 pub struct GetBackup(RequestBuilder<crate::model::GetBackupRequest>);
1125
1126 impl GetBackup {
1127 pub(crate) fn new(
1128 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
1129 ) -> Self {
1130 Self(RequestBuilder::new(stub))
1131 }
1132
1133 pub fn with_request<V: Into<crate::model::GetBackupRequest>>(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::Backup> {
1147 (*self.0.stub)
1148 .get_backup(self.0.request, self.0.options)
1149 .await
1150 .map(gax::response::Response::into_body)
1151 }
1152
1153 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1157 self.0.request.name = v.into();
1158 self
1159 }
1160 }
1161
1162 #[doc(hidden)]
1163 impl gax::options::internal::RequestBuilder for GetBackup {
1164 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1165 &mut self.0.options
1166 }
1167 }
1168
1169 #[derive(Clone, Debug)]
1188 pub struct DeleteBackup(RequestBuilder<crate::model::DeleteBackupRequest>);
1189
1190 impl DeleteBackup {
1191 pub(crate) fn new(
1192 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
1193 ) -> Self {
1194 Self(RequestBuilder::new(stub))
1195 }
1196
1197 pub fn with_request<V: Into<crate::model::DeleteBackupRequest>>(mut self, v: V) -> Self {
1199 self.0.request = v.into();
1200 self
1201 }
1202
1203 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1205 self.0.options = v.into();
1206 self
1207 }
1208
1209 pub async fn send(self) -> Result<longrunning::model::Operation> {
1216 (*self.0.stub)
1217 .delete_backup(self.0.request, self.0.options)
1218 .await
1219 .map(gax::response::Response::into_body)
1220 }
1221
1222 pub fn poller(self) -> impl lro::Poller<(), wkt::Any> {
1224 type Operation = lro::internal::Operation<wkt::Empty, wkt::Any>;
1225 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1226 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1227
1228 let stub = self.0.stub.clone();
1229 let mut options = self.0.options.clone();
1230 options.set_retry_policy(gax::retry_policy::NeverRetry);
1231 let query = move |name| {
1232 let stub = stub.clone();
1233 let options = options.clone();
1234 async {
1235 let op = GetOperation::new(stub)
1236 .set_name(name)
1237 .with_options(options)
1238 .send()
1239 .await?;
1240 Ok(Operation::new(op))
1241 }
1242 };
1243
1244 let start = move || async {
1245 let op = self.send().await?;
1246 Ok(Operation::new(op))
1247 };
1248
1249 lro::internal::new_unit_response_poller(
1250 polling_error_policy,
1251 polling_backoff_policy,
1252 start,
1253 query,
1254 )
1255 }
1256
1257 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1261 self.0.request.name = v.into();
1262 self
1263 }
1264
1265 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1267 self.0.request.request_id = v.into();
1268 self
1269 }
1270 }
1271
1272 #[doc(hidden)]
1273 impl gax::options::internal::RequestBuilder for DeleteBackup {
1274 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1275 &mut self.0.options
1276 }
1277 }
1278
1279 #[derive(Clone, Debug)]
1298 pub struct ExportBackup(RequestBuilder<crate::model::ExportBackupRequest>);
1299
1300 impl ExportBackup {
1301 pub(crate) fn new(
1302 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
1303 ) -> Self {
1304 Self(RequestBuilder::new(stub))
1305 }
1306
1307 pub fn with_request<V: Into<crate::model::ExportBackupRequest>>(mut self, v: V) -> Self {
1309 self.0.request = v.into();
1310 self
1311 }
1312
1313 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1315 self.0.options = v.into();
1316 self
1317 }
1318
1319 pub async fn send(self) -> Result<longrunning::model::Operation> {
1326 (*self.0.stub)
1327 .export_backup(self.0.request, self.0.options)
1328 .await
1329 .map(gax::response::Response::into_body)
1330 }
1331
1332 pub fn poller(self) -> impl lro::Poller<crate::model::Backup, wkt::Any> {
1334 type Operation = lro::internal::Operation<crate::model::Backup, wkt::Any>;
1335 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1336 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1337
1338 let stub = self.0.stub.clone();
1339 let mut options = self.0.options.clone();
1340 options.set_retry_policy(gax::retry_policy::NeverRetry);
1341 let query = move |name| {
1342 let stub = stub.clone();
1343 let options = options.clone();
1344 async {
1345 let op = GetOperation::new(stub)
1346 .set_name(name)
1347 .with_options(options)
1348 .send()
1349 .await?;
1350 Ok(Operation::new(op))
1351 }
1352 };
1353
1354 let start = move || async {
1355 let op = self.send().await?;
1356 Ok(Operation::new(op))
1357 };
1358
1359 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1360 }
1361
1362 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1366 self.0.request.name = v.into();
1367 self
1368 }
1369
1370 pub fn set_destination<
1375 T: Into<Option<crate::model::export_backup_request::Destination>>,
1376 >(
1377 mut self,
1378 v: T,
1379 ) -> Self {
1380 self.0.request.destination = v.into();
1381 self
1382 }
1383
1384 pub fn set_gcs_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1390 self.0.request = self.0.request.set_gcs_bucket(v);
1391 self
1392 }
1393 }
1394
1395 #[doc(hidden)]
1396 impl gax::options::internal::RequestBuilder for ExportBackup {
1397 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1398 &mut self.0.options
1399 }
1400 }
1401
1402 #[derive(Clone, Debug)]
1421 pub struct BackupCluster(RequestBuilder<crate::model::BackupClusterRequest>);
1422
1423 impl BackupCluster {
1424 pub(crate) fn new(
1425 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
1426 ) -> Self {
1427 Self(RequestBuilder::new(stub))
1428 }
1429
1430 pub fn with_request<V: Into<crate::model::BackupClusterRequest>>(mut self, v: V) -> Self {
1432 self.0.request = v.into();
1433 self
1434 }
1435
1436 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1438 self.0.options = v.into();
1439 self
1440 }
1441
1442 pub async fn send(self) -> Result<longrunning::model::Operation> {
1449 (*self.0.stub)
1450 .backup_cluster(self.0.request, self.0.options)
1451 .await
1452 .map(gax::response::Response::into_body)
1453 }
1454
1455 pub fn poller(self) -> impl lro::Poller<crate::model::Cluster, wkt::Any> {
1457 type Operation = lro::internal::Operation<crate::model::Cluster, wkt::Any>;
1458 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1459 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1460
1461 let stub = self.0.stub.clone();
1462 let mut options = self.0.options.clone();
1463 options.set_retry_policy(gax::retry_policy::NeverRetry);
1464 let query = move |name| {
1465 let stub = stub.clone();
1466 let options = options.clone();
1467 async {
1468 let op = GetOperation::new(stub)
1469 .set_name(name)
1470 .with_options(options)
1471 .send()
1472 .await?;
1473 Ok(Operation::new(op))
1474 }
1475 };
1476
1477 let start = move || async {
1478 let op = self.send().await?;
1479 Ok(Operation::new(op))
1480 };
1481
1482 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1483 }
1484
1485 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1489 self.0.request.name = v.into();
1490 self
1491 }
1492
1493 pub fn set_ttl<T>(mut self, v: T) -> Self
1495 where
1496 T: std::convert::Into<wkt::Duration>,
1497 {
1498 self.0.request.ttl = std::option::Option::Some(v.into());
1499 self
1500 }
1501
1502 pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
1504 where
1505 T: std::convert::Into<wkt::Duration>,
1506 {
1507 self.0.request.ttl = v.map(|x| x.into());
1508 self
1509 }
1510
1511 pub fn set_backup_id<T>(mut self, v: T) -> Self
1513 where
1514 T: std::convert::Into<std::string::String>,
1515 {
1516 self.0.request.backup_id = std::option::Option::Some(v.into());
1517 self
1518 }
1519
1520 pub fn set_or_clear_backup_id<T>(mut self, v: std::option::Option<T>) -> Self
1522 where
1523 T: std::convert::Into<std::string::String>,
1524 {
1525 self.0.request.backup_id = v.map(|x| x.into());
1526 self
1527 }
1528 }
1529
1530 #[doc(hidden)]
1531 impl gax::options::internal::RequestBuilder for BackupCluster {
1532 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1533 &mut self.0.options
1534 }
1535 }
1536
1537 #[derive(Clone, Debug)]
1559 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
1560
1561 impl ListLocations {
1562 pub(crate) fn new(
1563 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
1564 ) -> Self {
1565 Self(RequestBuilder::new(stub))
1566 }
1567
1568 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
1570 mut self,
1571 v: V,
1572 ) -> Self {
1573 self.0.request = v.into();
1574 self
1575 }
1576
1577 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1579 self.0.options = v.into();
1580 self
1581 }
1582
1583 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
1585 (*self.0.stub)
1586 .list_locations(self.0.request, self.0.options)
1587 .await
1588 .map(gax::response::Response::into_body)
1589 }
1590
1591 pub fn by_page(
1593 self,
1594 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
1595 {
1596 use std::clone::Clone;
1597 let token = self.0.request.page_token.clone();
1598 let execute = move |token: String| {
1599 let mut builder = self.clone();
1600 builder.0.request = builder.0.request.set_page_token(token);
1601 builder.send()
1602 };
1603 gax::paginator::internal::new_paginator(token, execute)
1604 }
1605
1606 pub fn by_item(
1608 self,
1609 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
1610 {
1611 use gax::paginator::Paginator;
1612 self.by_page().items()
1613 }
1614
1615 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1617 self.0.request.name = v.into();
1618 self
1619 }
1620
1621 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1623 self.0.request.filter = v.into();
1624 self
1625 }
1626
1627 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1629 self.0.request.page_size = v.into();
1630 self
1631 }
1632
1633 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1635 self.0.request.page_token = v.into();
1636 self
1637 }
1638 }
1639
1640 #[doc(hidden)]
1641 impl gax::options::internal::RequestBuilder for ListLocations {
1642 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1643 &mut self.0.options
1644 }
1645 }
1646
1647 #[derive(Clone, Debug)]
1665 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1666
1667 impl GetLocation {
1668 pub(crate) fn new(
1669 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
1670 ) -> Self {
1671 Self(RequestBuilder::new(stub))
1672 }
1673
1674 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1676 self.0.request = v.into();
1677 self
1678 }
1679
1680 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1682 self.0.options = v.into();
1683 self
1684 }
1685
1686 pub async fn send(self) -> Result<location::model::Location> {
1688 (*self.0.stub)
1689 .get_location(self.0.request, self.0.options)
1690 .await
1691 .map(gax::response::Response::into_body)
1692 }
1693
1694 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1696 self.0.request.name = v.into();
1697 self
1698 }
1699 }
1700
1701 #[doc(hidden)]
1702 impl gax::options::internal::RequestBuilder for GetLocation {
1703 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1704 &mut self.0.options
1705 }
1706 }
1707
1708 #[derive(Clone, Debug)]
1730 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1731
1732 impl ListOperations {
1733 pub(crate) fn new(
1734 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
1735 ) -> Self {
1736 Self(RequestBuilder::new(stub))
1737 }
1738
1739 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1741 mut self,
1742 v: V,
1743 ) -> Self {
1744 self.0.request = v.into();
1745 self
1746 }
1747
1748 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1750 self.0.options = v.into();
1751 self
1752 }
1753
1754 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1756 (*self.0.stub)
1757 .list_operations(self.0.request, self.0.options)
1758 .await
1759 .map(gax::response::Response::into_body)
1760 }
1761
1762 pub fn by_page(
1764 self,
1765 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1766 {
1767 use std::clone::Clone;
1768 let token = self.0.request.page_token.clone();
1769 let execute = move |token: String| {
1770 let mut builder = self.clone();
1771 builder.0.request = builder.0.request.set_page_token(token);
1772 builder.send()
1773 };
1774 gax::paginator::internal::new_paginator(token, execute)
1775 }
1776
1777 pub fn by_item(
1779 self,
1780 ) -> impl gax::paginator::ItemPaginator<
1781 longrunning::model::ListOperationsResponse,
1782 gax::error::Error,
1783 > {
1784 use gax::paginator::Paginator;
1785 self.by_page().items()
1786 }
1787
1788 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1790 self.0.request.name = v.into();
1791 self
1792 }
1793
1794 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1796 self.0.request.filter = v.into();
1797 self
1798 }
1799
1800 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1802 self.0.request.page_size = v.into();
1803 self
1804 }
1805
1806 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1808 self.0.request.page_token = v.into();
1809 self
1810 }
1811
1812 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1814 self.0.request.return_partial_success = v.into();
1815 self
1816 }
1817 }
1818
1819 #[doc(hidden)]
1820 impl gax::options::internal::RequestBuilder for ListOperations {
1821 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1822 &mut self.0.options
1823 }
1824 }
1825
1826 #[derive(Clone, Debug)]
1844 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1845
1846 impl GetOperation {
1847 pub(crate) fn new(
1848 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
1849 ) -> Self {
1850 Self(RequestBuilder::new(stub))
1851 }
1852
1853 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1855 mut self,
1856 v: V,
1857 ) -> Self {
1858 self.0.request = v.into();
1859 self
1860 }
1861
1862 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1864 self.0.options = v.into();
1865 self
1866 }
1867
1868 pub async fn send(self) -> Result<longrunning::model::Operation> {
1870 (*self.0.stub)
1871 .get_operation(self.0.request, self.0.options)
1872 .await
1873 .map(gax::response::Response::into_body)
1874 }
1875
1876 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1878 self.0.request.name = v.into();
1879 self
1880 }
1881 }
1882
1883 #[doc(hidden)]
1884 impl gax::options::internal::RequestBuilder for GetOperation {
1885 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1886 &mut self.0.options
1887 }
1888 }
1889
1890 #[derive(Clone, Debug)]
1908 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1909
1910 impl DeleteOperation {
1911 pub(crate) fn new(
1912 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
1913 ) -> Self {
1914 Self(RequestBuilder::new(stub))
1915 }
1916
1917 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1919 mut self,
1920 v: V,
1921 ) -> Self {
1922 self.0.request = v.into();
1923 self
1924 }
1925
1926 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1928 self.0.options = v.into();
1929 self
1930 }
1931
1932 pub async fn send(self) -> Result<()> {
1934 (*self.0.stub)
1935 .delete_operation(self.0.request, self.0.options)
1936 .await
1937 .map(gax::response::Response::into_body)
1938 }
1939
1940 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1942 self.0.request.name = v.into();
1943 self
1944 }
1945 }
1946
1947 #[doc(hidden)]
1948 impl gax::options::internal::RequestBuilder for DeleteOperation {
1949 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1950 &mut self.0.options
1951 }
1952 }
1953
1954 #[derive(Clone, Debug)]
1972 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1973
1974 impl CancelOperation {
1975 pub(crate) fn new(
1976 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedisCluster>,
1977 ) -> Self {
1978 Self(RequestBuilder::new(stub))
1979 }
1980
1981 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1983 mut self,
1984 v: V,
1985 ) -> Self {
1986 self.0.request = v.into();
1987 self
1988 }
1989
1990 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1992 self.0.options = v.into();
1993 self
1994 }
1995
1996 pub async fn send(self) -> Result<()> {
1998 (*self.0.stub)
1999 .cancel_operation(self.0.request, self.0.options)
2000 .await
2001 .map(gax::response::Response::into_body)
2002 }
2003
2004 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2006 self.0.request.name = v.into();
2007 self
2008 }
2009 }
2010
2011 #[doc(hidden)]
2012 impl gax::options::internal::RequestBuilder for CancelOperation {
2013 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2014 &mut self.0.options
2015 }
2016 }
2017}