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