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