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