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