1pub mod cloud_memcache {
18 use crate::Result;
19
20 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
34
35 pub(crate) mod client {
36 use super::super::super::client::CloudMemcache;
37 pub struct Factory;
38 impl crate::ClientFactory for Factory {
39 type Client = CloudMemcache;
40 type Credentials = gaxi::options::Credentials;
41 async fn build(
42 self,
43 config: gaxi::options::ClientConfig,
44 ) -> crate::ClientBuilderResult<Self::Client> {
45 Self::Client::new(config).await
46 }
47 }
48 }
49
50 #[derive(Clone, Debug)]
52 pub(crate) struct RequestBuilder<R: std::default::Default> {
53 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
54 request: R,
55 options: crate::RequestOptions,
56 }
57
58 impl<R> RequestBuilder<R>
59 where
60 R: std::default::Default,
61 {
62 pub(crate) fn new(
63 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
64 ) -> Self {
65 Self {
66 stub,
67 request: R::default(),
68 options: crate::RequestOptions::default(),
69 }
70 }
71 }
72
73 #[derive(Clone, Debug)]
94 pub struct ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
95
96 impl ListInstances {
97 pub(crate) fn new(
98 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
99 ) -> Self {
100 Self(RequestBuilder::new(stub))
101 }
102
103 pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
105 self.0.request = v.into();
106 self
107 }
108
109 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
111 self.0.options = v.into();
112 self
113 }
114
115 pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
117 (*self.0.stub)
118 .list_instances(self.0.request, self.0.options)
119 .await
120 .map(crate::Response::into_body)
121 }
122
123 pub fn by_page(
125 self,
126 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListInstancesResponse, crate::Error>
127 {
128 use std::clone::Clone;
129 let token = self.0.request.page_token.clone();
130 let execute = move |token: String| {
131 let mut builder = self.clone();
132 builder.0.request = builder.0.request.set_page_token(token);
133 builder.send()
134 };
135 google_cloud_gax::paginator::internal::new_paginator(token, execute)
136 }
137
138 pub fn by_item(
140 self,
141 ) -> impl google_cloud_gax::paginator::ItemPaginator<
142 crate::model::ListInstancesResponse,
143 crate::Error,
144 > {
145 use google_cloud_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 crate::RequestBuilder for ListInstances {
184 fn request_options(&mut self) -> &mut crate::RequestOptions {
185 &mut self.0.options
186 }
187 }
188
189 #[derive(Clone, Debug)]
206 pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
207
208 impl GetInstance {
209 pub(crate) fn new(
210 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
211 ) -> Self {
212 Self(RequestBuilder::new(stub))
213 }
214
215 pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
217 self.0.request = v.into();
218 self
219 }
220
221 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
223 self.0.options = v.into();
224 self
225 }
226
227 pub async fn send(self) -> Result<crate::model::Instance> {
229 (*self.0.stub)
230 .get_instance(self.0.request, self.0.options)
231 .await
232 .map(crate::Response::into_body)
233 }
234
235 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
239 self.0.request.name = v.into();
240 self
241 }
242 }
243
244 #[doc(hidden)]
245 impl crate::RequestBuilder for GetInstance {
246 fn request_options(&mut self) -> &mut crate::RequestOptions {
247 &mut self.0.options
248 }
249 }
250
251 #[derive(Clone, Debug)]
269 pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
270
271 impl CreateInstance {
272 pub(crate) fn new(
273 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
274 ) -> Self {
275 Self(RequestBuilder::new(stub))
276 }
277
278 pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
280 self.0.request = v.into();
281 self
282 }
283
284 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
286 self.0.options = v.into();
287 self
288 }
289
290 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
297 (*self.0.stub)
298 .create_instance(self.0.request, self.0.options)
299 .await
300 .map(crate::Response::into_body)
301 }
302
303 pub fn poller(
305 self,
306 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
307 {
308 type Operation = google_cloud_lro::internal::Operation<
309 crate::model::Instance,
310 crate::model::OperationMetadata,
311 >;
312 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
313 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
314
315 let stub = self.0.stub.clone();
316 let mut options = self.0.options.clone();
317 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
318 let query = move |name| {
319 let stub = stub.clone();
320 let options = options.clone();
321 async {
322 let op = GetOperation::new(stub)
323 .set_name(name)
324 .with_options(options)
325 .send()
326 .await?;
327 Ok(Operation::new(op))
328 }
329 };
330
331 let start = move || async {
332 let op = self.send().await?;
333 Ok(Operation::new(op))
334 };
335
336 google_cloud_lro::internal::new_poller(
337 polling_error_policy,
338 polling_backoff_policy,
339 start,
340 query,
341 )
342 }
343
344 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
348 self.0.request.parent = v.into();
349 self
350 }
351
352 pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
356 self.0.request.instance_id = v.into();
357 self
358 }
359
360 pub fn set_instance<T>(mut self, v: T) -> Self
364 where
365 T: std::convert::Into<crate::model::Instance>,
366 {
367 self.0.request.instance = std::option::Option::Some(v.into());
368 self
369 }
370
371 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
375 where
376 T: std::convert::Into<crate::model::Instance>,
377 {
378 self.0.request.instance = v.map(|x| x.into());
379 self
380 }
381 }
382
383 #[doc(hidden)]
384 impl crate::RequestBuilder for CreateInstance {
385 fn request_options(&mut self) -> &mut crate::RequestOptions {
386 &mut self.0.options
387 }
388 }
389
390 #[derive(Clone, Debug)]
408 pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
409
410 impl UpdateInstance {
411 pub(crate) fn new(
412 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
413 ) -> Self {
414 Self(RequestBuilder::new(stub))
415 }
416
417 pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
419 self.0.request = v.into();
420 self
421 }
422
423 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
425 self.0.options = v.into();
426 self
427 }
428
429 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
436 (*self.0.stub)
437 .update_instance(self.0.request, self.0.options)
438 .await
439 .map(crate::Response::into_body)
440 }
441
442 pub fn poller(
444 self,
445 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
446 {
447 type Operation = google_cloud_lro::internal::Operation<
448 crate::model::Instance,
449 crate::model::OperationMetadata,
450 >;
451 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
452 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
453
454 let stub = self.0.stub.clone();
455 let mut options = self.0.options.clone();
456 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
457 let query = move |name| {
458 let stub = stub.clone();
459 let options = options.clone();
460 async {
461 let op = GetOperation::new(stub)
462 .set_name(name)
463 .with_options(options)
464 .send()
465 .await?;
466 Ok(Operation::new(op))
467 }
468 };
469
470 let start = move || async {
471 let op = self.send().await?;
472 Ok(Operation::new(op))
473 };
474
475 google_cloud_lro::internal::new_poller(
476 polling_error_policy,
477 polling_backoff_policy,
478 start,
479 query,
480 )
481 }
482
483 pub fn set_update_mask<T>(mut self, v: T) -> Self
487 where
488 T: std::convert::Into<wkt::FieldMask>,
489 {
490 self.0.request.update_mask = std::option::Option::Some(v.into());
491 self
492 }
493
494 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
498 where
499 T: std::convert::Into<wkt::FieldMask>,
500 {
501 self.0.request.update_mask = v.map(|x| x.into());
502 self
503 }
504
505 pub fn set_instance<T>(mut self, v: T) -> Self
509 where
510 T: std::convert::Into<crate::model::Instance>,
511 {
512 self.0.request.instance = std::option::Option::Some(v.into());
513 self
514 }
515
516 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
520 where
521 T: std::convert::Into<crate::model::Instance>,
522 {
523 self.0.request.instance = v.map(|x| x.into());
524 self
525 }
526 }
527
528 #[doc(hidden)]
529 impl crate::RequestBuilder for UpdateInstance {
530 fn request_options(&mut self) -> &mut crate::RequestOptions {
531 &mut self.0.options
532 }
533 }
534
535 #[derive(Clone, Debug)]
553 pub struct UpdateParameters(RequestBuilder<crate::model::UpdateParametersRequest>);
554
555 impl UpdateParameters {
556 pub(crate) fn new(
557 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
558 ) -> Self {
559 Self(RequestBuilder::new(stub))
560 }
561
562 pub fn with_request<V: Into<crate::model::UpdateParametersRequest>>(
564 mut self,
565 v: V,
566 ) -> Self {
567 self.0.request = v.into();
568 self
569 }
570
571 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
573 self.0.options = v.into();
574 self
575 }
576
577 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
584 (*self.0.stub)
585 .update_parameters(self.0.request, self.0.options)
586 .await
587 .map(crate::Response::into_body)
588 }
589
590 pub fn poller(
592 self,
593 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
594 {
595 type Operation = google_cloud_lro::internal::Operation<
596 crate::model::Instance,
597 crate::model::OperationMetadata,
598 >;
599 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
600 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
601
602 let stub = self.0.stub.clone();
603 let mut options = self.0.options.clone();
604 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
605 let query = move |name| {
606 let stub = stub.clone();
607 let options = options.clone();
608 async {
609 let op = GetOperation::new(stub)
610 .set_name(name)
611 .with_options(options)
612 .send()
613 .await?;
614 Ok(Operation::new(op))
615 }
616 };
617
618 let start = move || async {
619 let op = self.send().await?;
620 Ok(Operation::new(op))
621 };
622
623 google_cloud_lro::internal::new_poller(
624 polling_error_policy,
625 polling_backoff_policy,
626 start,
627 query,
628 )
629 }
630
631 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
635 self.0.request.name = v.into();
636 self
637 }
638
639 pub fn set_update_mask<T>(mut self, v: T) -> Self
643 where
644 T: std::convert::Into<wkt::FieldMask>,
645 {
646 self.0.request.update_mask = std::option::Option::Some(v.into());
647 self
648 }
649
650 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
654 where
655 T: std::convert::Into<wkt::FieldMask>,
656 {
657 self.0.request.update_mask = v.map(|x| x.into());
658 self
659 }
660
661 pub fn set_parameters<T>(mut self, v: T) -> Self
663 where
664 T: std::convert::Into<crate::model::MemcacheParameters>,
665 {
666 self.0.request.parameters = std::option::Option::Some(v.into());
667 self
668 }
669
670 pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
672 where
673 T: std::convert::Into<crate::model::MemcacheParameters>,
674 {
675 self.0.request.parameters = v.map(|x| x.into());
676 self
677 }
678 }
679
680 #[doc(hidden)]
681 impl crate::RequestBuilder for UpdateParameters {
682 fn request_options(&mut self) -> &mut crate::RequestOptions {
683 &mut self.0.options
684 }
685 }
686
687 #[derive(Clone, Debug)]
705 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
706
707 impl DeleteInstance {
708 pub(crate) fn new(
709 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
710 ) -> Self {
711 Self(RequestBuilder::new(stub))
712 }
713
714 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
716 self.0.request = v.into();
717 self
718 }
719
720 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
722 self.0.options = v.into();
723 self
724 }
725
726 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
733 (*self.0.stub)
734 .delete_instance(self.0.request, self.0.options)
735 .await
736 .map(crate::Response::into_body)
737 }
738
739 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
741 type Operation =
742 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
743 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
744 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
745
746 let stub = self.0.stub.clone();
747 let mut options = self.0.options.clone();
748 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
749 let query = move |name| {
750 let stub = stub.clone();
751 let options = options.clone();
752 async {
753 let op = GetOperation::new(stub)
754 .set_name(name)
755 .with_options(options)
756 .send()
757 .await?;
758 Ok(Operation::new(op))
759 }
760 };
761
762 let start = move || async {
763 let op = self.send().await?;
764 Ok(Operation::new(op))
765 };
766
767 google_cloud_lro::internal::new_unit_response_poller(
768 polling_error_policy,
769 polling_backoff_policy,
770 start,
771 query,
772 )
773 }
774
775 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
779 self.0.request.name = v.into();
780 self
781 }
782 }
783
784 #[doc(hidden)]
785 impl crate::RequestBuilder for DeleteInstance {
786 fn request_options(&mut self) -> &mut crate::RequestOptions {
787 &mut self.0.options
788 }
789 }
790
791 #[derive(Clone, Debug)]
809 pub struct ApplyParameters(RequestBuilder<crate::model::ApplyParametersRequest>);
810
811 impl ApplyParameters {
812 pub(crate) fn new(
813 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
814 ) -> Self {
815 Self(RequestBuilder::new(stub))
816 }
817
818 pub fn with_request<V: Into<crate::model::ApplyParametersRequest>>(mut self, v: V) -> Self {
820 self.0.request = v.into();
821 self
822 }
823
824 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
826 self.0.options = v.into();
827 self
828 }
829
830 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
837 (*self.0.stub)
838 .apply_parameters(self.0.request, self.0.options)
839 .await
840 .map(crate::Response::into_body)
841 }
842
843 pub fn poller(
845 self,
846 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
847 {
848 type Operation = google_cloud_lro::internal::Operation<
849 crate::model::Instance,
850 crate::model::OperationMetadata,
851 >;
852 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
853 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
854
855 let stub = self.0.stub.clone();
856 let mut options = self.0.options.clone();
857 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
858 let query = move |name| {
859 let stub = stub.clone();
860 let options = options.clone();
861 async {
862 let op = GetOperation::new(stub)
863 .set_name(name)
864 .with_options(options)
865 .send()
866 .await?;
867 Ok(Operation::new(op))
868 }
869 };
870
871 let start = move || async {
872 let op = self.send().await?;
873 Ok(Operation::new(op))
874 };
875
876 google_cloud_lro::internal::new_poller(
877 polling_error_policy,
878 polling_backoff_policy,
879 start,
880 query,
881 )
882 }
883
884 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
888 self.0.request.name = v.into();
889 self
890 }
891
892 pub fn set_node_ids<T, V>(mut self, v: T) -> Self
894 where
895 T: std::iter::IntoIterator<Item = V>,
896 V: std::convert::Into<std::string::String>,
897 {
898 use std::iter::Iterator;
899 self.0.request.node_ids = v.into_iter().map(|i| i.into()).collect();
900 self
901 }
902
903 pub fn set_apply_all<T: Into<bool>>(mut self, v: T) -> Self {
905 self.0.request.apply_all = v.into();
906 self
907 }
908 }
909
910 #[doc(hidden)]
911 impl crate::RequestBuilder for ApplyParameters {
912 fn request_options(&mut self) -> &mut crate::RequestOptions {
913 &mut self.0.options
914 }
915 }
916
917 #[derive(Clone, Debug)]
935 pub struct RescheduleMaintenance(RequestBuilder<crate::model::RescheduleMaintenanceRequest>);
936
937 impl RescheduleMaintenance {
938 pub(crate) fn new(
939 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
940 ) -> Self {
941 Self(RequestBuilder::new(stub))
942 }
943
944 pub fn with_request<V: Into<crate::model::RescheduleMaintenanceRequest>>(
946 mut self,
947 v: V,
948 ) -> Self {
949 self.0.request = v.into();
950 self
951 }
952
953 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
955 self.0.options = v.into();
956 self
957 }
958
959 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
966 (*self.0.stub)
967 .reschedule_maintenance(self.0.request, self.0.options)
968 .await
969 .map(crate::Response::into_body)
970 }
971
972 pub fn poller(
974 self,
975 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
976 {
977 type Operation = google_cloud_lro::internal::Operation<
978 crate::model::Instance,
979 crate::model::OperationMetadata,
980 >;
981 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
982 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
983
984 let stub = self.0.stub.clone();
985 let mut options = self.0.options.clone();
986 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
987 let query = move |name| {
988 let stub = stub.clone();
989 let options = options.clone();
990 async {
991 let op = GetOperation::new(stub)
992 .set_name(name)
993 .with_options(options)
994 .send()
995 .await?;
996 Ok(Operation::new(op))
997 }
998 };
999
1000 let start = move || async {
1001 let op = self.send().await?;
1002 Ok(Operation::new(op))
1003 };
1004
1005 google_cloud_lro::internal::new_poller(
1006 polling_error_policy,
1007 polling_backoff_policy,
1008 start,
1009 query,
1010 )
1011 }
1012
1013 pub fn set_instance<T: Into<std::string::String>>(mut self, v: T) -> Self {
1017 self.0.request.instance = v.into();
1018 self
1019 }
1020
1021 pub fn set_reschedule_type<
1025 T: Into<crate::model::reschedule_maintenance_request::RescheduleType>,
1026 >(
1027 mut self,
1028 v: T,
1029 ) -> Self {
1030 self.0.request.reschedule_type = v.into();
1031 self
1032 }
1033
1034 pub fn set_schedule_time<T>(mut self, v: T) -> Self
1036 where
1037 T: std::convert::Into<wkt::Timestamp>,
1038 {
1039 self.0.request.schedule_time = std::option::Option::Some(v.into());
1040 self
1041 }
1042
1043 pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
1045 where
1046 T: std::convert::Into<wkt::Timestamp>,
1047 {
1048 self.0.request.schedule_time = v.map(|x| x.into());
1049 self
1050 }
1051 }
1052
1053 #[doc(hidden)]
1054 impl crate::RequestBuilder for RescheduleMaintenance {
1055 fn request_options(&mut self) -> &mut crate::RequestOptions {
1056 &mut self.0.options
1057 }
1058 }
1059
1060 #[derive(Clone, Debug)]
1081 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
1082
1083 impl ListLocations {
1084 pub(crate) fn new(
1085 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1086 ) -> Self {
1087 Self(RequestBuilder::new(stub))
1088 }
1089
1090 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
1092 mut self,
1093 v: V,
1094 ) -> Self {
1095 self.0.request = v.into();
1096 self
1097 }
1098
1099 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1101 self.0.options = v.into();
1102 self
1103 }
1104
1105 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
1107 (*self.0.stub)
1108 .list_locations(self.0.request, self.0.options)
1109 .await
1110 .map(crate::Response::into_body)
1111 }
1112
1113 pub fn by_page(
1115 self,
1116 ) -> impl google_cloud_gax::paginator::Paginator<
1117 google_cloud_location::model::ListLocationsResponse,
1118 crate::Error,
1119 > {
1120 use std::clone::Clone;
1121 let token = self.0.request.page_token.clone();
1122 let execute = move |token: String| {
1123 let mut builder = self.clone();
1124 builder.0.request = builder.0.request.set_page_token(token);
1125 builder.send()
1126 };
1127 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1128 }
1129
1130 pub fn by_item(
1132 self,
1133 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1134 google_cloud_location::model::ListLocationsResponse,
1135 crate::Error,
1136 > {
1137 use google_cloud_gax::paginator::Paginator;
1138 self.by_page().items()
1139 }
1140
1141 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1143 self.0.request.name = v.into();
1144 self
1145 }
1146
1147 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1149 self.0.request.filter = v.into();
1150 self
1151 }
1152
1153 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1155 self.0.request.page_size = v.into();
1156 self
1157 }
1158
1159 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1161 self.0.request.page_token = v.into();
1162 self
1163 }
1164 }
1165
1166 #[doc(hidden)]
1167 impl crate::RequestBuilder for ListLocations {
1168 fn request_options(&mut self) -> &mut crate::RequestOptions {
1169 &mut self.0.options
1170 }
1171 }
1172
1173 #[derive(Clone, Debug)]
1190 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
1191
1192 impl GetLocation {
1193 pub(crate) fn new(
1194 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1195 ) -> Self {
1196 Self(RequestBuilder::new(stub))
1197 }
1198
1199 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
1201 mut self,
1202 v: V,
1203 ) -> Self {
1204 self.0.request = v.into();
1205 self
1206 }
1207
1208 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1210 self.0.options = v.into();
1211 self
1212 }
1213
1214 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
1216 (*self.0.stub)
1217 .get_location(self.0.request, self.0.options)
1218 .await
1219 .map(crate::Response::into_body)
1220 }
1221
1222 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1224 self.0.request.name = v.into();
1225 self
1226 }
1227 }
1228
1229 #[doc(hidden)]
1230 impl crate::RequestBuilder for GetLocation {
1231 fn request_options(&mut self) -> &mut crate::RequestOptions {
1232 &mut self.0.options
1233 }
1234 }
1235
1236 #[derive(Clone, Debug)]
1257 pub struct ListOperations(
1258 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1259 );
1260
1261 impl ListOperations {
1262 pub(crate) fn new(
1263 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1264 ) -> Self {
1265 Self(RequestBuilder::new(stub))
1266 }
1267
1268 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1270 mut self,
1271 v: V,
1272 ) -> Self {
1273 self.0.request = v.into();
1274 self
1275 }
1276
1277 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1279 self.0.options = v.into();
1280 self
1281 }
1282
1283 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1285 (*self.0.stub)
1286 .list_operations(self.0.request, self.0.options)
1287 .await
1288 .map(crate::Response::into_body)
1289 }
1290
1291 pub fn by_page(
1293 self,
1294 ) -> impl google_cloud_gax::paginator::Paginator<
1295 google_cloud_longrunning::model::ListOperationsResponse,
1296 crate::Error,
1297 > {
1298 use std::clone::Clone;
1299 let token = self.0.request.page_token.clone();
1300 let execute = move |token: String| {
1301 let mut builder = self.clone();
1302 builder.0.request = builder.0.request.set_page_token(token);
1303 builder.send()
1304 };
1305 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1306 }
1307
1308 pub fn by_item(
1310 self,
1311 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1312 google_cloud_longrunning::model::ListOperationsResponse,
1313 crate::Error,
1314 > {
1315 use google_cloud_gax::paginator::Paginator;
1316 self.by_page().items()
1317 }
1318
1319 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1321 self.0.request.name = v.into();
1322 self
1323 }
1324
1325 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1327 self.0.request.filter = v.into();
1328 self
1329 }
1330
1331 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1333 self.0.request.page_size = v.into();
1334 self
1335 }
1336
1337 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1339 self.0.request.page_token = v.into();
1340 self
1341 }
1342
1343 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1345 self.0.request.return_partial_success = v.into();
1346 self
1347 }
1348 }
1349
1350 #[doc(hidden)]
1351 impl crate::RequestBuilder for ListOperations {
1352 fn request_options(&mut self) -> &mut crate::RequestOptions {
1353 &mut self.0.options
1354 }
1355 }
1356
1357 #[derive(Clone, Debug)]
1374 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1375
1376 impl GetOperation {
1377 pub(crate) fn new(
1378 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1379 ) -> Self {
1380 Self(RequestBuilder::new(stub))
1381 }
1382
1383 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1385 mut self,
1386 v: V,
1387 ) -> Self {
1388 self.0.request = v.into();
1389 self
1390 }
1391
1392 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1394 self.0.options = v.into();
1395 self
1396 }
1397
1398 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1400 (*self.0.stub)
1401 .get_operation(self.0.request, self.0.options)
1402 .await
1403 .map(crate::Response::into_body)
1404 }
1405
1406 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1408 self.0.request.name = v.into();
1409 self
1410 }
1411 }
1412
1413 #[doc(hidden)]
1414 impl crate::RequestBuilder for GetOperation {
1415 fn request_options(&mut self) -> &mut crate::RequestOptions {
1416 &mut self.0.options
1417 }
1418 }
1419
1420 #[derive(Clone, Debug)]
1437 pub struct DeleteOperation(
1438 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
1439 );
1440
1441 impl DeleteOperation {
1442 pub(crate) fn new(
1443 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1444 ) -> Self {
1445 Self(RequestBuilder::new(stub))
1446 }
1447
1448 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
1450 mut self,
1451 v: V,
1452 ) -> Self {
1453 self.0.request = v.into();
1454 self
1455 }
1456
1457 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1459 self.0.options = v.into();
1460 self
1461 }
1462
1463 pub async fn send(self) -> Result<()> {
1465 (*self.0.stub)
1466 .delete_operation(self.0.request, self.0.options)
1467 .await
1468 .map(crate::Response::into_body)
1469 }
1470
1471 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1473 self.0.request.name = v.into();
1474 self
1475 }
1476 }
1477
1478 #[doc(hidden)]
1479 impl crate::RequestBuilder for DeleteOperation {
1480 fn request_options(&mut self) -> &mut crate::RequestOptions {
1481 &mut self.0.options
1482 }
1483 }
1484
1485 #[derive(Clone, Debug)]
1502 pub struct CancelOperation(
1503 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1504 );
1505
1506 impl CancelOperation {
1507 pub(crate) fn new(
1508 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1509 ) -> Self {
1510 Self(RequestBuilder::new(stub))
1511 }
1512
1513 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
1515 mut self,
1516 v: V,
1517 ) -> Self {
1518 self.0.request = v.into();
1519 self
1520 }
1521
1522 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1524 self.0.options = v.into();
1525 self
1526 }
1527
1528 pub async fn send(self) -> Result<()> {
1530 (*self.0.stub)
1531 .cancel_operation(self.0.request, self.0.options)
1532 .await
1533 .map(crate::Response::into_body)
1534 }
1535
1536 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1538 self.0.request.name = v.into();
1539 self
1540 }
1541 }
1542
1543 #[doc(hidden)]
1544 impl crate::RequestBuilder for CancelOperation {
1545 fn request_options(&mut self) -> &mut crate::RequestOptions {
1546 &mut self.0.options
1547 }
1548 }
1549}