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