1pub mod cloud_memcache {
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::CloudMemcache;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = CloudMemcache;
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::CloudMemcache>,
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::CloudMemcache>,
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::CloudMemcache>,
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::CloudMemcache>,
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::CloudMemcache>,
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
377 #[doc(hidden)]
378 impl gax::options::internal::RequestBuilder for CreateInstance {
379 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
380 &mut self.0.options
381 }
382 }
383
384 #[derive(Clone, Debug)]
403 pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
404
405 impl UpdateInstance {
406 pub(crate) fn new(
407 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
408 ) -> Self {
409 Self(RequestBuilder::new(stub))
410 }
411
412 pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
414 self.0.request = v.into();
415 self
416 }
417
418 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
420 self.0.options = v.into();
421 self
422 }
423
424 pub async fn send(self) -> Result<longrunning::model::Operation> {
431 (*self.0.stub)
432 .update_instance(self.0.request, self.0.options)
433 .await
434 .map(gax::response::Response::into_body)
435 }
436
437 pub fn poller(
439 self,
440 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
441 type Operation =
442 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
443 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
444 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
445
446 let stub = self.0.stub.clone();
447 let mut options = self.0.options.clone();
448 options.set_retry_policy(gax::retry_policy::NeverRetry);
449 let query = move |name| {
450 let stub = stub.clone();
451 let options = options.clone();
452 async {
453 let op = GetOperation::new(stub)
454 .set_name(name)
455 .with_options(options)
456 .send()
457 .await?;
458 Ok(Operation::new(op))
459 }
460 };
461
462 let start = move || async {
463 let op = self.send().await?;
464 Ok(Operation::new(op))
465 };
466
467 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
468 }
469
470 pub fn set_update_mask<T>(mut self, v: T) -> Self
474 where
475 T: std::convert::Into<wkt::FieldMask>,
476 {
477 self.0.request.update_mask = std::option::Option::Some(v.into());
478 self
479 }
480
481 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
485 where
486 T: std::convert::Into<wkt::FieldMask>,
487 {
488 self.0.request.update_mask = v.map(|x| x.into());
489 self
490 }
491
492 pub fn set_instance<T>(mut self, v: T) -> Self
496 where
497 T: std::convert::Into<crate::model::Instance>,
498 {
499 self.0.request.instance = std::option::Option::Some(v.into());
500 self
501 }
502
503 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
507 where
508 T: std::convert::Into<crate::model::Instance>,
509 {
510 self.0.request.instance = v.map(|x| x.into());
511 self
512 }
513 }
514
515 #[doc(hidden)]
516 impl gax::options::internal::RequestBuilder for UpdateInstance {
517 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
518 &mut self.0.options
519 }
520 }
521
522 #[derive(Clone, Debug)]
541 pub struct UpdateParameters(RequestBuilder<crate::model::UpdateParametersRequest>);
542
543 impl UpdateParameters {
544 pub(crate) fn new(
545 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
546 ) -> Self {
547 Self(RequestBuilder::new(stub))
548 }
549
550 pub fn with_request<V: Into<crate::model::UpdateParametersRequest>>(
552 mut self,
553 v: V,
554 ) -> Self {
555 self.0.request = v.into();
556 self
557 }
558
559 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
561 self.0.options = v.into();
562 self
563 }
564
565 pub async fn send(self) -> Result<longrunning::model::Operation> {
572 (*self.0.stub)
573 .update_parameters(self.0.request, self.0.options)
574 .await
575 .map(gax::response::Response::into_body)
576 }
577
578 pub fn poller(
580 self,
581 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
582 type Operation =
583 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
584 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
585 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
586
587 let stub = self.0.stub.clone();
588 let mut options = self.0.options.clone();
589 options.set_retry_policy(gax::retry_policy::NeverRetry);
590 let query = move |name| {
591 let stub = stub.clone();
592 let options = options.clone();
593 async {
594 let op = GetOperation::new(stub)
595 .set_name(name)
596 .with_options(options)
597 .send()
598 .await?;
599 Ok(Operation::new(op))
600 }
601 };
602
603 let start = move || async {
604 let op = self.send().await?;
605 Ok(Operation::new(op))
606 };
607
608 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
609 }
610
611 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
615 self.0.request.name = v.into();
616 self
617 }
618
619 pub fn set_update_mask<T>(mut self, v: T) -> Self
623 where
624 T: std::convert::Into<wkt::FieldMask>,
625 {
626 self.0.request.update_mask = std::option::Option::Some(v.into());
627 self
628 }
629
630 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
634 where
635 T: std::convert::Into<wkt::FieldMask>,
636 {
637 self.0.request.update_mask = v.map(|x| x.into());
638 self
639 }
640
641 pub fn set_parameters<T>(mut self, v: T) -> Self
643 where
644 T: std::convert::Into<crate::model::MemcacheParameters>,
645 {
646 self.0.request.parameters = std::option::Option::Some(v.into());
647 self
648 }
649
650 pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
652 where
653 T: std::convert::Into<crate::model::MemcacheParameters>,
654 {
655 self.0.request.parameters = v.map(|x| x.into());
656 self
657 }
658 }
659
660 #[doc(hidden)]
661 impl gax::options::internal::RequestBuilder for UpdateParameters {
662 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
663 &mut self.0.options
664 }
665 }
666
667 #[derive(Clone, Debug)]
686 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
687
688 impl DeleteInstance {
689 pub(crate) fn new(
690 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
691 ) -> Self {
692 Self(RequestBuilder::new(stub))
693 }
694
695 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
697 self.0.request = v.into();
698 self
699 }
700
701 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
703 self.0.options = v.into();
704 self
705 }
706
707 pub async fn send(self) -> Result<longrunning::model::Operation> {
714 (*self.0.stub)
715 .delete_instance(self.0.request, self.0.options)
716 .await
717 .map(gax::response::Response::into_body)
718 }
719
720 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
722 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
723 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
724 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
725
726 let stub = self.0.stub.clone();
727 let mut options = self.0.options.clone();
728 options.set_retry_policy(gax::retry_policy::NeverRetry);
729 let query = move |name| {
730 let stub = stub.clone();
731 let options = options.clone();
732 async {
733 let op = GetOperation::new(stub)
734 .set_name(name)
735 .with_options(options)
736 .send()
737 .await?;
738 Ok(Operation::new(op))
739 }
740 };
741
742 let start = move || async {
743 let op = self.send().await?;
744 Ok(Operation::new(op))
745 };
746
747 lro::internal::new_unit_response_poller(
748 polling_error_policy,
749 polling_backoff_policy,
750 start,
751 query,
752 )
753 }
754
755 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
759 self.0.request.name = v.into();
760 self
761 }
762 }
763
764 #[doc(hidden)]
765 impl gax::options::internal::RequestBuilder for DeleteInstance {
766 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
767 &mut self.0.options
768 }
769 }
770
771 #[derive(Clone, Debug)]
790 pub struct ApplyParameters(RequestBuilder<crate::model::ApplyParametersRequest>);
791
792 impl ApplyParameters {
793 pub(crate) fn new(
794 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
795 ) -> Self {
796 Self(RequestBuilder::new(stub))
797 }
798
799 pub fn with_request<V: Into<crate::model::ApplyParametersRequest>>(mut self, v: V) -> Self {
801 self.0.request = v.into();
802 self
803 }
804
805 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
807 self.0.options = v.into();
808 self
809 }
810
811 pub async fn send(self) -> Result<longrunning::model::Operation> {
818 (*self.0.stub)
819 .apply_parameters(self.0.request, self.0.options)
820 .await
821 .map(gax::response::Response::into_body)
822 }
823
824 pub fn poller(
826 self,
827 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
828 type Operation =
829 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
830 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
831 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
832
833 let stub = self.0.stub.clone();
834 let mut options = self.0.options.clone();
835 options.set_retry_policy(gax::retry_policy::NeverRetry);
836 let query = move |name| {
837 let stub = stub.clone();
838 let options = options.clone();
839 async {
840 let op = GetOperation::new(stub)
841 .set_name(name)
842 .with_options(options)
843 .send()
844 .await?;
845 Ok(Operation::new(op))
846 }
847 };
848
849 let start = move || async {
850 let op = self.send().await?;
851 Ok(Operation::new(op))
852 };
853
854 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
855 }
856
857 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
861 self.0.request.name = v.into();
862 self
863 }
864
865 pub fn set_node_ids<T, V>(mut self, v: T) -> Self
867 where
868 T: std::iter::IntoIterator<Item = V>,
869 V: std::convert::Into<std::string::String>,
870 {
871 use std::iter::Iterator;
872 self.0.request.node_ids = v.into_iter().map(|i| i.into()).collect();
873 self
874 }
875
876 pub fn set_apply_all<T: Into<bool>>(mut self, v: T) -> Self {
878 self.0.request.apply_all = v.into();
879 self
880 }
881 }
882
883 #[doc(hidden)]
884 impl gax::options::internal::RequestBuilder for ApplyParameters {
885 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
886 &mut self.0.options
887 }
888 }
889
890 #[derive(Clone, Debug)]
909 pub struct RescheduleMaintenance(RequestBuilder<crate::model::RescheduleMaintenanceRequest>);
910
911 impl RescheduleMaintenance {
912 pub(crate) fn new(
913 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
914 ) -> Self {
915 Self(RequestBuilder::new(stub))
916 }
917
918 pub fn with_request<V: Into<crate::model::RescheduleMaintenanceRequest>>(
920 mut self,
921 v: V,
922 ) -> Self {
923 self.0.request = v.into();
924 self
925 }
926
927 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
929 self.0.options = v.into();
930 self
931 }
932
933 pub async fn send(self) -> Result<longrunning::model::Operation> {
940 (*self.0.stub)
941 .reschedule_maintenance(self.0.request, self.0.options)
942 .await
943 .map(gax::response::Response::into_body)
944 }
945
946 pub fn poller(
948 self,
949 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
950 type Operation =
951 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
952 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
953 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
954
955 let stub = self.0.stub.clone();
956 let mut options = self.0.options.clone();
957 options.set_retry_policy(gax::retry_policy::NeverRetry);
958 let query = move |name| {
959 let stub = stub.clone();
960 let options = options.clone();
961 async {
962 let op = GetOperation::new(stub)
963 .set_name(name)
964 .with_options(options)
965 .send()
966 .await?;
967 Ok(Operation::new(op))
968 }
969 };
970
971 let start = move || async {
972 let op = self.send().await?;
973 Ok(Operation::new(op))
974 };
975
976 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
977 }
978
979 pub fn set_instance<T: Into<std::string::String>>(mut self, v: T) -> Self {
983 self.0.request.instance = v.into();
984 self
985 }
986
987 pub fn set_reschedule_type<
991 T: Into<crate::model::reschedule_maintenance_request::RescheduleType>,
992 >(
993 mut self,
994 v: T,
995 ) -> Self {
996 self.0.request.reschedule_type = v.into();
997 self
998 }
999
1000 pub fn set_schedule_time<T>(mut self, v: T) -> Self
1002 where
1003 T: std::convert::Into<wkt::Timestamp>,
1004 {
1005 self.0.request.schedule_time = std::option::Option::Some(v.into());
1006 self
1007 }
1008
1009 pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
1011 where
1012 T: std::convert::Into<wkt::Timestamp>,
1013 {
1014 self.0.request.schedule_time = v.map(|x| x.into());
1015 self
1016 }
1017 }
1018
1019 #[doc(hidden)]
1020 impl gax::options::internal::RequestBuilder for RescheduleMaintenance {
1021 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1022 &mut self.0.options
1023 }
1024 }
1025
1026 #[derive(Clone, Debug)]
1048 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
1049
1050 impl ListLocations {
1051 pub(crate) fn new(
1052 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1053 ) -> Self {
1054 Self(RequestBuilder::new(stub))
1055 }
1056
1057 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
1059 mut self,
1060 v: V,
1061 ) -> Self {
1062 self.0.request = v.into();
1063 self
1064 }
1065
1066 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1068 self.0.options = v.into();
1069 self
1070 }
1071
1072 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
1074 (*self.0.stub)
1075 .list_locations(self.0.request, self.0.options)
1076 .await
1077 .map(gax::response::Response::into_body)
1078 }
1079
1080 pub fn by_page(
1082 self,
1083 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
1084 {
1085 use std::clone::Clone;
1086 let token = self.0.request.page_token.clone();
1087 let execute = move |token: String| {
1088 let mut builder = self.clone();
1089 builder.0.request = builder.0.request.set_page_token(token);
1090 builder.send()
1091 };
1092 gax::paginator::internal::new_paginator(token, execute)
1093 }
1094
1095 pub fn by_item(
1097 self,
1098 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
1099 {
1100 use gax::paginator::Paginator;
1101 self.by_page().items()
1102 }
1103
1104 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1106 self.0.request.name = v.into();
1107 self
1108 }
1109
1110 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1112 self.0.request.filter = v.into();
1113 self
1114 }
1115
1116 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1118 self.0.request.page_size = v.into();
1119 self
1120 }
1121
1122 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1124 self.0.request.page_token = v.into();
1125 self
1126 }
1127 }
1128
1129 #[doc(hidden)]
1130 impl gax::options::internal::RequestBuilder for ListLocations {
1131 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1132 &mut self.0.options
1133 }
1134 }
1135
1136 #[derive(Clone, Debug)]
1154 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1155
1156 impl GetLocation {
1157 pub(crate) fn new(
1158 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1159 ) -> Self {
1160 Self(RequestBuilder::new(stub))
1161 }
1162
1163 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1165 self.0.request = v.into();
1166 self
1167 }
1168
1169 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1171 self.0.options = v.into();
1172 self
1173 }
1174
1175 pub async fn send(self) -> Result<location::model::Location> {
1177 (*self.0.stub)
1178 .get_location(self.0.request, self.0.options)
1179 .await
1180 .map(gax::response::Response::into_body)
1181 }
1182
1183 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1185 self.0.request.name = v.into();
1186 self
1187 }
1188 }
1189
1190 #[doc(hidden)]
1191 impl gax::options::internal::RequestBuilder for GetLocation {
1192 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1193 &mut self.0.options
1194 }
1195 }
1196
1197 #[derive(Clone, Debug)]
1219 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1220
1221 impl ListOperations {
1222 pub(crate) fn new(
1223 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1224 ) -> Self {
1225 Self(RequestBuilder::new(stub))
1226 }
1227
1228 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1230 mut self,
1231 v: V,
1232 ) -> Self {
1233 self.0.request = v.into();
1234 self
1235 }
1236
1237 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1239 self.0.options = v.into();
1240 self
1241 }
1242
1243 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1245 (*self.0.stub)
1246 .list_operations(self.0.request, self.0.options)
1247 .await
1248 .map(gax::response::Response::into_body)
1249 }
1250
1251 pub fn by_page(
1253 self,
1254 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1255 {
1256 use std::clone::Clone;
1257 let token = self.0.request.page_token.clone();
1258 let execute = move |token: String| {
1259 let mut builder = self.clone();
1260 builder.0.request = builder.0.request.set_page_token(token);
1261 builder.send()
1262 };
1263 gax::paginator::internal::new_paginator(token, execute)
1264 }
1265
1266 pub fn by_item(
1268 self,
1269 ) -> impl gax::paginator::ItemPaginator<
1270 longrunning::model::ListOperationsResponse,
1271 gax::error::Error,
1272 > {
1273 use gax::paginator::Paginator;
1274 self.by_page().items()
1275 }
1276
1277 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1279 self.0.request.name = v.into();
1280 self
1281 }
1282
1283 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1285 self.0.request.filter = v.into();
1286 self
1287 }
1288
1289 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1291 self.0.request.page_size = v.into();
1292 self
1293 }
1294
1295 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1297 self.0.request.page_token = v.into();
1298 self
1299 }
1300
1301 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1303 self.0.request.return_partial_success = v.into();
1304 self
1305 }
1306 }
1307
1308 #[doc(hidden)]
1309 impl gax::options::internal::RequestBuilder for ListOperations {
1310 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1311 &mut self.0.options
1312 }
1313 }
1314
1315 #[derive(Clone, Debug)]
1333 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1334
1335 impl GetOperation {
1336 pub(crate) fn new(
1337 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1338 ) -> Self {
1339 Self(RequestBuilder::new(stub))
1340 }
1341
1342 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1344 mut self,
1345 v: V,
1346 ) -> Self {
1347 self.0.request = v.into();
1348 self
1349 }
1350
1351 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1353 self.0.options = v.into();
1354 self
1355 }
1356
1357 pub async fn send(self) -> Result<longrunning::model::Operation> {
1359 (*self.0.stub)
1360 .get_operation(self.0.request, self.0.options)
1361 .await
1362 .map(gax::response::Response::into_body)
1363 }
1364
1365 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1367 self.0.request.name = v.into();
1368 self
1369 }
1370 }
1371
1372 #[doc(hidden)]
1373 impl gax::options::internal::RequestBuilder for GetOperation {
1374 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1375 &mut self.0.options
1376 }
1377 }
1378
1379 #[derive(Clone, Debug)]
1397 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1398
1399 impl DeleteOperation {
1400 pub(crate) fn new(
1401 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1402 ) -> Self {
1403 Self(RequestBuilder::new(stub))
1404 }
1405
1406 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1408 mut self,
1409 v: V,
1410 ) -> Self {
1411 self.0.request = v.into();
1412 self
1413 }
1414
1415 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1417 self.0.options = v.into();
1418 self
1419 }
1420
1421 pub async fn send(self) -> Result<()> {
1423 (*self.0.stub)
1424 .delete_operation(self.0.request, self.0.options)
1425 .await
1426 .map(gax::response::Response::into_body)
1427 }
1428
1429 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1431 self.0.request.name = v.into();
1432 self
1433 }
1434 }
1435
1436 #[doc(hidden)]
1437 impl gax::options::internal::RequestBuilder for DeleteOperation {
1438 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1439 &mut self.0.options
1440 }
1441 }
1442
1443 #[derive(Clone, Debug)]
1461 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1462
1463 impl CancelOperation {
1464 pub(crate) fn new(
1465 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1466 ) -> Self {
1467 Self(RequestBuilder::new(stub))
1468 }
1469
1470 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1472 mut self,
1473 v: V,
1474 ) -> Self {
1475 self.0.request = v.into();
1476 self
1477 }
1478
1479 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1481 self.0.options = v.into();
1482 self
1483 }
1484
1485 pub async fn send(self) -> Result<()> {
1487 (*self.0.stub)
1488 .cancel_operation(self.0.request, self.0.options)
1489 .await
1490 .map(gax::response::Response::into_body)
1491 }
1492
1493 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1495 self.0.request.name = v.into();
1496 self
1497 }
1498 }
1499
1500 #[doc(hidden)]
1501 impl gax::options::internal::RequestBuilder for CancelOperation {
1502 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1503 &mut self.0.options
1504 }
1505 }
1506}