Skip to main content

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
20    /// A builder for [CloudMemcache][crate::client::CloudMemcache].
21    ///
22    /// ```
23    /// # async fn sample() -> gax::client_builder::Result<()> {
24    /// # use google_cloud_memcache_v1::*;
25    /// # use builder::cloud_memcache::ClientBuilder;
26    /// # use client::CloudMemcache;
27    /// let builder : ClientBuilder = CloudMemcache::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://memcache.googleapis.com")
30    ///     .build().await?;
31    /// # Ok(()) }
32    /// ```
33    pub type ClientBuilder =
34        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36    pub(crate) mod client {
37        use super::super::super::client::CloudMemcache;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = CloudMemcache;
41            type Credentials = gaxi::options::Credentials;
42            async fn build(
43                self,
44                config: gaxi::options::ClientConfig,
45            ) -> gax::client_builder::Result<Self::Client> {
46                Self::Client::new(config).await
47            }
48        }
49    }
50
51    /// Common implementation for [crate::client::CloudMemcache] request builders.
52    #[derive(Clone, Debug)]
53    pub(crate) struct RequestBuilder<R: std::default::Default> {
54        stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
55        request: R,
56        options: gax::options::RequestOptions,
57    }
58
59    impl<R> RequestBuilder<R>
60    where
61        R: std::default::Default,
62    {
63        pub(crate) fn new(
64            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: gax::options::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [CloudMemcache::list_instances][crate::client::CloudMemcache::list_instances] calls.
75    ///
76    /// # Example
77    /// ```
78    /// # use google_cloud_memcache_v1::builder::cloud_memcache::ListInstances;
79    /// # async fn sample() -> gax::Result<()> {
80    /// use gax::paginator::ItemPaginator;
81    ///
82    /// let builder = prepare_request_builder();
83    /// let mut items = builder.by_item();
84    /// while let Some(result) = items.next().await {
85    ///   let item = result?;
86    /// }
87    /// # Ok(()) }
88    ///
89    /// fn prepare_request_builder() -> ListInstances {
90    ///   # panic!();
91    ///   // ... details omitted ...
92    /// }
93    /// ```
94    #[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        /// Sets the full request, replacing any prior values.
105        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        /// Sets all the options, replacing any prior values.
111        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
112            self.0.options = v.into();
113            self
114        }
115
116        /// Sends the request.
117        pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
118            (*self.0.stub)
119                .list_instances(self.0.request, self.0.options)
120                .await
121                .map(gax::response::Response::into_body)
122        }
123
124        /// Streams each page in the collection.
125        pub fn by_page(
126            self,
127        ) -> impl gax::paginator::Paginator<crate::model::ListInstancesResponse, gax::error::Error>
128        {
129            use std::clone::Clone;
130            let token = self.0.request.page_token.clone();
131            let execute = move |token: String| {
132                let mut builder = self.clone();
133                builder.0.request = builder.0.request.set_page_token(token);
134                builder.send()
135            };
136            gax::paginator::internal::new_paginator(token, execute)
137        }
138
139        /// Streams each item in the collection.
140        pub fn by_item(
141            self,
142        ) -> impl gax::paginator::ItemPaginator<crate::model::ListInstancesResponse, gax::error::Error>
143        {
144            use gax::paginator::Paginator;
145            self.by_page().items()
146        }
147
148        /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
149        ///
150        /// This is a **required** field for requests.
151        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
152            self.0.request.parent = v.into();
153            self
154        }
155
156        /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
157        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
158            self.0.request.page_size = v.into();
159            self
160        }
161
162        /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
163        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
164            self.0.request.page_token = v.into();
165            self
166        }
167
168        /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
169        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
170            self.0.request.filter = v.into();
171            self
172        }
173
174        /// Sets the value of [order_by][crate::model::ListInstancesRequest::order_by].
175        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
176            self.0.request.order_by = v.into();
177            self
178        }
179    }
180
181    #[doc(hidden)]
182    impl gax::options::internal::RequestBuilder for ListInstances {
183        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
184            &mut self.0.options
185        }
186    }
187
188    /// The request builder for [CloudMemcache::get_instance][crate::client::CloudMemcache::get_instance] calls.
189    ///
190    /// # Example
191    /// ```
192    /// # use google_cloud_memcache_v1::builder::cloud_memcache::GetInstance;
193    /// # async fn sample() -> gax::Result<()> {
194    ///
195    /// let builder = prepare_request_builder();
196    /// let response = builder.send().await?;
197    /// # Ok(()) }
198    ///
199    /// fn prepare_request_builder() -> GetInstance {
200    ///   # panic!();
201    ///   // ... details omitted ...
202    /// }
203    /// ```
204    #[derive(Clone, Debug)]
205    pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
206
207    impl GetInstance {
208        pub(crate) fn new(
209            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
210        ) -> Self {
211            Self(RequestBuilder::new(stub))
212        }
213
214        /// Sets the full request, replacing any prior values.
215        pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
216            self.0.request = v.into();
217            self
218        }
219
220        /// Sets all the options, replacing any prior values.
221        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
222            self.0.options = v.into();
223            self
224        }
225
226        /// Sends the request.
227        pub async fn send(self) -> Result<crate::model::Instance> {
228            (*self.0.stub)
229                .get_instance(self.0.request, self.0.options)
230                .await
231                .map(gax::response::Response::into_body)
232        }
233
234        /// Sets the value of [name][crate::model::GetInstanceRequest::name].
235        ///
236        /// This is a **required** field for requests.
237        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
238            self.0.request.name = v.into();
239            self
240        }
241    }
242
243    #[doc(hidden)]
244    impl gax::options::internal::RequestBuilder for GetInstance {
245        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
246            &mut self.0.options
247        }
248    }
249
250    /// The request builder for [CloudMemcache::create_instance][crate::client::CloudMemcache::create_instance] calls.
251    ///
252    /// # Example
253    /// ```
254    /// # use google_cloud_memcache_v1::builder::cloud_memcache::CreateInstance;
255    /// # async fn sample() -> gax::Result<()> {
256    /// use lro::Poller;
257    ///
258    /// let builder = prepare_request_builder();
259    /// let response = builder.poller().until_done().await?;
260    /// # Ok(()) }
261    ///
262    /// fn prepare_request_builder() -> CreateInstance {
263    ///   # panic!();
264    ///   // ... details omitted ...
265    /// }
266    /// ```
267    #[derive(Clone, Debug)]
268    pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
269
270    impl CreateInstance {
271        pub(crate) fn new(
272            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
273        ) -> Self {
274            Self(RequestBuilder::new(stub))
275        }
276
277        /// Sets the full request, replacing any prior values.
278        pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
279            self.0.request = v.into();
280            self
281        }
282
283        /// Sets all the options, replacing any prior values.
284        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
285            self.0.options = v.into();
286            self
287        }
288
289        /// Sends the request.
290        ///
291        /// # Long running operations
292        ///
293        /// This starts, but does not poll, a longrunning operation. More information
294        /// on [create_instance][crate::client::CloudMemcache::create_instance].
295        pub async fn send(self) -> Result<longrunning::model::Operation> {
296            (*self.0.stub)
297                .create_instance(self.0.request, self.0.options)
298                .await
299                .map(gax::response::Response::into_body)
300        }
301
302        /// Creates a [Poller][lro::Poller] to work with `create_instance`.
303        pub fn poller(
304            self,
305        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
306            type Operation =
307                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
308            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
309            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
310
311            let stub = self.0.stub.clone();
312            let mut options = self.0.options.clone();
313            options.set_retry_policy(gax::retry_policy::NeverRetry);
314            let query = move |name| {
315                let stub = stub.clone();
316                let options = options.clone();
317                async {
318                    let op = GetOperation::new(stub)
319                        .set_name(name)
320                        .with_options(options)
321                        .send()
322                        .await?;
323                    Ok(Operation::new(op))
324                }
325            };
326
327            let start = move || async {
328                let op = self.send().await?;
329                Ok(Operation::new(op))
330            };
331
332            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
333        }
334
335        /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
336        ///
337        /// This is a **required** field for requests.
338        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
339            self.0.request.parent = v.into();
340            self
341        }
342
343        /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
344        ///
345        /// This is a **required** field for requests.
346        pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
347            self.0.request.instance_id = v.into();
348            self
349        }
350
351        /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
352        ///
353        /// This is a **required** field for requests.
354        pub fn set_instance<T>(mut self, v: T) -> Self
355        where
356            T: std::convert::Into<crate::model::Instance>,
357        {
358            self.0.request.instance = std::option::Option::Some(v.into());
359            self
360        }
361
362        /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
363        ///
364        /// This is a **required** field for requests.
365        pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
366        where
367            T: std::convert::Into<crate::model::Instance>,
368        {
369            self.0.request.instance = v.map(|x| x.into());
370            self
371        }
372    }
373
374    #[doc(hidden)]
375    impl gax::options::internal::RequestBuilder for CreateInstance {
376        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
377            &mut self.0.options
378        }
379    }
380
381    /// The request builder for [CloudMemcache::update_instance][crate::client::CloudMemcache::update_instance] calls.
382    ///
383    /// # Example
384    /// ```
385    /// # use google_cloud_memcache_v1::builder::cloud_memcache::UpdateInstance;
386    /// # async fn sample() -> gax::Result<()> {
387    /// use lro::Poller;
388    ///
389    /// let builder = prepare_request_builder();
390    /// let response = builder.poller().until_done().await?;
391    /// # Ok(()) }
392    ///
393    /// fn prepare_request_builder() -> UpdateInstance {
394    ///   # panic!();
395    ///   // ... details omitted ...
396    /// }
397    /// ```
398    #[derive(Clone, Debug)]
399    pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
400
401    impl UpdateInstance {
402        pub(crate) fn new(
403            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
404        ) -> Self {
405            Self(RequestBuilder::new(stub))
406        }
407
408        /// Sets the full request, replacing any prior values.
409        pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
410            self.0.request = v.into();
411            self
412        }
413
414        /// Sets all the options, replacing any prior values.
415        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
416            self.0.options = v.into();
417            self
418        }
419
420        /// Sends the request.
421        ///
422        /// # Long running operations
423        ///
424        /// This starts, but does not poll, a longrunning operation. More information
425        /// on [update_instance][crate::client::CloudMemcache::update_instance].
426        pub async fn send(self) -> Result<longrunning::model::Operation> {
427            (*self.0.stub)
428                .update_instance(self.0.request, self.0.options)
429                .await
430                .map(gax::response::Response::into_body)
431        }
432
433        /// Creates a [Poller][lro::Poller] to work with `update_instance`.
434        pub fn poller(
435            self,
436        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
437            type Operation =
438                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
439            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
440            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
441
442            let stub = self.0.stub.clone();
443            let mut options = self.0.options.clone();
444            options.set_retry_policy(gax::retry_policy::NeverRetry);
445            let query = move |name| {
446                let stub = stub.clone();
447                let options = options.clone();
448                async {
449                    let op = GetOperation::new(stub)
450                        .set_name(name)
451                        .with_options(options)
452                        .send()
453                        .await?;
454                    Ok(Operation::new(op))
455                }
456            };
457
458            let start = move || async {
459                let op = self.send().await?;
460                Ok(Operation::new(op))
461            };
462
463            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
464        }
465
466        /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
467        ///
468        /// This is a **required** field for requests.
469        pub fn set_update_mask<T>(mut self, v: T) -> Self
470        where
471            T: std::convert::Into<wkt::FieldMask>,
472        {
473            self.0.request.update_mask = std::option::Option::Some(v.into());
474            self
475        }
476
477        /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
478        ///
479        /// This is a **required** field for requests.
480        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
481        where
482            T: std::convert::Into<wkt::FieldMask>,
483        {
484            self.0.request.update_mask = v.map(|x| x.into());
485            self
486        }
487
488        /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
489        ///
490        /// This is a **required** field for requests.
491        pub fn set_instance<T>(mut self, v: T) -> Self
492        where
493            T: std::convert::Into<crate::model::Instance>,
494        {
495            self.0.request.instance = std::option::Option::Some(v.into());
496            self
497        }
498
499        /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
500        ///
501        /// This is a **required** field for requests.
502        pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
503        where
504            T: std::convert::Into<crate::model::Instance>,
505        {
506            self.0.request.instance = v.map(|x| x.into());
507            self
508        }
509    }
510
511    #[doc(hidden)]
512    impl gax::options::internal::RequestBuilder for UpdateInstance {
513        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
514            &mut self.0.options
515        }
516    }
517
518    /// The request builder for [CloudMemcache::update_parameters][crate::client::CloudMemcache::update_parameters] calls.
519    ///
520    /// # Example
521    /// ```
522    /// # use google_cloud_memcache_v1::builder::cloud_memcache::UpdateParameters;
523    /// # async fn sample() -> gax::Result<()> {
524    /// use lro::Poller;
525    ///
526    /// let builder = prepare_request_builder();
527    /// let response = builder.poller().until_done().await?;
528    /// # Ok(()) }
529    ///
530    /// fn prepare_request_builder() -> UpdateParameters {
531    ///   # panic!();
532    ///   // ... details omitted ...
533    /// }
534    /// ```
535    #[derive(Clone, Debug)]
536    pub struct UpdateParameters(RequestBuilder<crate::model::UpdateParametersRequest>);
537
538    impl UpdateParameters {
539        pub(crate) fn new(
540            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
541        ) -> Self {
542            Self(RequestBuilder::new(stub))
543        }
544
545        /// Sets the full request, replacing any prior values.
546        pub fn with_request<V: Into<crate::model::UpdateParametersRequest>>(
547            mut self,
548            v: V,
549        ) -> Self {
550            self.0.request = v.into();
551            self
552        }
553
554        /// Sets all the options, replacing any prior values.
555        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
556            self.0.options = v.into();
557            self
558        }
559
560        /// Sends the request.
561        ///
562        /// # Long running operations
563        ///
564        /// This starts, but does not poll, a longrunning operation. More information
565        /// on [update_parameters][crate::client::CloudMemcache::update_parameters].
566        pub async fn send(self) -> Result<longrunning::model::Operation> {
567            (*self.0.stub)
568                .update_parameters(self.0.request, self.0.options)
569                .await
570                .map(gax::response::Response::into_body)
571        }
572
573        /// Creates a [Poller][lro::Poller] to work with `update_parameters`.
574        pub fn poller(
575            self,
576        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
577            type Operation =
578                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
579            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
580            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
581
582            let stub = self.0.stub.clone();
583            let mut options = self.0.options.clone();
584            options.set_retry_policy(gax::retry_policy::NeverRetry);
585            let query = move |name| {
586                let stub = stub.clone();
587                let options = options.clone();
588                async {
589                    let op = GetOperation::new(stub)
590                        .set_name(name)
591                        .with_options(options)
592                        .send()
593                        .await?;
594                    Ok(Operation::new(op))
595                }
596            };
597
598            let start = move || async {
599                let op = self.send().await?;
600                Ok(Operation::new(op))
601            };
602
603            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
604        }
605
606        /// Sets the value of [name][crate::model::UpdateParametersRequest::name].
607        ///
608        /// This is a **required** field for requests.
609        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
610            self.0.request.name = v.into();
611            self
612        }
613
614        /// Sets the value of [update_mask][crate::model::UpdateParametersRequest::update_mask].
615        ///
616        /// This is a **required** field for requests.
617        pub fn set_update_mask<T>(mut self, v: T) -> Self
618        where
619            T: std::convert::Into<wkt::FieldMask>,
620        {
621            self.0.request.update_mask = std::option::Option::Some(v.into());
622            self
623        }
624
625        /// Sets or clears the value of [update_mask][crate::model::UpdateParametersRequest::update_mask].
626        ///
627        /// This is a **required** field for requests.
628        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
629        where
630            T: std::convert::Into<wkt::FieldMask>,
631        {
632            self.0.request.update_mask = v.map(|x| x.into());
633            self
634        }
635
636        /// Sets the value of [parameters][crate::model::UpdateParametersRequest::parameters].
637        pub fn set_parameters<T>(mut self, v: T) -> Self
638        where
639            T: std::convert::Into<crate::model::MemcacheParameters>,
640        {
641            self.0.request.parameters = std::option::Option::Some(v.into());
642            self
643        }
644
645        /// Sets or clears the value of [parameters][crate::model::UpdateParametersRequest::parameters].
646        pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
647        where
648            T: std::convert::Into<crate::model::MemcacheParameters>,
649        {
650            self.0.request.parameters = v.map(|x| x.into());
651            self
652        }
653    }
654
655    #[doc(hidden)]
656    impl gax::options::internal::RequestBuilder for UpdateParameters {
657        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
658            &mut self.0.options
659        }
660    }
661
662    /// The request builder for [CloudMemcache::delete_instance][crate::client::CloudMemcache::delete_instance] calls.
663    ///
664    /// # Example
665    /// ```
666    /// # use google_cloud_memcache_v1::builder::cloud_memcache::DeleteInstance;
667    /// # async fn sample() -> gax::Result<()> {
668    /// use lro::Poller;
669    ///
670    /// let builder = prepare_request_builder();
671    /// let response = builder.poller().until_done().await?;
672    /// # Ok(()) }
673    ///
674    /// fn prepare_request_builder() -> DeleteInstance {
675    ///   # panic!();
676    ///   // ... details omitted ...
677    /// }
678    /// ```
679    #[derive(Clone, Debug)]
680    pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
681
682    impl DeleteInstance {
683        pub(crate) fn new(
684            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
685        ) -> Self {
686            Self(RequestBuilder::new(stub))
687        }
688
689        /// Sets the full request, replacing any prior values.
690        pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
691            self.0.request = v.into();
692            self
693        }
694
695        /// Sets all the options, replacing any prior values.
696        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
697            self.0.options = v.into();
698            self
699        }
700
701        /// Sends the request.
702        ///
703        /// # Long running operations
704        ///
705        /// This starts, but does not poll, a longrunning operation. More information
706        /// on [delete_instance][crate::client::CloudMemcache::delete_instance].
707        pub async fn send(self) -> Result<longrunning::model::Operation> {
708            (*self.0.stub)
709                .delete_instance(self.0.request, self.0.options)
710                .await
711                .map(gax::response::Response::into_body)
712        }
713
714        /// Creates a [Poller][lro::Poller] to work with `delete_instance`.
715        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
716            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
717            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
718            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
719
720            let stub = self.0.stub.clone();
721            let mut options = self.0.options.clone();
722            options.set_retry_policy(gax::retry_policy::NeverRetry);
723            let query = move |name| {
724                let stub = stub.clone();
725                let options = options.clone();
726                async {
727                    let op = GetOperation::new(stub)
728                        .set_name(name)
729                        .with_options(options)
730                        .send()
731                        .await?;
732                    Ok(Operation::new(op))
733                }
734            };
735
736            let start = move || async {
737                let op = self.send().await?;
738                Ok(Operation::new(op))
739            };
740
741            lro::internal::new_unit_response_poller(
742                polling_error_policy,
743                polling_backoff_policy,
744                start,
745                query,
746            )
747        }
748
749        /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
750        ///
751        /// This is a **required** field for requests.
752        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
753            self.0.request.name = v.into();
754            self
755        }
756    }
757
758    #[doc(hidden)]
759    impl gax::options::internal::RequestBuilder for DeleteInstance {
760        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
761            &mut self.0.options
762        }
763    }
764
765    /// The request builder for [CloudMemcache::apply_parameters][crate::client::CloudMemcache::apply_parameters] calls.
766    ///
767    /// # Example
768    /// ```
769    /// # use google_cloud_memcache_v1::builder::cloud_memcache::ApplyParameters;
770    /// # async fn sample() -> gax::Result<()> {
771    /// use lro::Poller;
772    ///
773    /// let builder = prepare_request_builder();
774    /// let response = builder.poller().until_done().await?;
775    /// # Ok(()) }
776    ///
777    /// fn prepare_request_builder() -> ApplyParameters {
778    ///   # panic!();
779    ///   // ... details omitted ...
780    /// }
781    /// ```
782    #[derive(Clone, Debug)]
783    pub struct ApplyParameters(RequestBuilder<crate::model::ApplyParametersRequest>);
784
785    impl ApplyParameters {
786        pub(crate) fn new(
787            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
788        ) -> Self {
789            Self(RequestBuilder::new(stub))
790        }
791
792        /// Sets the full request, replacing any prior values.
793        pub fn with_request<V: Into<crate::model::ApplyParametersRequest>>(mut self, v: V) -> Self {
794            self.0.request = v.into();
795            self
796        }
797
798        /// Sets all the options, replacing any prior values.
799        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
800            self.0.options = v.into();
801            self
802        }
803
804        /// Sends the request.
805        ///
806        /// # Long running operations
807        ///
808        /// This starts, but does not poll, a longrunning operation. More information
809        /// on [apply_parameters][crate::client::CloudMemcache::apply_parameters].
810        pub async fn send(self) -> Result<longrunning::model::Operation> {
811            (*self.0.stub)
812                .apply_parameters(self.0.request, self.0.options)
813                .await
814                .map(gax::response::Response::into_body)
815        }
816
817        /// Creates a [Poller][lro::Poller] to work with `apply_parameters`.
818        pub fn poller(
819            self,
820        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
821            type Operation =
822                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
823            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
824            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
825
826            let stub = self.0.stub.clone();
827            let mut options = self.0.options.clone();
828            options.set_retry_policy(gax::retry_policy::NeverRetry);
829            let query = move |name| {
830                let stub = stub.clone();
831                let options = options.clone();
832                async {
833                    let op = GetOperation::new(stub)
834                        .set_name(name)
835                        .with_options(options)
836                        .send()
837                        .await?;
838                    Ok(Operation::new(op))
839                }
840            };
841
842            let start = move || async {
843                let op = self.send().await?;
844                Ok(Operation::new(op))
845            };
846
847            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
848        }
849
850        /// Sets the value of [name][crate::model::ApplyParametersRequest::name].
851        ///
852        /// This is a **required** field for requests.
853        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
854            self.0.request.name = v.into();
855            self
856        }
857
858        /// Sets the value of [node_ids][crate::model::ApplyParametersRequest::node_ids].
859        pub fn set_node_ids<T, V>(mut self, v: T) -> Self
860        where
861            T: std::iter::IntoIterator<Item = V>,
862            V: std::convert::Into<std::string::String>,
863        {
864            use std::iter::Iterator;
865            self.0.request.node_ids = v.into_iter().map(|i| i.into()).collect();
866            self
867        }
868
869        /// Sets the value of [apply_all][crate::model::ApplyParametersRequest::apply_all].
870        pub fn set_apply_all<T: Into<bool>>(mut self, v: T) -> Self {
871            self.0.request.apply_all = v.into();
872            self
873        }
874    }
875
876    #[doc(hidden)]
877    impl gax::options::internal::RequestBuilder for ApplyParameters {
878        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
879            &mut self.0.options
880        }
881    }
882
883    /// The request builder for [CloudMemcache::reschedule_maintenance][crate::client::CloudMemcache::reschedule_maintenance] calls.
884    ///
885    /// # Example
886    /// ```
887    /// # use google_cloud_memcache_v1::builder::cloud_memcache::RescheduleMaintenance;
888    /// # async fn sample() -> gax::Result<()> {
889    /// use lro::Poller;
890    ///
891    /// let builder = prepare_request_builder();
892    /// let response = builder.poller().until_done().await?;
893    /// # Ok(()) }
894    ///
895    /// fn prepare_request_builder() -> RescheduleMaintenance {
896    ///   # panic!();
897    ///   // ... details omitted ...
898    /// }
899    /// ```
900    #[derive(Clone, Debug)]
901    pub struct RescheduleMaintenance(RequestBuilder<crate::model::RescheduleMaintenanceRequest>);
902
903    impl RescheduleMaintenance {
904        pub(crate) fn new(
905            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
906        ) -> Self {
907            Self(RequestBuilder::new(stub))
908        }
909
910        /// Sets the full request, replacing any prior values.
911        pub fn with_request<V: Into<crate::model::RescheduleMaintenanceRequest>>(
912            mut self,
913            v: V,
914        ) -> Self {
915            self.0.request = v.into();
916            self
917        }
918
919        /// Sets all the options, replacing any prior values.
920        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
921            self.0.options = v.into();
922            self
923        }
924
925        /// Sends the request.
926        ///
927        /// # Long running operations
928        ///
929        /// This starts, but does not poll, a longrunning operation. More information
930        /// on [reschedule_maintenance][crate::client::CloudMemcache::reschedule_maintenance].
931        pub async fn send(self) -> Result<longrunning::model::Operation> {
932            (*self.0.stub)
933                .reschedule_maintenance(self.0.request, self.0.options)
934                .await
935                .map(gax::response::Response::into_body)
936        }
937
938        /// Creates a [Poller][lro::Poller] to work with `reschedule_maintenance`.
939        pub fn poller(
940            self,
941        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
942            type Operation =
943                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
944            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
945            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
946
947            let stub = self.0.stub.clone();
948            let mut options = self.0.options.clone();
949            options.set_retry_policy(gax::retry_policy::NeverRetry);
950            let query = move |name| {
951                let stub = stub.clone();
952                let options = options.clone();
953                async {
954                    let op = GetOperation::new(stub)
955                        .set_name(name)
956                        .with_options(options)
957                        .send()
958                        .await?;
959                    Ok(Operation::new(op))
960                }
961            };
962
963            let start = move || async {
964                let op = self.send().await?;
965                Ok(Operation::new(op))
966            };
967
968            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
969        }
970
971        /// Sets the value of [instance][crate::model::RescheduleMaintenanceRequest::instance].
972        ///
973        /// This is a **required** field for requests.
974        pub fn set_instance<T: Into<std::string::String>>(mut self, v: T) -> Self {
975            self.0.request.instance = v.into();
976            self
977        }
978
979        /// Sets the value of [reschedule_type][crate::model::RescheduleMaintenanceRequest::reschedule_type].
980        ///
981        /// This is a **required** field for requests.
982        pub fn set_reschedule_type<
983            T: Into<crate::model::reschedule_maintenance_request::RescheduleType>,
984        >(
985            mut self,
986            v: T,
987        ) -> Self {
988            self.0.request.reschedule_type = v.into();
989            self
990        }
991
992        /// Sets the value of [schedule_time][crate::model::RescheduleMaintenanceRequest::schedule_time].
993        pub fn set_schedule_time<T>(mut self, v: T) -> Self
994        where
995            T: std::convert::Into<wkt::Timestamp>,
996        {
997            self.0.request.schedule_time = std::option::Option::Some(v.into());
998            self
999        }
1000
1001        /// Sets or clears the value of [schedule_time][crate::model::RescheduleMaintenanceRequest::schedule_time].
1002        pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
1003        where
1004            T: std::convert::Into<wkt::Timestamp>,
1005        {
1006            self.0.request.schedule_time = v.map(|x| x.into());
1007            self
1008        }
1009    }
1010
1011    #[doc(hidden)]
1012    impl gax::options::internal::RequestBuilder for RescheduleMaintenance {
1013        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1014            &mut self.0.options
1015        }
1016    }
1017
1018    /// The request builder for [CloudMemcache::list_locations][crate::client::CloudMemcache::list_locations] calls.
1019    ///
1020    /// # Example
1021    /// ```
1022    /// # use google_cloud_memcache_v1::builder::cloud_memcache::ListLocations;
1023    /// # async fn sample() -> gax::Result<()> {
1024    /// use gax::paginator::ItemPaginator;
1025    ///
1026    /// let builder = prepare_request_builder();
1027    /// let mut items = builder.by_item();
1028    /// while let Some(result) = items.next().await {
1029    ///   let item = result?;
1030    /// }
1031    /// # Ok(()) }
1032    ///
1033    /// fn prepare_request_builder() -> ListLocations {
1034    ///   # panic!();
1035    ///   // ... details omitted ...
1036    /// }
1037    /// ```
1038    #[derive(Clone, Debug)]
1039    pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
1040
1041    impl ListLocations {
1042        pub(crate) fn new(
1043            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1044        ) -> Self {
1045            Self(RequestBuilder::new(stub))
1046        }
1047
1048        /// Sets the full request, replacing any prior values.
1049        pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
1050            mut self,
1051            v: V,
1052        ) -> Self {
1053            self.0.request = v.into();
1054            self
1055        }
1056
1057        /// Sets all the options, replacing any prior values.
1058        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1059            self.0.options = v.into();
1060            self
1061        }
1062
1063        /// Sends the request.
1064        pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
1065            (*self.0.stub)
1066                .list_locations(self.0.request, self.0.options)
1067                .await
1068                .map(gax::response::Response::into_body)
1069        }
1070
1071        /// Streams each page in the collection.
1072        pub fn by_page(
1073            self,
1074        ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
1075        {
1076            use std::clone::Clone;
1077            let token = self.0.request.page_token.clone();
1078            let execute = move |token: String| {
1079                let mut builder = self.clone();
1080                builder.0.request = builder.0.request.set_page_token(token);
1081                builder.send()
1082            };
1083            gax::paginator::internal::new_paginator(token, execute)
1084        }
1085
1086        /// Streams each item in the collection.
1087        pub fn by_item(
1088            self,
1089        ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
1090        {
1091            use gax::paginator::Paginator;
1092            self.by_page().items()
1093        }
1094
1095        /// Sets the value of [name][location::model::ListLocationsRequest::name].
1096        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1097            self.0.request.name = v.into();
1098            self
1099        }
1100
1101        /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
1102        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1103            self.0.request.filter = v.into();
1104            self
1105        }
1106
1107        /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
1108        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1109            self.0.request.page_size = v.into();
1110            self
1111        }
1112
1113        /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
1114        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1115            self.0.request.page_token = v.into();
1116            self
1117        }
1118    }
1119
1120    #[doc(hidden)]
1121    impl gax::options::internal::RequestBuilder for ListLocations {
1122        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1123            &mut self.0.options
1124        }
1125    }
1126
1127    /// The request builder for [CloudMemcache::get_location][crate::client::CloudMemcache::get_location] calls.
1128    ///
1129    /// # Example
1130    /// ```
1131    /// # use google_cloud_memcache_v1::builder::cloud_memcache::GetLocation;
1132    /// # async fn sample() -> gax::Result<()> {
1133    ///
1134    /// let builder = prepare_request_builder();
1135    /// let response = builder.send().await?;
1136    /// # Ok(()) }
1137    ///
1138    /// fn prepare_request_builder() -> GetLocation {
1139    ///   # panic!();
1140    ///   // ... details omitted ...
1141    /// }
1142    /// ```
1143    #[derive(Clone, Debug)]
1144    pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1145
1146    impl GetLocation {
1147        pub(crate) fn new(
1148            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1149        ) -> Self {
1150            Self(RequestBuilder::new(stub))
1151        }
1152
1153        /// Sets the full request, replacing any prior values.
1154        pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1155            self.0.request = v.into();
1156            self
1157        }
1158
1159        /// Sets all the options, replacing any prior values.
1160        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1161            self.0.options = v.into();
1162            self
1163        }
1164
1165        /// Sends the request.
1166        pub async fn send(self) -> Result<location::model::Location> {
1167            (*self.0.stub)
1168                .get_location(self.0.request, self.0.options)
1169                .await
1170                .map(gax::response::Response::into_body)
1171        }
1172
1173        /// Sets the value of [name][location::model::GetLocationRequest::name].
1174        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1175            self.0.request.name = v.into();
1176            self
1177        }
1178    }
1179
1180    #[doc(hidden)]
1181    impl gax::options::internal::RequestBuilder for GetLocation {
1182        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1183            &mut self.0.options
1184        }
1185    }
1186
1187    /// The request builder for [CloudMemcache::list_operations][crate::client::CloudMemcache::list_operations] calls.
1188    ///
1189    /// # Example
1190    /// ```
1191    /// # use google_cloud_memcache_v1::builder::cloud_memcache::ListOperations;
1192    /// # async fn sample() -> gax::Result<()> {
1193    /// use gax::paginator::ItemPaginator;
1194    ///
1195    /// let builder = prepare_request_builder();
1196    /// let mut items = builder.by_item();
1197    /// while let Some(result) = items.next().await {
1198    ///   let item = result?;
1199    /// }
1200    /// # Ok(()) }
1201    ///
1202    /// fn prepare_request_builder() -> ListOperations {
1203    ///   # panic!();
1204    ///   // ... details omitted ...
1205    /// }
1206    /// ```
1207    #[derive(Clone, Debug)]
1208    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1209
1210    impl ListOperations {
1211        pub(crate) fn new(
1212            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1213        ) -> Self {
1214            Self(RequestBuilder::new(stub))
1215        }
1216
1217        /// Sets the full request, replacing any prior values.
1218        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1219            mut self,
1220            v: V,
1221        ) -> Self {
1222            self.0.request = v.into();
1223            self
1224        }
1225
1226        /// Sets all the options, replacing any prior values.
1227        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1228            self.0.options = v.into();
1229            self
1230        }
1231
1232        /// Sends the request.
1233        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1234            (*self.0.stub)
1235                .list_operations(self.0.request, self.0.options)
1236                .await
1237                .map(gax::response::Response::into_body)
1238        }
1239
1240        /// Streams each page in the collection.
1241        pub fn by_page(
1242            self,
1243        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1244        {
1245            use std::clone::Clone;
1246            let token = self.0.request.page_token.clone();
1247            let execute = move |token: String| {
1248                let mut builder = self.clone();
1249                builder.0.request = builder.0.request.set_page_token(token);
1250                builder.send()
1251            };
1252            gax::paginator::internal::new_paginator(token, execute)
1253        }
1254
1255        /// Streams each item in the collection.
1256        pub fn by_item(
1257            self,
1258        ) -> impl gax::paginator::ItemPaginator<
1259            longrunning::model::ListOperationsResponse,
1260            gax::error::Error,
1261        > {
1262            use gax::paginator::Paginator;
1263            self.by_page().items()
1264        }
1265
1266        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
1267        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1268            self.0.request.name = v.into();
1269            self
1270        }
1271
1272        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
1273        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1274            self.0.request.filter = v.into();
1275            self
1276        }
1277
1278        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
1279        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1280            self.0.request.page_size = v.into();
1281            self
1282        }
1283
1284        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
1285        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1286            self.0.request.page_token = v.into();
1287            self
1288        }
1289
1290        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
1291        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1292            self.0.request.return_partial_success = v.into();
1293            self
1294        }
1295    }
1296
1297    #[doc(hidden)]
1298    impl gax::options::internal::RequestBuilder for ListOperations {
1299        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1300            &mut self.0.options
1301        }
1302    }
1303
1304    /// The request builder for [CloudMemcache::get_operation][crate::client::CloudMemcache::get_operation] calls.
1305    ///
1306    /// # Example
1307    /// ```
1308    /// # use google_cloud_memcache_v1::builder::cloud_memcache::GetOperation;
1309    /// # async fn sample() -> gax::Result<()> {
1310    ///
1311    /// let builder = prepare_request_builder();
1312    /// let response = builder.send().await?;
1313    /// # Ok(()) }
1314    ///
1315    /// fn prepare_request_builder() -> GetOperation {
1316    ///   # panic!();
1317    ///   // ... details omitted ...
1318    /// }
1319    /// ```
1320    #[derive(Clone, Debug)]
1321    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1322
1323    impl GetOperation {
1324        pub(crate) fn new(
1325            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1326        ) -> Self {
1327            Self(RequestBuilder::new(stub))
1328        }
1329
1330        /// Sets the full request, replacing any prior values.
1331        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1332            mut self,
1333            v: V,
1334        ) -> Self {
1335            self.0.request = v.into();
1336            self
1337        }
1338
1339        /// Sets all the options, replacing any prior values.
1340        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1341            self.0.options = v.into();
1342            self
1343        }
1344
1345        /// Sends the request.
1346        pub async fn send(self) -> Result<longrunning::model::Operation> {
1347            (*self.0.stub)
1348                .get_operation(self.0.request, self.0.options)
1349                .await
1350                .map(gax::response::Response::into_body)
1351        }
1352
1353        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
1354        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1355            self.0.request.name = v.into();
1356            self
1357        }
1358    }
1359
1360    #[doc(hidden)]
1361    impl gax::options::internal::RequestBuilder for GetOperation {
1362        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1363            &mut self.0.options
1364        }
1365    }
1366
1367    /// The request builder for [CloudMemcache::delete_operation][crate::client::CloudMemcache::delete_operation] calls.
1368    ///
1369    /// # Example
1370    /// ```
1371    /// # use google_cloud_memcache_v1::builder::cloud_memcache::DeleteOperation;
1372    /// # async fn sample() -> gax::Result<()> {
1373    ///
1374    /// let builder = prepare_request_builder();
1375    /// let response = builder.send().await?;
1376    /// # Ok(()) }
1377    ///
1378    /// fn prepare_request_builder() -> DeleteOperation {
1379    ///   # panic!();
1380    ///   // ... details omitted ...
1381    /// }
1382    /// ```
1383    #[derive(Clone, Debug)]
1384    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1385
1386    impl DeleteOperation {
1387        pub(crate) fn new(
1388            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1389        ) -> Self {
1390            Self(RequestBuilder::new(stub))
1391        }
1392
1393        /// Sets the full request, replacing any prior values.
1394        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1395            mut self,
1396            v: V,
1397        ) -> Self {
1398            self.0.request = v.into();
1399            self
1400        }
1401
1402        /// Sets all the options, replacing any prior values.
1403        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1404            self.0.options = v.into();
1405            self
1406        }
1407
1408        /// Sends the request.
1409        pub async fn send(self) -> Result<()> {
1410            (*self.0.stub)
1411                .delete_operation(self.0.request, self.0.options)
1412                .await
1413                .map(gax::response::Response::into_body)
1414        }
1415
1416        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
1417        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1418            self.0.request.name = v.into();
1419            self
1420        }
1421    }
1422
1423    #[doc(hidden)]
1424    impl gax::options::internal::RequestBuilder for DeleteOperation {
1425        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1426            &mut self.0.options
1427        }
1428    }
1429
1430    /// The request builder for [CloudMemcache::cancel_operation][crate::client::CloudMemcache::cancel_operation] calls.
1431    ///
1432    /// # Example
1433    /// ```
1434    /// # use google_cloud_memcache_v1::builder::cloud_memcache::CancelOperation;
1435    /// # async fn sample() -> gax::Result<()> {
1436    ///
1437    /// let builder = prepare_request_builder();
1438    /// let response = builder.send().await?;
1439    /// # Ok(()) }
1440    ///
1441    /// fn prepare_request_builder() -> CancelOperation {
1442    ///   # panic!();
1443    ///   // ... details omitted ...
1444    /// }
1445    /// ```
1446    #[derive(Clone, Debug)]
1447    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1448
1449    impl CancelOperation {
1450        pub(crate) fn new(
1451            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudMemcache>,
1452        ) -> Self {
1453            Self(RequestBuilder::new(stub))
1454        }
1455
1456        /// Sets the full request, replacing any prior values.
1457        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1458            mut self,
1459            v: V,
1460        ) -> Self {
1461            self.0.request = v.into();
1462            self
1463        }
1464
1465        /// Sets all the options, replacing any prior values.
1466        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1467            self.0.options = v.into();
1468            self
1469        }
1470
1471        /// Sends the request.
1472        pub async fn send(self) -> Result<()> {
1473            (*self.0.stub)
1474                .cancel_operation(self.0.request, self.0.options)
1475                .await
1476                .map(gax::response::Response::into_body)
1477        }
1478
1479        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
1480        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1481            self.0.request.name = v.into();
1482            self
1483        }
1484    }
1485
1486    #[doc(hidden)]
1487    impl gax::options::internal::RequestBuilder for CancelOperation {
1488        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1489            &mut self.0.options
1490        }
1491    }
1492}