google_cloud_memcache_v1/
builder.rs1pub mod cloud_memcache {
18 use crate::Result;
19 use std::sync::Arc;
20
21 pub type ClientBuilder =
35 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
36
37 pub(crate) mod client {
38 use super::super::super::client::CloudMemcache;
39 pub struct Factory;
40 impl gax::client_builder::internal::ClientFactory for Factory {
41 type Client = CloudMemcache;
42 type Credentials = gaxi::options::Credentials;
43 async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
44 Self::Client::new(config).await
45 }
46 }
47 }
48
49 #[derive(Clone, Debug)]
51 pub(crate) struct RequestBuilder<R: std::default::Default> {
52 stub: Arc<dyn super::super::stub::dynamic::CloudMemcache>,
53 request: R,
54 options: gax::options::RequestOptions,
55 }
56
57 impl<R> RequestBuilder<R>
58 where
59 R: std::default::Default,
60 {
61 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::CloudMemcache>) -> Self {
62 Self {
63 stub,
64 request: R::default(),
65 options: gax::options::RequestOptions::default(),
66 }
67 }
68 }
69
70 #[derive(Clone, Debug)]
72 pub struct ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
73
74 impl ListInstances {
75 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::CloudMemcache>) -> Self {
76 Self(RequestBuilder::new(stub))
77 }
78
79 pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
81 self.0.request = v.into();
82 self
83 }
84
85 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
87 self.0.options = v.into();
88 self
89 }
90
91 pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
93 (*self.0.stub)
94 .list_instances(self.0.request, self.0.options)
95 .await
96 .map(gax::response::Response::into_body)
97 }
98
99 pub async fn paginator(
101 self,
102 ) -> impl gax::paginator::Paginator<crate::model::ListInstancesResponse, gax::error::Error>
103 {
104 use std::clone::Clone;
105 let token = self.0.request.page_token.clone();
106 let execute = move |token: String| {
107 let mut builder = self.clone();
108 builder.0.request = builder.0.request.set_page_token(token);
109 builder.send()
110 };
111 gax::paginator::internal::new_paginator(token, execute)
112 }
113
114 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
116 self.0.request.parent = v.into();
117 self
118 }
119
120 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
122 self.0.request.page_size = v.into();
123 self
124 }
125
126 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
128 self.0.request.page_token = v.into();
129 self
130 }
131
132 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
134 self.0.request.filter = v.into();
135 self
136 }
137
138 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
140 self.0.request.order_by = v.into();
141 self
142 }
143 }
144
145 #[doc(hidden)]
146 impl gax::options::internal::RequestBuilder for ListInstances {
147 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
148 &mut self.0.options
149 }
150 }
151
152 #[derive(Clone, Debug)]
154 pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
155
156 impl GetInstance {
157 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::CloudMemcache>) -> Self {
158 Self(RequestBuilder::new(stub))
159 }
160
161 pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
163 self.0.request = v.into();
164 self
165 }
166
167 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
169 self.0.options = v.into();
170 self
171 }
172
173 pub async fn send(self) -> Result<crate::model::Instance> {
175 (*self.0.stub)
176 .get_instance(self.0.request, self.0.options)
177 .await
178 .map(gax::response::Response::into_body)
179 }
180
181 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
183 self.0.request.name = v.into();
184 self
185 }
186 }
187
188 #[doc(hidden)]
189 impl gax::options::internal::RequestBuilder for GetInstance {
190 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
191 &mut self.0.options
192 }
193 }
194
195 #[derive(Clone, Debug)]
197 pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
198
199 impl CreateInstance {
200 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::CloudMemcache>) -> Self {
201 Self(RequestBuilder::new(stub))
202 }
203
204 pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
206 self.0.request = v.into();
207 self
208 }
209
210 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
212 self.0.options = v.into();
213 self
214 }
215
216 pub async fn send(self) -> Result<longrunning::model::Operation> {
223 (*self.0.stub)
224 .create_instance(self.0.request, self.0.options)
225 .await
226 .map(gax::response::Response::into_body)
227 }
228
229 pub fn poller(
231 self,
232 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
233 type Operation =
234 lro::Operation<crate::model::Instance, crate::model::OperationMetadata>;
235 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
236 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
237
238 let stub = self.0.stub.clone();
239 let mut options = self.0.options.clone();
240 options.set_retry_policy(gax::retry_policy::NeverRetry);
241 let query = move |name| {
242 let stub = stub.clone();
243 let options = options.clone();
244 async {
245 let op = GetOperation::new(stub)
246 .set_name(name)
247 .with_options(options)
248 .send()
249 .await?;
250 Ok(Operation::new(op))
251 }
252 };
253
254 let start = move || async {
255 let op = self.send().await?;
256 Ok(Operation::new(op))
257 };
258
259 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
260 }
261
262 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
264 self.0.request.parent = v.into();
265 self
266 }
267
268 pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
270 self.0.request.instance_id = v.into();
271 self
272 }
273
274 pub fn set_instance<T: Into<std::option::Option<crate::model::Instance>>>(
276 mut self,
277 v: T,
278 ) -> Self {
279 self.0.request.instance = v.into();
280 self
281 }
282 }
283
284 #[doc(hidden)]
285 impl gax::options::internal::RequestBuilder for CreateInstance {
286 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
287 &mut self.0.options
288 }
289 }
290
291 #[derive(Clone, Debug)]
293 pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
294
295 impl UpdateInstance {
296 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::CloudMemcache>) -> Self {
297 Self(RequestBuilder::new(stub))
298 }
299
300 pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
302 self.0.request = v.into();
303 self
304 }
305
306 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
308 self.0.options = v.into();
309 self
310 }
311
312 pub async fn send(self) -> Result<longrunning::model::Operation> {
319 (*self.0.stub)
320 .update_instance(self.0.request, self.0.options)
321 .await
322 .map(gax::response::Response::into_body)
323 }
324
325 pub fn poller(
327 self,
328 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
329 type Operation =
330 lro::Operation<crate::model::Instance, crate::model::OperationMetadata>;
331 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
332 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
333
334 let stub = self.0.stub.clone();
335 let mut options = self.0.options.clone();
336 options.set_retry_policy(gax::retry_policy::NeverRetry);
337 let query = move |name| {
338 let stub = stub.clone();
339 let options = options.clone();
340 async {
341 let op = GetOperation::new(stub)
342 .set_name(name)
343 .with_options(options)
344 .send()
345 .await?;
346 Ok(Operation::new(op))
347 }
348 };
349
350 let start = move || async {
351 let op = self.send().await?;
352 Ok(Operation::new(op))
353 };
354
355 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
356 }
357
358 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
360 mut self,
361 v: T,
362 ) -> Self {
363 self.0.request.update_mask = v.into();
364 self
365 }
366
367 pub fn set_instance<T: Into<std::option::Option<crate::model::Instance>>>(
369 mut self,
370 v: T,
371 ) -> Self {
372 self.0.request.instance = v.into();
373 self
374 }
375 }
376
377 #[doc(hidden)]
378 impl gax::options::internal::RequestBuilder for UpdateInstance {
379 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
380 &mut self.0.options
381 }
382 }
383
384 #[derive(Clone, Debug)]
386 pub struct UpdateParameters(RequestBuilder<crate::model::UpdateParametersRequest>);
387
388 impl UpdateParameters {
389 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::CloudMemcache>) -> Self {
390 Self(RequestBuilder::new(stub))
391 }
392
393 pub fn with_request<V: Into<crate::model::UpdateParametersRequest>>(
395 mut self,
396 v: V,
397 ) -> Self {
398 self.0.request = v.into();
399 self
400 }
401
402 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
404 self.0.options = v.into();
405 self
406 }
407
408 pub async fn send(self) -> Result<longrunning::model::Operation> {
415 (*self.0.stub)
416 .update_parameters(self.0.request, self.0.options)
417 .await
418 .map(gax::response::Response::into_body)
419 }
420
421 pub fn poller(
423 self,
424 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
425 type Operation =
426 lro::Operation<crate::model::Instance, crate::model::OperationMetadata>;
427 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
428 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
429
430 let stub = self.0.stub.clone();
431 let mut options = self.0.options.clone();
432 options.set_retry_policy(gax::retry_policy::NeverRetry);
433 let query = move |name| {
434 let stub = stub.clone();
435 let options = options.clone();
436 async {
437 let op = GetOperation::new(stub)
438 .set_name(name)
439 .with_options(options)
440 .send()
441 .await?;
442 Ok(Operation::new(op))
443 }
444 };
445
446 let start = move || async {
447 let op = self.send().await?;
448 Ok(Operation::new(op))
449 };
450
451 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
452 }
453
454 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
456 self.0.request.name = v.into();
457 self
458 }
459
460 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
462 mut self,
463 v: T,
464 ) -> Self {
465 self.0.request.update_mask = v.into();
466 self
467 }
468
469 pub fn set_parameters<T: Into<std::option::Option<crate::model::MemcacheParameters>>>(
471 mut self,
472 v: T,
473 ) -> Self {
474 self.0.request.parameters = v.into();
475 self
476 }
477 }
478
479 #[doc(hidden)]
480 impl gax::options::internal::RequestBuilder for UpdateParameters {
481 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
482 &mut self.0.options
483 }
484 }
485
486 #[derive(Clone, Debug)]
488 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
489
490 impl DeleteInstance {
491 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::CloudMemcache>) -> Self {
492 Self(RequestBuilder::new(stub))
493 }
494
495 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
497 self.0.request = v.into();
498 self
499 }
500
501 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
503 self.0.options = v.into();
504 self
505 }
506
507 pub async fn send(self) -> Result<longrunning::model::Operation> {
514 (*self.0.stub)
515 .delete_instance(self.0.request, self.0.options)
516 .await
517 .map(gax::response::Response::into_body)
518 }
519
520 pub fn poller(self) -> impl lro::Poller<wkt::Empty, crate::model::OperationMetadata> {
522 type Operation = lro::Operation<wkt::Empty, crate::model::OperationMetadata>;
523 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
524 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
525
526 let stub = self.0.stub.clone();
527 let mut options = self.0.options.clone();
528 options.set_retry_policy(gax::retry_policy::NeverRetry);
529 let query = move |name| {
530 let stub = stub.clone();
531 let options = options.clone();
532 async {
533 let op = GetOperation::new(stub)
534 .set_name(name)
535 .with_options(options)
536 .send()
537 .await?;
538 Ok(Operation::new(op))
539 }
540 };
541
542 let start = move || async {
543 let op = self.send().await?;
544 Ok(Operation::new(op))
545 };
546
547 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
548 }
549
550 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
552 self.0.request.name = v.into();
553 self
554 }
555 }
556
557 #[doc(hidden)]
558 impl gax::options::internal::RequestBuilder for DeleteInstance {
559 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
560 &mut self.0.options
561 }
562 }
563
564 #[derive(Clone, Debug)]
566 pub struct ApplyParameters(RequestBuilder<crate::model::ApplyParametersRequest>);
567
568 impl ApplyParameters {
569 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::CloudMemcache>) -> Self {
570 Self(RequestBuilder::new(stub))
571 }
572
573 pub fn with_request<V: Into<crate::model::ApplyParametersRequest>>(mut self, v: V) -> Self {
575 self.0.request = v.into();
576 self
577 }
578
579 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
581 self.0.options = v.into();
582 self
583 }
584
585 pub async fn send(self) -> Result<longrunning::model::Operation> {
592 (*self.0.stub)
593 .apply_parameters(self.0.request, self.0.options)
594 .await
595 .map(gax::response::Response::into_body)
596 }
597
598 pub fn poller(
600 self,
601 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
602 type Operation =
603 lro::Operation<crate::model::Instance, crate::model::OperationMetadata>;
604 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
605 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
606
607 let stub = self.0.stub.clone();
608 let mut options = self.0.options.clone();
609 options.set_retry_policy(gax::retry_policy::NeverRetry);
610 let query = move |name| {
611 let stub = stub.clone();
612 let options = options.clone();
613 async {
614 let op = GetOperation::new(stub)
615 .set_name(name)
616 .with_options(options)
617 .send()
618 .await?;
619 Ok(Operation::new(op))
620 }
621 };
622
623 let start = move || async {
624 let op = self.send().await?;
625 Ok(Operation::new(op))
626 };
627
628 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
629 }
630
631 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
633 self.0.request.name = v.into();
634 self
635 }
636
637 pub fn set_apply_all<T: Into<bool>>(mut self, v: T) -> Self {
639 self.0.request.apply_all = v.into();
640 self
641 }
642
643 pub fn set_node_ids<T, V>(mut self, v: T) -> Self
645 where
646 T: std::iter::IntoIterator<Item = V>,
647 V: std::convert::Into<std::string::String>,
648 {
649 use std::iter::Iterator;
650 self.0.request.node_ids = v.into_iter().map(|i| i.into()).collect();
651 self
652 }
653 }
654
655 #[doc(hidden)]
656 impl gax::options::internal::RequestBuilder for ApplyParameters {
657 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
658 &mut self.0.options
659 }
660 }
661
662 #[derive(Clone, Debug)]
664 pub struct RescheduleMaintenance(RequestBuilder<crate::model::RescheduleMaintenanceRequest>);
665
666 impl RescheduleMaintenance {
667 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::CloudMemcache>) -> Self {
668 Self(RequestBuilder::new(stub))
669 }
670
671 pub fn with_request<V: Into<crate::model::RescheduleMaintenanceRequest>>(
673 mut self,
674 v: V,
675 ) -> Self {
676 self.0.request = v.into();
677 self
678 }
679
680 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
682 self.0.options = v.into();
683 self
684 }
685
686 pub async fn send(self) -> Result<longrunning::model::Operation> {
693 (*self.0.stub)
694 .reschedule_maintenance(self.0.request, self.0.options)
695 .await
696 .map(gax::response::Response::into_body)
697 }
698
699 pub fn poller(
701 self,
702 ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
703 type Operation =
704 lro::Operation<crate::model::Instance, crate::model::OperationMetadata>;
705 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
706 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
707
708 let stub = self.0.stub.clone();
709 let mut options = self.0.options.clone();
710 options.set_retry_policy(gax::retry_policy::NeverRetry);
711 let query = move |name| {
712 let stub = stub.clone();
713 let options = options.clone();
714 async {
715 let op = GetOperation::new(stub)
716 .set_name(name)
717 .with_options(options)
718 .send()
719 .await?;
720 Ok(Operation::new(op))
721 }
722 };
723
724 let start = move || async {
725 let op = self.send().await?;
726 Ok(Operation::new(op))
727 };
728
729 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
730 }
731
732 pub fn set_instance<T: Into<std::string::String>>(mut self, v: T) -> Self {
734 self.0.request.instance = v.into();
735 self
736 }
737
738 pub fn set_reschedule_type<
740 T: Into<crate::model::reschedule_maintenance_request::RescheduleType>,
741 >(
742 mut self,
743 v: T,
744 ) -> Self {
745 self.0.request.reschedule_type = v.into();
746 self
747 }
748
749 pub fn set_schedule_time<T: Into<std::option::Option<wkt::Timestamp>>>(
751 mut self,
752 v: T,
753 ) -> Self {
754 self.0.request.schedule_time = v.into();
755 self
756 }
757 }
758
759 #[doc(hidden)]
760 impl gax::options::internal::RequestBuilder for RescheduleMaintenance {
761 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
762 &mut self.0.options
763 }
764 }
765
766 #[derive(Clone, Debug)]
768 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
769
770 impl ListLocations {
771 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::CloudMemcache>) -> Self {
772 Self(RequestBuilder::new(stub))
773 }
774
775 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
777 mut self,
778 v: V,
779 ) -> Self {
780 self.0.request = v.into();
781 self
782 }
783
784 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
786 self.0.options = v.into();
787 self
788 }
789
790 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
792 (*self.0.stub)
793 .list_locations(self.0.request, self.0.options)
794 .await
795 .map(gax::response::Response::into_body)
796 }
797
798 pub async fn paginator(
800 self,
801 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
802 {
803 use std::clone::Clone;
804 let token = self.0.request.page_token.clone();
805 let execute = move |token: String| {
806 let mut builder = self.clone();
807 builder.0.request = builder.0.request.set_page_token(token);
808 builder.send()
809 };
810 gax::paginator::internal::new_paginator(token, execute)
811 }
812
813 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 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
821 self.0.request.filter = v.into();
822 self
823 }
824
825 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
827 self.0.request.page_size = v.into();
828 self
829 }
830
831 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
833 self.0.request.page_token = v.into();
834 self
835 }
836 }
837
838 #[doc(hidden)]
839 impl gax::options::internal::RequestBuilder for ListLocations {
840 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
841 &mut self.0.options
842 }
843 }
844
845 #[derive(Clone, Debug)]
847 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
848
849 impl GetLocation {
850 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::CloudMemcache>) -> Self {
851 Self(RequestBuilder::new(stub))
852 }
853
854 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
856 self.0.request = v.into();
857 self
858 }
859
860 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
862 self.0.options = v.into();
863 self
864 }
865
866 pub async fn send(self) -> Result<location::model::Location> {
868 (*self.0.stub)
869 .get_location(self.0.request, self.0.options)
870 .await
871 .map(gax::response::Response::into_body)
872 }
873
874 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
876 self.0.request.name = v.into();
877 self
878 }
879 }
880
881 #[doc(hidden)]
882 impl gax::options::internal::RequestBuilder for GetLocation {
883 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
884 &mut self.0.options
885 }
886 }
887
888 #[derive(Clone, Debug)]
890 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
891
892 impl ListOperations {
893 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::CloudMemcache>) -> Self {
894 Self(RequestBuilder::new(stub))
895 }
896
897 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
899 mut self,
900 v: V,
901 ) -> Self {
902 self.0.request = v.into();
903 self
904 }
905
906 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
908 self.0.options = v.into();
909 self
910 }
911
912 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
914 (*self.0.stub)
915 .list_operations(self.0.request, self.0.options)
916 .await
917 .map(gax::response::Response::into_body)
918 }
919
920 pub async fn paginator(
922 self,
923 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
924 {
925 use std::clone::Clone;
926 let token = self.0.request.page_token.clone();
927 let execute = move |token: String| {
928 let mut builder = self.clone();
929 builder.0.request = builder.0.request.set_page_token(token);
930 builder.send()
931 };
932 gax::paginator::internal::new_paginator(token, execute)
933 }
934
935 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
937 self.0.request.name = v.into();
938 self
939 }
940
941 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
943 self.0.request.filter = v.into();
944 self
945 }
946
947 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
949 self.0.request.page_size = v.into();
950 self
951 }
952
953 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
955 self.0.request.page_token = v.into();
956 self
957 }
958 }
959
960 #[doc(hidden)]
961 impl gax::options::internal::RequestBuilder for ListOperations {
962 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
963 &mut self.0.options
964 }
965 }
966
967 #[derive(Clone, Debug)]
969 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
970
971 impl GetOperation {
972 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::CloudMemcache>) -> Self {
973 Self(RequestBuilder::new(stub))
974 }
975
976 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
978 mut self,
979 v: V,
980 ) -> Self {
981 self.0.request = v.into();
982 self
983 }
984
985 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
987 self.0.options = v.into();
988 self
989 }
990
991 pub async fn send(self) -> Result<longrunning::model::Operation> {
993 (*self.0.stub)
994 .get_operation(self.0.request, self.0.options)
995 .await
996 .map(gax::response::Response::into_body)
997 }
998
999 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1001 self.0.request.name = v.into();
1002 self
1003 }
1004 }
1005
1006 #[doc(hidden)]
1007 impl gax::options::internal::RequestBuilder for GetOperation {
1008 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1009 &mut self.0.options
1010 }
1011 }
1012
1013 #[derive(Clone, Debug)]
1015 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1016
1017 impl DeleteOperation {
1018 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::CloudMemcache>) -> Self {
1019 Self(RequestBuilder::new(stub))
1020 }
1021
1022 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1024 mut self,
1025 v: V,
1026 ) -> Self {
1027 self.0.request = v.into();
1028 self
1029 }
1030
1031 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1033 self.0.options = v.into();
1034 self
1035 }
1036
1037 pub async fn send(self) -> Result<()> {
1039 (*self.0.stub)
1040 .delete_operation(self.0.request, self.0.options)
1041 .await
1042 .map(gax::response::Response::into_body)
1043 }
1044
1045 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1047 self.0.request.name = v.into();
1048 self
1049 }
1050 }
1051
1052 #[doc(hidden)]
1053 impl gax::options::internal::RequestBuilder for DeleteOperation {
1054 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1055 &mut self.0.options
1056 }
1057 }
1058
1059 #[derive(Clone, Debug)]
1061 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1062
1063 impl CancelOperation {
1064 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::CloudMemcache>) -> Self {
1065 Self(RequestBuilder::new(stub))
1066 }
1067
1068 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1070 mut self,
1071 v: V,
1072 ) -> Self {
1073 self.0.request = v.into();
1074 self
1075 }
1076
1077 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1079 self.0.options = v.into();
1080 self
1081 }
1082
1083 pub async fn send(self) -> Result<()> {
1085 (*self.0.stub)
1086 .cancel_operation(self.0.request, self.0.options)
1087 .await
1088 .map(gax::response::Response::into_body)
1089 }
1090
1091 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1093 self.0.request.name = v.into();
1094 self
1095 }
1096 }
1097
1098 #[doc(hidden)]
1099 impl gax::options::internal::RequestBuilder for CancelOperation {
1100 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1101 &mut self.0.options
1102 }
1103 }
1104}