1pub mod cloud_redis {
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::CloudRedis;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = CloudRedis;
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::CloudRedis>,
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::CloudRedis>,
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 ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
97
98 impl ListInstances {
99 pub(crate) fn new(
100 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedis>,
101 ) -> Self {
102 Self(RequestBuilder::new(stub))
103 }
104
105 pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(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::ListInstancesResponse> {
119 (*self.0.stub)
120 .list_instances(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::ListInstancesResponse, 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::ListInstancesResponse, 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 ListInstances {
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 GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
196
197 impl GetInstance {
198 pub(crate) fn new(
199 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedis>,
200 ) -> Self {
201 Self(RequestBuilder::new(stub))
202 }
203
204 pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(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::Instance> {
218 (*self.0.stub)
219 .get_instance(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 GetInstance {
235 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
236 &mut self.0.options
237 }
238 }
239
240 #[derive(Clone, Debug)]
258 pub struct GetInstanceAuthString(RequestBuilder<crate::model::GetInstanceAuthStringRequest>);
259
260 impl GetInstanceAuthString {
261 pub(crate) fn new(
262 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedis>,
263 ) -> Self {
264 Self(RequestBuilder::new(stub))
265 }
266
267 pub fn with_request<V: Into<crate::model::GetInstanceAuthStringRequest>>(
269 mut self,
270 v: V,
271 ) -> Self {
272 self.0.request = v.into();
273 self
274 }
275
276 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
278 self.0.options = v.into();
279 self
280 }
281
282 pub async fn send(self) -> Result<crate::model::InstanceAuthString> {
284 (*self.0.stub)
285 .get_instance_auth_string(self.0.request, self.0.options)
286 .await
287 .map(gax::response::Response::into_body)
288 }
289
290 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
294 self.0.request.name = v.into();
295 self
296 }
297 }
298
299 #[doc(hidden)]
300 impl gax::options::internal::RequestBuilder for GetInstanceAuthString {
301 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
302 &mut self.0.options
303 }
304 }
305
306 #[derive(Clone, Debug)]
325 pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
326
327 impl CreateInstance {
328 pub(crate) fn new(
329 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedis>,
330 ) -> Self {
331 Self(RequestBuilder::new(stub))
332 }
333
334 pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
336 self.0.request = v.into();
337 self
338 }
339
340 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
342 self.0.options = v.into();
343 self
344 }
345
346 pub async fn send(self) -> Result<longrunning::model::Operation> {
353 (*self.0.stub)
354 .create_instance(self.0.request, self.0.options)
355 .await
356 .map(gax::response::Response::into_body)
357 }
358
359 pub fn poller(
361 self,
362 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
363 type Operation =
364 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
365 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
366 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
367
368 let stub = self.0.stub.clone();
369 let mut options = self.0.options.clone();
370 options.set_retry_policy(gax::retry_policy::NeverRetry);
371 let query = move |name| {
372 let stub = stub.clone();
373 let options = options.clone();
374 async {
375 let op = GetOperation::new(stub)
376 .set_name(name)
377 .with_options(options)
378 .send()
379 .await?;
380 Ok(Operation::new(op))
381 }
382 };
383
384 let start = move || async {
385 let op = self.send().await?;
386 Ok(Operation::new(op))
387 };
388
389 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
390 }
391
392 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
396 self.0.request.parent = v.into();
397 self
398 }
399
400 pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
404 self.0.request.instance_id = v.into();
405 self
406 }
407
408 pub fn set_instance<T>(mut self, v: T) -> Self
412 where
413 T: std::convert::Into<crate::model::Instance>,
414 {
415 self.0.request.instance = std::option::Option::Some(v.into());
416 self
417 }
418
419 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
423 where
424 T: std::convert::Into<crate::model::Instance>,
425 {
426 self.0.request.instance = v.map(|x| x.into());
427 self
428 }
429 }
430
431 #[doc(hidden)]
432 impl gax::options::internal::RequestBuilder for CreateInstance {
433 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
434 &mut self.0.options
435 }
436 }
437
438 #[derive(Clone, Debug)]
457 pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
458
459 impl UpdateInstance {
460 pub(crate) fn new(
461 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedis>,
462 ) -> Self {
463 Self(RequestBuilder::new(stub))
464 }
465
466 pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
468 self.0.request = v.into();
469 self
470 }
471
472 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
474 self.0.options = v.into();
475 self
476 }
477
478 pub async fn send(self) -> Result<longrunning::model::Operation> {
485 (*self.0.stub)
486 .update_instance(self.0.request, self.0.options)
487 .await
488 .map(gax::response::Response::into_body)
489 }
490
491 pub fn poller(
493 self,
494 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
495 type Operation =
496 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
497 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
498 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
499
500 let stub = self.0.stub.clone();
501 let mut options = self.0.options.clone();
502 options.set_retry_policy(gax::retry_policy::NeverRetry);
503 let query = move |name| {
504 let stub = stub.clone();
505 let options = options.clone();
506 async {
507 let op = GetOperation::new(stub)
508 .set_name(name)
509 .with_options(options)
510 .send()
511 .await?;
512 Ok(Operation::new(op))
513 }
514 };
515
516 let start = move || async {
517 let op = self.send().await?;
518 Ok(Operation::new(op))
519 };
520
521 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
522 }
523
524 pub fn set_update_mask<T>(mut self, v: T) -> Self
528 where
529 T: std::convert::Into<wkt::FieldMask>,
530 {
531 self.0.request.update_mask = std::option::Option::Some(v.into());
532 self
533 }
534
535 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
539 where
540 T: std::convert::Into<wkt::FieldMask>,
541 {
542 self.0.request.update_mask = v.map(|x| x.into());
543 self
544 }
545
546 pub fn set_instance<T>(mut self, v: T) -> Self
550 where
551 T: std::convert::Into<crate::model::Instance>,
552 {
553 self.0.request.instance = std::option::Option::Some(v.into());
554 self
555 }
556
557 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
561 where
562 T: std::convert::Into<crate::model::Instance>,
563 {
564 self.0.request.instance = v.map(|x| x.into());
565 self
566 }
567 }
568
569 #[doc(hidden)]
570 impl gax::options::internal::RequestBuilder for UpdateInstance {
571 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
572 &mut self.0.options
573 }
574 }
575
576 #[derive(Clone, Debug)]
595 pub struct UpgradeInstance(RequestBuilder<crate::model::UpgradeInstanceRequest>);
596
597 impl UpgradeInstance {
598 pub(crate) fn new(
599 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedis>,
600 ) -> Self {
601 Self(RequestBuilder::new(stub))
602 }
603
604 pub fn with_request<V: Into<crate::model::UpgradeInstanceRequest>>(mut self, v: V) -> Self {
606 self.0.request = v.into();
607 self
608 }
609
610 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
612 self.0.options = v.into();
613 self
614 }
615
616 pub async fn send(self) -> Result<longrunning::model::Operation> {
623 (*self.0.stub)
624 .upgrade_instance(self.0.request, self.0.options)
625 .await
626 .map(gax::response::Response::into_body)
627 }
628
629 pub fn poller(
631 self,
632 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
633 type Operation =
634 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
635 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
636 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
637
638 let stub = self.0.stub.clone();
639 let mut options = self.0.options.clone();
640 options.set_retry_policy(gax::retry_policy::NeverRetry);
641 let query = move |name| {
642 let stub = stub.clone();
643 let options = options.clone();
644 async {
645 let op = GetOperation::new(stub)
646 .set_name(name)
647 .with_options(options)
648 .send()
649 .await?;
650 Ok(Operation::new(op))
651 }
652 };
653
654 let start = move || async {
655 let op = self.send().await?;
656 Ok(Operation::new(op))
657 };
658
659 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
660 }
661
662 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
666 self.0.request.name = v.into();
667 self
668 }
669
670 pub fn set_redis_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
674 self.0.request.redis_version = v.into();
675 self
676 }
677 }
678
679 #[doc(hidden)]
680 impl gax::options::internal::RequestBuilder for UpgradeInstance {
681 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
682 &mut self.0.options
683 }
684 }
685
686 #[derive(Clone, Debug)]
705 pub struct ImportInstance(RequestBuilder<crate::model::ImportInstanceRequest>);
706
707 impl ImportInstance {
708 pub(crate) fn new(
709 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedis>,
710 ) -> Self {
711 Self(RequestBuilder::new(stub))
712 }
713
714 pub fn with_request<V: Into<crate::model::ImportInstanceRequest>>(mut self, v: V) -> Self {
716 self.0.request = v.into();
717 self
718 }
719
720 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
722 self.0.options = v.into();
723 self
724 }
725
726 pub async fn send(self) -> Result<longrunning::model::Operation> {
733 (*self.0.stub)
734 .import_instance(self.0.request, self.0.options)
735 .await
736 .map(gax::response::Response::into_body)
737 }
738
739 pub fn poller(
741 self,
742 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
743 type Operation =
744 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
745 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
746 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
747
748 let stub = self.0.stub.clone();
749 let mut options = self.0.options.clone();
750 options.set_retry_policy(gax::retry_policy::NeverRetry);
751 let query = move |name| {
752 let stub = stub.clone();
753 let options = options.clone();
754 async {
755 let op = GetOperation::new(stub)
756 .set_name(name)
757 .with_options(options)
758 .send()
759 .await?;
760 Ok(Operation::new(op))
761 }
762 };
763
764 let start = move || async {
765 let op = self.send().await?;
766 Ok(Operation::new(op))
767 };
768
769 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
770 }
771
772 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
776 self.0.request.name = v.into();
777 self
778 }
779
780 pub fn set_input_config<T>(mut self, v: T) -> Self
784 where
785 T: std::convert::Into<crate::model::InputConfig>,
786 {
787 self.0.request.input_config = std::option::Option::Some(v.into());
788 self
789 }
790
791 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
795 where
796 T: std::convert::Into<crate::model::InputConfig>,
797 {
798 self.0.request.input_config = v.map(|x| x.into());
799 self
800 }
801 }
802
803 #[doc(hidden)]
804 impl gax::options::internal::RequestBuilder for ImportInstance {
805 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
806 &mut self.0.options
807 }
808 }
809
810 #[derive(Clone, Debug)]
829 pub struct ExportInstance(RequestBuilder<crate::model::ExportInstanceRequest>);
830
831 impl ExportInstance {
832 pub(crate) fn new(
833 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedis>,
834 ) -> Self {
835 Self(RequestBuilder::new(stub))
836 }
837
838 pub fn with_request<V: Into<crate::model::ExportInstanceRequest>>(mut self, v: V) -> Self {
840 self.0.request = v.into();
841 self
842 }
843
844 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
846 self.0.options = v.into();
847 self
848 }
849
850 pub async fn send(self) -> Result<longrunning::model::Operation> {
857 (*self.0.stub)
858 .export_instance(self.0.request, self.0.options)
859 .await
860 .map(gax::response::Response::into_body)
861 }
862
863 pub fn poller(
865 self,
866 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
867 type Operation =
868 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
869 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
870 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
871
872 let stub = self.0.stub.clone();
873 let mut options = self.0.options.clone();
874 options.set_retry_policy(gax::retry_policy::NeverRetry);
875 let query = move |name| {
876 let stub = stub.clone();
877 let options = options.clone();
878 async {
879 let op = GetOperation::new(stub)
880 .set_name(name)
881 .with_options(options)
882 .send()
883 .await?;
884 Ok(Operation::new(op))
885 }
886 };
887
888 let start = move || async {
889 let op = self.send().await?;
890 Ok(Operation::new(op))
891 };
892
893 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
894 }
895
896 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
900 self.0.request.name = v.into();
901 self
902 }
903
904 pub fn set_output_config<T>(mut self, v: T) -> Self
908 where
909 T: std::convert::Into<crate::model::OutputConfig>,
910 {
911 self.0.request.output_config = std::option::Option::Some(v.into());
912 self
913 }
914
915 pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
919 where
920 T: std::convert::Into<crate::model::OutputConfig>,
921 {
922 self.0.request.output_config = v.map(|x| x.into());
923 self
924 }
925 }
926
927 #[doc(hidden)]
928 impl gax::options::internal::RequestBuilder for ExportInstance {
929 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
930 &mut self.0.options
931 }
932 }
933
934 #[derive(Clone, Debug)]
953 pub struct FailoverInstance(RequestBuilder<crate::model::FailoverInstanceRequest>);
954
955 impl FailoverInstance {
956 pub(crate) fn new(
957 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedis>,
958 ) -> Self {
959 Self(RequestBuilder::new(stub))
960 }
961
962 pub fn with_request<V: Into<crate::model::FailoverInstanceRequest>>(
964 mut self,
965 v: V,
966 ) -> Self {
967 self.0.request = v.into();
968 self
969 }
970
971 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
973 self.0.options = v.into();
974 self
975 }
976
977 pub async fn send(self) -> Result<longrunning::model::Operation> {
984 (*self.0.stub)
985 .failover_instance(self.0.request, self.0.options)
986 .await
987 .map(gax::response::Response::into_body)
988 }
989
990 pub fn poller(
992 self,
993 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
994 type Operation =
995 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
996 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
997 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
998
999 let stub = self.0.stub.clone();
1000 let mut options = self.0.options.clone();
1001 options.set_retry_policy(gax::retry_policy::NeverRetry);
1002 let query = move |name| {
1003 let stub = stub.clone();
1004 let options = options.clone();
1005 async {
1006 let op = GetOperation::new(stub)
1007 .set_name(name)
1008 .with_options(options)
1009 .send()
1010 .await?;
1011 Ok(Operation::new(op))
1012 }
1013 };
1014
1015 let start = move || async {
1016 let op = self.send().await?;
1017 Ok(Operation::new(op))
1018 };
1019
1020 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1021 }
1022
1023 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1027 self.0.request.name = v.into();
1028 self
1029 }
1030
1031 pub fn set_data_protection_mode<
1033 T: Into<crate::model::failover_instance_request::DataProtectionMode>,
1034 >(
1035 mut self,
1036 v: T,
1037 ) -> Self {
1038 self.0.request.data_protection_mode = v.into();
1039 self
1040 }
1041 }
1042
1043 #[doc(hidden)]
1044 impl gax::options::internal::RequestBuilder for FailoverInstance {
1045 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1046 &mut self.0.options
1047 }
1048 }
1049
1050 #[derive(Clone, Debug)]
1069 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
1070
1071 impl DeleteInstance {
1072 pub(crate) fn new(
1073 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedis>,
1074 ) -> Self {
1075 Self(RequestBuilder::new(stub))
1076 }
1077
1078 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
1080 self.0.request = v.into();
1081 self
1082 }
1083
1084 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1086 self.0.options = v.into();
1087 self
1088 }
1089
1090 pub async fn send(self) -> Result<longrunning::model::Operation> {
1097 (*self.0.stub)
1098 .delete_instance(self.0.request, self.0.options)
1099 .await
1100 .map(gax::response::Response::into_body)
1101 }
1102
1103 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
1105 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
1106 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1107 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1108
1109 let stub = self.0.stub.clone();
1110 let mut options = self.0.options.clone();
1111 options.set_retry_policy(gax::retry_policy::NeverRetry);
1112 let query = move |name| {
1113 let stub = stub.clone();
1114 let options = options.clone();
1115 async {
1116 let op = GetOperation::new(stub)
1117 .set_name(name)
1118 .with_options(options)
1119 .send()
1120 .await?;
1121 Ok(Operation::new(op))
1122 }
1123 };
1124
1125 let start = move || async {
1126 let op = self.send().await?;
1127 Ok(Operation::new(op))
1128 };
1129
1130 lro::internal::new_unit_response_poller(
1131 polling_error_policy,
1132 polling_backoff_policy,
1133 start,
1134 query,
1135 )
1136 }
1137
1138 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1142 self.0.request.name = v.into();
1143 self
1144 }
1145 }
1146
1147 #[doc(hidden)]
1148 impl gax::options::internal::RequestBuilder for DeleteInstance {
1149 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1150 &mut self.0.options
1151 }
1152 }
1153
1154 #[derive(Clone, Debug)]
1173 pub struct RescheduleMaintenance(RequestBuilder<crate::model::RescheduleMaintenanceRequest>);
1174
1175 impl RescheduleMaintenance {
1176 pub(crate) fn new(
1177 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedis>,
1178 ) -> Self {
1179 Self(RequestBuilder::new(stub))
1180 }
1181
1182 pub fn with_request<V: Into<crate::model::RescheduleMaintenanceRequest>>(
1184 mut self,
1185 v: V,
1186 ) -> Self {
1187 self.0.request = v.into();
1188 self
1189 }
1190
1191 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1193 self.0.options = v.into();
1194 self
1195 }
1196
1197 pub async fn send(self) -> Result<longrunning::model::Operation> {
1204 (*self.0.stub)
1205 .reschedule_maintenance(self.0.request, self.0.options)
1206 .await
1207 .map(gax::response::Response::into_body)
1208 }
1209
1210 pub fn poller(
1212 self,
1213 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
1214 type Operation =
1215 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
1216 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1217 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1218
1219 let stub = self.0.stub.clone();
1220 let mut options = self.0.options.clone();
1221 options.set_retry_policy(gax::retry_policy::NeverRetry);
1222 let query = move |name| {
1223 let stub = stub.clone();
1224 let options = options.clone();
1225 async {
1226 let op = GetOperation::new(stub)
1227 .set_name(name)
1228 .with_options(options)
1229 .send()
1230 .await?;
1231 Ok(Operation::new(op))
1232 }
1233 };
1234
1235 let start = move || async {
1236 let op = self.send().await?;
1237 Ok(Operation::new(op))
1238 };
1239
1240 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1241 }
1242
1243 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1247 self.0.request.name = v.into();
1248 self
1249 }
1250
1251 pub fn set_reschedule_type<
1255 T: Into<crate::model::reschedule_maintenance_request::RescheduleType>,
1256 >(
1257 mut self,
1258 v: T,
1259 ) -> Self {
1260 self.0.request.reschedule_type = v.into();
1261 self
1262 }
1263
1264 pub fn set_schedule_time<T>(mut self, v: T) -> Self
1266 where
1267 T: std::convert::Into<wkt::Timestamp>,
1268 {
1269 self.0.request.schedule_time = std::option::Option::Some(v.into());
1270 self
1271 }
1272
1273 pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
1275 where
1276 T: std::convert::Into<wkt::Timestamp>,
1277 {
1278 self.0.request.schedule_time = v.map(|x| x.into());
1279 self
1280 }
1281 }
1282
1283 #[doc(hidden)]
1284 impl gax::options::internal::RequestBuilder for RescheduleMaintenance {
1285 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1286 &mut self.0.options
1287 }
1288 }
1289
1290 #[derive(Clone, Debug)]
1312 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
1313
1314 impl ListLocations {
1315 pub(crate) fn new(
1316 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedis>,
1317 ) -> Self {
1318 Self(RequestBuilder::new(stub))
1319 }
1320
1321 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
1323 mut self,
1324 v: V,
1325 ) -> Self {
1326 self.0.request = v.into();
1327 self
1328 }
1329
1330 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1332 self.0.options = v.into();
1333 self
1334 }
1335
1336 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
1338 (*self.0.stub)
1339 .list_locations(self.0.request, self.0.options)
1340 .await
1341 .map(gax::response::Response::into_body)
1342 }
1343
1344 pub fn by_page(
1346 self,
1347 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
1348 {
1349 use std::clone::Clone;
1350 let token = self.0.request.page_token.clone();
1351 let execute = move |token: String| {
1352 let mut builder = self.clone();
1353 builder.0.request = builder.0.request.set_page_token(token);
1354 builder.send()
1355 };
1356 gax::paginator::internal::new_paginator(token, execute)
1357 }
1358
1359 pub fn by_item(
1361 self,
1362 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
1363 {
1364 use gax::paginator::Paginator;
1365 self.by_page().items()
1366 }
1367
1368 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1370 self.0.request.name = v.into();
1371 self
1372 }
1373
1374 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1376 self.0.request.filter = v.into();
1377 self
1378 }
1379
1380 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1382 self.0.request.page_size = v.into();
1383 self
1384 }
1385
1386 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1388 self.0.request.page_token = v.into();
1389 self
1390 }
1391 }
1392
1393 #[doc(hidden)]
1394 impl gax::options::internal::RequestBuilder for ListLocations {
1395 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1396 &mut self.0.options
1397 }
1398 }
1399
1400 #[derive(Clone, Debug)]
1418 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1419
1420 impl GetLocation {
1421 pub(crate) fn new(
1422 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedis>,
1423 ) -> Self {
1424 Self(RequestBuilder::new(stub))
1425 }
1426
1427 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1429 self.0.request = v.into();
1430 self
1431 }
1432
1433 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1435 self.0.options = v.into();
1436 self
1437 }
1438
1439 pub async fn send(self) -> Result<location::model::Location> {
1441 (*self.0.stub)
1442 .get_location(self.0.request, self.0.options)
1443 .await
1444 .map(gax::response::Response::into_body)
1445 }
1446
1447 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1449 self.0.request.name = v.into();
1450 self
1451 }
1452 }
1453
1454 #[doc(hidden)]
1455 impl gax::options::internal::RequestBuilder for GetLocation {
1456 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1457 &mut self.0.options
1458 }
1459 }
1460
1461 #[derive(Clone, Debug)]
1483 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1484
1485 impl ListOperations {
1486 pub(crate) fn new(
1487 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedis>,
1488 ) -> Self {
1489 Self(RequestBuilder::new(stub))
1490 }
1491
1492 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1494 mut self,
1495 v: V,
1496 ) -> Self {
1497 self.0.request = v.into();
1498 self
1499 }
1500
1501 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1503 self.0.options = v.into();
1504 self
1505 }
1506
1507 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1509 (*self.0.stub)
1510 .list_operations(self.0.request, self.0.options)
1511 .await
1512 .map(gax::response::Response::into_body)
1513 }
1514
1515 pub fn by_page(
1517 self,
1518 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1519 {
1520 use std::clone::Clone;
1521 let token = self.0.request.page_token.clone();
1522 let execute = move |token: String| {
1523 let mut builder = self.clone();
1524 builder.0.request = builder.0.request.set_page_token(token);
1525 builder.send()
1526 };
1527 gax::paginator::internal::new_paginator(token, execute)
1528 }
1529
1530 pub fn by_item(
1532 self,
1533 ) -> impl gax::paginator::ItemPaginator<
1534 longrunning::model::ListOperationsResponse,
1535 gax::error::Error,
1536 > {
1537 use gax::paginator::Paginator;
1538 self.by_page().items()
1539 }
1540
1541 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1543 self.0.request.name = v.into();
1544 self
1545 }
1546
1547 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1549 self.0.request.filter = v.into();
1550 self
1551 }
1552
1553 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1555 self.0.request.page_size = v.into();
1556 self
1557 }
1558
1559 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1561 self.0.request.page_token = v.into();
1562 self
1563 }
1564
1565 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1567 self.0.request.return_partial_success = v.into();
1568 self
1569 }
1570 }
1571
1572 #[doc(hidden)]
1573 impl gax::options::internal::RequestBuilder for ListOperations {
1574 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1575 &mut self.0.options
1576 }
1577 }
1578
1579 #[derive(Clone, Debug)]
1597 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1598
1599 impl GetOperation {
1600 pub(crate) fn new(
1601 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedis>,
1602 ) -> Self {
1603 Self(RequestBuilder::new(stub))
1604 }
1605
1606 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1608 mut self,
1609 v: V,
1610 ) -> Self {
1611 self.0.request = v.into();
1612 self
1613 }
1614
1615 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1617 self.0.options = v.into();
1618 self
1619 }
1620
1621 pub async fn send(self) -> Result<longrunning::model::Operation> {
1623 (*self.0.stub)
1624 .get_operation(self.0.request, self.0.options)
1625 .await
1626 .map(gax::response::Response::into_body)
1627 }
1628
1629 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1631 self.0.request.name = v.into();
1632 self
1633 }
1634 }
1635
1636 #[doc(hidden)]
1637 impl gax::options::internal::RequestBuilder for GetOperation {
1638 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1639 &mut self.0.options
1640 }
1641 }
1642
1643 #[derive(Clone, Debug)]
1661 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1662
1663 impl DeleteOperation {
1664 pub(crate) fn new(
1665 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedis>,
1666 ) -> Self {
1667 Self(RequestBuilder::new(stub))
1668 }
1669
1670 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1672 mut self,
1673 v: V,
1674 ) -> Self {
1675 self.0.request = v.into();
1676 self
1677 }
1678
1679 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1681 self.0.options = v.into();
1682 self
1683 }
1684
1685 pub async fn send(self) -> Result<()> {
1687 (*self.0.stub)
1688 .delete_operation(self.0.request, self.0.options)
1689 .await
1690 .map(gax::response::Response::into_body)
1691 }
1692
1693 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1695 self.0.request.name = v.into();
1696 self
1697 }
1698 }
1699
1700 #[doc(hidden)]
1701 impl gax::options::internal::RequestBuilder for DeleteOperation {
1702 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1703 &mut self.0.options
1704 }
1705 }
1706
1707 #[derive(Clone, Debug)]
1725 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1726
1727 impl CancelOperation {
1728 pub(crate) fn new(
1729 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudRedis>,
1730 ) -> Self {
1731 Self(RequestBuilder::new(stub))
1732 }
1733
1734 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1736 mut self,
1737 v: V,
1738 ) -> Self {
1739 self.0.request = v.into();
1740 self
1741 }
1742
1743 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1745 self.0.options = v.into();
1746 self
1747 }
1748
1749 pub async fn send(self) -> Result<()> {
1751 (*self.0.stub)
1752 .cancel_operation(self.0.request, self.0.options)
1753 .await
1754 .map(gax::response::Response::into_body)
1755 }
1756
1757 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1759 self.0.request.name = v.into();
1760 self
1761 }
1762 }
1763
1764 #[doc(hidden)]
1765 impl gax::options::internal::RequestBuilder for CancelOperation {
1766 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1767 &mut self.0.options
1768 }
1769 }
1770}