google_cloud_memorystore_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 memorystore {
18    use crate::Result;
19
20    /// A builder for [Memorystore][crate::client::Memorystore].
21    ///
22    /// ```
23    /// # tokio_test::block_on(async {
24    /// # use google_cloud_memorystore_v1::*;
25    /// # use builder::memorystore::ClientBuilder;
26    /// # use client::Memorystore;
27    /// let builder : ClientBuilder = Memorystore::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://memorystore.googleapis.com")
30    ///     .build().await?;
31    /// # gax::client_builder::Result::<()>::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::Memorystore;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = Memorystore;
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::Memorystore] 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::Memorystore>,
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::Memorystore>,
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 [Memorystore::list_instances][crate::client::Memorystore::list_instances] calls.
75    ///
76    /// # Example
77    /// ```no_run
78    /// # use google_cloud_memorystore_v1::builder;
79    /// use builder::memorystore::ListInstances;
80    /// # tokio_test::block_on(async {
81    /// use gax::paginator::ItemPaginator;
82    ///
83    /// let builder = prepare_request_builder();
84    /// let mut items = builder.by_item();
85    /// while let Some(result) = items.next().await {
86    ///   let item = result?;
87    /// }
88    /// # gax::Result::<()>::Ok(()) });
89    ///
90    /// fn prepare_request_builder() -> ListInstances {
91    ///   # panic!();
92    ///   // ... details omitted ...
93    /// }
94    /// ```
95    #[derive(Clone, Debug)]
96    pub struct ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
97
98    impl ListInstances {
99        pub(crate) fn new(
100            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
101        ) -> Self {
102            Self(RequestBuilder::new(stub))
103        }
104
105        /// Sets the full request, replacing any prior values.
106        pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
107            self.0.request = v.into();
108            self
109        }
110
111        /// Sets all the options, replacing any prior values.
112        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
113            self.0.options = v.into();
114            self
115        }
116
117        /// Sends the request.
118        pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
119            (*self.0.stub)
120                .list_instances(self.0.request, self.0.options)
121                .await
122                .map(gax::response::Response::into_body)
123        }
124
125        /// Streams each page in the collection.
126        pub fn by_page(
127            self,
128        ) -> impl gax::paginator::Paginator<crate::model::ListInstancesResponse, gax::error::Error>
129        {
130            use std::clone::Clone;
131            let token = self.0.request.page_token.clone();
132            let execute = move |token: String| {
133                let mut builder = self.clone();
134                builder.0.request = builder.0.request.set_page_token(token);
135                builder.send()
136            };
137            gax::paginator::internal::new_paginator(token, execute)
138        }
139
140        /// Streams each item in the collection.
141        pub fn by_item(
142            self,
143        ) -> impl gax::paginator::ItemPaginator<crate::model::ListInstancesResponse, gax::error::Error>
144        {
145            use gax::paginator::Paginator;
146            self.by_page().items()
147        }
148
149        /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
150        ///
151        /// This is a **required** field for requests.
152        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
153            self.0.request.parent = v.into();
154            self
155        }
156
157        /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
158        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
159            self.0.request.page_size = v.into();
160            self
161        }
162
163        /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
164        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
165            self.0.request.page_token = v.into();
166            self
167        }
168
169        /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
170        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
171            self.0.request.filter = v.into();
172            self
173        }
174
175        /// Sets the value of [order_by][crate::model::ListInstancesRequest::order_by].
176        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
177            self.0.request.order_by = v.into();
178            self
179        }
180    }
181
182    #[doc(hidden)]
183    impl gax::options::internal::RequestBuilder for ListInstances {
184        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
185            &mut self.0.options
186        }
187    }
188
189    /// The request builder for [Memorystore::get_instance][crate::client::Memorystore::get_instance] calls.
190    ///
191    /// # Example
192    /// ```no_run
193    /// # use google_cloud_memorystore_v1::builder;
194    /// use builder::memorystore::GetInstance;
195    /// # tokio_test::block_on(async {
196    ///
197    /// let builder = prepare_request_builder();
198    /// let response = builder.send().await?;
199    /// # gax::Result::<()>::Ok(()) });
200    ///
201    /// fn prepare_request_builder() -> GetInstance {
202    ///   # panic!();
203    ///   // ... details omitted ...
204    /// }
205    /// ```
206    #[derive(Clone, Debug)]
207    pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
208
209    impl GetInstance {
210        pub(crate) fn new(
211            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
212        ) -> Self {
213            Self(RequestBuilder::new(stub))
214        }
215
216        /// Sets the full request, replacing any prior values.
217        pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
218            self.0.request = v.into();
219            self
220        }
221
222        /// Sets all the options, replacing any prior values.
223        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
224            self.0.options = v.into();
225            self
226        }
227
228        /// Sends the request.
229        pub async fn send(self) -> Result<crate::model::Instance> {
230            (*self.0.stub)
231                .get_instance(self.0.request, self.0.options)
232                .await
233                .map(gax::response::Response::into_body)
234        }
235
236        /// Sets the value of [name][crate::model::GetInstanceRequest::name].
237        ///
238        /// This is a **required** field for requests.
239        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
240            self.0.request.name = v.into();
241            self
242        }
243    }
244
245    #[doc(hidden)]
246    impl gax::options::internal::RequestBuilder for GetInstance {
247        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
248            &mut self.0.options
249        }
250    }
251
252    /// The request builder for [Memorystore::create_instance][crate::client::Memorystore::create_instance] calls.
253    ///
254    /// # Example
255    /// ```no_run
256    /// # use google_cloud_memorystore_v1::builder;
257    /// use builder::memorystore::CreateInstance;
258    /// # tokio_test::block_on(async {
259    /// use lro::Poller;
260    ///
261    /// let builder = prepare_request_builder();
262    /// let response = builder.poller().until_done().await?;
263    /// # gax::Result::<()>::Ok(()) });
264    ///
265    /// fn prepare_request_builder() -> CreateInstance {
266    ///   # panic!();
267    ///   // ... details omitted ...
268    /// }
269    /// ```
270    #[derive(Clone, Debug)]
271    pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
272
273    impl CreateInstance {
274        pub(crate) fn new(
275            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
276        ) -> Self {
277            Self(RequestBuilder::new(stub))
278        }
279
280        /// Sets the full request, replacing any prior values.
281        pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
282            self.0.request = v.into();
283            self
284        }
285
286        /// Sets all the options, replacing any prior values.
287        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
288            self.0.options = v.into();
289            self
290        }
291
292        /// Sends the request.
293        ///
294        /// # Long running operations
295        ///
296        /// This starts, but does not poll, a longrunning operation. More information
297        /// on [create_instance][crate::client::Memorystore::create_instance].
298        pub async fn send(self) -> Result<longrunning::model::Operation> {
299            (*self.0.stub)
300                .create_instance(self.0.request, self.0.options)
301                .await
302                .map(gax::response::Response::into_body)
303        }
304
305        /// Creates a [Poller][lro::Poller] to work with `create_instance`.
306        pub fn poller(
307            self,
308        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
309            type Operation =
310                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
311            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
312            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
313
314            let stub = self.0.stub.clone();
315            let mut options = self.0.options.clone();
316            options.set_retry_policy(gax::retry_policy::NeverRetry);
317            let query = move |name| {
318                let stub = stub.clone();
319                let options = options.clone();
320                async {
321                    let op = GetOperation::new(stub)
322                        .set_name(name)
323                        .with_options(options)
324                        .send()
325                        .await?;
326                    Ok(Operation::new(op))
327                }
328            };
329
330            let start = move || async {
331                let op = self.send().await?;
332                Ok(Operation::new(op))
333            };
334
335            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
336        }
337
338        /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
339        ///
340        /// This is a **required** field for requests.
341        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
342            self.0.request.parent = v.into();
343            self
344        }
345
346        /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
347        ///
348        /// This is a **required** field for requests.
349        pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
350            self.0.request.instance_id = v.into();
351            self
352        }
353
354        /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
355        ///
356        /// This is a **required** field for requests.
357        pub fn set_instance<T>(mut self, v: T) -> Self
358        where
359            T: std::convert::Into<crate::model::Instance>,
360        {
361            self.0.request.instance = std::option::Option::Some(v.into());
362            self
363        }
364
365        /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
366        ///
367        /// This is a **required** field for requests.
368        pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
369        where
370            T: std::convert::Into<crate::model::Instance>,
371        {
372            self.0.request.instance = v.map(|x| x.into());
373            self
374        }
375
376        /// Sets the value of [request_id][crate::model::CreateInstanceRequest::request_id].
377        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
378            self.0.request.request_id = v.into();
379            self
380        }
381    }
382
383    #[doc(hidden)]
384    impl gax::options::internal::RequestBuilder for CreateInstance {
385        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
386            &mut self.0.options
387        }
388    }
389
390    /// The request builder for [Memorystore::update_instance][crate::client::Memorystore::update_instance] calls.
391    ///
392    /// # Example
393    /// ```no_run
394    /// # use google_cloud_memorystore_v1::builder;
395    /// use builder::memorystore::UpdateInstance;
396    /// # tokio_test::block_on(async {
397    /// use lro::Poller;
398    ///
399    /// let builder = prepare_request_builder();
400    /// let response = builder.poller().until_done().await?;
401    /// # gax::Result::<()>::Ok(()) });
402    ///
403    /// fn prepare_request_builder() -> UpdateInstance {
404    ///   # panic!();
405    ///   // ... details omitted ...
406    /// }
407    /// ```
408    #[derive(Clone, Debug)]
409    pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
410
411    impl UpdateInstance {
412        pub(crate) fn new(
413            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
414        ) -> Self {
415            Self(RequestBuilder::new(stub))
416        }
417
418        /// Sets the full request, replacing any prior values.
419        pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
420            self.0.request = v.into();
421            self
422        }
423
424        /// Sets all the options, replacing any prior values.
425        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
426            self.0.options = v.into();
427            self
428        }
429
430        /// Sends the request.
431        ///
432        /// # Long running operations
433        ///
434        /// This starts, but does not poll, a longrunning operation. More information
435        /// on [update_instance][crate::client::Memorystore::update_instance].
436        pub async fn send(self) -> Result<longrunning::model::Operation> {
437            (*self.0.stub)
438                .update_instance(self.0.request, self.0.options)
439                .await
440                .map(gax::response::Response::into_body)
441        }
442
443        /// Creates a [Poller][lro::Poller] to work with `update_instance`.
444        pub fn poller(
445            self,
446        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
447            type Operation =
448                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
449            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
450            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
451
452            let stub = self.0.stub.clone();
453            let mut options = self.0.options.clone();
454            options.set_retry_policy(gax::retry_policy::NeverRetry);
455            let query = move |name| {
456                let stub = stub.clone();
457                let options = options.clone();
458                async {
459                    let op = GetOperation::new(stub)
460                        .set_name(name)
461                        .with_options(options)
462                        .send()
463                        .await?;
464                    Ok(Operation::new(op))
465                }
466            };
467
468            let start = move || async {
469                let op = self.send().await?;
470                Ok(Operation::new(op))
471            };
472
473            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
474        }
475
476        /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
477        pub fn set_update_mask<T>(mut self, v: T) -> Self
478        where
479            T: std::convert::Into<wkt::FieldMask>,
480        {
481            self.0.request.update_mask = std::option::Option::Some(v.into());
482            self
483        }
484
485        /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
486        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
487        where
488            T: std::convert::Into<wkt::FieldMask>,
489        {
490            self.0.request.update_mask = v.map(|x| x.into());
491            self
492        }
493
494        /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
495        ///
496        /// This is a **required** field for requests.
497        pub fn set_instance<T>(mut self, v: T) -> Self
498        where
499            T: std::convert::Into<crate::model::Instance>,
500        {
501            self.0.request.instance = std::option::Option::Some(v.into());
502            self
503        }
504
505        /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
506        ///
507        /// This is a **required** field for requests.
508        pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
509        where
510            T: std::convert::Into<crate::model::Instance>,
511        {
512            self.0.request.instance = v.map(|x| x.into());
513            self
514        }
515
516        /// Sets the value of [request_id][crate::model::UpdateInstanceRequest::request_id].
517        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
518            self.0.request.request_id = v.into();
519            self
520        }
521    }
522
523    #[doc(hidden)]
524    impl gax::options::internal::RequestBuilder for UpdateInstance {
525        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
526            &mut self.0.options
527        }
528    }
529
530    /// The request builder for [Memorystore::delete_instance][crate::client::Memorystore::delete_instance] calls.
531    ///
532    /// # Example
533    /// ```no_run
534    /// # use google_cloud_memorystore_v1::builder;
535    /// use builder::memorystore::DeleteInstance;
536    /// # tokio_test::block_on(async {
537    /// use lro::Poller;
538    ///
539    /// let builder = prepare_request_builder();
540    /// let response = builder.poller().until_done().await?;
541    /// # gax::Result::<()>::Ok(()) });
542    ///
543    /// fn prepare_request_builder() -> DeleteInstance {
544    ///   # panic!();
545    ///   // ... details omitted ...
546    /// }
547    /// ```
548    #[derive(Clone, Debug)]
549    pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
550
551    impl DeleteInstance {
552        pub(crate) fn new(
553            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
554        ) -> Self {
555            Self(RequestBuilder::new(stub))
556        }
557
558        /// Sets the full request, replacing any prior values.
559        pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
560            self.0.request = v.into();
561            self
562        }
563
564        /// Sets all the options, replacing any prior values.
565        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
566            self.0.options = v.into();
567            self
568        }
569
570        /// Sends the request.
571        ///
572        /// # Long running operations
573        ///
574        /// This starts, but does not poll, a longrunning operation. More information
575        /// on [delete_instance][crate::client::Memorystore::delete_instance].
576        pub async fn send(self) -> Result<longrunning::model::Operation> {
577            (*self.0.stub)
578                .delete_instance(self.0.request, self.0.options)
579                .await
580                .map(gax::response::Response::into_body)
581        }
582
583        /// Creates a [Poller][lro::Poller] to work with `delete_instance`.
584        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
585            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
586            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
587            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
588
589            let stub = self.0.stub.clone();
590            let mut options = self.0.options.clone();
591            options.set_retry_policy(gax::retry_policy::NeverRetry);
592            let query = move |name| {
593                let stub = stub.clone();
594                let options = options.clone();
595                async {
596                    let op = GetOperation::new(stub)
597                        .set_name(name)
598                        .with_options(options)
599                        .send()
600                        .await?;
601                    Ok(Operation::new(op))
602                }
603            };
604
605            let start = move || async {
606                let op = self.send().await?;
607                Ok(Operation::new(op))
608            };
609
610            lro::internal::new_unit_response_poller(
611                polling_error_policy,
612                polling_backoff_policy,
613                start,
614                query,
615            )
616        }
617
618        /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
619        ///
620        /// This is a **required** field for requests.
621        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
622            self.0.request.name = v.into();
623            self
624        }
625
626        /// Sets the value of [request_id][crate::model::DeleteInstanceRequest::request_id].
627        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
628            self.0.request.request_id = v.into();
629            self
630        }
631    }
632
633    #[doc(hidden)]
634    impl gax::options::internal::RequestBuilder for DeleteInstance {
635        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
636            &mut self.0.options
637        }
638    }
639
640    /// The request builder for [Memorystore::get_certificate_authority][crate::client::Memorystore::get_certificate_authority] calls.
641    ///
642    /// # Example
643    /// ```no_run
644    /// # use google_cloud_memorystore_v1::builder;
645    /// use builder::memorystore::GetCertificateAuthority;
646    /// # tokio_test::block_on(async {
647    ///
648    /// let builder = prepare_request_builder();
649    /// let response = builder.send().await?;
650    /// # gax::Result::<()>::Ok(()) });
651    ///
652    /// fn prepare_request_builder() -> GetCertificateAuthority {
653    ///   # panic!();
654    ///   // ... details omitted ...
655    /// }
656    /// ```
657    #[derive(Clone, Debug)]
658    pub struct GetCertificateAuthority(
659        RequestBuilder<crate::model::GetCertificateAuthorityRequest>,
660    );
661
662    impl GetCertificateAuthority {
663        pub(crate) fn new(
664            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
665        ) -> Self {
666            Self(RequestBuilder::new(stub))
667        }
668
669        /// Sets the full request, replacing any prior values.
670        pub fn with_request<V: Into<crate::model::GetCertificateAuthorityRequest>>(
671            mut self,
672            v: V,
673        ) -> Self {
674            self.0.request = v.into();
675            self
676        }
677
678        /// Sets all the options, replacing any prior values.
679        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
680            self.0.options = v.into();
681            self
682        }
683
684        /// Sends the request.
685        pub async fn send(self) -> Result<crate::model::CertificateAuthority> {
686            (*self.0.stub)
687                .get_certificate_authority(self.0.request, self.0.options)
688                .await
689                .map(gax::response::Response::into_body)
690        }
691
692        /// Sets the value of [name][crate::model::GetCertificateAuthorityRequest::name].
693        ///
694        /// This is a **required** field for requests.
695        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
696            self.0.request.name = v.into();
697            self
698        }
699    }
700
701    #[doc(hidden)]
702    impl gax::options::internal::RequestBuilder for GetCertificateAuthority {
703        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
704            &mut self.0.options
705        }
706    }
707
708    /// The request builder for [Memorystore::reschedule_maintenance][crate::client::Memorystore::reschedule_maintenance] calls.
709    ///
710    /// # Example
711    /// ```no_run
712    /// # use google_cloud_memorystore_v1::builder;
713    /// use builder::memorystore::RescheduleMaintenance;
714    /// # tokio_test::block_on(async {
715    /// use lro::Poller;
716    ///
717    /// let builder = prepare_request_builder();
718    /// let response = builder.poller().until_done().await?;
719    /// # gax::Result::<()>::Ok(()) });
720    ///
721    /// fn prepare_request_builder() -> RescheduleMaintenance {
722    ///   # panic!();
723    ///   // ... details omitted ...
724    /// }
725    /// ```
726    #[derive(Clone, Debug)]
727    pub struct RescheduleMaintenance(RequestBuilder<crate::model::RescheduleMaintenanceRequest>);
728
729    impl RescheduleMaintenance {
730        pub(crate) fn new(
731            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
732        ) -> Self {
733            Self(RequestBuilder::new(stub))
734        }
735
736        /// Sets the full request, replacing any prior values.
737        pub fn with_request<V: Into<crate::model::RescheduleMaintenanceRequest>>(
738            mut self,
739            v: V,
740        ) -> Self {
741            self.0.request = v.into();
742            self
743        }
744
745        /// Sets all the options, replacing any prior values.
746        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
747            self.0.options = v.into();
748            self
749        }
750
751        /// Sends the request.
752        ///
753        /// # Long running operations
754        ///
755        /// This starts, but does not poll, a longrunning operation. More information
756        /// on [reschedule_maintenance][crate::client::Memorystore::reschedule_maintenance].
757        pub async fn send(self) -> Result<longrunning::model::Operation> {
758            (*self.0.stub)
759                .reschedule_maintenance(self.0.request, self.0.options)
760                .await
761                .map(gax::response::Response::into_body)
762        }
763
764        /// Creates a [Poller][lro::Poller] to work with `reschedule_maintenance`.
765        pub fn poller(
766            self,
767        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
768            type Operation =
769                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
770            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
771            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
772
773            let stub = self.0.stub.clone();
774            let mut options = self.0.options.clone();
775            options.set_retry_policy(gax::retry_policy::NeverRetry);
776            let query = move |name| {
777                let stub = stub.clone();
778                let options = options.clone();
779                async {
780                    let op = GetOperation::new(stub)
781                        .set_name(name)
782                        .with_options(options)
783                        .send()
784                        .await?;
785                    Ok(Operation::new(op))
786                }
787            };
788
789            let start = move || async {
790                let op = self.send().await?;
791                Ok(Operation::new(op))
792            };
793
794            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
795        }
796
797        /// Sets the value of [name][crate::model::RescheduleMaintenanceRequest::name].
798        ///
799        /// This is a **required** field for requests.
800        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
801            self.0.request.name = v.into();
802            self
803        }
804
805        /// Sets the value of [reschedule_type][crate::model::RescheduleMaintenanceRequest::reschedule_type].
806        ///
807        /// This is a **required** field for requests.
808        pub fn set_reschedule_type<
809            T: Into<crate::model::reschedule_maintenance_request::RescheduleType>,
810        >(
811            mut self,
812            v: T,
813        ) -> Self {
814            self.0.request.reschedule_type = v.into();
815            self
816        }
817
818        /// Sets the value of [schedule_time][crate::model::RescheduleMaintenanceRequest::schedule_time].
819        pub fn set_schedule_time<T>(mut self, v: T) -> Self
820        where
821            T: std::convert::Into<wkt::Timestamp>,
822        {
823            self.0.request.schedule_time = std::option::Option::Some(v.into());
824            self
825        }
826
827        /// Sets or clears the value of [schedule_time][crate::model::RescheduleMaintenanceRequest::schedule_time].
828        pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
829        where
830            T: std::convert::Into<wkt::Timestamp>,
831        {
832            self.0.request.schedule_time = v.map(|x| x.into());
833            self
834        }
835    }
836
837    #[doc(hidden)]
838    impl gax::options::internal::RequestBuilder for RescheduleMaintenance {
839        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
840            &mut self.0.options
841        }
842    }
843
844    /// The request builder for [Memorystore::list_backup_collections][crate::client::Memorystore::list_backup_collections] calls.
845    ///
846    /// # Example
847    /// ```no_run
848    /// # use google_cloud_memorystore_v1::builder;
849    /// use builder::memorystore::ListBackupCollections;
850    /// # tokio_test::block_on(async {
851    /// use gax::paginator::ItemPaginator;
852    ///
853    /// let builder = prepare_request_builder();
854    /// let mut items = builder.by_item();
855    /// while let Some(result) = items.next().await {
856    ///   let item = result?;
857    /// }
858    /// # gax::Result::<()>::Ok(()) });
859    ///
860    /// fn prepare_request_builder() -> ListBackupCollections {
861    ///   # panic!();
862    ///   // ... details omitted ...
863    /// }
864    /// ```
865    #[derive(Clone, Debug)]
866    pub struct ListBackupCollections(RequestBuilder<crate::model::ListBackupCollectionsRequest>);
867
868    impl ListBackupCollections {
869        pub(crate) fn new(
870            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
871        ) -> Self {
872            Self(RequestBuilder::new(stub))
873        }
874
875        /// Sets the full request, replacing any prior values.
876        pub fn with_request<V: Into<crate::model::ListBackupCollectionsRequest>>(
877            mut self,
878            v: V,
879        ) -> Self {
880            self.0.request = v.into();
881            self
882        }
883
884        /// Sets all the options, replacing any prior values.
885        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
886            self.0.options = v.into();
887            self
888        }
889
890        /// Sends the request.
891        pub async fn send(self) -> Result<crate::model::ListBackupCollectionsResponse> {
892            (*self.0.stub)
893                .list_backup_collections(self.0.request, self.0.options)
894                .await
895                .map(gax::response::Response::into_body)
896        }
897
898        /// Streams each page in the collection.
899        pub fn by_page(
900            self,
901        ) -> impl gax::paginator::Paginator<crate::model::ListBackupCollectionsResponse, gax::error::Error>
902        {
903            use std::clone::Clone;
904            let token = self.0.request.page_token.clone();
905            let execute = move |token: String| {
906                let mut builder = self.clone();
907                builder.0.request = builder.0.request.set_page_token(token);
908                builder.send()
909            };
910            gax::paginator::internal::new_paginator(token, execute)
911        }
912
913        /// Streams each item in the collection.
914        pub fn by_item(
915            self,
916        ) -> impl gax::paginator::ItemPaginator<
917            crate::model::ListBackupCollectionsResponse,
918            gax::error::Error,
919        > {
920            use gax::paginator::Paginator;
921            self.by_page().items()
922        }
923
924        /// Sets the value of [parent][crate::model::ListBackupCollectionsRequest::parent].
925        ///
926        /// This is a **required** field for requests.
927        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
928            self.0.request.parent = v.into();
929            self
930        }
931
932        /// Sets the value of [page_size][crate::model::ListBackupCollectionsRequest::page_size].
933        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
934            self.0.request.page_size = v.into();
935            self
936        }
937
938        /// Sets the value of [page_token][crate::model::ListBackupCollectionsRequest::page_token].
939        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
940            self.0.request.page_token = v.into();
941            self
942        }
943    }
944
945    #[doc(hidden)]
946    impl gax::options::internal::RequestBuilder for ListBackupCollections {
947        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
948            &mut self.0.options
949        }
950    }
951
952    /// The request builder for [Memorystore::get_backup_collection][crate::client::Memorystore::get_backup_collection] calls.
953    ///
954    /// # Example
955    /// ```no_run
956    /// # use google_cloud_memorystore_v1::builder;
957    /// use builder::memorystore::GetBackupCollection;
958    /// # tokio_test::block_on(async {
959    ///
960    /// let builder = prepare_request_builder();
961    /// let response = builder.send().await?;
962    /// # gax::Result::<()>::Ok(()) });
963    ///
964    /// fn prepare_request_builder() -> GetBackupCollection {
965    ///   # panic!();
966    ///   // ... details omitted ...
967    /// }
968    /// ```
969    #[derive(Clone, Debug)]
970    pub struct GetBackupCollection(RequestBuilder<crate::model::GetBackupCollectionRequest>);
971
972    impl GetBackupCollection {
973        pub(crate) fn new(
974            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
975        ) -> Self {
976            Self(RequestBuilder::new(stub))
977        }
978
979        /// Sets the full request, replacing any prior values.
980        pub fn with_request<V: Into<crate::model::GetBackupCollectionRequest>>(
981            mut self,
982            v: V,
983        ) -> Self {
984            self.0.request = v.into();
985            self
986        }
987
988        /// Sets all the options, replacing any prior values.
989        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
990            self.0.options = v.into();
991            self
992        }
993
994        /// Sends the request.
995        pub async fn send(self) -> Result<crate::model::BackupCollection> {
996            (*self.0.stub)
997                .get_backup_collection(self.0.request, self.0.options)
998                .await
999                .map(gax::response::Response::into_body)
1000        }
1001
1002        /// Sets the value of [name][crate::model::GetBackupCollectionRequest::name].
1003        ///
1004        /// This is a **required** field for requests.
1005        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1006            self.0.request.name = v.into();
1007            self
1008        }
1009    }
1010
1011    #[doc(hidden)]
1012    impl gax::options::internal::RequestBuilder for GetBackupCollection {
1013        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1014            &mut self.0.options
1015        }
1016    }
1017
1018    /// The request builder for [Memorystore::list_backups][crate::client::Memorystore::list_backups] calls.
1019    ///
1020    /// # Example
1021    /// ```no_run
1022    /// # use google_cloud_memorystore_v1::builder;
1023    /// use builder::memorystore::ListBackups;
1024    /// # tokio_test::block_on(async {
1025    /// use gax::paginator::ItemPaginator;
1026    ///
1027    /// let builder = prepare_request_builder();
1028    /// let mut items = builder.by_item();
1029    /// while let Some(result) = items.next().await {
1030    ///   let item = result?;
1031    /// }
1032    /// # gax::Result::<()>::Ok(()) });
1033    ///
1034    /// fn prepare_request_builder() -> ListBackups {
1035    ///   # panic!();
1036    ///   // ... details omitted ...
1037    /// }
1038    /// ```
1039    #[derive(Clone, Debug)]
1040    pub struct ListBackups(RequestBuilder<crate::model::ListBackupsRequest>);
1041
1042    impl ListBackups {
1043        pub(crate) fn new(
1044            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1045        ) -> Self {
1046            Self(RequestBuilder::new(stub))
1047        }
1048
1049        /// Sets the full request, replacing any prior values.
1050        pub fn with_request<V: Into<crate::model::ListBackupsRequest>>(mut self, v: V) -> Self {
1051            self.0.request = v.into();
1052            self
1053        }
1054
1055        /// Sets all the options, replacing any prior values.
1056        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1057            self.0.options = v.into();
1058            self
1059        }
1060
1061        /// Sends the request.
1062        pub async fn send(self) -> Result<crate::model::ListBackupsResponse> {
1063            (*self.0.stub)
1064                .list_backups(self.0.request, self.0.options)
1065                .await
1066                .map(gax::response::Response::into_body)
1067        }
1068
1069        /// Streams each page in the collection.
1070        pub fn by_page(
1071            self,
1072        ) -> impl gax::paginator::Paginator<crate::model::ListBackupsResponse, gax::error::Error>
1073        {
1074            use std::clone::Clone;
1075            let token = self.0.request.page_token.clone();
1076            let execute = move |token: String| {
1077                let mut builder = self.clone();
1078                builder.0.request = builder.0.request.set_page_token(token);
1079                builder.send()
1080            };
1081            gax::paginator::internal::new_paginator(token, execute)
1082        }
1083
1084        /// Streams each item in the collection.
1085        pub fn by_item(
1086            self,
1087        ) -> impl gax::paginator::ItemPaginator<crate::model::ListBackupsResponse, gax::error::Error>
1088        {
1089            use gax::paginator::Paginator;
1090            self.by_page().items()
1091        }
1092
1093        /// Sets the value of [parent][crate::model::ListBackupsRequest::parent].
1094        ///
1095        /// This is a **required** field for requests.
1096        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1097            self.0.request.parent = v.into();
1098            self
1099        }
1100
1101        /// Sets the value of [page_size][crate::model::ListBackupsRequest::page_size].
1102        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1103            self.0.request.page_size = v.into();
1104            self
1105        }
1106
1107        /// Sets the value of [page_token][crate::model::ListBackupsRequest::page_token].
1108        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1109            self.0.request.page_token = v.into();
1110            self
1111        }
1112    }
1113
1114    #[doc(hidden)]
1115    impl gax::options::internal::RequestBuilder for ListBackups {
1116        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1117            &mut self.0.options
1118        }
1119    }
1120
1121    /// The request builder for [Memorystore::get_backup][crate::client::Memorystore::get_backup] calls.
1122    ///
1123    /// # Example
1124    /// ```no_run
1125    /// # use google_cloud_memorystore_v1::builder;
1126    /// use builder::memorystore::GetBackup;
1127    /// # tokio_test::block_on(async {
1128    ///
1129    /// let builder = prepare_request_builder();
1130    /// let response = builder.send().await?;
1131    /// # gax::Result::<()>::Ok(()) });
1132    ///
1133    /// fn prepare_request_builder() -> GetBackup {
1134    ///   # panic!();
1135    ///   // ... details omitted ...
1136    /// }
1137    /// ```
1138    #[derive(Clone, Debug)]
1139    pub struct GetBackup(RequestBuilder<crate::model::GetBackupRequest>);
1140
1141    impl GetBackup {
1142        pub(crate) fn new(
1143            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1144        ) -> Self {
1145            Self(RequestBuilder::new(stub))
1146        }
1147
1148        /// Sets the full request, replacing any prior values.
1149        pub fn with_request<V: Into<crate::model::GetBackupRequest>>(mut self, v: V) -> Self {
1150            self.0.request = v.into();
1151            self
1152        }
1153
1154        /// Sets all the options, replacing any prior values.
1155        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1156            self.0.options = v.into();
1157            self
1158        }
1159
1160        /// Sends the request.
1161        pub async fn send(self) -> Result<crate::model::Backup> {
1162            (*self.0.stub)
1163                .get_backup(self.0.request, self.0.options)
1164                .await
1165                .map(gax::response::Response::into_body)
1166        }
1167
1168        /// Sets the value of [name][crate::model::GetBackupRequest::name].
1169        ///
1170        /// This is a **required** field for requests.
1171        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1172            self.0.request.name = v.into();
1173            self
1174        }
1175    }
1176
1177    #[doc(hidden)]
1178    impl gax::options::internal::RequestBuilder for GetBackup {
1179        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1180            &mut self.0.options
1181        }
1182    }
1183
1184    /// The request builder for [Memorystore::delete_backup][crate::client::Memorystore::delete_backup] calls.
1185    ///
1186    /// # Example
1187    /// ```no_run
1188    /// # use google_cloud_memorystore_v1::builder;
1189    /// use builder::memorystore::DeleteBackup;
1190    /// # tokio_test::block_on(async {
1191    /// use lro::Poller;
1192    ///
1193    /// let builder = prepare_request_builder();
1194    /// let response = builder.poller().until_done().await?;
1195    /// # gax::Result::<()>::Ok(()) });
1196    ///
1197    /// fn prepare_request_builder() -> DeleteBackup {
1198    ///   # panic!();
1199    ///   // ... details omitted ...
1200    /// }
1201    /// ```
1202    #[derive(Clone, Debug)]
1203    pub struct DeleteBackup(RequestBuilder<crate::model::DeleteBackupRequest>);
1204
1205    impl DeleteBackup {
1206        pub(crate) fn new(
1207            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1208        ) -> Self {
1209            Self(RequestBuilder::new(stub))
1210        }
1211
1212        /// Sets the full request, replacing any prior values.
1213        pub fn with_request<V: Into<crate::model::DeleteBackupRequest>>(mut self, v: V) -> Self {
1214            self.0.request = v.into();
1215            self
1216        }
1217
1218        /// Sets all the options, replacing any prior values.
1219        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1220            self.0.options = v.into();
1221            self
1222        }
1223
1224        /// Sends the request.
1225        ///
1226        /// # Long running operations
1227        ///
1228        /// This starts, but does not poll, a longrunning operation. More information
1229        /// on [delete_backup][crate::client::Memorystore::delete_backup].
1230        pub async fn send(self) -> Result<longrunning::model::Operation> {
1231            (*self.0.stub)
1232                .delete_backup(self.0.request, self.0.options)
1233                .await
1234                .map(gax::response::Response::into_body)
1235        }
1236
1237        /// Creates a [Poller][lro::Poller] to work with `delete_backup`.
1238        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
1239            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
1240            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1241            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1242
1243            let stub = self.0.stub.clone();
1244            let mut options = self.0.options.clone();
1245            options.set_retry_policy(gax::retry_policy::NeverRetry);
1246            let query = move |name| {
1247                let stub = stub.clone();
1248                let options = options.clone();
1249                async {
1250                    let op = GetOperation::new(stub)
1251                        .set_name(name)
1252                        .with_options(options)
1253                        .send()
1254                        .await?;
1255                    Ok(Operation::new(op))
1256                }
1257            };
1258
1259            let start = move || async {
1260                let op = self.send().await?;
1261                Ok(Operation::new(op))
1262            };
1263
1264            lro::internal::new_unit_response_poller(
1265                polling_error_policy,
1266                polling_backoff_policy,
1267                start,
1268                query,
1269            )
1270        }
1271
1272        /// Sets the value of [name][crate::model::DeleteBackupRequest::name].
1273        ///
1274        /// This is a **required** field for requests.
1275        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1276            self.0.request.name = v.into();
1277            self
1278        }
1279
1280        /// Sets the value of [request_id][crate::model::DeleteBackupRequest::request_id].
1281        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1282            self.0.request.request_id = v.into();
1283            self
1284        }
1285    }
1286
1287    #[doc(hidden)]
1288    impl gax::options::internal::RequestBuilder for DeleteBackup {
1289        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1290            &mut self.0.options
1291        }
1292    }
1293
1294    /// The request builder for [Memorystore::export_backup][crate::client::Memorystore::export_backup] calls.
1295    ///
1296    /// # Example
1297    /// ```no_run
1298    /// # use google_cloud_memorystore_v1::builder;
1299    /// use builder::memorystore::ExportBackup;
1300    /// # tokio_test::block_on(async {
1301    /// use lro::Poller;
1302    ///
1303    /// let builder = prepare_request_builder();
1304    /// let response = builder.poller().until_done().await?;
1305    /// # gax::Result::<()>::Ok(()) });
1306    ///
1307    /// fn prepare_request_builder() -> ExportBackup {
1308    ///   # panic!();
1309    ///   // ... details omitted ...
1310    /// }
1311    /// ```
1312    #[derive(Clone, Debug)]
1313    pub struct ExportBackup(RequestBuilder<crate::model::ExportBackupRequest>);
1314
1315    impl ExportBackup {
1316        pub(crate) fn new(
1317            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1318        ) -> Self {
1319            Self(RequestBuilder::new(stub))
1320        }
1321
1322        /// Sets the full request, replacing any prior values.
1323        pub fn with_request<V: Into<crate::model::ExportBackupRequest>>(mut self, v: V) -> Self {
1324            self.0.request = v.into();
1325            self
1326        }
1327
1328        /// Sets all the options, replacing any prior values.
1329        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1330            self.0.options = v.into();
1331            self
1332        }
1333
1334        /// Sends the request.
1335        ///
1336        /// # Long running operations
1337        ///
1338        /// This starts, but does not poll, a longrunning operation. More information
1339        /// on [export_backup][crate::client::Memorystore::export_backup].
1340        pub async fn send(self) -> Result<longrunning::model::Operation> {
1341            (*self.0.stub)
1342                .export_backup(self.0.request, self.0.options)
1343                .await
1344                .map(gax::response::Response::into_body)
1345        }
1346
1347        /// Creates a [Poller][lro::Poller] to work with `export_backup`.
1348        pub fn poller(
1349            self,
1350        ) -> impl lro::Poller<crate::model::Backup, crate::model::OperationMetadata> {
1351            type Operation =
1352                lro::internal::Operation<crate::model::Backup, crate::model::OperationMetadata>;
1353            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1354            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1355
1356            let stub = self.0.stub.clone();
1357            let mut options = self.0.options.clone();
1358            options.set_retry_policy(gax::retry_policy::NeverRetry);
1359            let query = move |name| {
1360                let stub = stub.clone();
1361                let options = options.clone();
1362                async {
1363                    let op = GetOperation::new(stub)
1364                        .set_name(name)
1365                        .with_options(options)
1366                        .send()
1367                        .await?;
1368                    Ok(Operation::new(op))
1369                }
1370            };
1371
1372            let start = move || async {
1373                let op = self.send().await?;
1374                Ok(Operation::new(op))
1375            };
1376
1377            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1378        }
1379
1380        /// Sets the value of [name][crate::model::ExportBackupRequest::name].
1381        ///
1382        /// This is a **required** field for requests.
1383        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1384            self.0.request.name = v.into();
1385            self
1386        }
1387
1388        /// Sets the value of [destination][crate::model::ExportBackupRequest::destination].
1389        ///
1390        /// Note that all the setters affecting `destination` are
1391        /// mutually exclusive.
1392        pub fn set_destination<
1393            T: Into<Option<crate::model::export_backup_request::Destination>>,
1394        >(
1395            mut self,
1396            v: T,
1397        ) -> Self {
1398            self.0.request.destination = v.into();
1399            self
1400        }
1401
1402        /// Sets the value of [destination][crate::model::ExportBackupRequest::destination]
1403        /// to hold a `GcsBucket`.
1404        ///
1405        /// Note that all the setters affecting `destination` are
1406        /// mutually exclusive.
1407        pub fn set_gcs_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1408            self.0.request = self.0.request.set_gcs_bucket(v);
1409            self
1410        }
1411    }
1412
1413    #[doc(hidden)]
1414    impl gax::options::internal::RequestBuilder for ExportBackup {
1415        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1416            &mut self.0.options
1417        }
1418    }
1419
1420    /// The request builder for [Memorystore::backup_instance][crate::client::Memorystore::backup_instance] calls.
1421    ///
1422    /// # Example
1423    /// ```no_run
1424    /// # use google_cloud_memorystore_v1::builder;
1425    /// use builder::memorystore::BackupInstance;
1426    /// # tokio_test::block_on(async {
1427    /// use lro::Poller;
1428    ///
1429    /// let builder = prepare_request_builder();
1430    /// let response = builder.poller().until_done().await?;
1431    /// # gax::Result::<()>::Ok(()) });
1432    ///
1433    /// fn prepare_request_builder() -> BackupInstance {
1434    ///   # panic!();
1435    ///   // ... details omitted ...
1436    /// }
1437    /// ```
1438    #[derive(Clone, Debug)]
1439    pub struct BackupInstance(RequestBuilder<crate::model::BackupInstanceRequest>);
1440
1441    impl BackupInstance {
1442        pub(crate) fn new(
1443            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1444        ) -> Self {
1445            Self(RequestBuilder::new(stub))
1446        }
1447
1448        /// Sets the full request, replacing any prior values.
1449        pub fn with_request<V: Into<crate::model::BackupInstanceRequest>>(mut self, v: V) -> Self {
1450            self.0.request = v.into();
1451            self
1452        }
1453
1454        /// Sets all the options, replacing any prior values.
1455        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1456            self.0.options = v.into();
1457            self
1458        }
1459
1460        /// Sends the request.
1461        ///
1462        /// # Long running operations
1463        ///
1464        /// This starts, but does not poll, a longrunning operation. More information
1465        /// on [backup_instance][crate::client::Memorystore::backup_instance].
1466        pub async fn send(self) -> Result<longrunning::model::Operation> {
1467            (*self.0.stub)
1468                .backup_instance(self.0.request, self.0.options)
1469                .await
1470                .map(gax::response::Response::into_body)
1471        }
1472
1473        /// Creates a [Poller][lro::Poller] to work with `backup_instance`.
1474        pub fn poller(
1475            self,
1476        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
1477            type Operation =
1478                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
1479            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1480            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1481
1482            let stub = self.0.stub.clone();
1483            let mut options = self.0.options.clone();
1484            options.set_retry_policy(gax::retry_policy::NeverRetry);
1485            let query = move |name| {
1486                let stub = stub.clone();
1487                let options = options.clone();
1488                async {
1489                    let op = GetOperation::new(stub)
1490                        .set_name(name)
1491                        .with_options(options)
1492                        .send()
1493                        .await?;
1494                    Ok(Operation::new(op))
1495                }
1496            };
1497
1498            let start = move || async {
1499                let op = self.send().await?;
1500                Ok(Operation::new(op))
1501            };
1502
1503            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1504        }
1505
1506        /// Sets the value of [name][crate::model::BackupInstanceRequest::name].
1507        ///
1508        /// This is a **required** field for requests.
1509        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1510            self.0.request.name = v.into();
1511            self
1512        }
1513
1514        /// Sets the value of [ttl][crate::model::BackupInstanceRequest::ttl].
1515        pub fn set_ttl<T>(mut self, v: T) -> Self
1516        where
1517            T: std::convert::Into<wkt::Duration>,
1518        {
1519            self.0.request.ttl = std::option::Option::Some(v.into());
1520            self
1521        }
1522
1523        /// Sets or clears the value of [ttl][crate::model::BackupInstanceRequest::ttl].
1524        pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
1525        where
1526            T: std::convert::Into<wkt::Duration>,
1527        {
1528            self.0.request.ttl = v.map(|x| x.into());
1529            self
1530        }
1531
1532        /// Sets the value of [backup_id][crate::model::BackupInstanceRequest::backup_id].
1533        pub fn set_backup_id<T>(mut self, v: T) -> Self
1534        where
1535            T: std::convert::Into<std::string::String>,
1536        {
1537            self.0.request.backup_id = std::option::Option::Some(v.into());
1538            self
1539        }
1540
1541        /// Sets or clears the value of [backup_id][crate::model::BackupInstanceRequest::backup_id].
1542        pub fn set_or_clear_backup_id<T>(mut self, v: std::option::Option<T>) -> Self
1543        where
1544            T: std::convert::Into<std::string::String>,
1545        {
1546            self.0.request.backup_id = v.map(|x| x.into());
1547            self
1548        }
1549    }
1550
1551    #[doc(hidden)]
1552    impl gax::options::internal::RequestBuilder for BackupInstance {
1553        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1554            &mut self.0.options
1555        }
1556    }
1557
1558    /// The request builder for [Memorystore::list_locations][crate::client::Memorystore::list_locations] calls.
1559    ///
1560    /// # Example
1561    /// ```no_run
1562    /// # use google_cloud_memorystore_v1::builder;
1563    /// use builder::memorystore::ListLocations;
1564    /// # tokio_test::block_on(async {
1565    /// use gax::paginator::ItemPaginator;
1566    ///
1567    /// let builder = prepare_request_builder();
1568    /// let mut items = builder.by_item();
1569    /// while let Some(result) = items.next().await {
1570    ///   let item = result?;
1571    /// }
1572    /// # gax::Result::<()>::Ok(()) });
1573    ///
1574    /// fn prepare_request_builder() -> ListLocations {
1575    ///   # panic!();
1576    ///   // ... details omitted ...
1577    /// }
1578    /// ```
1579    #[derive(Clone, Debug)]
1580    pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
1581
1582    impl ListLocations {
1583        pub(crate) fn new(
1584            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1585        ) -> Self {
1586            Self(RequestBuilder::new(stub))
1587        }
1588
1589        /// Sets the full request, replacing any prior values.
1590        pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
1591            mut self,
1592            v: V,
1593        ) -> Self {
1594            self.0.request = v.into();
1595            self
1596        }
1597
1598        /// Sets all the options, replacing any prior values.
1599        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1600            self.0.options = v.into();
1601            self
1602        }
1603
1604        /// Sends the request.
1605        pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
1606            (*self.0.stub)
1607                .list_locations(self.0.request, self.0.options)
1608                .await
1609                .map(gax::response::Response::into_body)
1610        }
1611
1612        /// Streams each page in the collection.
1613        pub fn by_page(
1614            self,
1615        ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
1616        {
1617            use std::clone::Clone;
1618            let token = self.0.request.page_token.clone();
1619            let execute = move |token: String| {
1620                let mut builder = self.clone();
1621                builder.0.request = builder.0.request.set_page_token(token);
1622                builder.send()
1623            };
1624            gax::paginator::internal::new_paginator(token, execute)
1625        }
1626
1627        /// Streams each item in the collection.
1628        pub fn by_item(
1629            self,
1630        ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
1631        {
1632            use gax::paginator::Paginator;
1633            self.by_page().items()
1634        }
1635
1636        /// Sets the value of [name][location::model::ListLocationsRequest::name].
1637        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1638            self.0.request.name = v.into();
1639            self
1640        }
1641
1642        /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
1643        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1644            self.0.request.filter = v.into();
1645            self
1646        }
1647
1648        /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
1649        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1650            self.0.request.page_size = v.into();
1651            self
1652        }
1653
1654        /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
1655        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1656            self.0.request.page_token = v.into();
1657            self
1658        }
1659    }
1660
1661    #[doc(hidden)]
1662    impl gax::options::internal::RequestBuilder for ListLocations {
1663        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1664            &mut self.0.options
1665        }
1666    }
1667
1668    /// The request builder for [Memorystore::get_location][crate::client::Memorystore::get_location] calls.
1669    ///
1670    /// # Example
1671    /// ```no_run
1672    /// # use google_cloud_memorystore_v1::builder;
1673    /// use builder::memorystore::GetLocation;
1674    /// # tokio_test::block_on(async {
1675    ///
1676    /// let builder = prepare_request_builder();
1677    /// let response = builder.send().await?;
1678    /// # gax::Result::<()>::Ok(()) });
1679    ///
1680    /// fn prepare_request_builder() -> GetLocation {
1681    ///   # panic!();
1682    ///   // ... details omitted ...
1683    /// }
1684    /// ```
1685    #[derive(Clone, Debug)]
1686    pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1687
1688    impl GetLocation {
1689        pub(crate) fn new(
1690            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1691        ) -> Self {
1692            Self(RequestBuilder::new(stub))
1693        }
1694
1695        /// Sets the full request, replacing any prior values.
1696        pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1697            self.0.request = v.into();
1698            self
1699        }
1700
1701        /// Sets all the options, replacing any prior values.
1702        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1703            self.0.options = v.into();
1704            self
1705        }
1706
1707        /// Sends the request.
1708        pub async fn send(self) -> Result<location::model::Location> {
1709            (*self.0.stub)
1710                .get_location(self.0.request, self.0.options)
1711                .await
1712                .map(gax::response::Response::into_body)
1713        }
1714
1715        /// Sets the value of [name][location::model::GetLocationRequest::name].
1716        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1717            self.0.request.name = v.into();
1718            self
1719        }
1720    }
1721
1722    #[doc(hidden)]
1723    impl gax::options::internal::RequestBuilder for GetLocation {
1724        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1725            &mut self.0.options
1726        }
1727    }
1728
1729    /// The request builder for [Memorystore::list_operations][crate::client::Memorystore::list_operations] calls.
1730    ///
1731    /// # Example
1732    /// ```no_run
1733    /// # use google_cloud_memorystore_v1::builder;
1734    /// use builder::memorystore::ListOperations;
1735    /// # tokio_test::block_on(async {
1736    /// use gax::paginator::ItemPaginator;
1737    ///
1738    /// let builder = prepare_request_builder();
1739    /// let mut items = builder.by_item();
1740    /// while let Some(result) = items.next().await {
1741    ///   let item = result?;
1742    /// }
1743    /// # gax::Result::<()>::Ok(()) });
1744    ///
1745    /// fn prepare_request_builder() -> ListOperations {
1746    ///   # panic!();
1747    ///   // ... details omitted ...
1748    /// }
1749    /// ```
1750    #[derive(Clone, Debug)]
1751    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1752
1753    impl ListOperations {
1754        pub(crate) fn new(
1755            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1756        ) -> Self {
1757            Self(RequestBuilder::new(stub))
1758        }
1759
1760        /// Sets the full request, replacing any prior values.
1761        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1762            mut self,
1763            v: V,
1764        ) -> Self {
1765            self.0.request = v.into();
1766            self
1767        }
1768
1769        /// Sets all the options, replacing any prior values.
1770        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1771            self.0.options = v.into();
1772            self
1773        }
1774
1775        /// Sends the request.
1776        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1777            (*self.0.stub)
1778                .list_operations(self.0.request, self.0.options)
1779                .await
1780                .map(gax::response::Response::into_body)
1781        }
1782
1783        /// Streams each page in the collection.
1784        pub fn by_page(
1785            self,
1786        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1787        {
1788            use std::clone::Clone;
1789            let token = self.0.request.page_token.clone();
1790            let execute = move |token: String| {
1791                let mut builder = self.clone();
1792                builder.0.request = builder.0.request.set_page_token(token);
1793                builder.send()
1794            };
1795            gax::paginator::internal::new_paginator(token, execute)
1796        }
1797
1798        /// Streams each item in the collection.
1799        pub fn by_item(
1800            self,
1801        ) -> impl gax::paginator::ItemPaginator<
1802            longrunning::model::ListOperationsResponse,
1803            gax::error::Error,
1804        > {
1805            use gax::paginator::Paginator;
1806            self.by_page().items()
1807        }
1808
1809        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
1810        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1811            self.0.request.name = v.into();
1812            self
1813        }
1814
1815        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
1816        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1817            self.0.request.filter = v.into();
1818            self
1819        }
1820
1821        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
1822        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1823            self.0.request.page_size = v.into();
1824            self
1825        }
1826
1827        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
1828        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1829            self.0.request.page_token = v.into();
1830            self
1831        }
1832
1833        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
1834        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1835            self.0.request.return_partial_success = v.into();
1836            self
1837        }
1838    }
1839
1840    #[doc(hidden)]
1841    impl gax::options::internal::RequestBuilder for ListOperations {
1842        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1843            &mut self.0.options
1844        }
1845    }
1846
1847    /// The request builder for [Memorystore::get_operation][crate::client::Memorystore::get_operation] calls.
1848    ///
1849    /// # Example
1850    /// ```no_run
1851    /// # use google_cloud_memorystore_v1::builder;
1852    /// use builder::memorystore::GetOperation;
1853    /// # tokio_test::block_on(async {
1854    ///
1855    /// let builder = prepare_request_builder();
1856    /// let response = builder.send().await?;
1857    /// # gax::Result::<()>::Ok(()) });
1858    ///
1859    /// fn prepare_request_builder() -> GetOperation {
1860    ///   # panic!();
1861    ///   // ... details omitted ...
1862    /// }
1863    /// ```
1864    #[derive(Clone, Debug)]
1865    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1866
1867    impl GetOperation {
1868        pub(crate) fn new(
1869            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1870        ) -> Self {
1871            Self(RequestBuilder::new(stub))
1872        }
1873
1874        /// Sets the full request, replacing any prior values.
1875        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1876            mut self,
1877            v: V,
1878        ) -> Self {
1879            self.0.request = v.into();
1880            self
1881        }
1882
1883        /// Sets all the options, replacing any prior values.
1884        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1885            self.0.options = v.into();
1886            self
1887        }
1888
1889        /// Sends the request.
1890        pub async fn send(self) -> Result<longrunning::model::Operation> {
1891            (*self.0.stub)
1892                .get_operation(self.0.request, self.0.options)
1893                .await
1894                .map(gax::response::Response::into_body)
1895        }
1896
1897        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
1898        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1899            self.0.request.name = v.into();
1900            self
1901        }
1902    }
1903
1904    #[doc(hidden)]
1905    impl gax::options::internal::RequestBuilder for GetOperation {
1906        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1907            &mut self.0.options
1908        }
1909    }
1910
1911    /// The request builder for [Memorystore::delete_operation][crate::client::Memorystore::delete_operation] calls.
1912    ///
1913    /// # Example
1914    /// ```no_run
1915    /// # use google_cloud_memorystore_v1::builder;
1916    /// use builder::memorystore::DeleteOperation;
1917    /// # tokio_test::block_on(async {
1918    ///
1919    /// let builder = prepare_request_builder();
1920    /// let response = builder.send().await?;
1921    /// # gax::Result::<()>::Ok(()) });
1922    ///
1923    /// fn prepare_request_builder() -> DeleteOperation {
1924    ///   # panic!();
1925    ///   // ... details omitted ...
1926    /// }
1927    /// ```
1928    #[derive(Clone, Debug)]
1929    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1930
1931    impl DeleteOperation {
1932        pub(crate) fn new(
1933            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1934        ) -> Self {
1935            Self(RequestBuilder::new(stub))
1936        }
1937
1938        /// Sets the full request, replacing any prior values.
1939        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1940            mut self,
1941            v: V,
1942        ) -> Self {
1943            self.0.request = v.into();
1944            self
1945        }
1946
1947        /// Sets all the options, replacing any prior values.
1948        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1949            self.0.options = v.into();
1950            self
1951        }
1952
1953        /// Sends the request.
1954        pub async fn send(self) -> Result<()> {
1955            (*self.0.stub)
1956                .delete_operation(self.0.request, self.0.options)
1957                .await
1958                .map(gax::response::Response::into_body)
1959        }
1960
1961        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
1962        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1963            self.0.request.name = v.into();
1964            self
1965        }
1966    }
1967
1968    #[doc(hidden)]
1969    impl gax::options::internal::RequestBuilder for DeleteOperation {
1970        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1971            &mut self.0.options
1972        }
1973    }
1974
1975    /// The request builder for [Memorystore::cancel_operation][crate::client::Memorystore::cancel_operation] calls.
1976    ///
1977    /// # Example
1978    /// ```no_run
1979    /// # use google_cloud_memorystore_v1::builder;
1980    /// use builder::memorystore::CancelOperation;
1981    /// # tokio_test::block_on(async {
1982    ///
1983    /// let builder = prepare_request_builder();
1984    /// let response = builder.send().await?;
1985    /// # gax::Result::<()>::Ok(()) });
1986    ///
1987    /// fn prepare_request_builder() -> CancelOperation {
1988    ///   # panic!();
1989    ///   // ... details omitted ...
1990    /// }
1991    /// ```
1992    #[derive(Clone, Debug)]
1993    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1994
1995    impl CancelOperation {
1996        pub(crate) fn new(
1997            stub: std::sync::Arc<dyn super::super::stub::dynamic::Memorystore>,
1998        ) -> Self {
1999            Self(RequestBuilder::new(stub))
2000        }
2001
2002        /// Sets the full request, replacing any prior values.
2003        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2004            mut self,
2005            v: V,
2006        ) -> Self {
2007            self.0.request = v.into();
2008            self
2009        }
2010
2011        /// Sets all the options, replacing any prior values.
2012        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2013            self.0.options = v.into();
2014            self
2015        }
2016
2017        /// Sends the request.
2018        pub async fn send(self) -> Result<()> {
2019            (*self.0.stub)
2020                .cancel_operation(self.0.request, self.0.options)
2021                .await
2022                .map(gax::response::Response::into_body)
2023        }
2024
2025        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
2026        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2027            self.0.request.name = v.into();
2028            self
2029        }
2030    }
2031
2032    #[doc(hidden)]
2033    impl gax::options::internal::RequestBuilder for CancelOperation {
2034        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2035            &mut self.0.options
2036        }
2037    }
2038}