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 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
316 if let Some(ref mut details) = poller_options.tracing {
317 details.method_name =
318 "google_cloud_memcache_v1::client::CloudMemcache::create_instance::until_done";
319 }
320
321 let stub = self.0.stub.clone();
322 let mut options = self.0.options.clone();
323 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
324 let query = move |name| {
325 let stub = stub.clone();
326 let options = options.clone();
327 async {
328 let op = GetOperation::new(stub)
329 .set_name(name)
330 .with_options(options)
331 .send()
332 .await?;
333 Ok(Operation::new(op))
334 }
335 };
336
337 let start = move || async {
338 let op = self.send().await?;
339 Ok(Operation::new(op))
340 };
341
342 use google_cloud_lro::internal::PollerExt;
343 {
344 google_cloud_lro::internal::new_poller(
345 polling_error_policy,
346 polling_backoff_policy,
347 start,
348 query,
349 )
350 }
351 .with_options(poller_options)
352 }
353
354 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
358 self.0.request.parent = v.into();
359 self
360 }
361
362 pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
366 self.0.request.instance_id = v.into();
367 self
368 }
369
370 pub fn set_instance<T>(mut self, v: T) -> Self
374 where
375 T: std::convert::Into<crate::model::Instance>,
376 {
377 self.0.request.instance = std::option::Option::Some(v.into());
378 self
379 }
380
381 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
385 where
386 T: std::convert::Into<crate::model::Instance>,
387 {
388 self.0.request.instance = v.map(|x| x.into());
389 self
390 }
391 }
392
393 #[doc(hidden)]
394 impl crate::RequestBuilder for CreateInstance {
395 fn request_options(&mut self) -> &mut crate::RequestOptions {
396 &mut self.0.options
397 }
398 }
399
400 #[derive(Clone, Debug)]
418 pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
419
420 impl UpdateInstance {
421 pub(crate) fn new(
422 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
423 ) -> Self {
424 Self(RequestBuilder::new(stub))
425 }
426
427 pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
429 self.0.request = v.into();
430 self
431 }
432
433 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
435 self.0.options = v.into();
436 self
437 }
438
439 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
446 (*self.0.stub)
447 .update_instance(self.0.request, self.0.options)
448 .await
449 .map(crate::Response::into_body)
450 }
451
452 pub fn poller(
454 self,
455 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
456 {
457 type Operation = google_cloud_lro::internal::Operation<
458 crate::model::Instance,
459 crate::model::OperationMetadata,
460 >;
461 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
462 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
463 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
464 if let Some(ref mut details) = poller_options.tracing {
465 details.method_name =
466 "google_cloud_memcache_v1::client::CloudMemcache::update_instance::until_done";
467 }
468
469 let stub = self.0.stub.clone();
470 let mut options = self.0.options.clone();
471 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
472 let query = move |name| {
473 let stub = stub.clone();
474 let options = options.clone();
475 async {
476 let op = GetOperation::new(stub)
477 .set_name(name)
478 .with_options(options)
479 .send()
480 .await?;
481 Ok(Operation::new(op))
482 }
483 };
484
485 let start = move || async {
486 let op = self.send().await?;
487 Ok(Operation::new(op))
488 };
489
490 use google_cloud_lro::internal::PollerExt;
491 {
492 google_cloud_lro::internal::new_poller(
493 polling_error_policy,
494 polling_backoff_policy,
495 start,
496 query,
497 )
498 }
499 .with_options(poller_options)
500 }
501
502 pub fn set_update_mask<T>(mut self, v: T) -> Self
506 where
507 T: std::convert::Into<wkt::FieldMask>,
508 {
509 self.0.request.update_mask = std::option::Option::Some(v.into());
510 self
511 }
512
513 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
517 where
518 T: std::convert::Into<wkt::FieldMask>,
519 {
520 self.0.request.update_mask = v.map(|x| x.into());
521 self
522 }
523
524 pub fn set_instance<T>(mut self, v: T) -> Self
528 where
529 T: std::convert::Into<crate::model::Instance>,
530 {
531 self.0.request.instance = std::option::Option::Some(v.into());
532 self
533 }
534
535 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
539 where
540 T: std::convert::Into<crate::model::Instance>,
541 {
542 self.0.request.instance = v.map(|x| x.into());
543 self
544 }
545 }
546
547 #[doc(hidden)]
548 impl crate::RequestBuilder for UpdateInstance {
549 fn request_options(&mut self) -> &mut crate::RequestOptions {
550 &mut self.0.options
551 }
552 }
553
554 #[derive(Clone, Debug)]
572 pub struct UpdateParameters(RequestBuilder<crate::model::UpdateParametersRequest>);
573
574 impl UpdateParameters {
575 pub(crate) fn new(
576 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
577 ) -> Self {
578 Self(RequestBuilder::new(stub))
579 }
580
581 pub fn with_request<V: Into<crate::model::UpdateParametersRequest>>(
583 mut self,
584 v: V,
585 ) -> Self {
586 self.0.request = v.into();
587 self
588 }
589
590 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
592 self.0.options = v.into();
593 self
594 }
595
596 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
603 (*self.0.stub)
604 .update_parameters(self.0.request, self.0.options)
605 .await
606 .map(crate::Response::into_body)
607 }
608
609 pub fn poller(
611 self,
612 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
613 {
614 type Operation = google_cloud_lro::internal::Operation<
615 crate::model::Instance,
616 crate::model::OperationMetadata,
617 >;
618 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
619 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
620 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
621 if let Some(ref mut details) = poller_options.tracing {
622 details.method_name = "google_cloud_memcache_v1::client::CloudMemcache::update_parameters::until_done";
623 }
624
625 let stub = self.0.stub.clone();
626 let mut options = self.0.options.clone();
627 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
628 let query = move |name| {
629 let stub = stub.clone();
630 let options = options.clone();
631 async {
632 let op = GetOperation::new(stub)
633 .set_name(name)
634 .with_options(options)
635 .send()
636 .await?;
637 Ok(Operation::new(op))
638 }
639 };
640
641 let start = move || async {
642 let op = self.send().await?;
643 Ok(Operation::new(op))
644 };
645
646 use google_cloud_lro::internal::PollerExt;
647 {
648 google_cloud_lro::internal::new_poller(
649 polling_error_policy,
650 polling_backoff_policy,
651 start,
652 query,
653 )
654 }
655 .with_options(poller_options)
656 }
657
658 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
662 self.0.request.name = v.into();
663 self
664 }
665
666 pub fn set_update_mask<T>(mut self, v: T) -> Self
670 where
671 T: std::convert::Into<wkt::FieldMask>,
672 {
673 self.0.request.update_mask = std::option::Option::Some(v.into());
674 self
675 }
676
677 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
681 where
682 T: std::convert::Into<wkt::FieldMask>,
683 {
684 self.0.request.update_mask = v.map(|x| x.into());
685 self
686 }
687
688 pub fn set_parameters<T>(mut self, v: T) -> Self
690 where
691 T: std::convert::Into<crate::model::MemcacheParameters>,
692 {
693 self.0.request.parameters = std::option::Option::Some(v.into());
694 self
695 }
696
697 pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
699 where
700 T: std::convert::Into<crate::model::MemcacheParameters>,
701 {
702 self.0.request.parameters = v.map(|x| x.into());
703 self
704 }
705 }
706
707 #[doc(hidden)]
708 impl crate::RequestBuilder for UpdateParameters {
709 fn request_options(&mut self) -> &mut crate::RequestOptions {
710 &mut self.0.options
711 }
712 }
713
714 #[derive(Clone, Debug)]
732 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
733
734 impl DeleteInstance {
735 pub(crate) fn new(
736 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
737 ) -> Self {
738 Self(RequestBuilder::new(stub))
739 }
740
741 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
743 self.0.request = v.into();
744 self
745 }
746
747 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
749 self.0.options = v.into();
750 self
751 }
752
753 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
760 (*self.0.stub)
761 .delete_instance(self.0.request, self.0.options)
762 .await
763 .map(crate::Response::into_body)
764 }
765
766 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
768 type Operation =
769 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
770 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
771 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
772 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
773 if let Some(ref mut details) = poller_options.tracing {
774 details.method_name =
775 "google_cloud_memcache_v1::client::CloudMemcache::delete_instance::until_done";
776 }
777
778 let stub = self.0.stub.clone();
779 let mut options = self.0.options.clone();
780 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
781 let query = move |name| {
782 let stub = stub.clone();
783 let options = options.clone();
784 async {
785 let op = GetOperation::new(stub)
786 .set_name(name)
787 .with_options(options)
788 .send()
789 .await?;
790 Ok(Operation::new(op))
791 }
792 };
793
794 let start = move || async {
795 let op = self.send().await?;
796 Ok(Operation::new(op))
797 };
798
799 use google_cloud_lro::internal::PollerExt;
800 {
801 google_cloud_lro::internal::new_unit_response_poller(
802 polling_error_policy,
803 polling_backoff_policy,
804 start,
805 query,
806 )
807 }
808 .with_options(poller_options)
809 }
810
811 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
815 self.0.request.name = v.into();
816 self
817 }
818 }
819
820 #[doc(hidden)]
821 impl crate::RequestBuilder for DeleteInstance {
822 fn request_options(&mut self) -> &mut crate::RequestOptions {
823 &mut self.0.options
824 }
825 }
826
827 #[derive(Clone, Debug)]
845 pub struct ApplyParameters(RequestBuilder<crate::model::ApplyParametersRequest>);
846
847 impl ApplyParameters {
848 pub(crate) fn new(
849 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
850 ) -> Self {
851 Self(RequestBuilder::new(stub))
852 }
853
854 pub fn with_request<V: Into<crate::model::ApplyParametersRequest>>(mut self, v: V) -> Self {
856 self.0.request = v.into();
857 self
858 }
859
860 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
862 self.0.options = v.into();
863 self
864 }
865
866 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
873 (*self.0.stub)
874 .apply_parameters(self.0.request, self.0.options)
875 .await
876 .map(crate::Response::into_body)
877 }
878
879 pub fn poller(
881 self,
882 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
883 {
884 type Operation = google_cloud_lro::internal::Operation<
885 crate::model::Instance,
886 crate::model::OperationMetadata,
887 >;
888 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
889 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
890 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
891 if let Some(ref mut details) = poller_options.tracing {
892 details.method_name =
893 "google_cloud_memcache_v1::client::CloudMemcache::apply_parameters::until_done";
894 }
895
896 let stub = self.0.stub.clone();
897 let mut options = self.0.options.clone();
898 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
899 let query = move |name| {
900 let stub = stub.clone();
901 let options = options.clone();
902 async {
903 let op = GetOperation::new(stub)
904 .set_name(name)
905 .with_options(options)
906 .send()
907 .await?;
908 Ok(Operation::new(op))
909 }
910 };
911
912 let start = move || async {
913 let op = self.send().await?;
914 Ok(Operation::new(op))
915 };
916
917 use google_cloud_lro::internal::PollerExt;
918 {
919 google_cloud_lro::internal::new_poller(
920 polling_error_policy,
921 polling_backoff_policy,
922 start,
923 query,
924 )
925 }
926 .with_options(poller_options)
927 }
928
929 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
933 self.0.request.name = v.into();
934 self
935 }
936
937 pub fn set_node_ids<T, V>(mut self, v: T) -> Self
939 where
940 T: std::iter::IntoIterator<Item = V>,
941 V: std::convert::Into<std::string::String>,
942 {
943 use std::iter::Iterator;
944 self.0.request.node_ids = v.into_iter().map(|i| i.into()).collect();
945 self
946 }
947
948 pub fn set_apply_all<T: Into<bool>>(mut self, v: T) -> Self {
950 self.0.request.apply_all = v.into();
951 self
952 }
953 }
954
955 #[doc(hidden)]
956 impl crate::RequestBuilder for ApplyParameters {
957 fn request_options(&mut self) -> &mut crate::RequestOptions {
958 &mut self.0.options
959 }
960 }
961
962 #[derive(Clone, Debug)]
980 pub struct RescheduleMaintenance(RequestBuilder<crate::model::RescheduleMaintenanceRequest>);
981
982 impl RescheduleMaintenance {
983 pub(crate) fn new(
984 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
985 ) -> Self {
986 Self(RequestBuilder::new(stub))
987 }
988
989 pub fn with_request<V: Into<crate::model::RescheduleMaintenanceRequest>>(
991 mut self,
992 v: V,
993 ) -> Self {
994 self.0.request = v.into();
995 self
996 }
997
998 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1000 self.0.options = v.into();
1001 self
1002 }
1003
1004 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1011 (*self.0.stub)
1012 .reschedule_maintenance(self.0.request, self.0.options)
1013 .await
1014 .map(crate::Response::into_body)
1015 }
1016
1017 pub fn poller(
1019 self,
1020 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
1021 {
1022 type Operation = google_cloud_lro::internal::Operation<
1023 crate::model::Instance,
1024 crate::model::OperationMetadata,
1025 >;
1026 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1027 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1028 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1029 if let Some(ref mut details) = poller_options.tracing {
1030 details.method_name = "google_cloud_memcache_v1::client::CloudMemcache::reschedule_maintenance::until_done";
1031 }
1032
1033 let stub = self.0.stub.clone();
1034 let mut options = self.0.options.clone();
1035 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1036 let query = move |name| {
1037 let stub = stub.clone();
1038 let options = options.clone();
1039 async {
1040 let op = GetOperation::new(stub)
1041 .set_name(name)
1042 .with_options(options)
1043 .send()
1044 .await?;
1045 Ok(Operation::new(op))
1046 }
1047 };
1048
1049 let start = move || async {
1050 let op = self.send().await?;
1051 Ok(Operation::new(op))
1052 };
1053
1054 use google_cloud_lro::internal::PollerExt;
1055 {
1056 google_cloud_lro::internal::new_poller(
1057 polling_error_policy,
1058 polling_backoff_policy,
1059 start,
1060 query,
1061 )
1062 }
1063 .with_options(poller_options)
1064 }
1065
1066 pub fn set_instance<T: Into<std::string::String>>(mut self, v: T) -> Self {
1070 self.0.request.instance = v.into();
1071 self
1072 }
1073
1074 pub fn set_reschedule_type<
1078 T: Into<crate::model::reschedule_maintenance_request::RescheduleType>,
1079 >(
1080 mut self,
1081 v: T,
1082 ) -> Self {
1083 self.0.request.reschedule_type = v.into();
1084 self
1085 }
1086
1087 pub fn set_schedule_time<T>(mut self, v: T) -> Self
1089 where
1090 T: std::convert::Into<wkt::Timestamp>,
1091 {
1092 self.0.request.schedule_time = std::option::Option::Some(v.into());
1093 self
1094 }
1095
1096 pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
1098 where
1099 T: std::convert::Into<wkt::Timestamp>,
1100 {
1101 self.0.request.schedule_time = v.map(|x| x.into());
1102 self
1103 }
1104 }
1105
1106 #[doc(hidden)]
1107 impl crate::RequestBuilder for RescheduleMaintenance {
1108 fn request_options(&mut self) -> &mut crate::RequestOptions {
1109 &mut self.0.options
1110 }
1111 }
1112
1113 #[derive(Clone, Debug)]
1134 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
1135
1136 impl ListLocations {
1137 pub(crate) fn new(
1138 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1139 ) -> Self {
1140 Self(RequestBuilder::new(stub))
1141 }
1142
1143 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
1145 mut self,
1146 v: V,
1147 ) -> Self {
1148 self.0.request = v.into();
1149 self
1150 }
1151
1152 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1154 self.0.options = v.into();
1155 self
1156 }
1157
1158 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
1160 (*self.0.stub)
1161 .list_locations(self.0.request, self.0.options)
1162 .await
1163 .map(crate::Response::into_body)
1164 }
1165
1166 pub fn by_page(
1168 self,
1169 ) -> impl google_cloud_gax::paginator::Paginator<
1170 google_cloud_location::model::ListLocationsResponse,
1171 crate::Error,
1172 > {
1173 use std::clone::Clone;
1174 let token = self.0.request.page_token.clone();
1175 let execute = move |token: String| {
1176 let mut builder = self.clone();
1177 builder.0.request = builder.0.request.set_page_token(token);
1178 builder.send()
1179 };
1180 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1181 }
1182
1183 pub fn by_item(
1185 self,
1186 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1187 google_cloud_location::model::ListLocationsResponse,
1188 crate::Error,
1189 > {
1190 use google_cloud_gax::paginator::Paginator;
1191 self.by_page().items()
1192 }
1193
1194 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1196 self.0.request.name = v.into();
1197 self
1198 }
1199
1200 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1202 self.0.request.filter = v.into();
1203 self
1204 }
1205
1206 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1208 self.0.request.page_size = v.into();
1209 self
1210 }
1211
1212 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1214 self.0.request.page_token = v.into();
1215 self
1216 }
1217 }
1218
1219 #[doc(hidden)]
1220 impl crate::RequestBuilder for ListLocations {
1221 fn request_options(&mut self) -> &mut crate::RequestOptions {
1222 &mut self.0.options
1223 }
1224 }
1225
1226 #[derive(Clone, Debug)]
1243 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
1244
1245 impl GetLocation {
1246 pub(crate) fn new(
1247 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1248 ) -> Self {
1249 Self(RequestBuilder::new(stub))
1250 }
1251
1252 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
1254 mut self,
1255 v: V,
1256 ) -> Self {
1257 self.0.request = v.into();
1258 self
1259 }
1260
1261 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1263 self.0.options = v.into();
1264 self
1265 }
1266
1267 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
1269 (*self.0.stub)
1270 .get_location(self.0.request, self.0.options)
1271 .await
1272 .map(crate::Response::into_body)
1273 }
1274
1275 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1277 self.0.request.name = v.into();
1278 self
1279 }
1280 }
1281
1282 #[doc(hidden)]
1283 impl crate::RequestBuilder for GetLocation {
1284 fn request_options(&mut self) -> &mut crate::RequestOptions {
1285 &mut self.0.options
1286 }
1287 }
1288
1289 #[derive(Clone, Debug)]
1310 pub struct ListOperations(
1311 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1312 );
1313
1314 impl ListOperations {
1315 pub(crate) fn new(
1316 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1317 ) -> Self {
1318 Self(RequestBuilder::new(stub))
1319 }
1320
1321 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1323 mut self,
1324 v: V,
1325 ) -> Self {
1326 self.0.request = v.into();
1327 self
1328 }
1329
1330 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1332 self.0.options = v.into();
1333 self
1334 }
1335
1336 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1338 (*self.0.stub)
1339 .list_operations(self.0.request, self.0.options)
1340 .await
1341 .map(crate::Response::into_body)
1342 }
1343
1344 pub fn by_page(
1346 self,
1347 ) -> impl google_cloud_gax::paginator::Paginator<
1348 google_cloud_longrunning::model::ListOperationsResponse,
1349 crate::Error,
1350 > {
1351 use std::clone::Clone;
1352 let token = self.0.request.page_token.clone();
1353 let execute = move |token: String| {
1354 let mut builder = self.clone();
1355 builder.0.request = builder.0.request.set_page_token(token);
1356 builder.send()
1357 };
1358 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1359 }
1360
1361 pub fn by_item(
1363 self,
1364 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1365 google_cloud_longrunning::model::ListOperationsResponse,
1366 crate::Error,
1367 > {
1368 use google_cloud_gax::paginator::Paginator;
1369 self.by_page().items()
1370 }
1371
1372 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1374 self.0.request.name = v.into();
1375 self
1376 }
1377
1378 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1380 self.0.request.filter = v.into();
1381 self
1382 }
1383
1384 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1386 self.0.request.page_size = v.into();
1387 self
1388 }
1389
1390 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1392 self.0.request.page_token = v.into();
1393 self
1394 }
1395
1396 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1398 self.0.request.return_partial_success = v.into();
1399 self
1400 }
1401 }
1402
1403 #[doc(hidden)]
1404 impl crate::RequestBuilder for ListOperations {
1405 fn request_options(&mut self) -> &mut crate::RequestOptions {
1406 &mut self.0.options
1407 }
1408 }
1409
1410 #[derive(Clone, Debug)]
1427 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1428
1429 impl GetOperation {
1430 pub(crate) fn new(
1431 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1432 ) -> Self {
1433 Self(RequestBuilder::new(stub))
1434 }
1435
1436 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1438 mut self,
1439 v: V,
1440 ) -> Self {
1441 self.0.request = v.into();
1442 self
1443 }
1444
1445 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1447 self.0.options = v.into();
1448 self
1449 }
1450
1451 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1453 (*self.0.stub)
1454 .get_operation(self.0.request, self.0.options)
1455 .await
1456 .map(crate::Response::into_body)
1457 }
1458
1459 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1461 self.0.request.name = v.into();
1462 self
1463 }
1464 }
1465
1466 #[doc(hidden)]
1467 impl crate::RequestBuilder for GetOperation {
1468 fn request_options(&mut self) -> &mut crate::RequestOptions {
1469 &mut self.0.options
1470 }
1471 }
1472
1473 #[derive(Clone, Debug)]
1490 pub struct DeleteOperation(
1491 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
1492 );
1493
1494 impl DeleteOperation {
1495 pub(crate) fn new(
1496 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1497 ) -> Self {
1498 Self(RequestBuilder::new(stub))
1499 }
1500
1501 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
1503 mut self,
1504 v: V,
1505 ) -> Self {
1506 self.0.request = v.into();
1507 self
1508 }
1509
1510 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1512 self.0.options = v.into();
1513 self
1514 }
1515
1516 pub async fn send(self) -> Result<()> {
1518 (*self.0.stub)
1519 .delete_operation(self.0.request, self.0.options)
1520 .await
1521 .map(crate::Response::into_body)
1522 }
1523
1524 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1526 self.0.request.name = v.into();
1527 self
1528 }
1529 }
1530
1531 #[doc(hidden)]
1532 impl crate::RequestBuilder for DeleteOperation {
1533 fn request_options(&mut self) -> &mut crate::RequestOptions {
1534 &mut self.0.options
1535 }
1536 }
1537
1538 #[derive(Clone, Debug)]
1555 pub struct CancelOperation(
1556 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1557 );
1558
1559 impl CancelOperation {
1560 pub(crate) fn new(
1561 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1562 ) -> Self {
1563 Self(RequestBuilder::new(stub))
1564 }
1565
1566 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
1568 mut self,
1569 v: V,
1570 ) -> Self {
1571 self.0.request = v.into();
1572 self
1573 }
1574
1575 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1577 self.0.options = v.into();
1578 self
1579 }
1580
1581 pub async fn send(self) -> Result<()> {
1583 (*self.0.stub)
1584 .cancel_operation(self.0.request, self.0.options)
1585 .await
1586 .map(crate::Response::into_body)
1587 }
1588
1589 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1591 self.0.request.name = v.into();
1592 self
1593 }
1594 }
1595
1596 #[doc(hidden)]
1597 impl crate::RequestBuilder for CancelOperation {
1598 fn request_options(&mut self) -> &mut crate::RequestOptions {
1599 &mut self.0.options
1600 }
1601 }
1602}