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