1pub mod cloud_memcache {
19 use crate::Result;
20
21 pub type ClientBuilder = crate::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 crate::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 ) -> crate::ClientBuilderResult<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: crate::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: crate::RequestOptions::default(),
70 }
71 }
72 }
73
74 #[derive(Clone, Debug)]
95 pub struct ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
96
97 impl ListInstances {
98 pub(crate) fn new(
99 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
100 ) -> Self {
101 Self(RequestBuilder::new(stub))
102 }
103
104 pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
106 self.0.request = v.into();
107 self
108 }
109
110 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
112 self.0.options = v.into();
113 self
114 }
115
116 pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
118 (*self.0.stub)
119 .list_instances(self.0.request, self.0.options)
120 .await
121 .map(crate::Response::into_body)
122 }
123
124 pub fn by_page(
126 self,
127 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListInstancesResponse, crate::Error>
128 {
129 use std::clone::Clone;
130 let token = self.0.request.page_token.clone();
131 let execute = move |token: String| {
132 let mut builder = self.clone();
133 builder.0.request = builder.0.request.set_page_token(token);
134 builder.send()
135 };
136 google_cloud_gax::paginator::internal::new_paginator(token, execute)
137 }
138
139 pub fn by_item(
141 self,
142 ) -> impl google_cloud_gax::paginator::ItemPaginator<
143 crate::model::ListInstancesResponse,
144 crate::Error,
145 > {
146 use google_cloud_gax::paginator::Paginator;
147 self.by_page().items()
148 }
149
150 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
154 self.0.request.parent = v.into();
155 self
156 }
157
158 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
160 self.0.request.page_size = v.into();
161 self
162 }
163
164 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
166 self.0.request.page_token = v.into();
167 self
168 }
169
170 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
172 self.0.request.filter = v.into();
173 self
174 }
175
176 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
178 self.0.request.order_by = v.into();
179 self
180 }
181 }
182
183 #[doc(hidden)]
184 impl crate::RequestBuilder for ListInstances {
185 fn request_options(&mut self) -> &mut crate::RequestOptions {
186 &mut self.0.options
187 }
188 }
189
190 #[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<crate::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(crate::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 crate::RequestBuilder for GetInstance {
247 fn request_options(&mut self) -> &mut crate::RequestOptions {
248 &mut self.0.options
249 }
250 }
251
252 #[derive(Clone, Debug)]
270 pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
271
272 impl CreateInstance {
273 pub(crate) fn new(
274 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
275 ) -> Self {
276 Self(RequestBuilder::new(stub))
277 }
278
279 pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
281 self.0.request = v.into();
282 self
283 }
284
285 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
287 self.0.options = v.into();
288 self
289 }
290
291 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
298 (*self.0.stub)
299 .create_instance(self.0.request, self.0.options)
300 .await
301 .map(crate::Response::into_body)
302 }
303
304 pub fn poller(
306 self,
307 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
308 {
309 type Operation = google_cloud_lro::internal::Operation<
310 crate::model::Instance,
311 crate::model::OperationMetadata,
312 >;
313 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
314 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
315
316 let stub = self.0.stub.clone();
317 let mut options = self.0.options.clone();
318 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
319 let query = move |name| {
320 let stub = stub.clone();
321 let options = options.clone();
322 async {
323 let op = GetOperation::new(stub)
324 .set_name(name)
325 .with_options(options)
326 .send()
327 .await?;
328 Ok(Operation::new(op))
329 }
330 };
331
332 let start = move || async {
333 let op = self.send().await?;
334 Ok(Operation::new(op))
335 };
336
337 google_cloud_lro::internal::new_poller(
338 polling_error_policy,
339 polling_backoff_policy,
340 start,
341 query,
342 )
343 }
344
345 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
349 self.0.request.parent = v.into();
350 self
351 }
352
353 pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
357 self.0.request.instance_id = v.into();
358 self
359 }
360
361 pub fn set_instance<T>(mut self, v: T) -> Self
365 where
366 T: std::convert::Into<crate::model::Instance>,
367 {
368 self.0.request.instance = std::option::Option::Some(v.into());
369 self
370 }
371
372 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
376 where
377 T: std::convert::Into<crate::model::Instance>,
378 {
379 self.0.request.instance = v.map(|x| x.into());
380 self
381 }
382 }
383
384 #[doc(hidden)]
385 impl crate::RequestBuilder for CreateInstance {
386 fn request_options(&mut self) -> &mut crate::RequestOptions {
387 &mut self.0.options
388 }
389 }
390
391 #[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::CloudMemcache>,
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<crate::RequestOptions>>(mut self, v: V) -> Self {
426 self.0.options = v.into();
427 self
428 }
429
430 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
437 (*self.0.stub)
438 .update_instance(self.0.request, self.0.options)
439 .await
440 .map(crate::Response::into_body)
441 }
442
443 pub fn poller(
445 self,
446 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
447 {
448 type Operation = google_cloud_lro::internal::Operation<
449 crate::model::Instance,
450 crate::model::OperationMetadata,
451 >;
452 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
453 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
454
455 let stub = self.0.stub.clone();
456 let mut options = self.0.options.clone();
457 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
458 let query = move |name| {
459 let stub = stub.clone();
460 let options = options.clone();
461 async {
462 let op = GetOperation::new(stub)
463 .set_name(name)
464 .with_options(options)
465 .send()
466 .await?;
467 Ok(Operation::new(op))
468 }
469 };
470
471 let start = move || async {
472 let op = self.send().await?;
473 Ok(Operation::new(op))
474 };
475
476 google_cloud_lro::internal::new_poller(
477 polling_error_policy,
478 polling_backoff_policy,
479 start,
480 query,
481 )
482 }
483
484 pub fn set_update_mask<T>(mut self, v: T) -> Self
488 where
489 T: std::convert::Into<wkt::FieldMask>,
490 {
491 self.0.request.update_mask = std::option::Option::Some(v.into());
492 self
493 }
494
495 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
499 where
500 T: std::convert::Into<wkt::FieldMask>,
501 {
502 self.0.request.update_mask = v.map(|x| x.into());
503 self
504 }
505
506 pub fn set_instance<T>(mut self, v: T) -> Self
510 where
511 T: std::convert::Into<crate::model::Instance>,
512 {
513 self.0.request.instance = std::option::Option::Some(v.into());
514 self
515 }
516
517 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
521 where
522 T: std::convert::Into<crate::model::Instance>,
523 {
524 self.0.request.instance = v.map(|x| x.into());
525 self
526 }
527 }
528
529 #[doc(hidden)]
530 impl crate::RequestBuilder for UpdateInstance {
531 fn request_options(&mut self) -> &mut crate::RequestOptions {
532 &mut self.0.options
533 }
534 }
535
536 #[derive(Clone, Debug)]
554 pub struct UpdateParameters(RequestBuilder<crate::model::UpdateParametersRequest>);
555
556 impl UpdateParameters {
557 pub(crate) fn new(
558 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
559 ) -> Self {
560 Self(RequestBuilder::new(stub))
561 }
562
563 pub fn with_request<V: Into<crate::model::UpdateParametersRequest>>(
565 mut self,
566 v: V,
567 ) -> Self {
568 self.0.request = v.into();
569 self
570 }
571
572 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
574 self.0.options = v.into();
575 self
576 }
577
578 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
585 (*self.0.stub)
586 .update_parameters(self.0.request, self.0.options)
587 .await
588 .map(crate::Response::into_body)
589 }
590
591 pub fn poller(
593 self,
594 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
595 {
596 type Operation = google_cloud_lro::internal::Operation<
597 crate::model::Instance,
598 crate::model::OperationMetadata,
599 >;
600 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
601 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
602
603 let stub = self.0.stub.clone();
604 let mut options = self.0.options.clone();
605 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
606 let query = move |name| {
607 let stub = stub.clone();
608 let options = options.clone();
609 async {
610 let op = GetOperation::new(stub)
611 .set_name(name)
612 .with_options(options)
613 .send()
614 .await?;
615 Ok(Operation::new(op))
616 }
617 };
618
619 let start = move || async {
620 let op = self.send().await?;
621 Ok(Operation::new(op))
622 };
623
624 google_cloud_lro::internal::new_poller(
625 polling_error_policy,
626 polling_backoff_policy,
627 start,
628 query,
629 )
630 }
631
632 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
636 self.0.request.name = v.into();
637 self
638 }
639
640 pub fn set_update_mask<T>(mut self, v: T) -> Self
644 where
645 T: std::convert::Into<wkt::FieldMask>,
646 {
647 self.0.request.update_mask = std::option::Option::Some(v.into());
648 self
649 }
650
651 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
655 where
656 T: std::convert::Into<wkt::FieldMask>,
657 {
658 self.0.request.update_mask = v.map(|x| x.into());
659 self
660 }
661
662 pub fn set_parameters<T>(mut self, v: T) -> Self
664 where
665 T: std::convert::Into<crate::model::MemcacheParameters>,
666 {
667 self.0.request.parameters = std::option::Option::Some(v.into());
668 self
669 }
670
671 pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
673 where
674 T: std::convert::Into<crate::model::MemcacheParameters>,
675 {
676 self.0.request.parameters = v.map(|x| x.into());
677 self
678 }
679 }
680
681 #[doc(hidden)]
682 impl crate::RequestBuilder for UpdateParameters {
683 fn request_options(&mut self) -> &mut crate::RequestOptions {
684 &mut self.0.options
685 }
686 }
687
688 #[derive(Clone, Debug)]
706 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
707
708 impl DeleteInstance {
709 pub(crate) fn new(
710 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
711 ) -> Self {
712 Self(RequestBuilder::new(stub))
713 }
714
715 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
717 self.0.request = v.into();
718 self
719 }
720
721 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
723 self.0.options = v.into();
724 self
725 }
726
727 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
734 (*self.0.stub)
735 .delete_instance(self.0.request, self.0.options)
736 .await
737 .map(crate::Response::into_body)
738 }
739
740 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
742 type Operation =
743 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
744 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
745 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
746
747 let stub = self.0.stub.clone();
748 let mut options = self.0.options.clone();
749 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
750 let query = move |name| {
751 let stub = stub.clone();
752 let options = options.clone();
753 async {
754 let op = GetOperation::new(stub)
755 .set_name(name)
756 .with_options(options)
757 .send()
758 .await?;
759 Ok(Operation::new(op))
760 }
761 };
762
763 let start = move || async {
764 let op = self.send().await?;
765 Ok(Operation::new(op))
766 };
767
768 google_cloud_lro::internal::new_unit_response_poller(
769 polling_error_policy,
770 polling_backoff_policy,
771 start,
772 query,
773 )
774 }
775
776 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
780 self.0.request.name = v.into();
781 self
782 }
783 }
784
785 #[doc(hidden)]
786 impl crate::RequestBuilder for DeleteInstance {
787 fn request_options(&mut self) -> &mut crate::RequestOptions {
788 &mut self.0.options
789 }
790 }
791
792 #[derive(Clone, Debug)]
810 pub struct ApplyParameters(RequestBuilder<crate::model::ApplyParametersRequest>);
811
812 impl ApplyParameters {
813 pub(crate) fn new(
814 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
815 ) -> Self {
816 Self(RequestBuilder::new(stub))
817 }
818
819 pub fn with_request<V: Into<crate::model::ApplyParametersRequest>>(mut self, v: V) -> Self {
821 self.0.request = v.into();
822 self
823 }
824
825 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
827 self.0.options = v.into();
828 self
829 }
830
831 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
838 (*self.0.stub)
839 .apply_parameters(self.0.request, self.0.options)
840 .await
841 .map(crate::Response::into_body)
842 }
843
844 pub fn poller(
846 self,
847 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
848 {
849 type Operation = google_cloud_lro::internal::Operation<
850 crate::model::Instance,
851 crate::model::OperationMetadata,
852 >;
853 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
854 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
855
856 let stub = self.0.stub.clone();
857 let mut options = self.0.options.clone();
858 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
859 let query = move |name| {
860 let stub = stub.clone();
861 let options = options.clone();
862 async {
863 let op = GetOperation::new(stub)
864 .set_name(name)
865 .with_options(options)
866 .send()
867 .await?;
868 Ok(Operation::new(op))
869 }
870 };
871
872 let start = move || async {
873 let op = self.send().await?;
874 Ok(Operation::new(op))
875 };
876
877 google_cloud_lro::internal::new_poller(
878 polling_error_policy,
879 polling_backoff_policy,
880 start,
881 query,
882 )
883 }
884
885 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
889 self.0.request.name = v.into();
890 self
891 }
892
893 pub fn set_node_ids<T, V>(mut self, v: T) -> Self
895 where
896 T: std::iter::IntoIterator<Item = V>,
897 V: std::convert::Into<std::string::String>,
898 {
899 use std::iter::Iterator;
900 self.0.request.node_ids = v.into_iter().map(|i| i.into()).collect();
901 self
902 }
903
904 pub fn set_apply_all<T: Into<bool>>(mut self, v: T) -> Self {
906 self.0.request.apply_all = v.into();
907 self
908 }
909 }
910
911 #[doc(hidden)]
912 impl crate::RequestBuilder for ApplyParameters {
913 fn request_options(&mut self) -> &mut crate::RequestOptions {
914 &mut self.0.options
915 }
916 }
917
918 #[derive(Clone, Debug)]
936 pub struct RescheduleMaintenance(RequestBuilder<crate::model::RescheduleMaintenanceRequest>);
937
938 impl RescheduleMaintenance {
939 pub(crate) fn new(
940 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
941 ) -> Self {
942 Self(RequestBuilder::new(stub))
943 }
944
945 pub fn with_request<V: Into<crate::model::RescheduleMaintenanceRequest>>(
947 mut self,
948 v: V,
949 ) -> Self {
950 self.0.request = v.into();
951 self
952 }
953
954 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
956 self.0.options = v.into();
957 self
958 }
959
960 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
967 (*self.0.stub)
968 .reschedule_maintenance(self.0.request, self.0.options)
969 .await
970 .map(crate::Response::into_body)
971 }
972
973 pub fn poller(
975 self,
976 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
977 {
978 type Operation = google_cloud_lro::internal::Operation<
979 crate::model::Instance,
980 crate::model::OperationMetadata,
981 >;
982 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
983 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
984
985 let stub = self.0.stub.clone();
986 let mut options = self.0.options.clone();
987 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
988 let query = move |name| {
989 let stub = stub.clone();
990 let options = options.clone();
991 async {
992 let op = GetOperation::new(stub)
993 .set_name(name)
994 .with_options(options)
995 .send()
996 .await?;
997 Ok(Operation::new(op))
998 }
999 };
1000
1001 let start = move || async {
1002 let op = self.send().await?;
1003 Ok(Operation::new(op))
1004 };
1005
1006 google_cloud_lro::internal::new_poller(
1007 polling_error_policy,
1008 polling_backoff_policy,
1009 start,
1010 query,
1011 )
1012 }
1013
1014 pub fn set_instance<T: Into<std::string::String>>(mut self, v: T) -> Self {
1018 self.0.request.instance = v.into();
1019 self
1020 }
1021
1022 pub fn set_reschedule_type<
1026 T: Into<crate::model::reschedule_maintenance_request::RescheduleType>,
1027 >(
1028 mut self,
1029 v: T,
1030 ) -> Self {
1031 self.0.request.reschedule_type = v.into();
1032 self
1033 }
1034
1035 pub fn set_schedule_time<T>(mut self, v: T) -> Self
1037 where
1038 T: std::convert::Into<wkt::Timestamp>,
1039 {
1040 self.0.request.schedule_time = std::option::Option::Some(v.into());
1041 self
1042 }
1043
1044 pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
1046 where
1047 T: std::convert::Into<wkt::Timestamp>,
1048 {
1049 self.0.request.schedule_time = v.map(|x| x.into());
1050 self
1051 }
1052 }
1053
1054 #[doc(hidden)]
1055 impl crate::RequestBuilder for RescheduleMaintenance {
1056 fn request_options(&mut self) -> &mut crate::RequestOptions {
1057 &mut self.0.options
1058 }
1059 }
1060
1061 #[derive(Clone, Debug)]
1082 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
1083
1084 impl ListLocations {
1085 pub(crate) fn new(
1086 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1087 ) -> Self {
1088 Self(RequestBuilder::new(stub))
1089 }
1090
1091 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
1093 mut self,
1094 v: V,
1095 ) -> Self {
1096 self.0.request = v.into();
1097 self
1098 }
1099
1100 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1102 self.0.options = v.into();
1103 self
1104 }
1105
1106 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
1108 (*self.0.stub)
1109 .list_locations(self.0.request, self.0.options)
1110 .await
1111 .map(crate::Response::into_body)
1112 }
1113
1114 pub fn by_page(
1116 self,
1117 ) -> impl google_cloud_gax::paginator::Paginator<
1118 google_cloud_location::model::ListLocationsResponse,
1119 crate::Error,
1120 > {
1121 use std::clone::Clone;
1122 let token = self.0.request.page_token.clone();
1123 let execute = move |token: String| {
1124 let mut builder = self.clone();
1125 builder.0.request = builder.0.request.set_page_token(token);
1126 builder.send()
1127 };
1128 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1129 }
1130
1131 pub fn by_item(
1133 self,
1134 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1135 google_cloud_location::model::ListLocationsResponse,
1136 crate::Error,
1137 > {
1138 use google_cloud_gax::paginator::Paginator;
1139 self.by_page().items()
1140 }
1141
1142 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1144 self.0.request.name = v.into();
1145 self
1146 }
1147
1148 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1150 self.0.request.filter = v.into();
1151 self
1152 }
1153
1154 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1156 self.0.request.page_size = v.into();
1157 self
1158 }
1159
1160 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1162 self.0.request.page_token = v.into();
1163 self
1164 }
1165 }
1166
1167 #[doc(hidden)]
1168 impl crate::RequestBuilder for ListLocations {
1169 fn request_options(&mut self) -> &mut crate::RequestOptions {
1170 &mut self.0.options
1171 }
1172 }
1173
1174 #[derive(Clone, Debug)]
1191 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
1192
1193 impl GetLocation {
1194 pub(crate) fn new(
1195 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1196 ) -> Self {
1197 Self(RequestBuilder::new(stub))
1198 }
1199
1200 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
1202 mut self,
1203 v: V,
1204 ) -> Self {
1205 self.0.request = v.into();
1206 self
1207 }
1208
1209 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1211 self.0.options = v.into();
1212 self
1213 }
1214
1215 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
1217 (*self.0.stub)
1218 .get_location(self.0.request, self.0.options)
1219 .await
1220 .map(crate::Response::into_body)
1221 }
1222
1223 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1225 self.0.request.name = v.into();
1226 self
1227 }
1228 }
1229
1230 #[doc(hidden)]
1231 impl crate::RequestBuilder for GetLocation {
1232 fn request_options(&mut self) -> &mut crate::RequestOptions {
1233 &mut self.0.options
1234 }
1235 }
1236
1237 #[derive(Clone, Debug)]
1258 pub struct ListOperations(
1259 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1260 );
1261
1262 impl ListOperations {
1263 pub(crate) fn new(
1264 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1265 ) -> Self {
1266 Self(RequestBuilder::new(stub))
1267 }
1268
1269 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1271 mut self,
1272 v: V,
1273 ) -> Self {
1274 self.0.request = v.into();
1275 self
1276 }
1277
1278 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1280 self.0.options = v.into();
1281 self
1282 }
1283
1284 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1286 (*self.0.stub)
1287 .list_operations(self.0.request, self.0.options)
1288 .await
1289 .map(crate::Response::into_body)
1290 }
1291
1292 pub fn by_page(
1294 self,
1295 ) -> impl google_cloud_gax::paginator::Paginator<
1296 google_cloud_longrunning::model::ListOperationsResponse,
1297 crate::Error,
1298 > {
1299 use std::clone::Clone;
1300 let token = self.0.request.page_token.clone();
1301 let execute = move |token: String| {
1302 let mut builder = self.clone();
1303 builder.0.request = builder.0.request.set_page_token(token);
1304 builder.send()
1305 };
1306 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1307 }
1308
1309 pub fn by_item(
1311 self,
1312 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1313 google_cloud_longrunning::model::ListOperationsResponse,
1314 crate::Error,
1315 > {
1316 use google_cloud_gax::paginator::Paginator;
1317 self.by_page().items()
1318 }
1319
1320 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1322 self.0.request.name = v.into();
1323 self
1324 }
1325
1326 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1328 self.0.request.filter = v.into();
1329 self
1330 }
1331
1332 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1334 self.0.request.page_size = v.into();
1335 self
1336 }
1337
1338 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1340 self.0.request.page_token = v.into();
1341 self
1342 }
1343
1344 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1346 self.0.request.return_partial_success = v.into();
1347 self
1348 }
1349 }
1350
1351 #[doc(hidden)]
1352 impl crate::RequestBuilder for ListOperations {
1353 fn request_options(&mut self) -> &mut crate::RequestOptions {
1354 &mut self.0.options
1355 }
1356 }
1357
1358 #[derive(Clone, Debug)]
1375 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1376
1377 impl GetOperation {
1378 pub(crate) fn new(
1379 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1380 ) -> Self {
1381 Self(RequestBuilder::new(stub))
1382 }
1383
1384 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1386 mut self,
1387 v: V,
1388 ) -> Self {
1389 self.0.request = v.into();
1390 self
1391 }
1392
1393 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1395 self.0.options = v.into();
1396 self
1397 }
1398
1399 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1401 (*self.0.stub)
1402 .get_operation(self.0.request, self.0.options)
1403 .await
1404 .map(crate::Response::into_body)
1405 }
1406
1407 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1409 self.0.request.name = v.into();
1410 self
1411 }
1412 }
1413
1414 #[doc(hidden)]
1415 impl crate::RequestBuilder for GetOperation {
1416 fn request_options(&mut self) -> &mut crate::RequestOptions {
1417 &mut self.0.options
1418 }
1419 }
1420
1421 #[derive(Clone, Debug)]
1438 pub struct DeleteOperation(
1439 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
1440 );
1441
1442 impl DeleteOperation {
1443 pub(crate) fn new(
1444 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1445 ) -> Self {
1446 Self(RequestBuilder::new(stub))
1447 }
1448
1449 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
1451 mut self,
1452 v: V,
1453 ) -> Self {
1454 self.0.request = v.into();
1455 self
1456 }
1457
1458 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1460 self.0.options = v.into();
1461 self
1462 }
1463
1464 pub async fn send(self) -> Result<()> {
1466 (*self.0.stub)
1467 .delete_operation(self.0.request, self.0.options)
1468 .await
1469 .map(crate::Response::into_body)
1470 }
1471
1472 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1474 self.0.request.name = v.into();
1475 self
1476 }
1477 }
1478
1479 #[doc(hidden)]
1480 impl crate::RequestBuilder for DeleteOperation {
1481 fn request_options(&mut self) -> &mut crate::RequestOptions {
1482 &mut self.0.options
1483 }
1484 }
1485
1486 #[derive(Clone, Debug)]
1503 pub struct CancelOperation(
1504 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1505 );
1506
1507 impl CancelOperation {
1508 pub(crate) fn new(
1509 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1510 ) -> Self {
1511 Self(RequestBuilder::new(stub))
1512 }
1513
1514 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
1516 mut self,
1517 v: V,
1518 ) -> Self {
1519 self.0.request = v.into();
1520 self
1521 }
1522
1523 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1525 self.0.options = v.into();
1526 self
1527 }
1528
1529 pub async fn send(self) -> Result<()> {
1531 (*self.0.stub)
1532 .cancel_operation(self.0.request, self.0.options)
1533 .await
1534 .map(crate::Response::into_body)
1535 }
1536
1537 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1539 self.0.request.name = v.into();
1540 self
1541 }
1542 }
1543
1544 #[doc(hidden)]
1545 impl crate::RequestBuilder for CancelOperation {
1546 fn request_options(&mut self) -> &mut crate::RequestOptions {
1547 &mut self.0.options
1548 }
1549 }
1550}