FirestoreAdmin

Struct FirestoreAdmin 

Source
pub struct FirestoreAdmin { /* private fields */ }
Expand description

Implements a client for the Cloud Firestore API.

§Example

let client = FirestoreAdmin::builder().build().await?;
// use `client` to make requests to the Cloud Firestore API.

§Service Description

The Cloud Firestore Admin API.

This API provides several administrative services for Cloud Firestore.

Project, Database, Namespace, Collection, Collection Group, and Document are used as defined in the Google Cloud Firestore API.

Operation: An Operation represents work being performed in the background.

The index service manages Cloud Firestore indexes.

Index creation is performed asynchronously. An Operation resource is created for each such asynchronous operation. The state of the operation (including any errors encountered) may be queried via the Operation resource.

The Operations collection provides a record of actions performed for the specified Project (including any Operations in progress). Operations are not created directly but through calls on other collections or resources.

An Operation that is done may be deleted so that it is no longer listed as part of the Operation collection. Operations are garbage collected after 30 days. By default, ListOperations will only return in progress and failed operations. To list completed operation, issue a ListOperations request with the filter done: true.

Operations are created by service FirestoreAdmin, but are accessed via service google.longrunning.Operations.

§Configuration

To configure FirestoreAdmin use the with_* methods in the type returned by builder(). The default configuration should work for most applications. Common configuration changes include

  • with_endpoint(): by default this client uses the global default endpoint (https://firestore.googleapis.com). Applications using regional endpoints or running in restricted networks (e.g. a network configured override this default.
  • with_credentials(): by default this client uses Application Default Credentials. Applications using custom authentication may need to override this default.

§Pooling and Cloning

FirestoreAdmin holds a connection pool internally, it is advised to create one and the reuse it. You do not need to wrap FirestoreAdmin in an Rc or Arc to reuse it, because it already uses an Arc internally.

Implementations§

Source§

impl FirestoreAdmin

Source

pub fn builder() -> ClientBuilder

Returns a builder for FirestoreAdmin.

let client = FirestoreAdmin::builder().build().await?;
Source

pub fn from_stub<T>(stub: T) -> Self
where T: FirestoreAdmin + 'static,

Creates a new client from the provided stub.

The most common case for calling this function is in tests mocking the client’s behavior.

Source

pub fn create_index(&self) -> CreateIndex

Creates a composite index. This returns a google.longrunning.Operation which may be used to track the status of the creation. The metadata for the operation will be the type IndexOperationMetadata.

§Long running operations

This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.

Source

pub fn list_indexes(&self) -> ListIndexes

Lists composite indexes.

Source

pub fn get_index(&self) -> GetIndex

Gets a composite index.

Source

pub fn delete_index(&self) -> DeleteIndex

Deletes a composite index.

Source

pub fn get_field(&self) -> GetField

Gets the metadata and configuration for a Field.

Source

pub fn update_field(&self) -> UpdateField

Updates a field configuration. Currently, field updates apply only to single field index configuration. However, calls to FirestoreAdmin.UpdateField should provide a field mask to avoid changing any configuration that the caller isn’t aware of. The field mask should be specified as: { paths: "index_config" }.

This call returns a google.longrunning.Operation which may be used to track the status of the field update. The metadata for the operation will be the type FieldOperationMetadata.

To configure the default field settings for the database, use the special Field with resource name: projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*.

§Long running operations

This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.

Source

pub fn list_fields(&self) -> ListFields

Lists the field configuration and metadata for this database.

Currently, FirestoreAdmin.ListFields only supports listing fields that have been explicitly overridden. To issue this query, call FirestoreAdmin.ListFields with the filter set to indexConfig.usesAncestorConfig:false or ttlConfig:*.

Source

pub fn export_documents(&self) -> ExportDocuments

Exports a copy of all or a subset of documents from Google Cloud Firestore to another storage system, such as Google Cloud Storage. Recent updates to documents may not be reflected in the export. The export occurs in the background and its progress can be monitored and managed via the Operation resource that is created. The output of an export may only be used once the associated operation is done. If an export operation is cancelled before completion it may leave partial data behind in Google Cloud Storage.

For more details on export behavior and output format, refer to: https://cloud.google.com/firestore/docs/manage-data/export-import

§Long running operations

This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.

Source

pub fn import_documents(&self) -> ImportDocuments

Imports documents into Google Cloud Firestore. Existing documents with the same name are overwritten. The import occurs in the background and its progress can be monitored and managed via the Operation resource that is created. If an ImportDocuments operation is cancelled, it is possible that a subset of the data has already been imported to Cloud Firestore.

§Long running operations

This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.

Source

pub fn bulk_delete_documents(&self) -> BulkDeleteDocuments

Bulk deletes a subset of documents from Google Cloud Firestore. Documents created or updated after the underlying system starts to process the request will not be deleted. The bulk delete occurs in the background and its progress can be monitored and managed via the Operation resource that is created.

For more details on bulk delete behavior, refer to: https://cloud.google.com/firestore/docs/manage-data/bulk-delete

§Long running operations

This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.

Source

pub fn create_database(&self) -> CreateDatabase

Create a database.

§Long running operations

This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.

Source

pub fn get_database(&self) -> GetDatabase

Gets information about a database.

Source

pub fn list_databases(&self) -> ListDatabases

List all the databases in the project.

Source

pub fn update_database(&self) -> UpdateDatabase

Updates a database.

§Long running operations

This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.

Source

pub fn delete_database(&self) -> DeleteDatabase

Deletes a database.

§Long running operations

This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.

Source

pub fn create_user_creds(&self) -> CreateUserCreds

Create a user creds.

Source

pub fn get_user_creds(&self) -> GetUserCreds

Gets a user creds resource. Note that the returned resource does not contain the secret value itself.

Source

pub fn list_user_creds(&self) -> ListUserCreds

List all user creds in the database. Note that the returned resource does not contain the secret value itself.

Source

pub fn enable_user_creds(&self) -> EnableUserCreds

Enables a user creds. No-op if the user creds are already enabled.

Source

pub fn disable_user_creds(&self) -> DisableUserCreds

Disables a user creds. No-op if the user creds are already disabled.

Source

pub fn reset_user_password(&self) -> ResetUserPassword

Resets the password of a user creds.

Source

pub fn delete_user_creds(&self) -> DeleteUserCreds

Deletes a user creds.

Source

pub fn get_backup(&self) -> GetBackup

Gets information about a backup.

Source

pub fn list_backups(&self) -> ListBackups

Lists all the backups.

Source

pub fn delete_backup(&self) -> DeleteBackup

Deletes a backup.

Source

pub fn restore_database(&self) -> RestoreDatabase

Creates a new database by restoring from an existing backup.

The new database must be in the same cloud region or multi-region location as the existing backup. This behaves similar to FirestoreAdmin.CreateDatabase except instead of creating a new empty database, a new database is created with the database type, index configuration, and documents from an existing backup.

The long-running operation can be used to track the progress of the restore, with the Operation’s metadata field type being the RestoreDatabaseMetadata. The response type is the Database if the restore was successful. The new database is not readable or writeable until the LRO has completed.

§Long running operations

This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.

Source

pub fn create_backup_schedule(&self) -> CreateBackupSchedule

Creates a backup schedule on a database. At most two backup schedules can be configured on a database, one daily backup schedule and one weekly backup schedule.

Source

pub fn get_backup_schedule(&self) -> GetBackupSchedule

Gets information about a backup schedule.

Source

pub fn list_backup_schedules(&self) -> ListBackupSchedules

List backup schedules.

Source

pub fn update_backup_schedule(&self) -> UpdateBackupSchedule

Updates a backup schedule.

Source

pub fn delete_backup_schedule(&self) -> DeleteBackupSchedule

Deletes a backup schedule.

Source

pub fn clone_database(&self) -> CloneDatabase

Creates a new database by cloning an existing one.

The new database must be in the same cloud region or multi-region location as the existing database. This behaves similar to FirestoreAdmin.CreateDatabase except instead of creating a new empty database, a new database is created with the database type, index configuration, and documents from an existing database.

The long-running operation can be used to track the progress of the clone, with the Operation’s metadata field type being the CloneDatabaseMetadata. The response type is the Database if the clone was successful. The new database is not readable or writeable until the LRO has completed.

§Long running operations

This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.

Source

pub fn list_operations(&self) -> ListOperations

Provides the Operations service functionality in this service.

Source

pub fn get_operation(&self) -> GetOperation

Provides the Operations service functionality in this service.

Source

pub fn delete_operation(&self) -> DeleteOperation

Provides the Operations service functionality in this service.

Source

pub fn cancel_operation(&self) -> CancelOperation

Provides the Operations service functionality in this service.

Trait Implementations§

Source§

impl Clone for FirestoreAdmin

Source§

fn clone(&self) -> FirestoreAdmin

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FirestoreAdmin

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more