google_cloud_memcache_v1/
builder.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17pub mod cloud_memcache {
18    use crate::Result;
19    use std::sync::Arc;
20
21    /// A builder for [CloudMemcache][super::super::client::CloudMemcache].
22    ///
23    /// ```
24    /// # tokio_test::block_on(async {
25    /// # use google_cloud_memcache_v1::*;
26    /// # use builder::cloud_memcache::ClientBuilder;
27    /// # use client::CloudMemcache;
28    /// let builder : ClientBuilder = CloudMemcache::builder();
29    /// let client = builder
30    ///     .with_endpoint("https://memcache.googleapis.com")
31    ///     .build().await?;
32    /// # gax::Result::<()>::Ok(()) });
33    /// ```
34    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    /// Common implementation for [super::super::client::CloudMemcache] request builders.
50    #[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    /// The request builder for [CloudMemcache::list_instances][super::super::client::CloudMemcache::list_instances] calls.
71    #[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        /// Sets the full request, replacing any prior values.
80        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        /// Sets all the options, replacing any prior values.
86        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        /// Sends the request.
92        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        /// Streams the responses back.
100        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        /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
115        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        /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
121        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        /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
127        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        /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
133        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        /// Sets the value of [order_by][crate::model::ListInstancesRequest::order_by].
139        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    /// The request builder for [CloudMemcache::get_instance][super::super::client::CloudMemcache::get_instance] calls.
153    #[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        /// Sets the full request, replacing any prior values.
162        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        /// Sets all the options, replacing any prior values.
168        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        /// Sends the request.
174        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        /// Sets the value of [name][crate::model::GetInstanceRequest::name].
182        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    /// The request builder for [CloudMemcache::create_instance][super::super::client::CloudMemcache::create_instance] calls.
196    #[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        /// Sets the full request, replacing any prior values.
205        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        /// Sets all the options, replacing any prior values.
211        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        /// Sends the request.
217        ///
218        /// # Long running operations
219        ///
220        /// This starts, but does not poll, a longrunning operation. More information
221        /// on [create_instance][super::super::client::CloudMemcache::create_instance].
222        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        /// Creates a [Poller][lro::Poller] to work with `create_instance`.
230        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        /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
263        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        /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
269        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        /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
275        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    /// The request builder for [CloudMemcache::update_instance][super::super::client::CloudMemcache::update_instance] calls.
292    #[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        /// Sets the full request, replacing any prior values.
301        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        /// Sets all the options, replacing any prior values.
307        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        /// Sends the request.
313        ///
314        /// # Long running operations
315        ///
316        /// This starts, but does not poll, a longrunning operation. More information
317        /// on [update_instance][super::super::client::CloudMemcache::update_instance].
318        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        /// Creates a [Poller][lro::Poller] to work with `update_instance`.
326        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        /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
359        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        /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
368        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    /// The request builder for [CloudMemcache::update_parameters][super::super::client::CloudMemcache::update_parameters] calls.
385    #[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        /// Sets the full request, replacing any prior values.
394        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        /// Sets all the options, replacing any prior values.
403        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        /// Sends the request.
409        ///
410        /// # Long running operations
411        ///
412        /// This starts, but does not poll, a longrunning operation. More information
413        /// on [update_parameters][super::super::client::CloudMemcache::update_parameters].
414        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        /// Creates a [Poller][lro::Poller] to work with `update_parameters`.
422        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        /// Sets the value of [name][crate::model::UpdateParametersRequest::name].
455        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        /// Sets the value of [update_mask][crate::model::UpdateParametersRequest::update_mask].
461        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        /// Sets the value of [parameters][crate::model::UpdateParametersRequest::parameters].
470        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    /// The request builder for [CloudMemcache::delete_instance][super::super::client::CloudMemcache::delete_instance] calls.
487    #[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        /// Sets the full request, replacing any prior values.
496        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        /// Sets all the options, replacing any prior values.
502        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        /// Sends the request.
508        ///
509        /// # Long running operations
510        ///
511        /// This starts, but does not poll, a longrunning operation. More information
512        /// on [delete_instance][super::super::client::CloudMemcache::delete_instance].
513        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        /// Creates a [Poller][lro::Poller] to work with `delete_instance`.
521        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        /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
551        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    /// The request builder for [CloudMemcache::apply_parameters][super::super::client::CloudMemcache::apply_parameters] calls.
565    #[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        /// Sets the full request, replacing any prior values.
574        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        /// Sets all the options, replacing any prior values.
580        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        /// Sends the request.
586        ///
587        /// # Long running operations
588        ///
589        /// This starts, but does not poll, a longrunning operation. More information
590        /// on [apply_parameters][super::super::client::CloudMemcache::apply_parameters].
591        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        /// Creates a [Poller][lro::Poller] to work with `apply_parameters`.
599        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        /// Sets the value of [name][crate::model::ApplyParametersRequest::name].
632        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        /// Sets the value of [apply_all][crate::model::ApplyParametersRequest::apply_all].
638        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        /// Sets the value of [node_ids][crate::model::ApplyParametersRequest::node_ids].
644        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    /// The request builder for [CloudMemcache::reschedule_maintenance][super::super::client::CloudMemcache::reschedule_maintenance] calls.
663    #[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        /// Sets the full request, replacing any prior values.
672        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        /// Sets all the options, replacing any prior values.
681        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        /// Sends the request.
687        ///
688        /// # Long running operations
689        ///
690        /// This starts, but does not poll, a longrunning operation. More information
691        /// on [reschedule_maintenance][super::super::client::CloudMemcache::reschedule_maintenance].
692        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        /// Creates a [Poller][lro::Poller] to work with `reschedule_maintenance`.
700        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        /// Sets the value of [instance][crate::model::RescheduleMaintenanceRequest::instance].
733        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        /// Sets the value of [reschedule_type][crate::model::RescheduleMaintenanceRequest::reschedule_type].
739        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        /// Sets the value of [schedule_time][crate::model::RescheduleMaintenanceRequest::schedule_time].
750        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    /// The request builder for [CloudMemcache::list_locations][super::super::client::CloudMemcache::list_locations] calls.
767    #[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        /// Sets the full request, replacing any prior values.
776        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        /// Sets all the options, replacing any prior values.
785        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        /// Sends the request.
791        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        /// Streams the responses back.
799        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        /// Sets the value of [name][location::model::ListLocationsRequest::name].
814        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        /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
820        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        /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
826        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        /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
832        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    /// The request builder for [CloudMemcache::get_location][super::super::client::CloudMemcache::get_location] calls.
846    #[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        /// Sets the full request, replacing any prior values.
855        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        /// Sets all the options, replacing any prior values.
861        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        /// Sends the request.
867        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        /// Sets the value of [name][location::model::GetLocationRequest::name].
875        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    /// The request builder for [CloudMemcache::list_operations][super::super::client::CloudMemcache::list_operations] calls.
889    #[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        /// Sets the full request, replacing any prior values.
898        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        /// Sets all the options, replacing any prior values.
907        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        /// Sends the request.
913        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        /// Streams the responses back.
921        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        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
936        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        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
942        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        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
948        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        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
954        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    /// The request builder for [CloudMemcache::get_operation][super::super::client::CloudMemcache::get_operation] calls.
968    #[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        /// Sets the full request, replacing any prior values.
977        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        /// Sets all the options, replacing any prior values.
986        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        /// Sends the request.
992        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        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
1000        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    /// The request builder for [CloudMemcache::delete_operation][super::super::client::CloudMemcache::delete_operation] calls.
1014    #[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        /// Sets the full request, replacing any prior values.
1023        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        /// Sets all the options, replacing any prior values.
1032        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        /// Sends the request.
1038        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        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
1046        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    /// The request builder for [CloudMemcache::cancel_operation][super::super::client::CloudMemcache::cancel_operation] calls.
1060    #[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        /// Sets the full request, replacing any prior values.
1069        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        /// Sets all the options, replacing any prior values.
1078        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        /// Sends the request.
1084        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        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
1092        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}