Skip to main content

google_cloud_firestore_admin_v1/
client.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#![allow(rustdoc::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18
19/// Implements a client for the Cloud Firestore API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
26///     let client = FirestoreAdmin::builder().build().await?;
27///     let parent = "parent_value";
28///     let mut list = client.list_indexes()
29///         .set_parent(parent)
30///         .by_item();
31///     while let Some(item) = list.next().await.transpose()? {
32///         println!("{:?}", item);
33///     }
34/// # Ok(()) }
35/// ```
36///
37/// # Service Description
38///
39/// The Cloud Firestore Admin API.
40///
41/// This API provides several administrative services for Cloud Firestore.
42///
43/// Project, Database, Namespace, Collection, Collection Group, and Document are
44/// used as defined in the Google Cloud Firestore API.
45///
46/// Operation: An Operation represents work being performed in the background.
47///
48/// The index service manages Cloud Firestore indexes.
49///
50/// Index creation is performed asynchronously.
51/// An Operation resource is created for each such asynchronous operation.
52/// The state of the operation (including any errors encountered)
53/// may be queried via the Operation resource.
54///
55/// The Operations collection provides a record of actions performed for the
56/// specified Project (including any Operations in progress). Operations are not
57/// created directly but through calls on other collections or resources.
58///
59/// An Operation that is done may be deleted so that it is no longer listed as
60/// part of the Operation collection. Operations are garbage collected after
61/// 30 days. By default, ListOperations will only return in progress and failed
62/// operations. To list completed operation, issue a ListOperations request with
63/// the filter `done: true`.
64///
65/// Operations are created by service `FirestoreAdmin`, but are accessed via
66/// service `google.longrunning.Operations`.
67///
68/// # Configuration
69///
70/// To configure `FirestoreAdmin` use the `with_*` methods in the type returned
71/// by [builder()][FirestoreAdmin::builder]. The default configuration should
72/// work for most applications. Common configuration changes include
73///
74/// * [with_endpoint()]: by default this client uses the global default endpoint
75///   (`https://firestore.googleapis.com`). Applications using regional
76///   endpoints or running in restricted networks (e.g. a network configured
77//    with [Private Google Access with VPC Service Controls]) may want to
78///   override this default.
79/// * [with_credentials()]: by default this client uses
80///   [Application Default Credentials]. Applications using custom
81///   authentication may need to override this default.
82///
83/// [with_endpoint()]: super::builder::firestore_admin::ClientBuilder::with_endpoint
84/// [with_credentials()]: super::builder::firestore_admin::ClientBuilder::with_credentials
85/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
86/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
87///
88/// # Pooling and Cloning
89///
90/// `FirestoreAdmin` holds a connection pool internally, it is advised to
91/// create one and reuse it. You do not need to wrap `FirestoreAdmin` in
92/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
93/// already uses an `Arc` internally.
94#[derive(Clone, Debug)]
95pub struct FirestoreAdmin {
96    inner: std::sync::Arc<dyn super::stub::dynamic::FirestoreAdmin>,
97}
98
99impl FirestoreAdmin {
100    /// Returns a builder for [FirestoreAdmin].
101    ///
102    /// ```
103    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
104    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
105    /// let client = FirestoreAdmin::builder().build().await?;
106    /// # Ok(()) }
107    /// ```
108    pub fn builder() -> super::builder::firestore_admin::ClientBuilder {
109        crate::new_client_builder(super::builder::firestore_admin::client::Factory)
110    }
111
112    /// Creates a new client from the provided stub.
113    ///
114    /// The most common case for calling this function is in tests mocking the
115    /// client's behavior.
116    pub fn from_stub<T>(stub: T) -> Self
117    where
118        T: super::stub::FirestoreAdmin + 'static,
119    {
120        Self {
121            inner: std::sync::Arc::new(stub),
122        }
123    }
124
125    pub(crate) async fn new(
126        config: gaxi::options::ClientConfig,
127    ) -> crate::ClientBuilderResult<Self> {
128        let inner = Self::build_inner(config).await?;
129        Ok(Self { inner })
130    }
131
132    async fn build_inner(
133        conf: gaxi::options::ClientConfig,
134    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::FirestoreAdmin>> {
135        if gaxi::options::tracing_enabled(&conf) {
136            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
137        }
138        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
139    }
140
141    async fn build_transport(
142        conf: gaxi::options::ClientConfig,
143    ) -> crate::ClientBuilderResult<impl super::stub::FirestoreAdmin> {
144        super::transport::FirestoreAdmin::new(conf).await
145    }
146
147    async fn build_with_tracing(
148        conf: gaxi::options::ClientConfig,
149    ) -> crate::ClientBuilderResult<impl super::stub::FirestoreAdmin> {
150        Self::build_transport(conf)
151            .await
152            .map(super::tracing::FirestoreAdmin::new)
153    }
154
155    /// Creates a composite index. This returns a
156    /// [google.longrunning.Operation][google.longrunning.Operation] which may be
157    /// used to track the status of the creation. The metadata for the operation
158    /// will be the type
159    /// [IndexOperationMetadata][google.firestore.admin.v1.IndexOperationMetadata].
160    ///
161    /// [google.firestore.admin.v1.IndexOperationMetadata]: crate::model::IndexOperationMetadata
162    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
163    ///
164    /// # Long running operations
165    ///
166    /// This method is used to start, and/or poll a [long-running Operation].
167    /// The [Working with long-running operations] chapter in the [user guide]
168    /// covers these operations in detail.
169    ///
170    /// [long-running operation]: https://google.aip.dev/151
171    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
172    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
173    ///
174    /// # Example
175    /// ```
176    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
177    /// use google_cloud_lro::Poller;
178    /// use google_cloud_firestore_admin_v1::model::Index;
179    /// use google_cloud_firestore_admin_v1::Result;
180    /// async fn sample(
181    ///    client: &FirestoreAdmin, parent: &str
182    /// ) -> Result<()> {
183    ///     let response = client.create_index()
184    ///         .set_parent(parent)
185    ///         .set_index(
186    ///             Index::new()/* set fields */
187    ///         )
188    ///         .poller().until_done().await?;
189    ///     println!("response {:?}", response);
190    ///     Ok(())
191    /// }
192    /// ```
193    pub fn create_index(&self) -> super::builder::firestore_admin::CreateIndex {
194        super::builder::firestore_admin::CreateIndex::new(self.inner.clone())
195    }
196
197    /// Lists composite indexes.
198    ///
199    /// # Example
200    /// ```
201    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
202    /// use google_cloud_gax::paginator::ItemPaginator as _;
203    /// use google_cloud_firestore_admin_v1::Result;
204    /// async fn sample(
205    ///    client: &FirestoreAdmin, parent: &str
206    /// ) -> Result<()> {
207    ///     let mut list = client.list_indexes()
208    ///         .set_parent(parent)
209    ///         .by_item();
210    ///     while let Some(item) = list.next().await.transpose()? {
211    ///         println!("{:?}", item);
212    ///     }
213    ///     Ok(())
214    /// }
215    /// ```
216    pub fn list_indexes(&self) -> super::builder::firestore_admin::ListIndexes {
217        super::builder::firestore_admin::ListIndexes::new(self.inner.clone())
218    }
219
220    /// Gets a composite index.
221    ///
222    /// # Example
223    /// ```
224    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
225    /// use google_cloud_firestore_admin_v1::Result;
226    /// async fn sample(
227    ///    client: &FirestoreAdmin, name: &str
228    /// ) -> Result<()> {
229    ///     let response = client.get_index()
230    ///         .set_name(name)
231    ///         .send().await?;
232    ///     println!("response {:?}", response);
233    ///     Ok(())
234    /// }
235    /// ```
236    pub fn get_index(&self) -> super::builder::firestore_admin::GetIndex {
237        super::builder::firestore_admin::GetIndex::new(self.inner.clone())
238    }
239
240    /// Deletes a composite index.
241    ///
242    /// # Example
243    /// ```
244    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
245    /// use google_cloud_firestore_admin_v1::Result;
246    /// async fn sample(
247    ///    client: &FirestoreAdmin, name: &str
248    /// ) -> Result<()> {
249    ///     client.delete_index()
250    ///         .set_name(name)
251    ///         .send().await?;
252    ///     Ok(())
253    /// }
254    /// ```
255    pub fn delete_index(&self) -> super::builder::firestore_admin::DeleteIndex {
256        super::builder::firestore_admin::DeleteIndex::new(self.inner.clone())
257    }
258
259    /// Gets the metadata and configuration for a Field.
260    ///
261    /// # Example
262    /// ```
263    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
264    /// use google_cloud_firestore_admin_v1::Result;
265    /// async fn sample(
266    ///    client: &FirestoreAdmin, name: &str
267    /// ) -> Result<()> {
268    ///     let response = client.get_field()
269    ///         .set_name(name)
270    ///         .send().await?;
271    ///     println!("response {:?}", response);
272    ///     Ok(())
273    /// }
274    /// ```
275    pub fn get_field(&self) -> super::builder::firestore_admin::GetField {
276        super::builder::firestore_admin::GetField::new(self.inner.clone())
277    }
278
279    /// Updates a field configuration. Currently, field updates apply only to
280    /// single field index configuration. However, calls to
281    /// [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField]
282    /// should provide a field mask to avoid changing any configuration that the
283    /// caller isn't aware of. The field mask should be specified as: `{ paths:
284    /// "index_config" }`.
285    ///
286    /// This call returns a
287    /// [google.longrunning.Operation][google.longrunning.Operation] which may be
288    /// used to track the status of the field update. The metadata for the
289    /// operation will be the type
290    /// [FieldOperationMetadata][google.firestore.admin.v1.FieldOperationMetadata].
291    ///
292    /// To configure the default field settings for the database, use
293    /// the special `Field` with resource name:
294    /// `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`.
295    ///
296    /// [google.firestore.admin.v1.FieldOperationMetadata]: crate::model::FieldOperationMetadata
297    /// [google.firestore.admin.v1.FirestoreAdmin.UpdateField]: crate::client::FirestoreAdmin::update_field
298    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
299    ///
300    /// # Long running operations
301    ///
302    /// This method is used to start, and/or poll a [long-running Operation].
303    /// The [Working with long-running operations] chapter in the [user guide]
304    /// covers these operations in detail.
305    ///
306    /// [long-running operation]: https://google.aip.dev/151
307    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
308    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
309    ///
310    /// # Example
311    /// ```
312    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
313    /// use google_cloud_lro::Poller;
314    /// # extern crate wkt as google_cloud_wkt;
315    /// use google_cloud_wkt::FieldMask;
316    /// use google_cloud_firestore_admin_v1::model::Field;
317    /// use google_cloud_firestore_admin_v1::Result;
318    /// async fn sample(
319    ///    client: &FirestoreAdmin, name: &str
320    /// ) -> Result<()> {
321    ///     let response = client.update_field()
322    ///         .set_field(
323    ///             Field::new().set_name(name)/* set fields */
324    ///         )
325    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
326    ///         .poller().until_done().await?;
327    ///     println!("response {:?}", response);
328    ///     Ok(())
329    /// }
330    /// ```
331    pub fn update_field(&self) -> super::builder::firestore_admin::UpdateField {
332        super::builder::firestore_admin::UpdateField::new(self.inner.clone())
333    }
334
335    /// Lists the field configuration and metadata for this database.
336    ///
337    /// Currently,
338    /// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
339    /// only supports listing fields that have been explicitly overridden. To issue
340    /// this query, call
341    /// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
342    /// with the filter set to `indexConfig.usesAncestorConfig:false` or
343    /// `ttlConfig:*`.
344    ///
345    /// [google.firestore.admin.v1.FirestoreAdmin.ListFields]: crate::client::FirestoreAdmin::list_fields
346    ///
347    /// # Example
348    /// ```
349    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
350    /// use google_cloud_gax::paginator::ItemPaginator as _;
351    /// use google_cloud_firestore_admin_v1::Result;
352    /// async fn sample(
353    ///    client: &FirestoreAdmin, parent: &str
354    /// ) -> Result<()> {
355    ///     let mut list = client.list_fields()
356    ///         .set_parent(parent)
357    ///         .by_item();
358    ///     while let Some(item) = list.next().await.transpose()? {
359    ///         println!("{:?}", item);
360    ///     }
361    ///     Ok(())
362    /// }
363    /// ```
364    pub fn list_fields(&self) -> super::builder::firestore_admin::ListFields {
365        super::builder::firestore_admin::ListFields::new(self.inner.clone())
366    }
367
368    /// Exports a copy of all or a subset of documents from Google Cloud Firestore
369    /// to another storage system, such as Google Cloud Storage. Recent updates to
370    /// documents may not be reflected in the export. The export occurs in the
371    /// background and its progress can be monitored and managed via the
372    /// Operation resource that is created. The output of an export may only be
373    /// used once the associated operation is done. If an export operation is
374    /// cancelled before completion it may leave partial data behind in Google
375    /// Cloud Storage.
376    ///
377    /// For more details on export behavior and output format, refer to:
378    /// <https://cloud.google.com/firestore/docs/manage-data/export-import>
379    ///
380    /// # Long running operations
381    ///
382    /// This method is used to start, and/or poll a [long-running Operation].
383    /// The [Working with long-running operations] chapter in the [user guide]
384    /// covers these operations in detail.
385    ///
386    /// [long-running operation]: https://google.aip.dev/151
387    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
388    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
389    ///
390    /// # Example
391    /// ```
392    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
393    /// use google_cloud_lro::Poller;
394    /// use google_cloud_firestore_admin_v1::Result;
395    /// async fn sample(
396    ///    client: &FirestoreAdmin
397    /// ) -> Result<()> {
398    ///     let response = client.export_documents()
399    ///         /* set fields */
400    ///         .poller().until_done().await?;
401    ///     println!("response {:?}", response);
402    ///     Ok(())
403    /// }
404    /// ```
405    pub fn export_documents(&self) -> super::builder::firestore_admin::ExportDocuments {
406        super::builder::firestore_admin::ExportDocuments::new(self.inner.clone())
407    }
408
409    /// Imports documents into Google Cloud Firestore. Existing documents with the
410    /// same name are overwritten. The import occurs in the background and its
411    /// progress can be monitored and managed via the Operation resource that is
412    /// created. If an ImportDocuments operation is cancelled, it is possible
413    /// that a subset of the data has already been imported to Cloud Firestore.
414    ///
415    /// # Long running operations
416    ///
417    /// This method is used to start, and/or poll a [long-running Operation].
418    /// The [Working with long-running operations] chapter in the [user guide]
419    /// covers these operations in detail.
420    ///
421    /// [long-running operation]: https://google.aip.dev/151
422    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
423    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
424    ///
425    /// # Example
426    /// ```
427    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
428    /// use google_cloud_lro::Poller;
429    /// use google_cloud_firestore_admin_v1::Result;
430    /// async fn sample(
431    ///    client: &FirestoreAdmin
432    /// ) -> Result<()> {
433    ///     client.import_documents()
434    ///         /* set fields */
435    ///         .poller().until_done().await?;
436    ///     Ok(())
437    /// }
438    /// ```
439    pub fn import_documents(&self) -> super::builder::firestore_admin::ImportDocuments {
440        super::builder::firestore_admin::ImportDocuments::new(self.inner.clone())
441    }
442
443    /// Bulk deletes a subset of documents from Google Cloud Firestore.
444    /// Documents created or updated after the underlying system starts to process
445    /// the request will not be deleted. The bulk delete occurs in the background
446    /// and its progress can be monitored and managed via the Operation resource
447    /// that is created.
448    ///
449    /// For more details on bulk delete behavior, refer to:
450    /// <https://cloud.google.com/firestore/docs/manage-data/bulk-delete>
451    ///
452    /// # Long running operations
453    ///
454    /// This method is used to start, and/or poll a [long-running Operation].
455    /// The [Working with long-running operations] chapter in the [user guide]
456    /// covers these operations in detail.
457    ///
458    /// [long-running operation]: https://google.aip.dev/151
459    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
460    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
461    ///
462    /// # Example
463    /// ```
464    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
465    /// use google_cloud_lro::Poller;
466    /// use google_cloud_firestore_admin_v1::Result;
467    /// async fn sample(
468    ///    client: &FirestoreAdmin
469    /// ) -> Result<()> {
470    ///     let response = client.bulk_delete_documents()
471    ///         /* set fields */
472    ///         .poller().until_done().await?;
473    ///     println!("response {:?}", response);
474    ///     Ok(())
475    /// }
476    /// ```
477    pub fn bulk_delete_documents(&self) -> super::builder::firestore_admin::BulkDeleteDocuments {
478        super::builder::firestore_admin::BulkDeleteDocuments::new(self.inner.clone())
479    }
480
481    /// Create a database.
482    ///
483    /// # Long running operations
484    ///
485    /// This method is used to start, and/or poll a [long-running Operation].
486    /// The [Working with long-running operations] chapter in the [user guide]
487    /// covers these operations in detail.
488    ///
489    /// [long-running operation]: https://google.aip.dev/151
490    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
491    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
492    ///
493    /// # Example
494    /// ```
495    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
496    /// use google_cloud_lro::Poller;
497    /// use google_cloud_firestore_admin_v1::model::Database;
498    /// use google_cloud_firestore_admin_v1::Result;
499    /// async fn sample(
500    ///    client: &FirestoreAdmin, parent: &str
501    /// ) -> Result<()> {
502    ///     let response = client.create_database()
503    ///         .set_parent(parent)
504    ///         .set_database_id("database_id_value")
505    ///         .set_database(
506    ///             Database::new()/* set fields */
507    ///         )
508    ///         .poller().until_done().await?;
509    ///     println!("response {:?}", response);
510    ///     Ok(())
511    /// }
512    /// ```
513    pub fn create_database(&self) -> super::builder::firestore_admin::CreateDatabase {
514        super::builder::firestore_admin::CreateDatabase::new(self.inner.clone())
515    }
516
517    /// Gets information about a database.
518    ///
519    /// # Example
520    /// ```
521    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
522    /// use google_cloud_firestore_admin_v1::Result;
523    /// async fn sample(
524    ///    client: &FirestoreAdmin, name: &str
525    /// ) -> Result<()> {
526    ///     let response = client.get_database()
527    ///         .set_name(name)
528    ///         .send().await?;
529    ///     println!("response {:?}", response);
530    ///     Ok(())
531    /// }
532    /// ```
533    pub fn get_database(&self) -> super::builder::firestore_admin::GetDatabase {
534        super::builder::firestore_admin::GetDatabase::new(self.inner.clone())
535    }
536
537    /// List all the databases in the project.
538    ///
539    /// # Example
540    /// ```
541    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
542    /// use google_cloud_firestore_admin_v1::Result;
543    /// async fn sample(
544    ///    client: &FirestoreAdmin
545    /// ) -> Result<()> {
546    ///     let response = client.list_databases()
547    ///         /* set fields */
548    ///         .send().await?;
549    ///     println!("response {:?}", response);
550    ///     Ok(())
551    /// }
552    /// ```
553    pub fn list_databases(&self) -> super::builder::firestore_admin::ListDatabases {
554        super::builder::firestore_admin::ListDatabases::new(self.inner.clone())
555    }
556
557    /// Updates a database.
558    ///
559    /// # Long running operations
560    ///
561    /// This method is used to start, and/or poll a [long-running Operation].
562    /// The [Working with long-running operations] chapter in the [user guide]
563    /// covers these operations in detail.
564    ///
565    /// [long-running operation]: https://google.aip.dev/151
566    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
567    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
568    ///
569    /// # Example
570    /// ```
571    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
572    /// use google_cloud_lro::Poller;
573    /// # extern crate wkt as google_cloud_wkt;
574    /// use google_cloud_wkt::FieldMask;
575    /// use google_cloud_firestore_admin_v1::model::Database;
576    /// use google_cloud_firestore_admin_v1::Result;
577    /// async fn sample(
578    ///    client: &FirestoreAdmin, name: &str
579    /// ) -> Result<()> {
580    ///     let response = client.update_database()
581    ///         .set_database(
582    ///             Database::new().set_name(name)/* set fields */
583    ///         )
584    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
585    ///         .poller().until_done().await?;
586    ///     println!("response {:?}", response);
587    ///     Ok(())
588    /// }
589    /// ```
590    pub fn update_database(&self) -> super::builder::firestore_admin::UpdateDatabase {
591        super::builder::firestore_admin::UpdateDatabase::new(self.inner.clone())
592    }
593
594    /// Deletes a database.
595    ///
596    /// # Long running operations
597    ///
598    /// This method is used to start, and/or poll a [long-running Operation].
599    /// The [Working with long-running operations] chapter in the [user guide]
600    /// covers these operations in detail.
601    ///
602    /// [long-running operation]: https://google.aip.dev/151
603    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
604    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
605    ///
606    /// # Example
607    /// ```
608    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
609    /// use google_cloud_lro::Poller;
610    /// use google_cloud_firestore_admin_v1::Result;
611    /// async fn sample(
612    ///    client: &FirestoreAdmin, name: &str
613    /// ) -> Result<()> {
614    ///     let response = client.delete_database()
615    ///         .set_name(name)
616    ///         .poller().until_done().await?;
617    ///     println!("response {:?}", response);
618    ///     Ok(())
619    /// }
620    /// ```
621    pub fn delete_database(&self) -> super::builder::firestore_admin::DeleteDatabase {
622        super::builder::firestore_admin::DeleteDatabase::new(self.inner.clone())
623    }
624
625    /// Create a user creds.
626    ///
627    /// # Example
628    /// ```
629    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
630    /// use google_cloud_firestore_admin_v1::model::UserCreds;
631    /// use google_cloud_firestore_admin_v1::Result;
632    /// async fn sample(
633    ///    client: &FirestoreAdmin, parent: &str
634    /// ) -> Result<()> {
635    ///     let response = client.create_user_creds()
636    ///         .set_parent(parent)
637    ///         .set_user_creds(
638    ///             UserCreds::new()/* set fields */
639    ///         )
640    ///         .send().await?;
641    ///     println!("response {:?}", response);
642    ///     Ok(())
643    /// }
644    /// ```
645    pub fn create_user_creds(&self) -> super::builder::firestore_admin::CreateUserCreds {
646        super::builder::firestore_admin::CreateUserCreds::new(self.inner.clone())
647    }
648
649    /// Gets a user creds resource. Note that the returned resource does not
650    /// contain the secret value itself.
651    ///
652    /// # Example
653    /// ```
654    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
655    /// use google_cloud_firestore_admin_v1::Result;
656    /// async fn sample(
657    ///    client: &FirestoreAdmin, name: &str
658    /// ) -> Result<()> {
659    ///     let response = client.get_user_creds()
660    ///         .set_name(name)
661    ///         .send().await?;
662    ///     println!("response {:?}", response);
663    ///     Ok(())
664    /// }
665    /// ```
666    pub fn get_user_creds(&self) -> super::builder::firestore_admin::GetUserCreds {
667        super::builder::firestore_admin::GetUserCreds::new(self.inner.clone())
668    }
669
670    /// List all user creds in the database. Note that the returned resource
671    /// does not contain the secret value itself.
672    ///
673    /// # Example
674    /// ```
675    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
676    /// use google_cloud_firestore_admin_v1::Result;
677    /// async fn sample(
678    ///    client: &FirestoreAdmin
679    /// ) -> Result<()> {
680    ///     let response = client.list_user_creds()
681    ///         /* set fields */
682    ///         .send().await?;
683    ///     println!("response {:?}", response);
684    ///     Ok(())
685    /// }
686    /// ```
687    pub fn list_user_creds(&self) -> super::builder::firestore_admin::ListUserCreds {
688        super::builder::firestore_admin::ListUserCreds::new(self.inner.clone())
689    }
690
691    /// Enables a user creds. No-op if the user creds are already enabled.
692    ///
693    /// # Example
694    /// ```
695    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
696    /// use google_cloud_firestore_admin_v1::Result;
697    /// async fn sample(
698    ///    client: &FirestoreAdmin
699    /// ) -> Result<()> {
700    ///     let response = client.enable_user_creds()
701    ///         /* set fields */
702    ///         .send().await?;
703    ///     println!("response {:?}", response);
704    ///     Ok(())
705    /// }
706    /// ```
707    pub fn enable_user_creds(&self) -> super::builder::firestore_admin::EnableUserCreds {
708        super::builder::firestore_admin::EnableUserCreds::new(self.inner.clone())
709    }
710
711    /// Disables a user creds. No-op if the user creds are already disabled.
712    ///
713    /// # Example
714    /// ```
715    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
716    /// use google_cloud_firestore_admin_v1::Result;
717    /// async fn sample(
718    ///    client: &FirestoreAdmin
719    /// ) -> Result<()> {
720    ///     let response = client.disable_user_creds()
721    ///         /* set fields */
722    ///         .send().await?;
723    ///     println!("response {:?}", response);
724    ///     Ok(())
725    /// }
726    /// ```
727    pub fn disable_user_creds(&self) -> super::builder::firestore_admin::DisableUserCreds {
728        super::builder::firestore_admin::DisableUserCreds::new(self.inner.clone())
729    }
730
731    /// Resets the password of a user creds.
732    ///
733    /// # Example
734    /// ```
735    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
736    /// use google_cloud_firestore_admin_v1::Result;
737    /// async fn sample(
738    ///    client: &FirestoreAdmin
739    /// ) -> Result<()> {
740    ///     let response = client.reset_user_password()
741    ///         /* set fields */
742    ///         .send().await?;
743    ///     println!("response {:?}", response);
744    ///     Ok(())
745    /// }
746    /// ```
747    pub fn reset_user_password(&self) -> super::builder::firestore_admin::ResetUserPassword {
748        super::builder::firestore_admin::ResetUserPassword::new(self.inner.clone())
749    }
750
751    /// Deletes a user creds.
752    ///
753    /// # Example
754    /// ```
755    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
756    /// use google_cloud_firestore_admin_v1::Result;
757    /// async fn sample(
758    ///    client: &FirestoreAdmin, name: &str
759    /// ) -> Result<()> {
760    ///     client.delete_user_creds()
761    ///         .set_name(name)
762    ///         .send().await?;
763    ///     Ok(())
764    /// }
765    /// ```
766    pub fn delete_user_creds(&self) -> super::builder::firestore_admin::DeleteUserCreds {
767        super::builder::firestore_admin::DeleteUserCreds::new(self.inner.clone())
768    }
769
770    /// Gets information about a backup.
771    ///
772    /// # Example
773    /// ```
774    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
775    /// use google_cloud_firestore_admin_v1::Result;
776    /// async fn sample(
777    ///    client: &FirestoreAdmin, name: &str
778    /// ) -> Result<()> {
779    ///     let response = client.get_backup()
780    ///         .set_name(name)
781    ///         .send().await?;
782    ///     println!("response {:?}", response);
783    ///     Ok(())
784    /// }
785    /// ```
786    pub fn get_backup(&self) -> super::builder::firestore_admin::GetBackup {
787        super::builder::firestore_admin::GetBackup::new(self.inner.clone())
788    }
789
790    /// Lists all the backups.
791    ///
792    /// # Example
793    /// ```
794    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
795    /// use google_cloud_firestore_admin_v1::Result;
796    /// async fn sample(
797    ///    client: &FirestoreAdmin
798    /// ) -> Result<()> {
799    ///     let response = client.list_backups()
800    ///         /* set fields */
801    ///         .send().await?;
802    ///     println!("response {:?}", response);
803    ///     Ok(())
804    /// }
805    /// ```
806    pub fn list_backups(&self) -> super::builder::firestore_admin::ListBackups {
807        super::builder::firestore_admin::ListBackups::new(self.inner.clone())
808    }
809
810    /// Deletes a backup.
811    ///
812    /// # Example
813    /// ```
814    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
815    /// use google_cloud_firestore_admin_v1::Result;
816    /// async fn sample(
817    ///    client: &FirestoreAdmin, name: &str
818    /// ) -> Result<()> {
819    ///     client.delete_backup()
820    ///         .set_name(name)
821    ///         .send().await?;
822    ///     Ok(())
823    /// }
824    /// ```
825    pub fn delete_backup(&self) -> super::builder::firestore_admin::DeleteBackup {
826        super::builder::firestore_admin::DeleteBackup::new(self.inner.clone())
827    }
828
829    /// Creates a new database by restoring from an existing backup.
830    ///
831    /// The new database must be in the same cloud region or multi-region location
832    /// as the existing backup. This behaves similar to
833    /// [FirestoreAdmin.CreateDatabase][google.firestore.admin.v1.FirestoreAdmin.CreateDatabase]
834    /// except instead of creating a new empty database, a new database is created
835    /// with the database type, index configuration, and documents from an existing
836    /// backup.
837    ///
838    /// The [long-running operation][google.longrunning.Operation] can be used to
839    /// track the progress of the restore, with the Operation's
840    /// [metadata][google.longrunning.Operation.metadata] field type being the
841    /// [RestoreDatabaseMetadata][google.firestore.admin.v1.RestoreDatabaseMetadata].
842    /// The [response][google.longrunning.Operation.response] type is the
843    /// [Database][google.firestore.admin.v1.Database] if the restore was
844    /// successful. The new database is not readable or writeable until the LRO has
845    /// completed.
846    ///
847    /// [google.firestore.admin.v1.Database]: crate::model::Database
848    /// [google.firestore.admin.v1.FirestoreAdmin.CreateDatabase]: crate::client::FirestoreAdmin::create_database
849    /// [google.firestore.admin.v1.RestoreDatabaseMetadata]: crate::model::RestoreDatabaseMetadata
850    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
851    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
852    /// [google.longrunning.Operation.response]: google_cloud_longrunning::model::Operation::result
853    ///
854    /// # Long running operations
855    ///
856    /// This method is used to start, and/or poll a [long-running Operation].
857    /// The [Working with long-running operations] chapter in the [user guide]
858    /// covers these operations in detail.
859    ///
860    /// [long-running operation]: https://google.aip.dev/151
861    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
862    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
863    ///
864    /// # Example
865    /// ```
866    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
867    /// use google_cloud_lro::Poller;
868    /// use google_cloud_firestore_admin_v1::Result;
869    /// async fn sample(
870    ///    client: &FirestoreAdmin
871    /// ) -> Result<()> {
872    ///     let response = client.restore_database()
873    ///         /* set fields */
874    ///         .poller().until_done().await?;
875    ///     println!("response {:?}", response);
876    ///     Ok(())
877    /// }
878    /// ```
879    pub fn restore_database(&self) -> super::builder::firestore_admin::RestoreDatabase {
880        super::builder::firestore_admin::RestoreDatabase::new(self.inner.clone())
881    }
882
883    /// Creates a backup schedule on a database.
884    /// At most two backup schedules can be configured on a database, one daily
885    /// backup schedule and one weekly backup schedule.
886    ///
887    /// # Example
888    /// ```
889    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
890    /// use google_cloud_firestore_admin_v1::model::BackupSchedule;
891    /// use google_cloud_firestore_admin_v1::Result;
892    /// async fn sample(
893    ///    client: &FirestoreAdmin, parent: &str
894    /// ) -> Result<()> {
895    ///     let response = client.create_backup_schedule()
896    ///         .set_parent(parent)
897    ///         .set_backup_schedule(
898    ///             BackupSchedule::new()/* set fields */
899    ///         )
900    ///         .send().await?;
901    ///     println!("response {:?}", response);
902    ///     Ok(())
903    /// }
904    /// ```
905    pub fn create_backup_schedule(&self) -> super::builder::firestore_admin::CreateBackupSchedule {
906        super::builder::firestore_admin::CreateBackupSchedule::new(self.inner.clone())
907    }
908
909    /// Gets information about a backup schedule.
910    ///
911    /// # Example
912    /// ```
913    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
914    /// use google_cloud_firestore_admin_v1::Result;
915    /// async fn sample(
916    ///    client: &FirestoreAdmin, name: &str
917    /// ) -> Result<()> {
918    ///     let response = client.get_backup_schedule()
919    ///         .set_name(name)
920    ///         .send().await?;
921    ///     println!("response {:?}", response);
922    ///     Ok(())
923    /// }
924    /// ```
925    pub fn get_backup_schedule(&self) -> super::builder::firestore_admin::GetBackupSchedule {
926        super::builder::firestore_admin::GetBackupSchedule::new(self.inner.clone())
927    }
928
929    /// List backup schedules.
930    ///
931    /// # Example
932    /// ```
933    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
934    /// use google_cloud_firestore_admin_v1::Result;
935    /// async fn sample(
936    ///    client: &FirestoreAdmin
937    /// ) -> Result<()> {
938    ///     let response = client.list_backup_schedules()
939    ///         /* set fields */
940    ///         .send().await?;
941    ///     println!("response {:?}", response);
942    ///     Ok(())
943    /// }
944    /// ```
945    pub fn list_backup_schedules(&self) -> super::builder::firestore_admin::ListBackupSchedules {
946        super::builder::firestore_admin::ListBackupSchedules::new(self.inner.clone())
947    }
948
949    /// Updates a backup schedule.
950    ///
951    /// # Example
952    /// ```
953    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
954    /// # extern crate wkt as google_cloud_wkt;
955    /// use google_cloud_wkt::FieldMask;
956    /// use google_cloud_firestore_admin_v1::model::BackupSchedule;
957    /// use google_cloud_firestore_admin_v1::Result;
958    /// async fn sample(
959    ///    client: &FirestoreAdmin, name: &str
960    /// ) -> Result<()> {
961    ///     let response = client.update_backup_schedule()
962    ///         .set_backup_schedule(
963    ///             BackupSchedule::new().set_name(name)/* set fields */
964    ///         )
965    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
966    ///         .send().await?;
967    ///     println!("response {:?}", response);
968    ///     Ok(())
969    /// }
970    /// ```
971    pub fn update_backup_schedule(&self) -> super::builder::firestore_admin::UpdateBackupSchedule {
972        super::builder::firestore_admin::UpdateBackupSchedule::new(self.inner.clone())
973    }
974
975    /// Deletes a backup schedule.
976    ///
977    /// # Example
978    /// ```
979    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
980    /// use google_cloud_firestore_admin_v1::Result;
981    /// async fn sample(
982    ///    client: &FirestoreAdmin, name: &str
983    /// ) -> Result<()> {
984    ///     client.delete_backup_schedule()
985    ///         .set_name(name)
986    ///         .send().await?;
987    ///     Ok(())
988    /// }
989    /// ```
990    pub fn delete_backup_schedule(&self) -> super::builder::firestore_admin::DeleteBackupSchedule {
991        super::builder::firestore_admin::DeleteBackupSchedule::new(self.inner.clone())
992    }
993
994    /// Creates a new database by cloning an existing one.
995    ///
996    /// The new database must be in the same cloud region or multi-region location
997    /// as the existing database. This behaves similar to
998    /// [FirestoreAdmin.CreateDatabase][google.firestore.admin.v1.FirestoreAdmin.CreateDatabase]
999    /// except instead of creating a new empty database, a new database is created
1000    /// with the database type, index configuration, and documents from an existing
1001    /// database.
1002    ///
1003    /// The [long-running operation][google.longrunning.Operation] can be used to
1004    /// track the progress of the clone, with the Operation's
1005    /// [metadata][google.longrunning.Operation.metadata] field type being the
1006    /// [CloneDatabaseMetadata][google.firestore.admin.v1.CloneDatabaseMetadata].
1007    /// The [response][google.longrunning.Operation.response] type is the
1008    /// [Database][google.firestore.admin.v1.Database] if the clone was
1009    /// successful. The new database is not readable or writeable until the LRO has
1010    /// completed.
1011    ///
1012    /// [google.firestore.admin.v1.CloneDatabaseMetadata]: crate::model::CloneDatabaseMetadata
1013    /// [google.firestore.admin.v1.Database]: crate::model::Database
1014    /// [google.firestore.admin.v1.FirestoreAdmin.CreateDatabase]: crate::client::FirestoreAdmin::create_database
1015    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
1016    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
1017    /// [google.longrunning.Operation.response]: google_cloud_longrunning::model::Operation::result
1018    ///
1019    /// # Long running operations
1020    ///
1021    /// This method is used to start, and/or poll a [long-running Operation].
1022    /// The [Working with long-running operations] chapter in the [user guide]
1023    /// covers these operations in detail.
1024    ///
1025    /// [long-running operation]: https://google.aip.dev/151
1026    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1027    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1028    ///
1029    /// # Example
1030    /// ```
1031    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
1032    /// use google_cloud_lro::Poller;
1033    /// use google_cloud_firestore_admin_v1::Result;
1034    /// async fn sample(
1035    ///    client: &FirestoreAdmin
1036    /// ) -> Result<()> {
1037    ///     let response = client.clone_database()
1038    ///         /* set fields */
1039    ///         .poller().until_done().await?;
1040    ///     println!("response {:?}", response);
1041    ///     Ok(())
1042    /// }
1043    /// ```
1044    pub fn clone_database(&self) -> super::builder::firestore_admin::CloneDatabase {
1045        super::builder::firestore_admin::CloneDatabase::new(self.inner.clone())
1046    }
1047
1048    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1049    ///
1050    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1051    ///
1052    /// # Example
1053    /// ```
1054    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
1055    /// use google_cloud_gax::paginator::ItemPaginator as _;
1056    /// use google_cloud_firestore_admin_v1::Result;
1057    /// async fn sample(
1058    ///    client: &FirestoreAdmin
1059    /// ) -> Result<()> {
1060    ///     let mut list = client.list_operations()
1061    ///         /* set fields */
1062    ///         .by_item();
1063    ///     while let Some(item) = list.next().await.transpose()? {
1064    ///         println!("{:?}", item);
1065    ///     }
1066    ///     Ok(())
1067    /// }
1068    /// ```
1069    pub fn list_operations(&self) -> super::builder::firestore_admin::ListOperations {
1070        super::builder::firestore_admin::ListOperations::new(self.inner.clone())
1071    }
1072
1073    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1074    ///
1075    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1076    ///
1077    /// # Example
1078    /// ```
1079    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
1080    /// use google_cloud_firestore_admin_v1::Result;
1081    /// async fn sample(
1082    ///    client: &FirestoreAdmin
1083    /// ) -> Result<()> {
1084    ///     let response = client.get_operation()
1085    ///         /* set fields */
1086    ///         .send().await?;
1087    ///     println!("response {:?}", response);
1088    ///     Ok(())
1089    /// }
1090    /// ```
1091    pub fn get_operation(&self) -> super::builder::firestore_admin::GetOperation {
1092        super::builder::firestore_admin::GetOperation::new(self.inner.clone())
1093    }
1094
1095    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1096    ///
1097    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1098    ///
1099    /// # Example
1100    /// ```
1101    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
1102    /// use google_cloud_firestore_admin_v1::Result;
1103    /// async fn sample(
1104    ///    client: &FirestoreAdmin
1105    /// ) -> Result<()> {
1106    ///     client.delete_operation()
1107    ///         /* set fields */
1108    ///         .send().await?;
1109    ///     Ok(())
1110    /// }
1111    /// ```
1112    pub fn delete_operation(&self) -> super::builder::firestore_admin::DeleteOperation {
1113        super::builder::firestore_admin::DeleteOperation::new(self.inner.clone())
1114    }
1115
1116    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1117    ///
1118    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1119    ///
1120    /// # Example
1121    /// ```
1122    /// # use google_cloud_firestore_admin_v1::client::FirestoreAdmin;
1123    /// use google_cloud_firestore_admin_v1::Result;
1124    /// async fn sample(
1125    ///    client: &FirestoreAdmin
1126    /// ) -> Result<()> {
1127    ///     client.cancel_operation()
1128    ///         /* set fields */
1129    ///         .send().await?;
1130    ///     Ok(())
1131    /// }
1132    /// ```
1133    pub fn cancel_operation(&self) -> super::builder::firestore_admin::CancelOperation {
1134        super::builder::firestore_admin::CancelOperation::new(self.inner.clone())
1135    }
1136}