1pub mod memorystore {
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::Memorystore;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = Memorystore;
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::Memorystore>,
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::Memorystore>,
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::Memorystore>,
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 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
171 self.0.request.filter = v.into();
172 self
173 }
174
175 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
177 self.0.request.order_by = v.into();
178 self
179 }
180 }
181
182 #[doc(hidden)]
183 impl gax::options::internal::RequestBuilder for ListInstances {
184 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
185 &mut self.0.options
186 }
187 }
188
189 #[derive(Clone, Debug)]
207 pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
208
209 impl GetInstance {
210 pub(crate) fn new(
211 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
212 ) -> Self {
213 Self(RequestBuilder::new(stub))
214 }
215
216 pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
218 self.0.request = v.into();
219 self
220 }
221
222 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
224 self.0.options = v.into();
225 self
226 }
227
228 pub async fn send(self) -> Result<crate::model::Instance> {
230 (*self.0.stub)
231 .get_instance(self.0.request, self.0.options)
232 .await
233 .map(gax::response::Response::into_body)
234 }
235
236 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
240 self.0.request.name = v.into();
241 self
242 }
243 }
244
245 #[doc(hidden)]
246 impl gax::options::internal::RequestBuilder for GetInstance {
247 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
248 &mut self.0.options
249 }
250 }
251
252 #[derive(Clone, Debug)]
271 pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
272
273 impl CreateInstance {
274 pub(crate) fn new(
275 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
276 ) -> Self {
277 Self(RequestBuilder::new(stub))
278 }
279
280 pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
282 self.0.request = v.into();
283 self
284 }
285
286 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
288 self.0.options = v.into();
289 self
290 }
291
292 pub async fn send(self) -> Result<longrunning::model::Operation> {
299 (*self.0.stub)
300 .create_instance(self.0.request, self.0.options)
301 .await
302 .map(gax::response::Response::into_body)
303 }
304
305 pub fn poller(
307 self,
308 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
309 type Operation =
310 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
311 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
312 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
313
314 let stub = self.0.stub.clone();
315 let mut options = self.0.options.clone();
316 options.set_retry_policy(gax::retry_policy::NeverRetry);
317 let query = move |name| {
318 let stub = stub.clone();
319 let options = options.clone();
320 async {
321 let op = GetOperation::new(stub)
322 .set_name(name)
323 .with_options(options)
324 .send()
325 .await?;
326 Ok(Operation::new(op))
327 }
328 };
329
330 let start = move || async {
331 let op = self.send().await?;
332 Ok(Operation::new(op))
333 };
334
335 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
336 }
337
338 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
342 self.0.request.parent = v.into();
343 self
344 }
345
346 pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
350 self.0.request.instance_id = v.into();
351 self
352 }
353
354 pub fn set_instance<T>(mut self, v: T) -> Self
358 where
359 T: std::convert::Into<crate::model::Instance>,
360 {
361 self.0.request.instance = std::option::Option::Some(v.into());
362 self
363 }
364
365 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
369 where
370 T: std::convert::Into<crate::model::Instance>,
371 {
372 self.0.request.instance = v.map(|x| x.into());
373 self
374 }
375
376 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
378 self.0.request.request_id = v.into();
379 self
380 }
381 }
382
383 #[doc(hidden)]
384 impl gax::options::internal::RequestBuilder for CreateInstance {
385 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
386 &mut self.0.options
387 }
388 }
389
390 #[derive(Clone, Debug)]
409 pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
410
411 impl UpdateInstance {
412 pub(crate) fn new(
413 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
414 ) -> Self {
415 Self(RequestBuilder::new(stub))
416 }
417
418 pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
420 self.0.request = v.into();
421 self
422 }
423
424 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
426 self.0.options = v.into();
427 self
428 }
429
430 pub async fn send(self) -> Result<longrunning::model::Operation> {
437 (*self.0.stub)
438 .update_instance(self.0.request, self.0.options)
439 .await
440 .map(gax::response::Response::into_body)
441 }
442
443 pub fn poller(
445 self,
446 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
447 type Operation =
448 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
449 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
450 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
451
452 let stub = self.0.stub.clone();
453 let mut options = self.0.options.clone();
454 options.set_retry_policy(gax::retry_policy::NeverRetry);
455 let query = move |name| {
456 let stub = stub.clone();
457 let options = options.clone();
458 async {
459 let op = GetOperation::new(stub)
460 .set_name(name)
461 .with_options(options)
462 .send()
463 .await?;
464 Ok(Operation::new(op))
465 }
466 };
467
468 let start = move || async {
469 let op = self.send().await?;
470 Ok(Operation::new(op))
471 };
472
473 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
474 }
475
476 pub fn set_update_mask<T>(mut self, v: T) -> Self
478 where
479 T: std::convert::Into<wkt::FieldMask>,
480 {
481 self.0.request.update_mask = std::option::Option::Some(v.into());
482 self
483 }
484
485 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
487 where
488 T: std::convert::Into<wkt::FieldMask>,
489 {
490 self.0.request.update_mask = v.map(|x| x.into());
491 self
492 }
493
494 pub fn set_instance<T>(mut self, v: T) -> Self
498 where
499 T: std::convert::Into<crate::model::Instance>,
500 {
501 self.0.request.instance = std::option::Option::Some(v.into());
502 self
503 }
504
505 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
509 where
510 T: std::convert::Into<crate::model::Instance>,
511 {
512 self.0.request.instance = v.map(|x| x.into());
513 self
514 }
515
516 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
518 self.0.request.request_id = v.into();
519 self
520 }
521 }
522
523 #[doc(hidden)]
524 impl gax::options::internal::RequestBuilder for UpdateInstance {
525 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
526 &mut self.0.options
527 }
528 }
529
530 #[derive(Clone, Debug)]
549 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
550
551 impl DeleteInstance {
552 pub(crate) fn new(
553 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
554 ) -> Self {
555 Self(RequestBuilder::new(stub))
556 }
557
558 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
560 self.0.request = v.into();
561 self
562 }
563
564 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
566 self.0.options = v.into();
567 self
568 }
569
570 pub async fn send(self) -> Result<longrunning::model::Operation> {
577 (*self.0.stub)
578 .delete_instance(self.0.request, self.0.options)
579 .await
580 .map(gax::response::Response::into_body)
581 }
582
583 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
585 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
586 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
587 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
588
589 let stub = self.0.stub.clone();
590 let mut options = self.0.options.clone();
591 options.set_retry_policy(gax::retry_policy::NeverRetry);
592 let query = move |name| {
593 let stub = stub.clone();
594 let options = options.clone();
595 async {
596 let op = GetOperation::new(stub)
597 .set_name(name)
598 .with_options(options)
599 .send()
600 .await?;
601 Ok(Operation::new(op))
602 }
603 };
604
605 let start = move || async {
606 let op = self.send().await?;
607 Ok(Operation::new(op))
608 };
609
610 lro::internal::new_unit_response_poller(
611 polling_error_policy,
612 polling_backoff_policy,
613 start,
614 query,
615 )
616 }
617
618 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
622 self.0.request.name = v.into();
623 self
624 }
625
626 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
628 self.0.request.request_id = v.into();
629 self
630 }
631 }
632
633 #[doc(hidden)]
634 impl gax::options::internal::RequestBuilder for DeleteInstance {
635 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
636 &mut self.0.options
637 }
638 }
639
640 #[derive(Clone, Debug)]
658 pub struct GetCertificateAuthority(
659 RequestBuilder<crate::model::GetCertificateAuthorityRequest>,
660 );
661
662 impl GetCertificateAuthority {
663 pub(crate) fn new(
664 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
665 ) -> Self {
666 Self(RequestBuilder::new(stub))
667 }
668
669 pub fn with_request<V: Into<crate::model::GetCertificateAuthorityRequest>>(
671 mut self,
672 v: V,
673 ) -> Self {
674 self.0.request = v.into();
675 self
676 }
677
678 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
680 self.0.options = v.into();
681 self
682 }
683
684 pub async fn send(self) -> Result<crate::model::CertificateAuthority> {
686 (*self.0.stub)
687 .get_certificate_authority(self.0.request, self.0.options)
688 .await
689 .map(gax::response::Response::into_body)
690 }
691
692 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
696 self.0.request.name = v.into();
697 self
698 }
699 }
700
701 #[doc(hidden)]
702 impl gax::options::internal::RequestBuilder for GetCertificateAuthority {
703 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
704 &mut self.0.options
705 }
706 }
707
708 #[derive(Clone, Debug)]
727 pub struct RescheduleMaintenance(RequestBuilder<crate::model::RescheduleMaintenanceRequest>);
728
729 impl RescheduleMaintenance {
730 pub(crate) fn new(
731 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
732 ) -> Self {
733 Self(RequestBuilder::new(stub))
734 }
735
736 pub fn with_request<V: Into<crate::model::RescheduleMaintenanceRequest>>(
738 mut self,
739 v: V,
740 ) -> Self {
741 self.0.request = v.into();
742 self
743 }
744
745 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
747 self.0.options = v.into();
748 self
749 }
750
751 pub async fn send(self) -> Result<longrunning::model::Operation> {
758 (*self.0.stub)
759 .reschedule_maintenance(self.0.request, self.0.options)
760 .await
761 .map(gax::response::Response::into_body)
762 }
763
764 pub fn poller(
766 self,
767 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
768 type Operation =
769 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
770 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
771 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
772
773 let stub = self.0.stub.clone();
774 let mut options = self.0.options.clone();
775 options.set_retry_policy(gax::retry_policy::NeverRetry);
776 let query = move |name| {
777 let stub = stub.clone();
778 let options = options.clone();
779 async {
780 let op = GetOperation::new(stub)
781 .set_name(name)
782 .with_options(options)
783 .send()
784 .await?;
785 Ok(Operation::new(op))
786 }
787 };
788
789 let start = move || async {
790 let op = self.send().await?;
791 Ok(Operation::new(op))
792 };
793
794 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
795 }
796
797 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
801 self.0.request.name = v.into();
802 self
803 }
804
805 pub fn set_reschedule_type<
809 T: Into<crate::model::reschedule_maintenance_request::RescheduleType>,
810 >(
811 mut self,
812 v: T,
813 ) -> Self {
814 self.0.request.reschedule_type = v.into();
815 self
816 }
817
818 pub fn set_schedule_time<T>(mut self, v: T) -> Self
820 where
821 T: std::convert::Into<wkt::Timestamp>,
822 {
823 self.0.request.schedule_time = std::option::Option::Some(v.into());
824 self
825 }
826
827 pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
829 where
830 T: std::convert::Into<wkt::Timestamp>,
831 {
832 self.0.request.schedule_time = v.map(|x| x.into());
833 self
834 }
835 }
836
837 #[doc(hidden)]
838 impl gax::options::internal::RequestBuilder for RescheduleMaintenance {
839 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
840 &mut self.0.options
841 }
842 }
843
844 #[derive(Clone, Debug)]
866 pub struct ListBackupCollections(RequestBuilder<crate::model::ListBackupCollectionsRequest>);
867
868 impl ListBackupCollections {
869 pub(crate) fn new(
870 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
871 ) -> Self {
872 Self(RequestBuilder::new(stub))
873 }
874
875 pub fn with_request<V: Into<crate::model::ListBackupCollectionsRequest>>(
877 mut self,
878 v: V,
879 ) -> Self {
880 self.0.request = v.into();
881 self
882 }
883
884 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
886 self.0.options = v.into();
887 self
888 }
889
890 pub async fn send(self) -> Result<crate::model::ListBackupCollectionsResponse> {
892 (*self.0.stub)
893 .list_backup_collections(self.0.request, self.0.options)
894 .await
895 .map(gax::response::Response::into_body)
896 }
897
898 pub fn by_page(
900 self,
901 ) -> impl gax::paginator::Paginator<crate::model::ListBackupCollectionsResponse, gax::error::Error>
902 {
903 use std::clone::Clone;
904 let token = self.0.request.page_token.clone();
905 let execute = move |token: String| {
906 let mut builder = self.clone();
907 builder.0.request = builder.0.request.set_page_token(token);
908 builder.send()
909 };
910 gax::paginator::internal::new_paginator(token, execute)
911 }
912
913 pub fn by_item(
915 self,
916 ) -> impl gax::paginator::ItemPaginator<
917 crate::model::ListBackupCollectionsResponse,
918 gax::error::Error,
919 > {
920 use gax::paginator::Paginator;
921 self.by_page().items()
922 }
923
924 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
928 self.0.request.parent = v.into();
929 self
930 }
931
932 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
934 self.0.request.page_size = v.into();
935 self
936 }
937
938 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
940 self.0.request.page_token = v.into();
941 self
942 }
943 }
944
945 #[doc(hidden)]
946 impl gax::options::internal::RequestBuilder for ListBackupCollections {
947 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
948 &mut self.0.options
949 }
950 }
951
952 #[derive(Clone, Debug)]
970 pub struct GetBackupCollection(RequestBuilder<crate::model::GetBackupCollectionRequest>);
971
972 impl GetBackupCollection {
973 pub(crate) fn new(
974 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
975 ) -> Self {
976 Self(RequestBuilder::new(stub))
977 }
978
979 pub fn with_request<V: Into<crate::model::GetBackupCollectionRequest>>(
981 mut self,
982 v: V,
983 ) -> Self {
984 self.0.request = v.into();
985 self
986 }
987
988 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
990 self.0.options = v.into();
991 self
992 }
993
994 pub async fn send(self) -> Result<crate::model::BackupCollection> {
996 (*self.0.stub)
997 .get_backup_collection(self.0.request, self.0.options)
998 .await
999 .map(gax::response::Response::into_body)
1000 }
1001
1002 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1006 self.0.request.name = v.into();
1007 self
1008 }
1009 }
1010
1011 #[doc(hidden)]
1012 impl gax::options::internal::RequestBuilder for GetBackupCollection {
1013 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1014 &mut self.0.options
1015 }
1016 }
1017
1018 #[derive(Clone, Debug)]
1040 pub struct ListBackups(RequestBuilder<crate::model::ListBackupsRequest>);
1041
1042 impl ListBackups {
1043 pub(crate) fn new(
1044 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1045 ) -> Self {
1046 Self(RequestBuilder::new(stub))
1047 }
1048
1049 pub fn with_request<V: Into<crate::model::ListBackupsRequest>>(mut self, v: V) -> Self {
1051 self.0.request = v.into();
1052 self
1053 }
1054
1055 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1057 self.0.options = v.into();
1058 self
1059 }
1060
1061 pub async fn send(self) -> Result<crate::model::ListBackupsResponse> {
1063 (*self.0.stub)
1064 .list_backups(self.0.request, self.0.options)
1065 .await
1066 .map(gax::response::Response::into_body)
1067 }
1068
1069 pub fn by_page(
1071 self,
1072 ) -> impl gax::paginator::Paginator<crate::model::ListBackupsResponse, gax::error::Error>
1073 {
1074 use std::clone::Clone;
1075 let token = self.0.request.page_token.clone();
1076 let execute = move |token: String| {
1077 let mut builder = self.clone();
1078 builder.0.request = builder.0.request.set_page_token(token);
1079 builder.send()
1080 };
1081 gax::paginator::internal::new_paginator(token, execute)
1082 }
1083
1084 pub fn by_item(
1086 self,
1087 ) -> impl gax::paginator::ItemPaginator<crate::model::ListBackupsResponse, gax::error::Error>
1088 {
1089 use gax::paginator::Paginator;
1090 self.by_page().items()
1091 }
1092
1093 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1097 self.0.request.parent = v.into();
1098 self
1099 }
1100
1101 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1103 self.0.request.page_size = v.into();
1104 self
1105 }
1106
1107 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1109 self.0.request.page_token = v.into();
1110 self
1111 }
1112 }
1113
1114 #[doc(hidden)]
1115 impl gax::options::internal::RequestBuilder for ListBackups {
1116 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1117 &mut self.0.options
1118 }
1119 }
1120
1121 #[derive(Clone, Debug)]
1139 pub struct GetBackup(RequestBuilder<crate::model::GetBackupRequest>);
1140
1141 impl GetBackup {
1142 pub(crate) fn new(
1143 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1144 ) -> Self {
1145 Self(RequestBuilder::new(stub))
1146 }
1147
1148 pub fn with_request<V: Into<crate::model::GetBackupRequest>>(mut self, v: V) -> Self {
1150 self.0.request = v.into();
1151 self
1152 }
1153
1154 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1156 self.0.options = v.into();
1157 self
1158 }
1159
1160 pub async fn send(self) -> Result<crate::model::Backup> {
1162 (*self.0.stub)
1163 .get_backup(self.0.request, self.0.options)
1164 .await
1165 .map(gax::response::Response::into_body)
1166 }
1167
1168 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1172 self.0.request.name = v.into();
1173 self
1174 }
1175 }
1176
1177 #[doc(hidden)]
1178 impl gax::options::internal::RequestBuilder for GetBackup {
1179 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1180 &mut self.0.options
1181 }
1182 }
1183
1184 #[derive(Clone, Debug)]
1203 pub struct DeleteBackup(RequestBuilder<crate::model::DeleteBackupRequest>);
1204
1205 impl DeleteBackup {
1206 pub(crate) fn new(
1207 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1208 ) -> Self {
1209 Self(RequestBuilder::new(stub))
1210 }
1211
1212 pub fn with_request<V: Into<crate::model::DeleteBackupRequest>>(mut self, v: V) -> Self {
1214 self.0.request = v.into();
1215 self
1216 }
1217
1218 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1220 self.0.options = v.into();
1221 self
1222 }
1223
1224 pub async fn send(self) -> Result<longrunning::model::Operation> {
1231 (*self.0.stub)
1232 .delete_backup(self.0.request, self.0.options)
1233 .await
1234 .map(gax::response::Response::into_body)
1235 }
1236
1237 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
1239 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
1240 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1241 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1242
1243 let stub = self.0.stub.clone();
1244 let mut options = self.0.options.clone();
1245 options.set_retry_policy(gax::retry_policy::NeverRetry);
1246 let query = move |name| {
1247 let stub = stub.clone();
1248 let options = options.clone();
1249 async {
1250 let op = GetOperation::new(stub)
1251 .set_name(name)
1252 .with_options(options)
1253 .send()
1254 .await?;
1255 Ok(Operation::new(op))
1256 }
1257 };
1258
1259 let start = move || async {
1260 let op = self.send().await?;
1261 Ok(Operation::new(op))
1262 };
1263
1264 lro::internal::new_unit_response_poller(
1265 polling_error_policy,
1266 polling_backoff_policy,
1267 start,
1268 query,
1269 )
1270 }
1271
1272 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1276 self.0.request.name = v.into();
1277 self
1278 }
1279
1280 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1282 self.0.request.request_id = v.into();
1283 self
1284 }
1285 }
1286
1287 #[doc(hidden)]
1288 impl gax::options::internal::RequestBuilder for DeleteBackup {
1289 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1290 &mut self.0.options
1291 }
1292 }
1293
1294 #[derive(Clone, Debug)]
1313 pub struct ExportBackup(RequestBuilder<crate::model::ExportBackupRequest>);
1314
1315 impl ExportBackup {
1316 pub(crate) fn new(
1317 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1318 ) -> Self {
1319 Self(RequestBuilder::new(stub))
1320 }
1321
1322 pub fn with_request<V: Into<crate::model::ExportBackupRequest>>(mut self, v: V) -> Self {
1324 self.0.request = v.into();
1325 self
1326 }
1327
1328 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1330 self.0.options = v.into();
1331 self
1332 }
1333
1334 pub async fn send(self) -> Result<longrunning::model::Operation> {
1341 (*self.0.stub)
1342 .export_backup(self.0.request, self.0.options)
1343 .await
1344 .map(gax::response::Response::into_body)
1345 }
1346
1347 pub fn poller(
1349 self,
1350 ) -> impl lro::Poller<crate::model::Backup, crate::model::OperationMetadata> {
1351 type Operation =
1352 lro::internal::Operation<crate::model::Backup, crate::model::OperationMetadata>;
1353 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1354 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1355
1356 let stub = self.0.stub.clone();
1357 let mut options = self.0.options.clone();
1358 options.set_retry_policy(gax::retry_policy::NeverRetry);
1359 let query = move |name| {
1360 let stub = stub.clone();
1361 let options = options.clone();
1362 async {
1363 let op = GetOperation::new(stub)
1364 .set_name(name)
1365 .with_options(options)
1366 .send()
1367 .await?;
1368 Ok(Operation::new(op))
1369 }
1370 };
1371
1372 let start = move || async {
1373 let op = self.send().await?;
1374 Ok(Operation::new(op))
1375 };
1376
1377 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1378 }
1379
1380 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1384 self.0.request.name = v.into();
1385 self
1386 }
1387
1388 pub fn set_destination<
1393 T: Into<Option<crate::model::export_backup_request::Destination>>,
1394 >(
1395 mut self,
1396 v: T,
1397 ) -> Self {
1398 self.0.request.destination = v.into();
1399 self
1400 }
1401
1402 pub fn set_gcs_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1408 self.0.request = self.0.request.set_gcs_bucket(v);
1409 self
1410 }
1411 }
1412
1413 #[doc(hidden)]
1414 impl gax::options::internal::RequestBuilder for ExportBackup {
1415 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1416 &mut self.0.options
1417 }
1418 }
1419
1420 #[derive(Clone, Debug)]
1439 pub struct BackupInstance(RequestBuilder<crate::model::BackupInstanceRequest>);
1440
1441 impl BackupInstance {
1442 pub(crate) fn new(
1443 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1444 ) -> Self {
1445 Self(RequestBuilder::new(stub))
1446 }
1447
1448 pub fn with_request<V: Into<crate::model::BackupInstanceRequest>>(mut self, v: V) -> Self {
1450 self.0.request = v.into();
1451 self
1452 }
1453
1454 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1456 self.0.options = v.into();
1457 self
1458 }
1459
1460 pub async fn send(self) -> Result<longrunning::model::Operation> {
1467 (*self.0.stub)
1468 .backup_instance(self.0.request, self.0.options)
1469 .await
1470 .map(gax::response::Response::into_body)
1471 }
1472
1473 pub fn poller(
1475 self,
1476 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
1477 type Operation =
1478 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
1479 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1480 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1481
1482 let stub = self.0.stub.clone();
1483 let mut options = self.0.options.clone();
1484 options.set_retry_policy(gax::retry_policy::NeverRetry);
1485 let query = move |name| {
1486 let stub = stub.clone();
1487 let options = options.clone();
1488 async {
1489 let op = GetOperation::new(stub)
1490 .set_name(name)
1491 .with_options(options)
1492 .send()
1493 .await?;
1494 Ok(Operation::new(op))
1495 }
1496 };
1497
1498 let start = move || async {
1499 let op = self.send().await?;
1500 Ok(Operation::new(op))
1501 };
1502
1503 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1504 }
1505
1506 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1510 self.0.request.name = v.into();
1511 self
1512 }
1513
1514 pub fn set_ttl<T>(mut self, v: T) -> Self
1516 where
1517 T: std::convert::Into<wkt::Duration>,
1518 {
1519 self.0.request.ttl = std::option::Option::Some(v.into());
1520 self
1521 }
1522
1523 pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
1525 where
1526 T: std::convert::Into<wkt::Duration>,
1527 {
1528 self.0.request.ttl = v.map(|x| x.into());
1529 self
1530 }
1531
1532 pub fn set_backup_id<T>(mut self, v: T) -> Self
1534 where
1535 T: std::convert::Into<std::string::String>,
1536 {
1537 self.0.request.backup_id = std::option::Option::Some(v.into());
1538 self
1539 }
1540
1541 pub fn set_or_clear_backup_id<T>(mut self, v: std::option::Option<T>) -> Self
1543 where
1544 T: std::convert::Into<std::string::String>,
1545 {
1546 self.0.request.backup_id = v.map(|x| x.into());
1547 self
1548 }
1549 }
1550
1551 #[doc(hidden)]
1552 impl gax::options::internal::RequestBuilder for BackupInstance {
1553 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1554 &mut self.0.options
1555 }
1556 }
1557
1558 #[derive(Clone, Debug)]
1580 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
1581
1582 impl ListLocations {
1583 pub(crate) fn new(
1584 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1585 ) -> Self {
1586 Self(RequestBuilder::new(stub))
1587 }
1588
1589 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
1591 mut self,
1592 v: V,
1593 ) -> Self {
1594 self.0.request = v.into();
1595 self
1596 }
1597
1598 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1600 self.0.options = v.into();
1601 self
1602 }
1603
1604 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
1606 (*self.0.stub)
1607 .list_locations(self.0.request, self.0.options)
1608 .await
1609 .map(gax::response::Response::into_body)
1610 }
1611
1612 pub fn by_page(
1614 self,
1615 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
1616 {
1617 use std::clone::Clone;
1618 let token = self.0.request.page_token.clone();
1619 let execute = move |token: String| {
1620 let mut builder = self.clone();
1621 builder.0.request = builder.0.request.set_page_token(token);
1622 builder.send()
1623 };
1624 gax::paginator::internal::new_paginator(token, execute)
1625 }
1626
1627 pub fn by_item(
1629 self,
1630 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
1631 {
1632 use gax::paginator::Paginator;
1633 self.by_page().items()
1634 }
1635
1636 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1638 self.0.request.name = v.into();
1639 self
1640 }
1641
1642 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1644 self.0.request.filter = v.into();
1645 self
1646 }
1647
1648 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1650 self.0.request.page_size = v.into();
1651 self
1652 }
1653
1654 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1656 self.0.request.page_token = v.into();
1657 self
1658 }
1659 }
1660
1661 #[doc(hidden)]
1662 impl gax::options::internal::RequestBuilder for ListLocations {
1663 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1664 &mut self.0.options
1665 }
1666 }
1667
1668 #[derive(Clone, Debug)]
1686 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1687
1688 impl GetLocation {
1689 pub(crate) fn new(
1690 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1691 ) -> Self {
1692 Self(RequestBuilder::new(stub))
1693 }
1694
1695 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1697 self.0.request = v.into();
1698 self
1699 }
1700
1701 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1703 self.0.options = v.into();
1704 self
1705 }
1706
1707 pub async fn send(self) -> Result<location::model::Location> {
1709 (*self.0.stub)
1710 .get_location(self.0.request, self.0.options)
1711 .await
1712 .map(gax::response::Response::into_body)
1713 }
1714
1715 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1717 self.0.request.name = v.into();
1718 self
1719 }
1720 }
1721
1722 #[doc(hidden)]
1723 impl gax::options::internal::RequestBuilder for GetLocation {
1724 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1725 &mut self.0.options
1726 }
1727 }
1728
1729 #[derive(Clone, Debug)]
1751 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1752
1753 impl ListOperations {
1754 pub(crate) fn new(
1755 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1756 ) -> Self {
1757 Self(RequestBuilder::new(stub))
1758 }
1759
1760 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1762 mut self,
1763 v: V,
1764 ) -> Self {
1765 self.0.request = v.into();
1766 self
1767 }
1768
1769 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1771 self.0.options = v.into();
1772 self
1773 }
1774
1775 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1777 (*self.0.stub)
1778 .list_operations(self.0.request, self.0.options)
1779 .await
1780 .map(gax::response::Response::into_body)
1781 }
1782
1783 pub fn by_page(
1785 self,
1786 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1787 {
1788 use std::clone::Clone;
1789 let token = self.0.request.page_token.clone();
1790 let execute = move |token: String| {
1791 let mut builder = self.clone();
1792 builder.0.request = builder.0.request.set_page_token(token);
1793 builder.send()
1794 };
1795 gax::paginator::internal::new_paginator(token, execute)
1796 }
1797
1798 pub fn by_item(
1800 self,
1801 ) -> impl gax::paginator::ItemPaginator<
1802 longrunning::model::ListOperationsResponse,
1803 gax::error::Error,
1804 > {
1805 use gax::paginator::Paginator;
1806 self.by_page().items()
1807 }
1808
1809 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1811 self.0.request.name = v.into();
1812 self
1813 }
1814
1815 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1817 self.0.request.filter = v.into();
1818 self
1819 }
1820
1821 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1823 self.0.request.page_size = v.into();
1824 self
1825 }
1826
1827 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1829 self.0.request.page_token = v.into();
1830 self
1831 }
1832
1833 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1835 self.0.request.return_partial_success = v.into();
1836 self
1837 }
1838 }
1839
1840 #[doc(hidden)]
1841 impl gax::options::internal::RequestBuilder for ListOperations {
1842 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1843 &mut self.0.options
1844 }
1845 }
1846
1847 #[derive(Clone, Debug)]
1865 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1866
1867 impl GetOperation {
1868 pub(crate) fn new(
1869 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1870 ) -> Self {
1871 Self(RequestBuilder::new(stub))
1872 }
1873
1874 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
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<longrunning::model::Operation> {
1891 (*self.0.stub)
1892 .get_operation(self.0.request, self.0.options)
1893 .await
1894 .map(gax::response::Response::into_body)
1895 }
1896
1897 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1899 self.0.request.name = v.into();
1900 self
1901 }
1902 }
1903
1904 #[doc(hidden)]
1905 impl gax::options::internal::RequestBuilder for GetOperation {
1906 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1907 &mut self.0.options
1908 }
1909 }
1910
1911 #[derive(Clone, Debug)]
1929 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1930
1931 impl DeleteOperation {
1932 pub(crate) fn new(
1933 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1934 ) -> Self {
1935 Self(RequestBuilder::new(stub))
1936 }
1937
1938 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1940 mut self,
1941 v: V,
1942 ) -> Self {
1943 self.0.request = v.into();
1944 self
1945 }
1946
1947 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1949 self.0.options = v.into();
1950 self
1951 }
1952
1953 pub async fn send(self) -> Result<()> {
1955 (*self.0.stub)
1956 .delete_operation(self.0.request, self.0.options)
1957 .await
1958 .map(gax::response::Response::into_body)
1959 }
1960
1961 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1963 self.0.request.name = v.into();
1964 self
1965 }
1966 }
1967
1968 #[doc(hidden)]
1969 impl gax::options::internal::RequestBuilder for DeleteOperation {
1970 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1971 &mut self.0.options
1972 }
1973 }
1974
1975 #[derive(Clone, Debug)]
1993 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1994
1995 impl CancelOperation {
1996 pub(crate) fn new(
1997 stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1998 ) -> Self {
1999 Self(RequestBuilder::new(stub))
2000 }
2001
2002 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2004 mut self,
2005 v: V,
2006 ) -> Self {
2007 self.0.request = v.into();
2008 self
2009 }
2010
2011 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2013 self.0.options = v.into();
2014 self
2015 }
2016
2017 pub async fn send(self) -> Result<()> {
2019 (*self.0.stub)
2020 .cancel_operation(self.0.request, self.0.options)
2021 .await
2022 .map(gax::response::Response::into_body)
2023 }
2024
2025 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2027 self.0.request.name = v.into();
2028 self
2029 }
2030 }
2031
2032 #[doc(hidden)]
2033 impl gax::options::internal::RequestBuilder for CancelOperation {
2034 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2035 &mut self.0.options
2036 }
2037 }
2038}