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)]
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<gax::options::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(gax::response::Response::into_body)
122 }
123
124 pub fn by_page(
126 self,
127 ) -> impl gax::paginator::Paginator<crate::model::ListInstancesResponse, gax::error::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 gax::paginator::internal::new_paginator(token, execute)
137 }
138
139 pub fn by_item(
141 self,
142 ) -> impl gax::paginator::ItemPaginator<crate::model::ListInstancesResponse, gax::error::Error>
143 {
144 use gax::paginator::Paginator;
145 self.by_page().items()
146 }
147
148 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
152 self.0.request.parent = v.into();
153 self
154 }
155
156 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
158 self.0.request.page_size = v.into();
159 self
160 }
161
162 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
164 self.0.request.page_token = v.into();
165 self
166 }
167
168 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
170 self.0.request.filter = v.into();
171 self
172 }
173
174 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
176 self.0.request.order_by = v.into();
177 self
178 }
179 }
180
181 #[doc(hidden)]
182 impl gax::options::internal::RequestBuilder for ListInstances {
183 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
184 &mut self.0.options
185 }
186 }
187
188 #[derive(Clone, Debug)]
205 pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
206
207 impl GetInstance {
208 pub(crate) fn new(
209 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
210 ) -> Self {
211 Self(RequestBuilder::new(stub))
212 }
213
214 pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
216 self.0.request = v.into();
217 self
218 }
219
220 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
222 self.0.options = v.into();
223 self
224 }
225
226 pub async fn send(self) -> Result<crate::model::Instance> {
228 (*self.0.stub)
229 .get_instance(self.0.request, self.0.options)
230 .await
231 .map(gax::response::Response::into_body)
232 }
233
234 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
238 self.0.request.name = v.into();
239 self
240 }
241 }
242
243 #[doc(hidden)]
244 impl gax::options::internal::RequestBuilder for GetInstance {
245 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
246 &mut self.0.options
247 }
248 }
249
250 #[derive(Clone, Debug)]
268 pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
269
270 impl CreateInstance {
271 pub(crate) fn new(
272 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
273 ) -> Self {
274 Self(RequestBuilder::new(stub))
275 }
276
277 pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
279 self.0.request = v.into();
280 self
281 }
282
283 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
285 self.0.options = v.into();
286 self
287 }
288
289 pub async fn send(self) -> Result<longrunning::model::Operation> {
296 (*self.0.stub)
297 .create_instance(self.0.request, self.0.options)
298 .await
299 .map(gax::response::Response::into_body)
300 }
301
302 pub fn poller(
304 self,
305 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
306 type Operation =
307 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
308 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
309 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
310
311 let stub = self.0.stub.clone();
312 let mut options = self.0.options.clone();
313 options.set_retry_policy(gax::retry_policy::NeverRetry);
314 let query = move |name| {
315 let stub = stub.clone();
316 let options = options.clone();
317 async {
318 let op = GetOperation::new(stub)
319 .set_name(name)
320 .with_options(options)
321 .send()
322 .await?;
323 Ok(Operation::new(op))
324 }
325 };
326
327 let start = move || async {
328 let op = self.send().await?;
329 Ok(Operation::new(op))
330 };
331
332 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
333 }
334
335 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
339 self.0.request.parent = v.into();
340 self
341 }
342
343 pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
347 self.0.request.instance_id = v.into();
348 self
349 }
350
351 pub fn set_instance<T>(mut self, v: T) -> Self
355 where
356 T: std::convert::Into<crate::model::Instance>,
357 {
358 self.0.request.instance = std::option::Option::Some(v.into());
359 self
360 }
361
362 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
366 where
367 T: std::convert::Into<crate::model::Instance>,
368 {
369 self.0.request.instance = v.map(|x| x.into());
370 self
371 }
372 }
373
374 #[doc(hidden)]
375 impl gax::options::internal::RequestBuilder for CreateInstance {
376 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
377 &mut self.0.options
378 }
379 }
380
381 #[derive(Clone, Debug)]
399 pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
400
401 impl UpdateInstance {
402 pub(crate) fn new(
403 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
404 ) -> Self {
405 Self(RequestBuilder::new(stub))
406 }
407
408 pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
410 self.0.request = v.into();
411 self
412 }
413
414 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
416 self.0.options = v.into();
417 self
418 }
419
420 pub async fn send(self) -> Result<longrunning::model::Operation> {
427 (*self.0.stub)
428 .update_instance(self.0.request, self.0.options)
429 .await
430 .map(gax::response::Response::into_body)
431 }
432
433 pub fn poller(
435 self,
436 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
437 type Operation =
438 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
439 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
440 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
441
442 let stub = self.0.stub.clone();
443 let mut options = self.0.options.clone();
444 options.set_retry_policy(gax::retry_policy::NeverRetry);
445 let query = move |name| {
446 let stub = stub.clone();
447 let options = options.clone();
448 async {
449 let op = GetOperation::new(stub)
450 .set_name(name)
451 .with_options(options)
452 .send()
453 .await?;
454 Ok(Operation::new(op))
455 }
456 };
457
458 let start = move || async {
459 let op = self.send().await?;
460 Ok(Operation::new(op))
461 };
462
463 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
464 }
465
466 pub fn set_update_mask<T>(mut self, v: T) -> Self
470 where
471 T: std::convert::Into<wkt::FieldMask>,
472 {
473 self.0.request.update_mask = std::option::Option::Some(v.into());
474 self
475 }
476
477 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
481 where
482 T: std::convert::Into<wkt::FieldMask>,
483 {
484 self.0.request.update_mask = v.map(|x| x.into());
485 self
486 }
487
488 pub fn set_instance<T>(mut self, v: T) -> Self
492 where
493 T: std::convert::Into<crate::model::Instance>,
494 {
495 self.0.request.instance = std::option::Option::Some(v.into());
496 self
497 }
498
499 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
503 where
504 T: std::convert::Into<crate::model::Instance>,
505 {
506 self.0.request.instance = v.map(|x| x.into());
507 self
508 }
509 }
510
511 #[doc(hidden)]
512 impl gax::options::internal::RequestBuilder for UpdateInstance {
513 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
514 &mut self.0.options
515 }
516 }
517
518 #[derive(Clone, Debug)]
536 pub struct UpdateParameters(RequestBuilder<crate::model::UpdateParametersRequest>);
537
538 impl UpdateParameters {
539 pub(crate) fn new(
540 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
541 ) -> Self {
542 Self(RequestBuilder::new(stub))
543 }
544
545 pub fn with_request<V: Into<crate::model::UpdateParametersRequest>>(
547 mut self,
548 v: V,
549 ) -> Self {
550 self.0.request = v.into();
551 self
552 }
553
554 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
556 self.0.options = v.into();
557 self
558 }
559
560 pub async fn send(self) -> Result<longrunning::model::Operation> {
567 (*self.0.stub)
568 .update_parameters(self.0.request, self.0.options)
569 .await
570 .map(gax::response::Response::into_body)
571 }
572
573 pub fn poller(
575 self,
576 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
577 type Operation =
578 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
579 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
580 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
581
582 let stub = self.0.stub.clone();
583 let mut options = self.0.options.clone();
584 options.set_retry_policy(gax::retry_policy::NeverRetry);
585 let query = move |name| {
586 let stub = stub.clone();
587 let options = options.clone();
588 async {
589 let op = GetOperation::new(stub)
590 .set_name(name)
591 .with_options(options)
592 .send()
593 .await?;
594 Ok(Operation::new(op))
595 }
596 };
597
598 let start = move || async {
599 let op = self.send().await?;
600 Ok(Operation::new(op))
601 };
602
603 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
604 }
605
606 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
610 self.0.request.name = v.into();
611 self
612 }
613
614 pub fn set_update_mask<T>(mut self, v: T) -> Self
618 where
619 T: std::convert::Into<wkt::FieldMask>,
620 {
621 self.0.request.update_mask = std::option::Option::Some(v.into());
622 self
623 }
624
625 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
629 where
630 T: std::convert::Into<wkt::FieldMask>,
631 {
632 self.0.request.update_mask = v.map(|x| x.into());
633 self
634 }
635
636 pub fn set_parameters<T>(mut self, v: T) -> Self
638 where
639 T: std::convert::Into<crate::model::MemcacheParameters>,
640 {
641 self.0.request.parameters = std::option::Option::Some(v.into());
642 self
643 }
644
645 pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
647 where
648 T: std::convert::Into<crate::model::MemcacheParameters>,
649 {
650 self.0.request.parameters = v.map(|x| x.into());
651 self
652 }
653 }
654
655 #[doc(hidden)]
656 impl gax::options::internal::RequestBuilder for UpdateParameters {
657 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
658 &mut self.0.options
659 }
660 }
661
662 #[derive(Clone, Debug)]
680 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
681
682 impl DeleteInstance {
683 pub(crate) fn new(
684 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
685 ) -> Self {
686 Self(RequestBuilder::new(stub))
687 }
688
689 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
691 self.0.request = v.into();
692 self
693 }
694
695 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
697 self.0.options = v.into();
698 self
699 }
700
701 pub async fn send(self) -> Result<longrunning::model::Operation> {
708 (*self.0.stub)
709 .delete_instance(self.0.request, self.0.options)
710 .await
711 .map(gax::response::Response::into_body)
712 }
713
714 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
716 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
717 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
718 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
719
720 let stub = self.0.stub.clone();
721 let mut options = self.0.options.clone();
722 options.set_retry_policy(gax::retry_policy::NeverRetry);
723 let query = move |name| {
724 let stub = stub.clone();
725 let options = options.clone();
726 async {
727 let op = GetOperation::new(stub)
728 .set_name(name)
729 .with_options(options)
730 .send()
731 .await?;
732 Ok(Operation::new(op))
733 }
734 };
735
736 let start = move || async {
737 let op = self.send().await?;
738 Ok(Operation::new(op))
739 };
740
741 lro::internal::new_unit_response_poller(
742 polling_error_policy,
743 polling_backoff_policy,
744 start,
745 query,
746 )
747 }
748
749 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
753 self.0.request.name = v.into();
754 self
755 }
756 }
757
758 #[doc(hidden)]
759 impl gax::options::internal::RequestBuilder for DeleteInstance {
760 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
761 &mut self.0.options
762 }
763 }
764
765 #[derive(Clone, Debug)]
783 pub struct ApplyParameters(RequestBuilder<crate::model::ApplyParametersRequest>);
784
785 impl ApplyParameters {
786 pub(crate) fn new(
787 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
788 ) -> Self {
789 Self(RequestBuilder::new(stub))
790 }
791
792 pub fn with_request<V: Into<crate::model::ApplyParametersRequest>>(mut self, v: V) -> Self {
794 self.0.request = v.into();
795 self
796 }
797
798 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
800 self.0.options = v.into();
801 self
802 }
803
804 pub async fn send(self) -> Result<longrunning::model::Operation> {
811 (*self.0.stub)
812 .apply_parameters(self.0.request, self.0.options)
813 .await
814 .map(gax::response::Response::into_body)
815 }
816
817 pub fn poller(
819 self,
820 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
821 type Operation =
822 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
823 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
824 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
825
826 let stub = self.0.stub.clone();
827 let mut options = self.0.options.clone();
828 options.set_retry_policy(gax::retry_policy::NeverRetry);
829 let query = move |name| {
830 let stub = stub.clone();
831 let options = options.clone();
832 async {
833 let op = GetOperation::new(stub)
834 .set_name(name)
835 .with_options(options)
836 .send()
837 .await?;
838 Ok(Operation::new(op))
839 }
840 };
841
842 let start = move || async {
843 let op = self.send().await?;
844 Ok(Operation::new(op))
845 };
846
847 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
848 }
849
850 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
854 self.0.request.name = v.into();
855 self
856 }
857
858 pub fn set_node_ids<T, V>(mut self, v: T) -> Self
860 where
861 T: std::iter::IntoIterator<Item = V>,
862 V: std::convert::Into<std::string::String>,
863 {
864 use std::iter::Iterator;
865 self.0.request.node_ids = v.into_iter().map(|i| i.into()).collect();
866 self
867 }
868
869 pub fn set_apply_all<T: Into<bool>>(mut self, v: T) -> Self {
871 self.0.request.apply_all = v.into();
872 self
873 }
874 }
875
876 #[doc(hidden)]
877 impl gax::options::internal::RequestBuilder for ApplyParameters {
878 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
879 &mut self.0.options
880 }
881 }
882
883 #[derive(Clone, Debug)]
901 pub struct RescheduleMaintenance(RequestBuilder<crate::model::RescheduleMaintenanceRequest>);
902
903 impl RescheduleMaintenance {
904 pub(crate) fn new(
905 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
906 ) -> Self {
907 Self(RequestBuilder::new(stub))
908 }
909
910 pub fn with_request<V: Into<crate::model::RescheduleMaintenanceRequest>>(
912 mut self,
913 v: V,
914 ) -> Self {
915 self.0.request = v.into();
916 self
917 }
918
919 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
921 self.0.options = v.into();
922 self
923 }
924
925 pub async fn send(self) -> Result<longrunning::model::Operation> {
932 (*self.0.stub)
933 .reschedule_maintenance(self.0.request, self.0.options)
934 .await
935 .map(gax::response::Response::into_body)
936 }
937
938 pub fn poller(
940 self,
941 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
942 type Operation =
943 lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
944 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
945 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
946
947 let stub = self.0.stub.clone();
948 let mut options = self.0.options.clone();
949 options.set_retry_policy(gax::retry_policy::NeverRetry);
950 let query = move |name| {
951 let stub = stub.clone();
952 let options = options.clone();
953 async {
954 let op = GetOperation::new(stub)
955 .set_name(name)
956 .with_options(options)
957 .send()
958 .await?;
959 Ok(Operation::new(op))
960 }
961 };
962
963 let start = move || async {
964 let op = self.send().await?;
965 Ok(Operation::new(op))
966 };
967
968 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
969 }
970
971 pub fn set_instance<T: Into<std::string::String>>(mut self, v: T) -> Self {
975 self.0.request.instance = v.into();
976 self
977 }
978
979 pub fn set_reschedule_type<
983 T: Into<crate::model::reschedule_maintenance_request::RescheduleType>,
984 >(
985 mut self,
986 v: T,
987 ) -> Self {
988 self.0.request.reschedule_type = v.into();
989 self
990 }
991
992 pub fn set_schedule_time<T>(mut self, v: T) -> Self
994 where
995 T: std::convert::Into<wkt::Timestamp>,
996 {
997 self.0.request.schedule_time = std::option::Option::Some(v.into());
998 self
999 }
1000
1001 pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
1003 where
1004 T: std::convert::Into<wkt::Timestamp>,
1005 {
1006 self.0.request.schedule_time = v.map(|x| x.into());
1007 self
1008 }
1009 }
1010
1011 #[doc(hidden)]
1012 impl gax::options::internal::RequestBuilder for RescheduleMaintenance {
1013 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1014 &mut self.0.options
1015 }
1016 }
1017
1018 #[derive(Clone, Debug)]
1039 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
1040
1041 impl ListLocations {
1042 pub(crate) fn new(
1043 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1044 ) -> Self {
1045 Self(RequestBuilder::new(stub))
1046 }
1047
1048 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
1050 mut self,
1051 v: V,
1052 ) -> Self {
1053 self.0.request = v.into();
1054 self
1055 }
1056
1057 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1059 self.0.options = v.into();
1060 self
1061 }
1062
1063 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
1065 (*self.0.stub)
1066 .list_locations(self.0.request, self.0.options)
1067 .await
1068 .map(gax::response::Response::into_body)
1069 }
1070
1071 pub fn by_page(
1073 self,
1074 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
1075 {
1076 use std::clone::Clone;
1077 let token = self.0.request.page_token.clone();
1078 let execute = move |token: String| {
1079 let mut builder = self.clone();
1080 builder.0.request = builder.0.request.set_page_token(token);
1081 builder.send()
1082 };
1083 gax::paginator::internal::new_paginator(token, execute)
1084 }
1085
1086 pub fn by_item(
1088 self,
1089 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
1090 {
1091 use gax::paginator::Paginator;
1092 self.by_page().items()
1093 }
1094
1095 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1097 self.0.request.name = v.into();
1098 self
1099 }
1100
1101 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1103 self.0.request.filter = v.into();
1104 self
1105 }
1106
1107 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1109 self.0.request.page_size = v.into();
1110 self
1111 }
1112
1113 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1115 self.0.request.page_token = v.into();
1116 self
1117 }
1118 }
1119
1120 #[doc(hidden)]
1121 impl gax::options::internal::RequestBuilder for ListLocations {
1122 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1123 &mut self.0.options
1124 }
1125 }
1126
1127 #[derive(Clone, Debug)]
1144 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1145
1146 impl GetLocation {
1147 pub(crate) fn new(
1148 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1149 ) -> Self {
1150 Self(RequestBuilder::new(stub))
1151 }
1152
1153 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1155 self.0.request = v.into();
1156 self
1157 }
1158
1159 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1161 self.0.options = v.into();
1162 self
1163 }
1164
1165 pub async fn send(self) -> Result<location::model::Location> {
1167 (*self.0.stub)
1168 .get_location(self.0.request, self.0.options)
1169 .await
1170 .map(gax::response::Response::into_body)
1171 }
1172
1173 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1175 self.0.request.name = v.into();
1176 self
1177 }
1178 }
1179
1180 #[doc(hidden)]
1181 impl gax::options::internal::RequestBuilder for GetLocation {
1182 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1183 &mut self.0.options
1184 }
1185 }
1186
1187 #[derive(Clone, Debug)]
1208 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1209
1210 impl ListOperations {
1211 pub(crate) fn new(
1212 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1213 ) -> Self {
1214 Self(RequestBuilder::new(stub))
1215 }
1216
1217 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1219 mut self,
1220 v: V,
1221 ) -> Self {
1222 self.0.request = v.into();
1223 self
1224 }
1225
1226 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1228 self.0.options = v.into();
1229 self
1230 }
1231
1232 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1234 (*self.0.stub)
1235 .list_operations(self.0.request, self.0.options)
1236 .await
1237 .map(gax::response::Response::into_body)
1238 }
1239
1240 pub fn by_page(
1242 self,
1243 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1244 {
1245 use std::clone::Clone;
1246 let token = self.0.request.page_token.clone();
1247 let execute = move |token: String| {
1248 let mut builder = self.clone();
1249 builder.0.request = builder.0.request.set_page_token(token);
1250 builder.send()
1251 };
1252 gax::paginator::internal::new_paginator(token, execute)
1253 }
1254
1255 pub fn by_item(
1257 self,
1258 ) -> impl gax::paginator::ItemPaginator<
1259 longrunning::model::ListOperationsResponse,
1260 gax::error::Error,
1261 > {
1262 use gax::paginator::Paginator;
1263 self.by_page().items()
1264 }
1265
1266 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1268 self.0.request.name = v.into();
1269 self
1270 }
1271
1272 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1274 self.0.request.filter = v.into();
1275 self
1276 }
1277
1278 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1280 self.0.request.page_size = v.into();
1281 self
1282 }
1283
1284 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1286 self.0.request.page_token = v.into();
1287 self
1288 }
1289
1290 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1292 self.0.request.return_partial_success = v.into();
1293 self
1294 }
1295 }
1296
1297 #[doc(hidden)]
1298 impl gax::options::internal::RequestBuilder for ListOperations {
1299 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1300 &mut self.0.options
1301 }
1302 }
1303
1304 #[derive(Clone, Debug)]
1321 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1322
1323 impl GetOperation {
1324 pub(crate) fn new(
1325 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1326 ) -> Self {
1327 Self(RequestBuilder::new(stub))
1328 }
1329
1330 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1332 mut self,
1333 v: V,
1334 ) -> Self {
1335 self.0.request = v.into();
1336 self
1337 }
1338
1339 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1341 self.0.options = v.into();
1342 self
1343 }
1344
1345 pub async fn send(self) -> Result<longrunning::model::Operation> {
1347 (*self.0.stub)
1348 .get_operation(self.0.request, self.0.options)
1349 .await
1350 .map(gax::response::Response::into_body)
1351 }
1352
1353 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1355 self.0.request.name = v.into();
1356 self
1357 }
1358 }
1359
1360 #[doc(hidden)]
1361 impl gax::options::internal::RequestBuilder for GetOperation {
1362 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1363 &mut self.0.options
1364 }
1365 }
1366
1367 #[derive(Clone, Debug)]
1384 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1385
1386 impl DeleteOperation {
1387 pub(crate) fn new(
1388 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1389 ) -> Self {
1390 Self(RequestBuilder::new(stub))
1391 }
1392
1393 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1395 mut self,
1396 v: V,
1397 ) -> Self {
1398 self.0.request = v.into();
1399 self
1400 }
1401
1402 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1404 self.0.options = v.into();
1405 self
1406 }
1407
1408 pub async fn send(self) -> Result<()> {
1410 (*self.0.stub)
1411 .delete_operation(self.0.request, self.0.options)
1412 .await
1413 .map(gax::response::Response::into_body)
1414 }
1415
1416 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1418 self.0.request.name = v.into();
1419 self
1420 }
1421 }
1422
1423 #[doc(hidden)]
1424 impl gax::options::internal::RequestBuilder for DeleteOperation {
1425 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1426 &mut self.0.options
1427 }
1428 }
1429
1430 #[derive(Clone, Debug)]
1447 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1448
1449 impl CancelOperation {
1450 pub(crate) fn new(
1451 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1452 ) -> Self {
1453 Self(RequestBuilder::new(stub))
1454 }
1455
1456 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1458 mut self,
1459 v: V,
1460 ) -> Self {
1461 self.0.request = v.into();
1462 self
1463 }
1464
1465 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1467 self.0.options = v.into();
1468 self
1469 }
1470
1471 pub async fn send(self) -> Result<()> {
1473 (*self.0.stub)
1474 .cancel_operation(self.0.request, self.0.options)
1475 .await
1476 .map(gax::response::Response::into_body)
1477 }
1478
1479 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1481 self.0.request.name = v.into();
1482 self
1483 }
1484 }
1485
1486 #[doc(hidden)]
1487 impl gax::options::internal::RequestBuilder for CancelOperation {
1488 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1489 &mut self.0.options
1490 }
1491 }
1492}