Skip to main content

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
17/// Request and client builders for [DatabaseAdmin][crate::client::DatabaseAdmin].
18pub mod database_admin {
19    use crate::Result;
20
21    /// A builder for [DatabaseAdmin][crate::client::DatabaseAdmin].
22    ///
23    /// ```
24    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
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    /// # Ok(()) }
33    /// ```
34    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36    pub(crate) mod client {
37        use super::super::super::client::DatabaseAdmin;
38        pub struct Factory;
39        impl crate::ClientFactory for Factory {
40            type Client = DatabaseAdmin;
41            type Credentials = gaxi::options::Credentials;
42            async fn build(
43                self,
44                config: gaxi::options::ClientConfig,
45            ) -> crate::ClientBuilderResult<Self::Client> {
46                Self::Client::new(config).await
47            }
48        }
49    }
50
51    /// Common implementation for [crate::client::DatabaseAdmin] 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::DatabaseAdmin>,
55        request: R,
56        options: crate::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::DatabaseAdmin>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: crate::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [DatabaseAdmin::list_databases][crate::client::DatabaseAdmin::list_databases] calls.
75    ///
76    /// # Example
77    /// ```
78    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::ListDatabases;
79    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
80    /// use google_cloud_gax::paginator::ItemPaginator;
81    ///
82    /// let builder = prepare_request_builder();
83    /// let mut items = builder.by_item();
84    /// while let Some(result) = items.next().await {
85    ///   let item = result?;
86    /// }
87    /// # Ok(()) }
88    ///
89    /// fn prepare_request_builder() -> ListDatabases {
90    ///   # panic!();
91    ///   // ... details omitted ...
92    /// }
93    /// ```
94    #[derive(Clone, Debug)]
95    pub struct ListDatabases(RequestBuilder<crate::model::ListDatabasesRequest>);
96
97    impl ListDatabases {
98        pub(crate) fn new(
99            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
100        ) -> Self {
101            Self(RequestBuilder::new(stub))
102        }
103
104        /// Sets the full request, replacing any prior values.
105        pub fn with_request<V: Into<crate::model::ListDatabasesRequest>>(mut self, v: V) -> Self {
106            self.0.request = v.into();
107            self
108        }
109
110        /// Sets all the options, replacing any prior values.
111        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
112            self.0.options = v.into();
113            self
114        }
115
116        /// Sends the request.
117        pub async fn send(self) -> Result<crate::model::ListDatabasesResponse> {
118            (*self.0.stub)
119                .list_databases(self.0.request, self.0.options)
120                .await
121                .map(crate::Response::into_body)
122        }
123
124        /// Streams each page in the collection.
125        pub fn by_page(
126            self,
127        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListDatabasesResponse, crate::Error>
128        {
129            use std::clone::Clone;
130            let token = self.0.request.page_token.clone();
131            let execute = move |token: String| {
132                let mut builder = self.clone();
133                builder.0.request = builder.0.request.set_page_token(token);
134                builder.send()
135            };
136            google_cloud_gax::paginator::internal::new_paginator(token, execute)
137        }
138
139        /// Streams each item in the collection.
140        pub fn by_item(
141            self,
142        ) -> impl google_cloud_gax::paginator::ItemPaginator<
143            crate::model::ListDatabasesResponse,
144            crate::Error,
145        > {
146            use google_cloud_gax::paginator::Paginator;
147            self.by_page().items()
148        }
149
150        /// Sets the value of [parent][crate::model::ListDatabasesRequest::parent].
151        ///
152        /// This is a **required** field for requests.
153        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
154            self.0.request.parent = v.into();
155            self
156        }
157
158        /// Sets the value of [page_size][crate::model::ListDatabasesRequest::page_size].
159        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
160            self.0.request.page_size = v.into();
161            self
162        }
163
164        /// Sets the value of [page_token][crate::model::ListDatabasesRequest::page_token].
165        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
166            self.0.request.page_token = v.into();
167            self
168        }
169    }
170
171    #[doc(hidden)]
172    impl crate::RequestBuilder for ListDatabases {
173        fn request_options(&mut self) -> &mut crate::RequestOptions {
174            &mut self.0.options
175        }
176    }
177
178    /// The request builder for [DatabaseAdmin::create_database][crate::client::DatabaseAdmin::create_database] calls.
179    ///
180    /// # Example
181    /// ```
182    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::CreateDatabase;
183    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
184    /// use google_cloud_lro::Poller;
185    ///
186    /// let builder = prepare_request_builder();
187    /// let response = builder.poller().until_done().await?;
188    /// # Ok(()) }
189    ///
190    /// fn prepare_request_builder() -> CreateDatabase {
191    ///   # panic!();
192    ///   // ... details omitted ...
193    /// }
194    /// ```
195    #[derive(Clone, Debug)]
196    pub struct CreateDatabase(RequestBuilder<crate::model::CreateDatabaseRequest>);
197
198    impl CreateDatabase {
199        pub(crate) fn new(
200            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
201        ) -> Self {
202            Self(RequestBuilder::new(stub))
203        }
204
205        /// Sets the full request, replacing any prior values.
206        pub fn with_request<V: Into<crate::model::CreateDatabaseRequest>>(mut self, v: V) -> Self {
207            self.0.request = v.into();
208            self
209        }
210
211        /// Sets all the options, replacing any prior values.
212        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
213            self.0.options = v.into();
214            self
215        }
216
217        /// Sends the request.
218        ///
219        /// # Long running operations
220        ///
221        /// This starts, but does not poll, a longrunning operation. More information
222        /// on [create_database][crate::client::DatabaseAdmin::create_database].
223        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
224            (*self.0.stub)
225                .create_database(self.0.request, self.0.options)
226                .await
227                .map(crate::Response::into_body)
228        }
229
230        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_database`.
231        pub fn poller(
232            self,
233        ) -> impl google_cloud_lro::Poller<crate::model::Database, crate::model::CreateDatabaseMetadata>
234        {
235            type Operation = google_cloud_lro::internal::Operation<
236                crate::model::Database,
237                crate::model::CreateDatabaseMetadata,
238            >;
239            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
240            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
241
242            let stub = self.0.stub.clone();
243            let mut options = self.0.options.clone();
244            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
245            let query = move |name| {
246                let stub = stub.clone();
247                let options = options.clone();
248                async {
249                    let op = GetOperation::new(stub)
250                        .set_name(name)
251                        .with_options(options)
252                        .send()
253                        .await?;
254                    Ok(Operation::new(op))
255                }
256            };
257
258            let start = move || async {
259                let op = self.send().await?;
260                Ok(Operation::new(op))
261            };
262
263            google_cloud_lro::internal::new_poller(
264                polling_error_policy,
265                polling_backoff_policy,
266                start,
267                query,
268            )
269        }
270
271        /// Sets the value of [parent][crate::model::CreateDatabaseRequest::parent].
272        ///
273        /// This is a **required** field for requests.
274        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
275            self.0.request.parent = v.into();
276            self
277        }
278
279        /// Sets the value of [create_statement][crate::model::CreateDatabaseRequest::create_statement].
280        ///
281        /// This is a **required** field for requests.
282        pub fn set_create_statement<T: Into<std::string::String>>(mut self, v: T) -> Self {
283            self.0.request.create_statement = v.into();
284            self
285        }
286
287        /// Sets the value of [extra_statements][crate::model::CreateDatabaseRequest::extra_statements].
288        pub fn set_extra_statements<T, V>(mut self, v: T) -> Self
289        where
290            T: std::iter::IntoIterator<Item = V>,
291            V: std::convert::Into<std::string::String>,
292        {
293            use std::iter::Iterator;
294            self.0.request.extra_statements = v.into_iter().map(|i| i.into()).collect();
295            self
296        }
297
298        /// Sets the value of [encryption_config][crate::model::CreateDatabaseRequest::encryption_config].
299        pub fn set_encryption_config<T>(mut self, v: T) -> Self
300        where
301            T: std::convert::Into<crate::model::EncryptionConfig>,
302        {
303            self.0.request.encryption_config = std::option::Option::Some(v.into());
304            self
305        }
306
307        /// Sets or clears the value of [encryption_config][crate::model::CreateDatabaseRequest::encryption_config].
308        pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
309        where
310            T: std::convert::Into<crate::model::EncryptionConfig>,
311        {
312            self.0.request.encryption_config = v.map(|x| x.into());
313            self
314        }
315
316        /// Sets the value of [database_dialect][crate::model::CreateDatabaseRequest::database_dialect].
317        pub fn set_database_dialect<T: Into<crate::model::DatabaseDialect>>(
318            mut self,
319            v: T,
320        ) -> Self {
321            self.0.request.database_dialect = v.into();
322            self
323        }
324
325        /// Sets the value of [proto_descriptors][crate::model::CreateDatabaseRequest::proto_descriptors].
326        pub fn set_proto_descriptors<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
327            self.0.request.proto_descriptors = v.into();
328            self
329        }
330    }
331
332    #[doc(hidden)]
333    impl crate::RequestBuilder for CreateDatabase {
334        fn request_options(&mut self) -> &mut crate::RequestOptions {
335            &mut self.0.options
336        }
337    }
338
339    /// The request builder for [DatabaseAdmin::get_database][crate::client::DatabaseAdmin::get_database] calls.
340    ///
341    /// # Example
342    /// ```
343    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::GetDatabase;
344    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
345    ///
346    /// let builder = prepare_request_builder();
347    /// let response = builder.send().await?;
348    /// # Ok(()) }
349    ///
350    /// fn prepare_request_builder() -> GetDatabase {
351    ///   # panic!();
352    ///   // ... details omitted ...
353    /// }
354    /// ```
355    #[derive(Clone, Debug)]
356    pub struct GetDatabase(RequestBuilder<crate::model::GetDatabaseRequest>);
357
358    impl GetDatabase {
359        pub(crate) fn new(
360            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
361        ) -> Self {
362            Self(RequestBuilder::new(stub))
363        }
364
365        /// Sets the full request, replacing any prior values.
366        pub fn with_request<V: Into<crate::model::GetDatabaseRequest>>(mut self, v: V) -> Self {
367            self.0.request = v.into();
368            self
369        }
370
371        /// Sets all the options, replacing any prior values.
372        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
373            self.0.options = v.into();
374            self
375        }
376
377        /// Sends the request.
378        pub async fn send(self) -> Result<crate::model::Database> {
379            (*self.0.stub)
380                .get_database(self.0.request, self.0.options)
381                .await
382                .map(crate::Response::into_body)
383        }
384
385        /// Sets the value of [name][crate::model::GetDatabaseRequest::name].
386        ///
387        /// This is a **required** field for requests.
388        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
389            self.0.request.name = v.into();
390            self
391        }
392    }
393
394    #[doc(hidden)]
395    impl crate::RequestBuilder for GetDatabase {
396        fn request_options(&mut self) -> &mut crate::RequestOptions {
397            &mut self.0.options
398        }
399    }
400
401    /// The request builder for [DatabaseAdmin::update_database][crate::client::DatabaseAdmin::update_database] calls.
402    ///
403    /// # Example
404    /// ```
405    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::UpdateDatabase;
406    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
407    /// use google_cloud_lro::Poller;
408    ///
409    /// let builder = prepare_request_builder();
410    /// let response = builder.poller().until_done().await?;
411    /// # Ok(()) }
412    ///
413    /// fn prepare_request_builder() -> UpdateDatabase {
414    ///   # panic!();
415    ///   // ... details omitted ...
416    /// }
417    /// ```
418    #[derive(Clone, Debug)]
419    pub struct UpdateDatabase(RequestBuilder<crate::model::UpdateDatabaseRequest>);
420
421    impl UpdateDatabase {
422        pub(crate) fn new(
423            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
424        ) -> Self {
425            Self(RequestBuilder::new(stub))
426        }
427
428        /// Sets the full request, replacing any prior values.
429        pub fn with_request<V: Into<crate::model::UpdateDatabaseRequest>>(mut self, v: V) -> Self {
430            self.0.request = v.into();
431            self
432        }
433
434        /// Sets all the options, replacing any prior values.
435        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
436            self.0.options = v.into();
437            self
438        }
439
440        /// Sends the request.
441        ///
442        /// # Long running operations
443        ///
444        /// This starts, but does not poll, a longrunning operation. More information
445        /// on [update_database][crate::client::DatabaseAdmin::update_database].
446        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
447            (*self.0.stub)
448                .update_database(self.0.request, self.0.options)
449                .await
450                .map(crate::Response::into_body)
451        }
452
453        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_database`.
454        pub fn poller(
455            self,
456        ) -> impl google_cloud_lro::Poller<crate::model::Database, crate::model::UpdateDatabaseMetadata>
457        {
458            type Operation = google_cloud_lro::internal::Operation<
459                crate::model::Database,
460                crate::model::UpdateDatabaseMetadata,
461            >;
462            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
463            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
464
465            let stub = self.0.stub.clone();
466            let mut options = self.0.options.clone();
467            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
468            let query = move |name| {
469                let stub = stub.clone();
470                let options = options.clone();
471                async {
472                    let op = GetOperation::new(stub)
473                        .set_name(name)
474                        .with_options(options)
475                        .send()
476                        .await?;
477                    Ok(Operation::new(op))
478                }
479            };
480
481            let start = move || async {
482                let op = self.send().await?;
483                Ok(Operation::new(op))
484            };
485
486            google_cloud_lro::internal::new_poller(
487                polling_error_policy,
488                polling_backoff_policy,
489                start,
490                query,
491            )
492        }
493
494        /// Sets the value of [database][crate::model::UpdateDatabaseRequest::database].
495        ///
496        /// This is a **required** field for requests.
497        pub fn set_database<T>(mut self, v: T) -> Self
498        where
499            T: std::convert::Into<crate::model::Database>,
500        {
501            self.0.request.database = std::option::Option::Some(v.into());
502            self
503        }
504
505        /// Sets or clears the value of [database][crate::model::UpdateDatabaseRequest::database].
506        ///
507        /// This is a **required** field for requests.
508        pub fn set_or_clear_database<T>(mut self, v: std::option::Option<T>) -> Self
509        where
510            T: std::convert::Into<crate::model::Database>,
511        {
512            self.0.request.database = v.map(|x| x.into());
513            self
514        }
515
516        /// Sets the value of [update_mask][crate::model::UpdateDatabaseRequest::update_mask].
517        ///
518        /// This is a **required** field for requests.
519        pub fn set_update_mask<T>(mut self, v: T) -> Self
520        where
521            T: std::convert::Into<wkt::FieldMask>,
522        {
523            self.0.request.update_mask = std::option::Option::Some(v.into());
524            self
525        }
526
527        /// Sets or clears the value of [update_mask][crate::model::UpdateDatabaseRequest::update_mask].
528        ///
529        /// This is a **required** field for requests.
530        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
531        where
532            T: std::convert::Into<wkt::FieldMask>,
533        {
534            self.0.request.update_mask = v.map(|x| x.into());
535            self
536        }
537    }
538
539    #[doc(hidden)]
540    impl crate::RequestBuilder for UpdateDatabase {
541        fn request_options(&mut self) -> &mut crate::RequestOptions {
542            &mut self.0.options
543        }
544    }
545
546    /// The request builder for [DatabaseAdmin::update_database_ddl][crate::client::DatabaseAdmin::update_database_ddl] calls.
547    ///
548    /// # Example
549    /// ```
550    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::UpdateDatabaseDdl;
551    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
552    /// use google_cloud_lro::Poller;
553    ///
554    /// let builder = prepare_request_builder();
555    /// let response = builder.poller().until_done().await?;
556    /// # Ok(()) }
557    ///
558    /// fn prepare_request_builder() -> UpdateDatabaseDdl {
559    ///   # panic!();
560    ///   // ... details omitted ...
561    /// }
562    /// ```
563    #[derive(Clone, Debug)]
564    pub struct UpdateDatabaseDdl(RequestBuilder<crate::model::UpdateDatabaseDdlRequest>);
565
566    impl UpdateDatabaseDdl {
567        pub(crate) fn new(
568            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
569        ) -> Self {
570            Self(RequestBuilder::new(stub))
571        }
572
573        /// Sets the full request, replacing any prior values.
574        pub fn with_request<V: Into<crate::model::UpdateDatabaseDdlRequest>>(
575            mut self,
576            v: V,
577        ) -> Self {
578            self.0.request = v.into();
579            self
580        }
581
582        /// Sets all the options, replacing any prior values.
583        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
584            self.0.options = v.into();
585            self
586        }
587
588        /// Sends the request.
589        ///
590        /// # Long running operations
591        ///
592        /// This starts, but does not poll, a longrunning operation. More information
593        /// on [update_database_ddl][crate::client::DatabaseAdmin::update_database_ddl].
594        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
595            (*self.0.stub)
596                .update_database_ddl(self.0.request, self.0.options)
597                .await
598                .map(crate::Response::into_body)
599        }
600
601        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_database_ddl`.
602        pub fn poller(
603            self,
604        ) -> impl google_cloud_lro::Poller<(), crate::model::UpdateDatabaseDdlMetadata> {
605            type Operation = google_cloud_lro::internal::Operation<
606                wkt::Empty,
607                crate::model::UpdateDatabaseDdlMetadata,
608            >;
609            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
610            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
611
612            let stub = self.0.stub.clone();
613            let mut options = self.0.options.clone();
614            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
615            let query = move |name| {
616                let stub = stub.clone();
617                let options = options.clone();
618                async {
619                    let op = GetOperation::new(stub)
620                        .set_name(name)
621                        .with_options(options)
622                        .send()
623                        .await?;
624                    Ok(Operation::new(op))
625                }
626            };
627
628            let start = move || async {
629                let op = self.send().await?;
630                Ok(Operation::new(op))
631            };
632
633            google_cloud_lro::internal::new_unit_response_poller(
634                polling_error_policy,
635                polling_backoff_policy,
636                start,
637                query,
638            )
639        }
640
641        /// Sets the value of [database][crate::model::UpdateDatabaseDdlRequest::database].
642        ///
643        /// This is a **required** field for requests.
644        pub fn set_database<T: Into<std::string::String>>(mut self, v: T) -> Self {
645            self.0.request.database = v.into();
646            self
647        }
648
649        /// Sets the value of [statements][crate::model::UpdateDatabaseDdlRequest::statements].
650        ///
651        /// This is a **required** field for requests.
652        pub fn set_statements<T, V>(mut self, v: T) -> Self
653        where
654            T: std::iter::IntoIterator<Item = V>,
655            V: std::convert::Into<std::string::String>,
656        {
657            use std::iter::Iterator;
658            self.0.request.statements = v.into_iter().map(|i| i.into()).collect();
659            self
660        }
661
662        /// Sets the value of [operation_id][crate::model::UpdateDatabaseDdlRequest::operation_id].
663        pub fn set_operation_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
664            self.0.request.operation_id = v.into();
665            self
666        }
667
668        /// Sets the value of [proto_descriptors][crate::model::UpdateDatabaseDdlRequest::proto_descriptors].
669        pub fn set_proto_descriptors<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
670            self.0.request.proto_descriptors = v.into();
671            self
672        }
673
674        /// Sets the value of [throughput_mode][crate::model::UpdateDatabaseDdlRequest::throughput_mode].
675        pub fn set_throughput_mode<T: Into<bool>>(mut self, v: T) -> Self {
676            self.0.request.throughput_mode = v.into();
677            self
678        }
679    }
680
681    #[doc(hidden)]
682    impl crate::RequestBuilder for UpdateDatabaseDdl {
683        fn request_options(&mut self) -> &mut crate::RequestOptions {
684            &mut self.0.options
685        }
686    }
687
688    /// The request builder for [DatabaseAdmin::drop_database][crate::client::DatabaseAdmin::drop_database] calls.
689    ///
690    /// # Example
691    /// ```
692    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::DropDatabase;
693    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
694    ///
695    /// let builder = prepare_request_builder();
696    /// let response = builder.send().await?;
697    /// # Ok(()) }
698    ///
699    /// fn prepare_request_builder() -> DropDatabase {
700    ///   # panic!();
701    ///   // ... details omitted ...
702    /// }
703    /// ```
704    #[derive(Clone, Debug)]
705    pub struct DropDatabase(RequestBuilder<crate::model::DropDatabaseRequest>);
706
707    impl DropDatabase {
708        pub(crate) fn new(
709            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
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::DropDatabaseRequest>>(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<crate::RequestOptions>>(mut self, v: V) -> Self {
722            self.0.options = v.into();
723            self
724        }
725
726        /// Sends the request.
727        pub async fn send(self) -> Result<()> {
728            (*self.0.stub)
729                .drop_database(self.0.request, self.0.options)
730                .await
731                .map(crate::Response::into_body)
732        }
733
734        /// Sets the value of [database][crate::model::DropDatabaseRequest::database].
735        ///
736        /// This is a **required** field for requests.
737        pub fn set_database<T: Into<std::string::String>>(mut self, v: T) -> Self {
738            self.0.request.database = v.into();
739            self
740        }
741    }
742
743    #[doc(hidden)]
744    impl crate::RequestBuilder for DropDatabase {
745        fn request_options(&mut self) -> &mut crate::RequestOptions {
746            &mut self.0.options
747        }
748    }
749
750    /// The request builder for [DatabaseAdmin::get_database_ddl][crate::client::DatabaseAdmin::get_database_ddl] calls.
751    ///
752    /// # Example
753    /// ```
754    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::GetDatabaseDdl;
755    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
756    ///
757    /// let builder = prepare_request_builder();
758    /// let response = builder.send().await?;
759    /// # Ok(()) }
760    ///
761    /// fn prepare_request_builder() -> GetDatabaseDdl {
762    ///   # panic!();
763    ///   // ... details omitted ...
764    /// }
765    /// ```
766    #[derive(Clone, Debug)]
767    pub struct GetDatabaseDdl(RequestBuilder<crate::model::GetDatabaseDdlRequest>);
768
769    impl GetDatabaseDdl {
770        pub(crate) fn new(
771            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
772        ) -> Self {
773            Self(RequestBuilder::new(stub))
774        }
775
776        /// Sets the full request, replacing any prior values.
777        pub fn with_request<V: Into<crate::model::GetDatabaseDdlRequest>>(mut self, v: V) -> Self {
778            self.0.request = v.into();
779            self
780        }
781
782        /// Sets all the options, replacing any prior values.
783        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
784            self.0.options = v.into();
785            self
786        }
787
788        /// Sends the request.
789        pub async fn send(self) -> Result<crate::model::GetDatabaseDdlResponse> {
790            (*self.0.stub)
791                .get_database_ddl(self.0.request, self.0.options)
792                .await
793                .map(crate::Response::into_body)
794        }
795
796        /// Sets the value of [database][crate::model::GetDatabaseDdlRequest::database].
797        ///
798        /// This is a **required** field for requests.
799        pub fn set_database<T: Into<std::string::String>>(mut self, v: T) -> Self {
800            self.0.request.database = v.into();
801            self
802        }
803    }
804
805    #[doc(hidden)]
806    impl crate::RequestBuilder for GetDatabaseDdl {
807        fn request_options(&mut self) -> &mut crate::RequestOptions {
808            &mut self.0.options
809        }
810    }
811
812    /// The request builder for [DatabaseAdmin::set_iam_policy][crate::client::DatabaseAdmin::set_iam_policy] calls.
813    ///
814    /// # Example
815    /// ```
816    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::SetIamPolicy;
817    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
818    ///
819    /// let builder = prepare_request_builder();
820    /// let response = builder.send().await?;
821    /// # Ok(()) }
822    ///
823    /// fn prepare_request_builder() -> SetIamPolicy {
824    ///   # panic!();
825    ///   // ... details omitted ...
826    /// }
827    /// ```
828    #[derive(Clone, Debug)]
829    pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
830
831    impl SetIamPolicy {
832        pub(crate) fn new(
833            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
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<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
840            mut self,
841            v: V,
842        ) -> Self {
843            self.0.request = v.into();
844            self
845        }
846
847        /// Sets all the options, replacing any prior values.
848        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
849            self.0.options = v.into();
850            self
851        }
852
853        /// Sends the request.
854        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
855            (*self.0.stub)
856                .set_iam_policy(self.0.request, self.0.options)
857                .await
858                .map(crate::Response::into_body)
859        }
860
861        /// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
862        ///
863        /// This is a **required** field for requests.
864        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
865            self.0.request.resource = v.into();
866            self
867        }
868
869        /// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
870        ///
871        /// This is a **required** field for requests.
872        pub fn set_policy<T>(mut self, v: T) -> Self
873        where
874            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
875        {
876            self.0.request.policy = std::option::Option::Some(v.into());
877            self
878        }
879
880        /// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
881        ///
882        /// This is a **required** field for requests.
883        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
884        where
885            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
886        {
887            self.0.request.policy = v.map(|x| x.into());
888            self
889        }
890
891        /// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
892        pub fn set_update_mask<T>(mut self, v: T) -> Self
893        where
894            T: std::convert::Into<wkt::FieldMask>,
895        {
896            self.0.request.update_mask = std::option::Option::Some(v.into());
897            self
898        }
899
900        /// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
901        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
902        where
903            T: std::convert::Into<wkt::FieldMask>,
904        {
905            self.0.request.update_mask = v.map(|x| x.into());
906            self
907        }
908    }
909
910    #[doc(hidden)]
911    impl crate::RequestBuilder for SetIamPolicy {
912        fn request_options(&mut self) -> &mut crate::RequestOptions {
913            &mut self.0.options
914        }
915    }
916
917    /// The request builder for [DatabaseAdmin::get_iam_policy][crate::client::DatabaseAdmin::get_iam_policy] calls.
918    ///
919    /// # Example
920    /// ```
921    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::GetIamPolicy;
922    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
923    ///
924    /// let builder = prepare_request_builder();
925    /// let response = builder.send().await?;
926    /// # Ok(()) }
927    ///
928    /// fn prepare_request_builder() -> GetIamPolicy {
929    ///   # panic!();
930    ///   // ... details omitted ...
931    /// }
932    /// ```
933    #[derive(Clone, Debug)]
934    pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
935
936    impl GetIamPolicy {
937        pub(crate) fn new(
938            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
939        ) -> Self {
940            Self(RequestBuilder::new(stub))
941        }
942
943        /// Sets the full request, replacing any prior values.
944        pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
945            mut self,
946            v: V,
947        ) -> Self {
948            self.0.request = v.into();
949            self
950        }
951
952        /// Sets all the options, replacing any prior values.
953        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
954            self.0.options = v.into();
955            self
956        }
957
958        /// Sends the request.
959        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
960            (*self.0.stub)
961                .get_iam_policy(self.0.request, self.0.options)
962                .await
963                .map(crate::Response::into_body)
964        }
965
966        /// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
967        ///
968        /// This is a **required** field for requests.
969        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
970            self.0.request.resource = v.into();
971            self
972        }
973
974        /// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
975        pub fn set_options<T>(mut self, v: T) -> Self
976        where
977            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
978        {
979            self.0.request.options = std::option::Option::Some(v.into());
980            self
981        }
982
983        /// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
984        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
985        where
986            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
987        {
988            self.0.request.options = v.map(|x| x.into());
989            self
990        }
991    }
992
993    #[doc(hidden)]
994    impl crate::RequestBuilder for GetIamPolicy {
995        fn request_options(&mut self) -> &mut crate::RequestOptions {
996            &mut self.0.options
997        }
998    }
999
1000    /// The request builder for [DatabaseAdmin::test_iam_permissions][crate::client::DatabaseAdmin::test_iam_permissions] calls.
1001    ///
1002    /// # Example
1003    /// ```
1004    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::TestIamPermissions;
1005    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
1006    ///
1007    /// let builder = prepare_request_builder();
1008    /// let response = builder.send().await?;
1009    /// # Ok(()) }
1010    ///
1011    /// fn prepare_request_builder() -> TestIamPermissions {
1012    ///   # panic!();
1013    ///   // ... details omitted ...
1014    /// }
1015    /// ```
1016    #[derive(Clone, Debug)]
1017    pub struct TestIamPermissions(
1018        RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
1019    );
1020
1021    impl TestIamPermissions {
1022        pub(crate) fn new(
1023            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1024        ) -> Self {
1025            Self(RequestBuilder::new(stub))
1026        }
1027
1028        /// Sets the full request, replacing any prior values.
1029        pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
1030            mut self,
1031            v: V,
1032        ) -> Self {
1033            self.0.request = v.into();
1034            self
1035        }
1036
1037        /// Sets all the options, replacing any prior values.
1038        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1039            self.0.options = v.into();
1040            self
1041        }
1042
1043        /// Sends the request.
1044        pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
1045            (*self.0.stub)
1046                .test_iam_permissions(self.0.request, self.0.options)
1047                .await
1048                .map(crate::Response::into_body)
1049        }
1050
1051        /// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
1052        ///
1053        /// This is a **required** field for requests.
1054        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1055            self.0.request.resource = v.into();
1056            self
1057        }
1058
1059        /// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
1060        ///
1061        /// This is a **required** field for requests.
1062        pub fn set_permissions<T, V>(mut self, v: T) -> Self
1063        where
1064            T: std::iter::IntoIterator<Item = V>,
1065            V: std::convert::Into<std::string::String>,
1066        {
1067            use std::iter::Iterator;
1068            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1069            self
1070        }
1071    }
1072
1073    #[doc(hidden)]
1074    impl crate::RequestBuilder for TestIamPermissions {
1075        fn request_options(&mut self) -> &mut crate::RequestOptions {
1076            &mut self.0.options
1077        }
1078    }
1079
1080    /// The request builder for [DatabaseAdmin::create_backup][crate::client::DatabaseAdmin::create_backup] calls.
1081    ///
1082    /// # Example
1083    /// ```
1084    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::CreateBackup;
1085    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
1086    /// use google_cloud_lro::Poller;
1087    ///
1088    /// let builder = prepare_request_builder();
1089    /// let response = builder.poller().until_done().await?;
1090    /// # Ok(()) }
1091    ///
1092    /// fn prepare_request_builder() -> CreateBackup {
1093    ///   # panic!();
1094    ///   // ... details omitted ...
1095    /// }
1096    /// ```
1097    #[derive(Clone, Debug)]
1098    pub struct CreateBackup(RequestBuilder<crate::model::CreateBackupRequest>);
1099
1100    impl CreateBackup {
1101        pub(crate) fn new(
1102            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1103        ) -> Self {
1104            Self(RequestBuilder::new(stub))
1105        }
1106
1107        /// Sets the full request, replacing any prior values.
1108        pub fn with_request<V: Into<crate::model::CreateBackupRequest>>(mut self, v: V) -> Self {
1109            self.0.request = v.into();
1110            self
1111        }
1112
1113        /// Sets all the options, replacing any prior values.
1114        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1115            self.0.options = v.into();
1116            self
1117        }
1118
1119        /// Sends the request.
1120        ///
1121        /// # Long running operations
1122        ///
1123        /// This starts, but does not poll, a longrunning operation. More information
1124        /// on [create_backup][crate::client::DatabaseAdmin::create_backup].
1125        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1126            (*self.0.stub)
1127                .create_backup(self.0.request, self.0.options)
1128                .await
1129                .map(crate::Response::into_body)
1130        }
1131
1132        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_backup`.
1133        pub fn poller(
1134            self,
1135        ) -> impl google_cloud_lro::Poller<crate::model::Backup, crate::model::CreateBackupMetadata>
1136        {
1137            type Operation = google_cloud_lro::internal::Operation<
1138                crate::model::Backup,
1139                crate::model::CreateBackupMetadata,
1140            >;
1141            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1142            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1143
1144            let stub = self.0.stub.clone();
1145            let mut options = self.0.options.clone();
1146            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1147            let query = move |name| {
1148                let stub = stub.clone();
1149                let options = options.clone();
1150                async {
1151                    let op = GetOperation::new(stub)
1152                        .set_name(name)
1153                        .with_options(options)
1154                        .send()
1155                        .await?;
1156                    Ok(Operation::new(op))
1157                }
1158            };
1159
1160            let start = move || async {
1161                let op = self.send().await?;
1162                Ok(Operation::new(op))
1163            };
1164
1165            google_cloud_lro::internal::new_poller(
1166                polling_error_policy,
1167                polling_backoff_policy,
1168                start,
1169                query,
1170            )
1171        }
1172
1173        /// Sets the value of [parent][crate::model::CreateBackupRequest::parent].
1174        ///
1175        /// This is a **required** field for requests.
1176        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1177            self.0.request.parent = v.into();
1178            self
1179        }
1180
1181        /// Sets the value of [backup_id][crate::model::CreateBackupRequest::backup_id].
1182        ///
1183        /// This is a **required** field for requests.
1184        pub fn set_backup_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1185            self.0.request.backup_id = v.into();
1186            self
1187        }
1188
1189        /// Sets the value of [backup][crate::model::CreateBackupRequest::backup].
1190        ///
1191        /// This is a **required** field for requests.
1192        pub fn set_backup<T>(mut self, v: T) -> Self
1193        where
1194            T: std::convert::Into<crate::model::Backup>,
1195        {
1196            self.0.request.backup = std::option::Option::Some(v.into());
1197            self
1198        }
1199
1200        /// Sets or clears the value of [backup][crate::model::CreateBackupRequest::backup].
1201        ///
1202        /// This is a **required** field for requests.
1203        pub fn set_or_clear_backup<T>(mut self, v: std::option::Option<T>) -> Self
1204        where
1205            T: std::convert::Into<crate::model::Backup>,
1206        {
1207            self.0.request.backup = v.map(|x| x.into());
1208            self
1209        }
1210
1211        /// Sets the value of [encryption_config][crate::model::CreateBackupRequest::encryption_config].
1212        pub fn set_encryption_config<T>(mut self, v: T) -> Self
1213        where
1214            T: std::convert::Into<crate::model::CreateBackupEncryptionConfig>,
1215        {
1216            self.0.request.encryption_config = std::option::Option::Some(v.into());
1217            self
1218        }
1219
1220        /// Sets or clears the value of [encryption_config][crate::model::CreateBackupRequest::encryption_config].
1221        pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
1222        where
1223            T: std::convert::Into<crate::model::CreateBackupEncryptionConfig>,
1224        {
1225            self.0.request.encryption_config = v.map(|x| x.into());
1226            self
1227        }
1228    }
1229
1230    #[doc(hidden)]
1231    impl crate::RequestBuilder for CreateBackup {
1232        fn request_options(&mut self) -> &mut crate::RequestOptions {
1233            &mut self.0.options
1234        }
1235    }
1236
1237    /// The request builder for [DatabaseAdmin::copy_backup][crate::client::DatabaseAdmin::copy_backup] calls.
1238    ///
1239    /// # Example
1240    /// ```
1241    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::CopyBackup;
1242    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
1243    /// use google_cloud_lro::Poller;
1244    ///
1245    /// let builder = prepare_request_builder();
1246    /// let response = builder.poller().until_done().await?;
1247    /// # Ok(()) }
1248    ///
1249    /// fn prepare_request_builder() -> CopyBackup {
1250    ///   # panic!();
1251    ///   // ... details omitted ...
1252    /// }
1253    /// ```
1254    #[derive(Clone, Debug)]
1255    pub struct CopyBackup(RequestBuilder<crate::model::CopyBackupRequest>);
1256
1257    impl CopyBackup {
1258        pub(crate) fn new(
1259            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1260        ) -> Self {
1261            Self(RequestBuilder::new(stub))
1262        }
1263
1264        /// Sets the full request, replacing any prior values.
1265        pub fn with_request<V: Into<crate::model::CopyBackupRequest>>(mut self, v: V) -> Self {
1266            self.0.request = v.into();
1267            self
1268        }
1269
1270        /// Sets all the options, replacing any prior values.
1271        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1272            self.0.options = v.into();
1273            self
1274        }
1275
1276        /// Sends the request.
1277        ///
1278        /// # Long running operations
1279        ///
1280        /// This starts, but does not poll, a longrunning operation. More information
1281        /// on [copy_backup][crate::client::DatabaseAdmin::copy_backup].
1282        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1283            (*self.0.stub)
1284                .copy_backup(self.0.request, self.0.options)
1285                .await
1286                .map(crate::Response::into_body)
1287        }
1288
1289        /// Creates a [Poller][google_cloud_lro::Poller] to work with `copy_backup`.
1290        pub fn poller(
1291            self,
1292        ) -> impl google_cloud_lro::Poller<crate::model::Backup, crate::model::CopyBackupMetadata>
1293        {
1294            type Operation = google_cloud_lro::internal::Operation<
1295                crate::model::Backup,
1296                crate::model::CopyBackupMetadata,
1297            >;
1298            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1299            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1300
1301            let stub = self.0.stub.clone();
1302            let mut options = self.0.options.clone();
1303            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1304            let query = move |name| {
1305                let stub = stub.clone();
1306                let options = options.clone();
1307                async {
1308                    let op = GetOperation::new(stub)
1309                        .set_name(name)
1310                        .with_options(options)
1311                        .send()
1312                        .await?;
1313                    Ok(Operation::new(op))
1314                }
1315            };
1316
1317            let start = move || async {
1318                let op = self.send().await?;
1319                Ok(Operation::new(op))
1320            };
1321
1322            google_cloud_lro::internal::new_poller(
1323                polling_error_policy,
1324                polling_backoff_policy,
1325                start,
1326                query,
1327            )
1328        }
1329
1330        /// Sets the value of [parent][crate::model::CopyBackupRequest::parent].
1331        ///
1332        /// This is a **required** field for requests.
1333        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1334            self.0.request.parent = v.into();
1335            self
1336        }
1337
1338        /// Sets the value of [backup_id][crate::model::CopyBackupRequest::backup_id].
1339        ///
1340        /// This is a **required** field for requests.
1341        pub fn set_backup_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1342            self.0.request.backup_id = v.into();
1343            self
1344        }
1345
1346        /// Sets the value of [source_backup][crate::model::CopyBackupRequest::source_backup].
1347        ///
1348        /// This is a **required** field for requests.
1349        pub fn set_source_backup<T: Into<std::string::String>>(mut self, v: T) -> Self {
1350            self.0.request.source_backup = v.into();
1351            self
1352        }
1353
1354        /// Sets the value of [expire_time][crate::model::CopyBackupRequest::expire_time].
1355        ///
1356        /// This is a **required** field for requests.
1357        pub fn set_expire_time<T>(mut self, v: T) -> Self
1358        where
1359            T: std::convert::Into<wkt::Timestamp>,
1360        {
1361            self.0.request.expire_time = std::option::Option::Some(v.into());
1362            self
1363        }
1364
1365        /// Sets or clears the value of [expire_time][crate::model::CopyBackupRequest::expire_time].
1366        ///
1367        /// This is a **required** field for requests.
1368        pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
1369        where
1370            T: std::convert::Into<wkt::Timestamp>,
1371        {
1372            self.0.request.expire_time = v.map(|x| x.into());
1373            self
1374        }
1375
1376        /// Sets the value of [encryption_config][crate::model::CopyBackupRequest::encryption_config].
1377        pub fn set_encryption_config<T>(mut self, v: T) -> Self
1378        where
1379            T: std::convert::Into<crate::model::CopyBackupEncryptionConfig>,
1380        {
1381            self.0.request.encryption_config = std::option::Option::Some(v.into());
1382            self
1383        }
1384
1385        /// Sets or clears the value of [encryption_config][crate::model::CopyBackupRequest::encryption_config].
1386        pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
1387        where
1388            T: std::convert::Into<crate::model::CopyBackupEncryptionConfig>,
1389        {
1390            self.0.request.encryption_config = v.map(|x| x.into());
1391            self
1392        }
1393    }
1394
1395    #[doc(hidden)]
1396    impl crate::RequestBuilder for CopyBackup {
1397        fn request_options(&mut self) -> &mut crate::RequestOptions {
1398            &mut self.0.options
1399        }
1400    }
1401
1402    /// The request builder for [DatabaseAdmin::get_backup][crate::client::DatabaseAdmin::get_backup] calls.
1403    ///
1404    /// # Example
1405    /// ```
1406    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::GetBackup;
1407    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
1408    ///
1409    /// let builder = prepare_request_builder();
1410    /// let response = builder.send().await?;
1411    /// # Ok(()) }
1412    ///
1413    /// fn prepare_request_builder() -> GetBackup {
1414    ///   # panic!();
1415    ///   // ... details omitted ...
1416    /// }
1417    /// ```
1418    #[derive(Clone, Debug)]
1419    pub struct GetBackup(RequestBuilder<crate::model::GetBackupRequest>);
1420
1421    impl GetBackup {
1422        pub(crate) fn new(
1423            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1424        ) -> Self {
1425            Self(RequestBuilder::new(stub))
1426        }
1427
1428        /// Sets the full request, replacing any prior values.
1429        pub fn with_request<V: Into<crate::model::GetBackupRequest>>(mut self, v: V) -> Self {
1430            self.0.request = v.into();
1431            self
1432        }
1433
1434        /// Sets all the options, replacing any prior values.
1435        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1436            self.0.options = v.into();
1437            self
1438        }
1439
1440        /// Sends the request.
1441        pub async fn send(self) -> Result<crate::model::Backup> {
1442            (*self.0.stub)
1443                .get_backup(self.0.request, self.0.options)
1444                .await
1445                .map(crate::Response::into_body)
1446        }
1447
1448        /// Sets the value of [name][crate::model::GetBackupRequest::name].
1449        ///
1450        /// This is a **required** field for requests.
1451        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1452            self.0.request.name = v.into();
1453            self
1454        }
1455    }
1456
1457    #[doc(hidden)]
1458    impl crate::RequestBuilder for GetBackup {
1459        fn request_options(&mut self) -> &mut crate::RequestOptions {
1460            &mut self.0.options
1461        }
1462    }
1463
1464    /// The request builder for [DatabaseAdmin::update_backup][crate::client::DatabaseAdmin::update_backup] calls.
1465    ///
1466    /// # Example
1467    /// ```
1468    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::UpdateBackup;
1469    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
1470    ///
1471    /// let builder = prepare_request_builder();
1472    /// let response = builder.send().await?;
1473    /// # Ok(()) }
1474    ///
1475    /// fn prepare_request_builder() -> UpdateBackup {
1476    ///   # panic!();
1477    ///   // ... details omitted ...
1478    /// }
1479    /// ```
1480    #[derive(Clone, Debug)]
1481    pub struct UpdateBackup(RequestBuilder<crate::model::UpdateBackupRequest>);
1482
1483    impl UpdateBackup {
1484        pub(crate) fn new(
1485            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1486        ) -> 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::UpdateBackupRequest>>(mut self, v: V) -> Self {
1492            self.0.request = v.into();
1493            self
1494        }
1495
1496        /// Sets all the options, replacing any prior values.
1497        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1498            self.0.options = v.into();
1499            self
1500        }
1501
1502        /// Sends the request.
1503        pub async fn send(self) -> Result<crate::model::Backup> {
1504            (*self.0.stub)
1505                .update_backup(self.0.request, self.0.options)
1506                .await
1507                .map(crate::Response::into_body)
1508        }
1509
1510        /// Sets the value of [backup][crate::model::UpdateBackupRequest::backup].
1511        ///
1512        /// This is a **required** field for requests.
1513        pub fn set_backup<T>(mut self, v: T) -> Self
1514        where
1515            T: std::convert::Into<crate::model::Backup>,
1516        {
1517            self.0.request.backup = std::option::Option::Some(v.into());
1518            self
1519        }
1520
1521        /// Sets or clears the value of [backup][crate::model::UpdateBackupRequest::backup].
1522        ///
1523        /// This is a **required** field for requests.
1524        pub fn set_or_clear_backup<T>(mut self, v: std::option::Option<T>) -> Self
1525        where
1526            T: std::convert::Into<crate::model::Backup>,
1527        {
1528            self.0.request.backup = v.map(|x| x.into());
1529            self
1530        }
1531
1532        /// Sets the value of [update_mask][crate::model::UpdateBackupRequest::update_mask].
1533        ///
1534        /// This is a **required** field for requests.
1535        pub fn set_update_mask<T>(mut self, v: T) -> Self
1536        where
1537            T: std::convert::Into<wkt::FieldMask>,
1538        {
1539            self.0.request.update_mask = std::option::Option::Some(v.into());
1540            self
1541        }
1542
1543        /// Sets or clears the value of [update_mask][crate::model::UpdateBackupRequest::update_mask].
1544        ///
1545        /// This is a **required** field for requests.
1546        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1547        where
1548            T: std::convert::Into<wkt::FieldMask>,
1549        {
1550            self.0.request.update_mask = v.map(|x| x.into());
1551            self
1552        }
1553    }
1554
1555    #[doc(hidden)]
1556    impl crate::RequestBuilder for UpdateBackup {
1557        fn request_options(&mut self) -> &mut crate::RequestOptions {
1558            &mut self.0.options
1559        }
1560    }
1561
1562    /// The request builder for [DatabaseAdmin::delete_backup][crate::client::DatabaseAdmin::delete_backup] calls.
1563    ///
1564    /// # Example
1565    /// ```
1566    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::DeleteBackup;
1567    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
1568    ///
1569    /// let builder = prepare_request_builder();
1570    /// let response = builder.send().await?;
1571    /// # Ok(()) }
1572    ///
1573    /// fn prepare_request_builder() -> DeleteBackup {
1574    ///   # panic!();
1575    ///   // ... details omitted ...
1576    /// }
1577    /// ```
1578    #[derive(Clone, Debug)]
1579    pub struct DeleteBackup(RequestBuilder<crate::model::DeleteBackupRequest>);
1580
1581    impl DeleteBackup {
1582        pub(crate) fn new(
1583            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1584        ) -> Self {
1585            Self(RequestBuilder::new(stub))
1586        }
1587
1588        /// Sets the full request, replacing any prior values.
1589        pub fn with_request<V: Into<crate::model::DeleteBackupRequest>>(mut self, v: V) -> Self {
1590            self.0.request = v.into();
1591            self
1592        }
1593
1594        /// Sets all the options, replacing any prior values.
1595        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1596            self.0.options = v.into();
1597            self
1598        }
1599
1600        /// Sends the request.
1601        pub async fn send(self) -> Result<()> {
1602            (*self.0.stub)
1603                .delete_backup(self.0.request, self.0.options)
1604                .await
1605                .map(crate::Response::into_body)
1606        }
1607
1608        /// Sets the value of [name][crate::model::DeleteBackupRequest::name].
1609        ///
1610        /// This is a **required** field for requests.
1611        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1612            self.0.request.name = v.into();
1613            self
1614        }
1615    }
1616
1617    #[doc(hidden)]
1618    impl crate::RequestBuilder for DeleteBackup {
1619        fn request_options(&mut self) -> &mut crate::RequestOptions {
1620            &mut self.0.options
1621        }
1622    }
1623
1624    /// The request builder for [DatabaseAdmin::list_backups][crate::client::DatabaseAdmin::list_backups] calls.
1625    ///
1626    /// # Example
1627    /// ```
1628    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::ListBackups;
1629    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
1630    /// use google_cloud_gax::paginator::ItemPaginator;
1631    ///
1632    /// let builder = prepare_request_builder();
1633    /// let mut items = builder.by_item();
1634    /// while let Some(result) = items.next().await {
1635    ///   let item = result?;
1636    /// }
1637    /// # Ok(()) }
1638    ///
1639    /// fn prepare_request_builder() -> ListBackups {
1640    ///   # panic!();
1641    ///   // ... details omitted ...
1642    /// }
1643    /// ```
1644    #[derive(Clone, Debug)]
1645    pub struct ListBackups(RequestBuilder<crate::model::ListBackupsRequest>);
1646
1647    impl ListBackups {
1648        pub(crate) fn new(
1649            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1650        ) -> Self {
1651            Self(RequestBuilder::new(stub))
1652        }
1653
1654        /// Sets the full request, replacing any prior values.
1655        pub fn with_request<V: Into<crate::model::ListBackupsRequest>>(mut self, v: V) -> Self {
1656            self.0.request = v.into();
1657            self
1658        }
1659
1660        /// Sets all the options, replacing any prior values.
1661        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1662            self.0.options = v.into();
1663            self
1664        }
1665
1666        /// Sends the request.
1667        pub async fn send(self) -> Result<crate::model::ListBackupsResponse> {
1668            (*self.0.stub)
1669                .list_backups(self.0.request, self.0.options)
1670                .await
1671                .map(crate::Response::into_body)
1672        }
1673
1674        /// Streams each page in the collection.
1675        pub fn by_page(
1676            self,
1677        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListBackupsResponse, crate::Error>
1678        {
1679            use std::clone::Clone;
1680            let token = self.0.request.page_token.clone();
1681            let execute = move |token: String| {
1682                let mut builder = self.clone();
1683                builder.0.request = builder.0.request.set_page_token(token);
1684                builder.send()
1685            };
1686            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1687        }
1688
1689        /// Streams each item in the collection.
1690        pub fn by_item(
1691            self,
1692        ) -> impl google_cloud_gax::paginator::ItemPaginator<
1693            crate::model::ListBackupsResponse,
1694            crate::Error,
1695        > {
1696            use google_cloud_gax::paginator::Paginator;
1697            self.by_page().items()
1698        }
1699
1700        /// Sets the value of [parent][crate::model::ListBackupsRequest::parent].
1701        ///
1702        /// This is a **required** field for requests.
1703        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1704            self.0.request.parent = v.into();
1705            self
1706        }
1707
1708        /// Sets the value of [filter][crate::model::ListBackupsRequest::filter].
1709        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1710            self.0.request.filter = v.into();
1711            self
1712        }
1713
1714        /// Sets the value of [page_size][crate::model::ListBackupsRequest::page_size].
1715        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1716            self.0.request.page_size = v.into();
1717            self
1718        }
1719
1720        /// Sets the value of [page_token][crate::model::ListBackupsRequest::page_token].
1721        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1722            self.0.request.page_token = v.into();
1723            self
1724        }
1725    }
1726
1727    #[doc(hidden)]
1728    impl crate::RequestBuilder for ListBackups {
1729        fn request_options(&mut self) -> &mut crate::RequestOptions {
1730            &mut self.0.options
1731        }
1732    }
1733
1734    /// The request builder for [DatabaseAdmin::restore_database][crate::client::DatabaseAdmin::restore_database] calls.
1735    ///
1736    /// # Example
1737    /// ```
1738    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::RestoreDatabase;
1739    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
1740    /// use google_cloud_lro::Poller;
1741    ///
1742    /// let builder = prepare_request_builder();
1743    /// let response = builder.poller().until_done().await?;
1744    /// # Ok(()) }
1745    ///
1746    /// fn prepare_request_builder() -> RestoreDatabase {
1747    ///   # panic!();
1748    ///   // ... details omitted ...
1749    /// }
1750    /// ```
1751    #[derive(Clone, Debug)]
1752    pub struct RestoreDatabase(RequestBuilder<crate::model::RestoreDatabaseRequest>);
1753
1754    impl RestoreDatabase {
1755        pub(crate) fn new(
1756            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1757        ) -> Self {
1758            Self(RequestBuilder::new(stub))
1759        }
1760
1761        /// Sets the full request, replacing any prior values.
1762        pub fn with_request<V: Into<crate::model::RestoreDatabaseRequest>>(mut self, v: V) -> Self {
1763            self.0.request = v.into();
1764            self
1765        }
1766
1767        /// Sets all the options, replacing any prior values.
1768        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1769            self.0.options = v.into();
1770            self
1771        }
1772
1773        /// Sends the request.
1774        ///
1775        /// # Long running operations
1776        ///
1777        /// This starts, but does not poll, a longrunning operation. More information
1778        /// on [restore_database][crate::client::DatabaseAdmin::restore_database].
1779        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1780            (*self.0.stub)
1781                .restore_database(self.0.request, self.0.options)
1782                .await
1783                .map(crate::Response::into_body)
1784        }
1785
1786        /// Creates a [Poller][google_cloud_lro::Poller] to work with `restore_database`.
1787        pub fn poller(
1788            self,
1789        ) -> impl google_cloud_lro::Poller<crate::model::Database, crate::model::RestoreDatabaseMetadata>
1790        {
1791            type Operation = google_cloud_lro::internal::Operation<
1792                crate::model::Database,
1793                crate::model::RestoreDatabaseMetadata,
1794            >;
1795            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1796            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1797
1798            let stub = self.0.stub.clone();
1799            let mut options = self.0.options.clone();
1800            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1801            let query = move |name| {
1802                let stub = stub.clone();
1803                let options = options.clone();
1804                async {
1805                    let op = GetOperation::new(stub)
1806                        .set_name(name)
1807                        .with_options(options)
1808                        .send()
1809                        .await?;
1810                    Ok(Operation::new(op))
1811                }
1812            };
1813
1814            let start = move || async {
1815                let op = self.send().await?;
1816                Ok(Operation::new(op))
1817            };
1818
1819            google_cloud_lro::internal::new_poller(
1820                polling_error_policy,
1821                polling_backoff_policy,
1822                start,
1823                query,
1824            )
1825        }
1826
1827        /// Sets the value of [parent][crate::model::RestoreDatabaseRequest::parent].
1828        ///
1829        /// This is a **required** field for requests.
1830        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1831            self.0.request.parent = v.into();
1832            self
1833        }
1834
1835        /// Sets the value of [database_id][crate::model::RestoreDatabaseRequest::database_id].
1836        ///
1837        /// This is a **required** field for requests.
1838        pub fn set_database_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1839            self.0.request.database_id = v.into();
1840            self
1841        }
1842
1843        /// Sets the value of [encryption_config][crate::model::RestoreDatabaseRequest::encryption_config].
1844        pub fn set_encryption_config<T>(mut self, v: T) -> Self
1845        where
1846            T: std::convert::Into<crate::model::RestoreDatabaseEncryptionConfig>,
1847        {
1848            self.0.request.encryption_config = std::option::Option::Some(v.into());
1849            self
1850        }
1851
1852        /// Sets or clears the value of [encryption_config][crate::model::RestoreDatabaseRequest::encryption_config].
1853        pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
1854        where
1855            T: std::convert::Into<crate::model::RestoreDatabaseEncryptionConfig>,
1856        {
1857            self.0.request.encryption_config = v.map(|x| x.into());
1858            self
1859        }
1860
1861        /// Sets the value of [source][crate::model::RestoreDatabaseRequest::source].
1862        ///
1863        /// Note that all the setters affecting `source` are
1864        /// mutually exclusive.
1865        pub fn set_source<T: Into<Option<crate::model::restore_database_request::Source>>>(
1866            mut self,
1867            v: T,
1868        ) -> Self {
1869            self.0.request.source = v.into();
1870            self
1871        }
1872
1873        /// Sets the value of [source][crate::model::RestoreDatabaseRequest::source]
1874        /// to hold a `Backup`.
1875        ///
1876        /// Note that all the setters affecting `source` are
1877        /// mutually exclusive.
1878        pub fn set_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1879            self.0.request = self.0.request.set_backup(v);
1880            self
1881        }
1882    }
1883
1884    #[doc(hidden)]
1885    impl crate::RequestBuilder for RestoreDatabase {
1886        fn request_options(&mut self) -> &mut crate::RequestOptions {
1887            &mut self.0.options
1888        }
1889    }
1890
1891    /// The request builder for [DatabaseAdmin::list_database_operations][crate::client::DatabaseAdmin::list_database_operations] calls.
1892    ///
1893    /// # Example
1894    /// ```
1895    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::ListDatabaseOperations;
1896    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
1897    /// use google_cloud_gax::paginator::ItemPaginator;
1898    ///
1899    /// let builder = prepare_request_builder();
1900    /// let mut items = builder.by_item();
1901    /// while let Some(result) = items.next().await {
1902    ///   let item = result?;
1903    /// }
1904    /// # Ok(()) }
1905    ///
1906    /// fn prepare_request_builder() -> ListDatabaseOperations {
1907    ///   # panic!();
1908    ///   // ... details omitted ...
1909    /// }
1910    /// ```
1911    #[derive(Clone, Debug)]
1912    pub struct ListDatabaseOperations(RequestBuilder<crate::model::ListDatabaseOperationsRequest>);
1913
1914    impl ListDatabaseOperations {
1915        pub(crate) fn new(
1916            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
1917        ) -> Self {
1918            Self(RequestBuilder::new(stub))
1919        }
1920
1921        /// Sets the full request, replacing any prior values.
1922        pub fn with_request<V: Into<crate::model::ListDatabaseOperationsRequest>>(
1923            mut self,
1924            v: V,
1925        ) -> Self {
1926            self.0.request = v.into();
1927            self
1928        }
1929
1930        /// Sets all the options, replacing any prior values.
1931        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1932            self.0.options = v.into();
1933            self
1934        }
1935
1936        /// Sends the request.
1937        pub async fn send(self) -> Result<crate::model::ListDatabaseOperationsResponse> {
1938            (*self.0.stub)
1939                .list_database_operations(self.0.request, self.0.options)
1940                .await
1941                .map(crate::Response::into_body)
1942        }
1943
1944        /// Streams each page in the collection.
1945        pub fn by_page(
1946            self,
1947        ) -> impl google_cloud_gax::paginator::Paginator<
1948            crate::model::ListDatabaseOperationsResponse,
1949            crate::Error,
1950        > {
1951            use std::clone::Clone;
1952            let token = self.0.request.page_token.clone();
1953            let execute = move |token: String| {
1954                let mut builder = self.clone();
1955                builder.0.request = builder.0.request.set_page_token(token);
1956                builder.send()
1957            };
1958            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1959        }
1960
1961        /// Streams each item in the collection.
1962        pub fn by_item(
1963            self,
1964        ) -> impl google_cloud_gax::paginator::ItemPaginator<
1965            crate::model::ListDatabaseOperationsResponse,
1966            crate::Error,
1967        > {
1968            use google_cloud_gax::paginator::Paginator;
1969            self.by_page().items()
1970        }
1971
1972        /// Sets the value of [parent][crate::model::ListDatabaseOperationsRequest::parent].
1973        ///
1974        /// This is a **required** field for requests.
1975        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1976            self.0.request.parent = v.into();
1977            self
1978        }
1979
1980        /// Sets the value of [filter][crate::model::ListDatabaseOperationsRequest::filter].
1981        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1982            self.0.request.filter = v.into();
1983            self
1984        }
1985
1986        /// Sets the value of [page_size][crate::model::ListDatabaseOperationsRequest::page_size].
1987        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1988            self.0.request.page_size = v.into();
1989            self
1990        }
1991
1992        /// Sets the value of [page_token][crate::model::ListDatabaseOperationsRequest::page_token].
1993        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1994            self.0.request.page_token = v.into();
1995            self
1996        }
1997    }
1998
1999    #[doc(hidden)]
2000    impl crate::RequestBuilder for ListDatabaseOperations {
2001        fn request_options(&mut self) -> &mut crate::RequestOptions {
2002            &mut self.0.options
2003        }
2004    }
2005
2006    /// The request builder for [DatabaseAdmin::list_backup_operations][crate::client::DatabaseAdmin::list_backup_operations] calls.
2007    ///
2008    /// # Example
2009    /// ```
2010    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::ListBackupOperations;
2011    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
2012    /// use google_cloud_gax::paginator::ItemPaginator;
2013    ///
2014    /// let builder = prepare_request_builder();
2015    /// let mut items = builder.by_item();
2016    /// while let Some(result) = items.next().await {
2017    ///   let item = result?;
2018    /// }
2019    /// # Ok(()) }
2020    ///
2021    /// fn prepare_request_builder() -> ListBackupOperations {
2022    ///   # panic!();
2023    ///   // ... details omitted ...
2024    /// }
2025    /// ```
2026    #[derive(Clone, Debug)]
2027    pub struct ListBackupOperations(RequestBuilder<crate::model::ListBackupOperationsRequest>);
2028
2029    impl ListBackupOperations {
2030        pub(crate) fn new(
2031            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2032        ) -> Self {
2033            Self(RequestBuilder::new(stub))
2034        }
2035
2036        /// Sets the full request, replacing any prior values.
2037        pub fn with_request<V: Into<crate::model::ListBackupOperationsRequest>>(
2038            mut self,
2039            v: V,
2040        ) -> Self {
2041            self.0.request = v.into();
2042            self
2043        }
2044
2045        /// Sets all the options, replacing any prior values.
2046        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2047            self.0.options = v.into();
2048            self
2049        }
2050
2051        /// Sends the request.
2052        pub async fn send(self) -> Result<crate::model::ListBackupOperationsResponse> {
2053            (*self.0.stub)
2054                .list_backup_operations(self.0.request, self.0.options)
2055                .await
2056                .map(crate::Response::into_body)
2057        }
2058
2059        /// Streams each page in the collection.
2060        pub fn by_page(
2061            self,
2062        ) -> impl google_cloud_gax::paginator::Paginator<
2063            crate::model::ListBackupOperationsResponse,
2064            crate::Error,
2065        > {
2066            use std::clone::Clone;
2067            let token = self.0.request.page_token.clone();
2068            let execute = move |token: String| {
2069                let mut builder = self.clone();
2070                builder.0.request = builder.0.request.set_page_token(token);
2071                builder.send()
2072            };
2073            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2074        }
2075
2076        /// Streams each item in the collection.
2077        pub fn by_item(
2078            self,
2079        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2080            crate::model::ListBackupOperationsResponse,
2081            crate::Error,
2082        > {
2083            use google_cloud_gax::paginator::Paginator;
2084            self.by_page().items()
2085        }
2086
2087        /// Sets the value of [parent][crate::model::ListBackupOperationsRequest::parent].
2088        ///
2089        /// This is a **required** field for requests.
2090        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2091            self.0.request.parent = v.into();
2092            self
2093        }
2094
2095        /// Sets the value of [filter][crate::model::ListBackupOperationsRequest::filter].
2096        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2097            self.0.request.filter = v.into();
2098            self
2099        }
2100
2101        /// Sets the value of [page_size][crate::model::ListBackupOperationsRequest::page_size].
2102        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2103            self.0.request.page_size = v.into();
2104            self
2105        }
2106
2107        /// Sets the value of [page_token][crate::model::ListBackupOperationsRequest::page_token].
2108        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2109            self.0.request.page_token = v.into();
2110            self
2111        }
2112    }
2113
2114    #[doc(hidden)]
2115    impl crate::RequestBuilder for ListBackupOperations {
2116        fn request_options(&mut self) -> &mut crate::RequestOptions {
2117            &mut self.0.options
2118        }
2119    }
2120
2121    /// The request builder for [DatabaseAdmin::list_database_roles][crate::client::DatabaseAdmin::list_database_roles] calls.
2122    ///
2123    /// # Example
2124    /// ```
2125    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::ListDatabaseRoles;
2126    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
2127    /// use google_cloud_gax::paginator::ItemPaginator;
2128    ///
2129    /// let builder = prepare_request_builder();
2130    /// let mut items = builder.by_item();
2131    /// while let Some(result) = items.next().await {
2132    ///   let item = result?;
2133    /// }
2134    /// # Ok(()) }
2135    ///
2136    /// fn prepare_request_builder() -> ListDatabaseRoles {
2137    ///   # panic!();
2138    ///   // ... details omitted ...
2139    /// }
2140    /// ```
2141    #[derive(Clone, Debug)]
2142    pub struct ListDatabaseRoles(RequestBuilder<crate::model::ListDatabaseRolesRequest>);
2143
2144    impl ListDatabaseRoles {
2145        pub(crate) fn new(
2146            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2147        ) -> Self {
2148            Self(RequestBuilder::new(stub))
2149        }
2150
2151        /// Sets the full request, replacing any prior values.
2152        pub fn with_request<V: Into<crate::model::ListDatabaseRolesRequest>>(
2153            mut self,
2154            v: V,
2155        ) -> Self {
2156            self.0.request = v.into();
2157            self
2158        }
2159
2160        /// Sets all the options, replacing any prior values.
2161        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2162            self.0.options = v.into();
2163            self
2164        }
2165
2166        /// Sends the request.
2167        pub async fn send(self) -> Result<crate::model::ListDatabaseRolesResponse> {
2168            (*self.0.stub)
2169                .list_database_roles(self.0.request, self.0.options)
2170                .await
2171                .map(crate::Response::into_body)
2172        }
2173
2174        /// Streams each page in the collection.
2175        pub fn by_page(
2176            self,
2177        ) -> impl google_cloud_gax::paginator::Paginator<
2178            crate::model::ListDatabaseRolesResponse,
2179            crate::Error,
2180        > {
2181            use std::clone::Clone;
2182            let token = self.0.request.page_token.clone();
2183            let execute = move |token: String| {
2184                let mut builder = self.clone();
2185                builder.0.request = builder.0.request.set_page_token(token);
2186                builder.send()
2187            };
2188            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2189        }
2190
2191        /// Streams each item in the collection.
2192        pub fn by_item(
2193            self,
2194        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2195            crate::model::ListDatabaseRolesResponse,
2196            crate::Error,
2197        > {
2198            use google_cloud_gax::paginator::Paginator;
2199            self.by_page().items()
2200        }
2201
2202        /// Sets the value of [parent][crate::model::ListDatabaseRolesRequest::parent].
2203        ///
2204        /// This is a **required** field for requests.
2205        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2206            self.0.request.parent = v.into();
2207            self
2208        }
2209
2210        /// Sets the value of [page_size][crate::model::ListDatabaseRolesRequest::page_size].
2211        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2212            self.0.request.page_size = v.into();
2213            self
2214        }
2215
2216        /// Sets the value of [page_token][crate::model::ListDatabaseRolesRequest::page_token].
2217        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2218            self.0.request.page_token = v.into();
2219            self
2220        }
2221    }
2222
2223    #[doc(hidden)]
2224    impl crate::RequestBuilder for ListDatabaseRoles {
2225        fn request_options(&mut self) -> &mut crate::RequestOptions {
2226            &mut self.0.options
2227        }
2228    }
2229
2230    /// The request builder for [DatabaseAdmin::add_split_points][crate::client::DatabaseAdmin::add_split_points] calls.
2231    ///
2232    /// # Example
2233    /// ```
2234    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::AddSplitPoints;
2235    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
2236    ///
2237    /// let builder = prepare_request_builder();
2238    /// let response = builder.send().await?;
2239    /// # Ok(()) }
2240    ///
2241    /// fn prepare_request_builder() -> AddSplitPoints {
2242    ///   # panic!();
2243    ///   // ... details omitted ...
2244    /// }
2245    /// ```
2246    #[derive(Clone, Debug)]
2247    pub struct AddSplitPoints(RequestBuilder<crate::model::AddSplitPointsRequest>);
2248
2249    impl AddSplitPoints {
2250        pub(crate) fn new(
2251            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2252        ) -> Self {
2253            Self(RequestBuilder::new(stub))
2254        }
2255
2256        /// Sets the full request, replacing any prior values.
2257        pub fn with_request<V: Into<crate::model::AddSplitPointsRequest>>(mut self, v: V) -> Self {
2258            self.0.request = v.into();
2259            self
2260        }
2261
2262        /// Sets all the options, replacing any prior values.
2263        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2264            self.0.options = v.into();
2265            self
2266        }
2267
2268        /// Sends the request.
2269        pub async fn send(self) -> Result<crate::model::AddSplitPointsResponse> {
2270            (*self.0.stub)
2271                .add_split_points(self.0.request, self.0.options)
2272                .await
2273                .map(crate::Response::into_body)
2274        }
2275
2276        /// Sets the value of [database][crate::model::AddSplitPointsRequest::database].
2277        ///
2278        /// This is a **required** field for requests.
2279        pub fn set_database<T: Into<std::string::String>>(mut self, v: T) -> Self {
2280            self.0.request.database = v.into();
2281            self
2282        }
2283
2284        /// Sets the value of [split_points][crate::model::AddSplitPointsRequest::split_points].
2285        ///
2286        /// This is a **required** field for requests.
2287        pub fn set_split_points<T, V>(mut self, v: T) -> Self
2288        where
2289            T: std::iter::IntoIterator<Item = V>,
2290            V: std::convert::Into<crate::model::SplitPoints>,
2291        {
2292            use std::iter::Iterator;
2293            self.0.request.split_points = v.into_iter().map(|i| i.into()).collect();
2294            self
2295        }
2296
2297        /// Sets the value of [initiator][crate::model::AddSplitPointsRequest::initiator].
2298        pub fn set_initiator<T: Into<std::string::String>>(mut self, v: T) -> Self {
2299            self.0.request.initiator = v.into();
2300            self
2301        }
2302    }
2303
2304    #[doc(hidden)]
2305    impl crate::RequestBuilder for AddSplitPoints {
2306        fn request_options(&mut self) -> &mut crate::RequestOptions {
2307            &mut self.0.options
2308        }
2309    }
2310
2311    /// The request builder for [DatabaseAdmin::create_backup_schedule][crate::client::DatabaseAdmin::create_backup_schedule] calls.
2312    ///
2313    /// # Example
2314    /// ```
2315    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::CreateBackupSchedule;
2316    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
2317    ///
2318    /// let builder = prepare_request_builder();
2319    /// let response = builder.send().await?;
2320    /// # Ok(()) }
2321    ///
2322    /// fn prepare_request_builder() -> CreateBackupSchedule {
2323    ///   # panic!();
2324    ///   // ... details omitted ...
2325    /// }
2326    /// ```
2327    #[derive(Clone, Debug)]
2328    pub struct CreateBackupSchedule(RequestBuilder<crate::model::CreateBackupScheduleRequest>);
2329
2330    impl CreateBackupSchedule {
2331        pub(crate) fn new(
2332            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2333        ) -> Self {
2334            Self(RequestBuilder::new(stub))
2335        }
2336
2337        /// Sets the full request, replacing any prior values.
2338        pub fn with_request<V: Into<crate::model::CreateBackupScheduleRequest>>(
2339            mut self,
2340            v: V,
2341        ) -> Self {
2342            self.0.request = v.into();
2343            self
2344        }
2345
2346        /// Sets all the options, replacing any prior values.
2347        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2348            self.0.options = v.into();
2349            self
2350        }
2351
2352        /// Sends the request.
2353        pub async fn send(self) -> Result<crate::model::BackupSchedule> {
2354            (*self.0.stub)
2355                .create_backup_schedule(self.0.request, self.0.options)
2356                .await
2357                .map(crate::Response::into_body)
2358        }
2359
2360        /// Sets the value of [parent][crate::model::CreateBackupScheduleRequest::parent].
2361        ///
2362        /// This is a **required** field for requests.
2363        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2364            self.0.request.parent = v.into();
2365            self
2366        }
2367
2368        /// Sets the value of [backup_schedule_id][crate::model::CreateBackupScheduleRequest::backup_schedule_id].
2369        ///
2370        /// This is a **required** field for requests.
2371        pub fn set_backup_schedule_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2372            self.0.request.backup_schedule_id = v.into();
2373            self
2374        }
2375
2376        /// Sets the value of [backup_schedule][crate::model::CreateBackupScheduleRequest::backup_schedule].
2377        ///
2378        /// This is a **required** field for requests.
2379        pub fn set_backup_schedule<T>(mut self, v: T) -> Self
2380        where
2381            T: std::convert::Into<crate::model::BackupSchedule>,
2382        {
2383            self.0.request.backup_schedule = std::option::Option::Some(v.into());
2384            self
2385        }
2386
2387        /// Sets or clears the value of [backup_schedule][crate::model::CreateBackupScheduleRequest::backup_schedule].
2388        ///
2389        /// This is a **required** field for requests.
2390        pub fn set_or_clear_backup_schedule<T>(mut self, v: std::option::Option<T>) -> Self
2391        where
2392            T: std::convert::Into<crate::model::BackupSchedule>,
2393        {
2394            self.0.request.backup_schedule = v.map(|x| x.into());
2395            self
2396        }
2397    }
2398
2399    #[doc(hidden)]
2400    impl crate::RequestBuilder for CreateBackupSchedule {
2401        fn request_options(&mut self) -> &mut crate::RequestOptions {
2402            &mut self.0.options
2403        }
2404    }
2405
2406    /// The request builder for [DatabaseAdmin::get_backup_schedule][crate::client::DatabaseAdmin::get_backup_schedule] calls.
2407    ///
2408    /// # Example
2409    /// ```
2410    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::GetBackupSchedule;
2411    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
2412    ///
2413    /// let builder = prepare_request_builder();
2414    /// let response = builder.send().await?;
2415    /// # Ok(()) }
2416    ///
2417    /// fn prepare_request_builder() -> GetBackupSchedule {
2418    ///   # panic!();
2419    ///   // ... details omitted ...
2420    /// }
2421    /// ```
2422    #[derive(Clone, Debug)]
2423    pub struct GetBackupSchedule(RequestBuilder<crate::model::GetBackupScheduleRequest>);
2424
2425    impl GetBackupSchedule {
2426        pub(crate) fn new(
2427            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2428        ) -> Self {
2429            Self(RequestBuilder::new(stub))
2430        }
2431
2432        /// Sets the full request, replacing any prior values.
2433        pub fn with_request<V: Into<crate::model::GetBackupScheduleRequest>>(
2434            mut self,
2435            v: V,
2436        ) -> Self {
2437            self.0.request = v.into();
2438            self
2439        }
2440
2441        /// Sets all the options, replacing any prior values.
2442        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2443            self.0.options = v.into();
2444            self
2445        }
2446
2447        /// Sends the request.
2448        pub async fn send(self) -> Result<crate::model::BackupSchedule> {
2449            (*self.0.stub)
2450                .get_backup_schedule(self.0.request, self.0.options)
2451                .await
2452                .map(crate::Response::into_body)
2453        }
2454
2455        /// Sets the value of [name][crate::model::GetBackupScheduleRequest::name].
2456        ///
2457        /// This is a **required** field for requests.
2458        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2459            self.0.request.name = v.into();
2460            self
2461        }
2462    }
2463
2464    #[doc(hidden)]
2465    impl crate::RequestBuilder for GetBackupSchedule {
2466        fn request_options(&mut self) -> &mut crate::RequestOptions {
2467            &mut self.0.options
2468        }
2469    }
2470
2471    /// The request builder for [DatabaseAdmin::update_backup_schedule][crate::client::DatabaseAdmin::update_backup_schedule] calls.
2472    ///
2473    /// # Example
2474    /// ```
2475    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::UpdateBackupSchedule;
2476    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
2477    ///
2478    /// let builder = prepare_request_builder();
2479    /// let response = builder.send().await?;
2480    /// # Ok(()) }
2481    ///
2482    /// fn prepare_request_builder() -> UpdateBackupSchedule {
2483    ///   # panic!();
2484    ///   // ... details omitted ...
2485    /// }
2486    /// ```
2487    #[derive(Clone, Debug)]
2488    pub struct UpdateBackupSchedule(RequestBuilder<crate::model::UpdateBackupScheduleRequest>);
2489
2490    impl UpdateBackupSchedule {
2491        pub(crate) fn new(
2492            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2493        ) -> Self {
2494            Self(RequestBuilder::new(stub))
2495        }
2496
2497        /// Sets the full request, replacing any prior values.
2498        pub fn with_request<V: Into<crate::model::UpdateBackupScheduleRequest>>(
2499            mut self,
2500            v: V,
2501        ) -> Self {
2502            self.0.request = v.into();
2503            self
2504        }
2505
2506        /// Sets all the options, replacing any prior values.
2507        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2508            self.0.options = v.into();
2509            self
2510        }
2511
2512        /// Sends the request.
2513        pub async fn send(self) -> Result<crate::model::BackupSchedule> {
2514            (*self.0.stub)
2515                .update_backup_schedule(self.0.request, self.0.options)
2516                .await
2517                .map(crate::Response::into_body)
2518        }
2519
2520        /// Sets the value of [backup_schedule][crate::model::UpdateBackupScheduleRequest::backup_schedule].
2521        ///
2522        /// This is a **required** field for requests.
2523        pub fn set_backup_schedule<T>(mut self, v: T) -> Self
2524        where
2525            T: std::convert::Into<crate::model::BackupSchedule>,
2526        {
2527            self.0.request.backup_schedule = std::option::Option::Some(v.into());
2528            self
2529        }
2530
2531        /// Sets or clears the value of [backup_schedule][crate::model::UpdateBackupScheduleRequest::backup_schedule].
2532        ///
2533        /// This is a **required** field for requests.
2534        pub fn set_or_clear_backup_schedule<T>(mut self, v: std::option::Option<T>) -> Self
2535        where
2536            T: std::convert::Into<crate::model::BackupSchedule>,
2537        {
2538            self.0.request.backup_schedule = v.map(|x| x.into());
2539            self
2540        }
2541
2542        /// Sets the value of [update_mask][crate::model::UpdateBackupScheduleRequest::update_mask].
2543        ///
2544        /// This is a **required** field for requests.
2545        pub fn set_update_mask<T>(mut self, v: T) -> Self
2546        where
2547            T: std::convert::Into<wkt::FieldMask>,
2548        {
2549            self.0.request.update_mask = std::option::Option::Some(v.into());
2550            self
2551        }
2552
2553        /// Sets or clears the value of [update_mask][crate::model::UpdateBackupScheduleRequest::update_mask].
2554        ///
2555        /// This is a **required** field for requests.
2556        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2557        where
2558            T: std::convert::Into<wkt::FieldMask>,
2559        {
2560            self.0.request.update_mask = v.map(|x| x.into());
2561            self
2562        }
2563    }
2564
2565    #[doc(hidden)]
2566    impl crate::RequestBuilder for UpdateBackupSchedule {
2567        fn request_options(&mut self) -> &mut crate::RequestOptions {
2568            &mut self.0.options
2569        }
2570    }
2571
2572    /// The request builder for [DatabaseAdmin::delete_backup_schedule][crate::client::DatabaseAdmin::delete_backup_schedule] calls.
2573    ///
2574    /// # Example
2575    /// ```
2576    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::DeleteBackupSchedule;
2577    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
2578    ///
2579    /// let builder = prepare_request_builder();
2580    /// let response = builder.send().await?;
2581    /// # Ok(()) }
2582    ///
2583    /// fn prepare_request_builder() -> DeleteBackupSchedule {
2584    ///   # panic!();
2585    ///   // ... details omitted ...
2586    /// }
2587    /// ```
2588    #[derive(Clone, Debug)]
2589    pub struct DeleteBackupSchedule(RequestBuilder<crate::model::DeleteBackupScheduleRequest>);
2590
2591    impl DeleteBackupSchedule {
2592        pub(crate) fn new(
2593            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2594        ) -> Self {
2595            Self(RequestBuilder::new(stub))
2596        }
2597
2598        /// Sets the full request, replacing any prior values.
2599        pub fn with_request<V: Into<crate::model::DeleteBackupScheduleRequest>>(
2600            mut self,
2601            v: V,
2602        ) -> Self {
2603            self.0.request = v.into();
2604            self
2605        }
2606
2607        /// Sets all the options, replacing any prior values.
2608        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2609            self.0.options = v.into();
2610            self
2611        }
2612
2613        /// Sends the request.
2614        pub async fn send(self) -> Result<()> {
2615            (*self.0.stub)
2616                .delete_backup_schedule(self.0.request, self.0.options)
2617                .await
2618                .map(crate::Response::into_body)
2619        }
2620
2621        /// Sets the value of [name][crate::model::DeleteBackupScheduleRequest::name].
2622        ///
2623        /// This is a **required** field for requests.
2624        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2625            self.0.request.name = v.into();
2626            self
2627        }
2628    }
2629
2630    #[doc(hidden)]
2631    impl crate::RequestBuilder for DeleteBackupSchedule {
2632        fn request_options(&mut self) -> &mut crate::RequestOptions {
2633            &mut self.0.options
2634        }
2635    }
2636
2637    /// The request builder for [DatabaseAdmin::list_backup_schedules][crate::client::DatabaseAdmin::list_backup_schedules] calls.
2638    ///
2639    /// # Example
2640    /// ```
2641    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::ListBackupSchedules;
2642    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
2643    /// use google_cloud_gax::paginator::ItemPaginator;
2644    ///
2645    /// let builder = prepare_request_builder();
2646    /// let mut items = builder.by_item();
2647    /// while let Some(result) = items.next().await {
2648    ///   let item = result?;
2649    /// }
2650    /// # Ok(()) }
2651    ///
2652    /// fn prepare_request_builder() -> ListBackupSchedules {
2653    ///   # panic!();
2654    ///   // ... details omitted ...
2655    /// }
2656    /// ```
2657    #[derive(Clone, Debug)]
2658    pub struct ListBackupSchedules(RequestBuilder<crate::model::ListBackupSchedulesRequest>);
2659
2660    impl ListBackupSchedules {
2661        pub(crate) fn new(
2662            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2663        ) -> Self {
2664            Self(RequestBuilder::new(stub))
2665        }
2666
2667        /// Sets the full request, replacing any prior values.
2668        pub fn with_request<V: Into<crate::model::ListBackupSchedulesRequest>>(
2669            mut self,
2670            v: V,
2671        ) -> Self {
2672            self.0.request = v.into();
2673            self
2674        }
2675
2676        /// Sets all the options, replacing any prior values.
2677        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2678            self.0.options = v.into();
2679            self
2680        }
2681
2682        /// Sends the request.
2683        pub async fn send(self) -> Result<crate::model::ListBackupSchedulesResponse> {
2684            (*self.0.stub)
2685                .list_backup_schedules(self.0.request, self.0.options)
2686                .await
2687                .map(crate::Response::into_body)
2688        }
2689
2690        /// Streams each page in the collection.
2691        pub fn by_page(
2692            self,
2693        ) -> impl google_cloud_gax::paginator::Paginator<
2694            crate::model::ListBackupSchedulesResponse,
2695            crate::Error,
2696        > {
2697            use std::clone::Clone;
2698            let token = self.0.request.page_token.clone();
2699            let execute = move |token: String| {
2700                let mut builder = self.clone();
2701                builder.0.request = builder.0.request.set_page_token(token);
2702                builder.send()
2703            };
2704            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2705        }
2706
2707        /// Streams each item in the collection.
2708        pub fn by_item(
2709            self,
2710        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2711            crate::model::ListBackupSchedulesResponse,
2712            crate::Error,
2713        > {
2714            use google_cloud_gax::paginator::Paginator;
2715            self.by_page().items()
2716        }
2717
2718        /// Sets the value of [parent][crate::model::ListBackupSchedulesRequest::parent].
2719        ///
2720        /// This is a **required** field for requests.
2721        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2722            self.0.request.parent = v.into();
2723            self
2724        }
2725
2726        /// Sets the value of [page_size][crate::model::ListBackupSchedulesRequest::page_size].
2727        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2728            self.0.request.page_size = v.into();
2729            self
2730        }
2731
2732        /// Sets the value of [page_token][crate::model::ListBackupSchedulesRequest::page_token].
2733        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2734            self.0.request.page_token = v.into();
2735            self
2736        }
2737    }
2738
2739    #[doc(hidden)]
2740    impl crate::RequestBuilder for ListBackupSchedules {
2741        fn request_options(&mut self) -> &mut crate::RequestOptions {
2742            &mut self.0.options
2743        }
2744    }
2745
2746    /// The request builder for [DatabaseAdmin::list_operations][crate::client::DatabaseAdmin::list_operations] calls.
2747    ///
2748    /// # Example
2749    /// ```
2750    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::ListOperations;
2751    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
2752    /// use google_cloud_gax::paginator::ItemPaginator;
2753    ///
2754    /// let builder = prepare_request_builder();
2755    /// let mut items = builder.by_item();
2756    /// while let Some(result) = items.next().await {
2757    ///   let item = result?;
2758    /// }
2759    /// # Ok(()) }
2760    ///
2761    /// fn prepare_request_builder() -> ListOperations {
2762    ///   # panic!();
2763    ///   // ... details omitted ...
2764    /// }
2765    /// ```
2766    #[derive(Clone, Debug)]
2767    pub struct ListOperations(
2768        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2769    );
2770
2771    impl ListOperations {
2772        pub(crate) fn new(
2773            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2774        ) -> Self {
2775            Self(RequestBuilder::new(stub))
2776        }
2777
2778        /// Sets the full request, replacing any prior values.
2779        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2780            mut self,
2781            v: V,
2782        ) -> Self {
2783            self.0.request = v.into();
2784            self
2785        }
2786
2787        /// Sets all the options, replacing any prior values.
2788        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2789            self.0.options = v.into();
2790            self
2791        }
2792
2793        /// Sends the request.
2794        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2795            (*self.0.stub)
2796                .list_operations(self.0.request, self.0.options)
2797                .await
2798                .map(crate::Response::into_body)
2799        }
2800
2801        /// Streams each page in the collection.
2802        pub fn by_page(
2803            self,
2804        ) -> impl google_cloud_gax::paginator::Paginator<
2805            google_cloud_longrunning::model::ListOperationsResponse,
2806            crate::Error,
2807        > {
2808            use std::clone::Clone;
2809            let token = self.0.request.page_token.clone();
2810            let execute = move |token: String| {
2811                let mut builder = self.clone();
2812                builder.0.request = builder.0.request.set_page_token(token);
2813                builder.send()
2814            };
2815            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2816        }
2817
2818        /// Streams each item in the collection.
2819        pub fn by_item(
2820            self,
2821        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2822            google_cloud_longrunning::model::ListOperationsResponse,
2823            crate::Error,
2824        > {
2825            use google_cloud_gax::paginator::Paginator;
2826            self.by_page().items()
2827        }
2828
2829        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
2830        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2831            self.0.request.name = v.into();
2832            self
2833        }
2834
2835        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
2836        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2837            self.0.request.filter = v.into();
2838            self
2839        }
2840
2841        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
2842        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2843            self.0.request.page_size = v.into();
2844            self
2845        }
2846
2847        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
2848        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2849            self.0.request.page_token = v.into();
2850            self
2851        }
2852
2853        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
2854        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2855            self.0.request.return_partial_success = v.into();
2856            self
2857        }
2858    }
2859
2860    #[doc(hidden)]
2861    impl crate::RequestBuilder for ListOperations {
2862        fn request_options(&mut self) -> &mut crate::RequestOptions {
2863            &mut self.0.options
2864        }
2865    }
2866
2867    /// The request builder for [DatabaseAdmin::get_operation][crate::client::DatabaseAdmin::get_operation] calls.
2868    ///
2869    /// # Example
2870    /// ```
2871    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::GetOperation;
2872    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
2873    ///
2874    /// let builder = prepare_request_builder();
2875    /// let response = builder.send().await?;
2876    /// # Ok(()) }
2877    ///
2878    /// fn prepare_request_builder() -> GetOperation {
2879    ///   # panic!();
2880    ///   // ... details omitted ...
2881    /// }
2882    /// ```
2883    #[derive(Clone, Debug)]
2884    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2885
2886    impl GetOperation {
2887        pub(crate) fn new(
2888            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2889        ) -> Self {
2890            Self(RequestBuilder::new(stub))
2891        }
2892
2893        /// Sets the full request, replacing any prior values.
2894        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2895            mut self,
2896            v: V,
2897        ) -> Self {
2898            self.0.request = v.into();
2899            self
2900        }
2901
2902        /// Sets all the options, replacing any prior values.
2903        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2904            self.0.options = v.into();
2905            self
2906        }
2907
2908        /// Sends the request.
2909        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2910            (*self.0.stub)
2911                .get_operation(self.0.request, self.0.options)
2912                .await
2913                .map(crate::Response::into_body)
2914        }
2915
2916        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
2917        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2918            self.0.request.name = v.into();
2919            self
2920        }
2921    }
2922
2923    #[doc(hidden)]
2924    impl crate::RequestBuilder for GetOperation {
2925        fn request_options(&mut self) -> &mut crate::RequestOptions {
2926            &mut self.0.options
2927        }
2928    }
2929
2930    /// The request builder for [DatabaseAdmin::delete_operation][crate::client::DatabaseAdmin::delete_operation] calls.
2931    ///
2932    /// # Example
2933    /// ```
2934    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::DeleteOperation;
2935    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
2936    ///
2937    /// let builder = prepare_request_builder();
2938    /// let response = builder.send().await?;
2939    /// # Ok(()) }
2940    ///
2941    /// fn prepare_request_builder() -> DeleteOperation {
2942    ///   # panic!();
2943    ///   // ... details omitted ...
2944    /// }
2945    /// ```
2946    #[derive(Clone, Debug)]
2947    pub struct DeleteOperation(
2948        RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
2949    );
2950
2951    impl DeleteOperation {
2952        pub(crate) fn new(
2953            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
2954        ) -> Self {
2955            Self(RequestBuilder::new(stub))
2956        }
2957
2958        /// Sets the full request, replacing any prior values.
2959        pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
2960            mut self,
2961            v: V,
2962        ) -> Self {
2963            self.0.request = v.into();
2964            self
2965        }
2966
2967        /// Sets all the options, replacing any prior values.
2968        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2969            self.0.options = v.into();
2970            self
2971        }
2972
2973        /// Sends the request.
2974        pub async fn send(self) -> Result<()> {
2975            (*self.0.stub)
2976                .delete_operation(self.0.request, self.0.options)
2977                .await
2978                .map(crate::Response::into_body)
2979        }
2980
2981        /// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
2982        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2983            self.0.request.name = v.into();
2984            self
2985        }
2986    }
2987
2988    #[doc(hidden)]
2989    impl crate::RequestBuilder for DeleteOperation {
2990        fn request_options(&mut self) -> &mut crate::RequestOptions {
2991            &mut self.0.options
2992        }
2993    }
2994
2995    /// The request builder for [DatabaseAdmin::cancel_operation][crate::client::DatabaseAdmin::cancel_operation] calls.
2996    ///
2997    /// # Example
2998    /// ```
2999    /// # use google_cloud_spanner_admin_database_v1::builder::database_admin::CancelOperation;
3000    /// # async fn sample() -> google_cloud_spanner_admin_database_v1::Result<()> {
3001    ///
3002    /// let builder = prepare_request_builder();
3003    /// let response = builder.send().await?;
3004    /// # Ok(()) }
3005    ///
3006    /// fn prepare_request_builder() -> CancelOperation {
3007    ///   # panic!();
3008    ///   // ... details omitted ...
3009    /// }
3010    /// ```
3011    #[derive(Clone, Debug)]
3012    pub struct CancelOperation(
3013        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
3014    );
3015
3016    impl CancelOperation {
3017        pub(crate) fn new(
3018            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatabaseAdmin>,
3019        ) -> Self {
3020            Self(RequestBuilder::new(stub))
3021        }
3022
3023        /// Sets the full request, replacing any prior values.
3024        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
3025            mut self,
3026            v: V,
3027        ) -> Self {
3028            self.0.request = v.into();
3029            self
3030        }
3031
3032        /// Sets all the options, replacing any prior values.
3033        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3034            self.0.options = v.into();
3035            self
3036        }
3037
3038        /// Sends the request.
3039        pub async fn send(self) -> Result<()> {
3040            (*self.0.stub)
3041                .cancel_operation(self.0.request, self.0.options)
3042                .await
3043                .map(crate::Response::into_body)
3044        }
3045
3046        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
3047        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3048            self.0.request.name = v.into();
3049            self
3050        }
3051    }
3052
3053    #[doc(hidden)]
3054    impl crate::RequestBuilder for CancelOperation {
3055        fn request_options(&mut self) -> &mut crate::RequestOptions {
3056            &mut self.0.options
3057        }
3058    }
3059}