Cloud Firestore Admin V1 API - Class Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client (v0.14.0)

Reference documentation and code samples for the Cloud Firestore Admin V1 API class Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.

Client for the FirestoreAdmin service.

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.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the FirestoreAdmin Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all FirestoreAdmin clients
::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the FirestoreAdmin Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_database

def create_database(request, options = nil) -> ::Gapic::Operation
def create_database(parent: nil, database: nil, database_id: nil) -> ::Gapic::Operation

Create a database.

Overloads
def create_database(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_database via a request object, either of type CreateDatabaseRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Firestore::Admin::V1::CreateDatabaseRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_database(parent: nil, database: nil, database_id: nil) -> ::Gapic::Operation
Pass arguments to create_database via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. A parent name of the form projects/{project_id}
  • database (::Google::Cloud::Firestore::Admin::V1::Database, ::Hash) — Required. The Database to create.
  • database_id (::String) — Required. The ID to use for the database, which will become the final component of the database's resource name.

    This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/ with first character a letter and the last a letter or a number. Must not be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.

    "(default)" database id is also valid.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/firestore/admin/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Firestore::Admin::V1::CreateDatabaseRequest.new

# Call the create_database method.
result = client.create_database request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#create_index

def create_index(request, options = nil) -> ::Gapic::Operation
def create_index(parent: nil, index: nil) -> ::Gapic::Operation

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.

Overloads
def create_index(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_index via a request object, either of type CreateIndexRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Firestore::Admin::V1::CreateIndexRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_index(parent: nil, index: nil) -> ::Gapic::Operation
Pass arguments to create_index via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. A parent name of the form projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}
  • index (::Google::Cloud::Firestore::Admin::V1::Index, ::Hash) — Required. The composite index to create.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/firestore/admin/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Firestore::Admin::V1::CreateIndexRequest.new

# Call the create_index method.
result = client.create_index request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#delete_database

def delete_database(request, options = nil) -> ::Gapic::Operation
def delete_database(name: nil, etag: nil) -> ::Gapic::Operation

Deletes a database.

Overloads
def delete_database(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_database via a request object, either of type DeleteDatabaseRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Firestore::Admin::V1::DeleteDatabaseRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_database(name: nil, etag: nil) -> ::Gapic::Operation
Pass arguments to delete_database via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. A name of the form projects/{project_id}/databases/{database_id}
  • etag (::String) — The current etag of the Database. If an etag is provided and does not match the current etag of the database, deletion will be blocked and a FAILED_PRECONDITION error will be returned.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/firestore/admin/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Firestore::Admin::V1::DeleteDatabaseRequest.new

# Call the delete_database method.
result = client.delete_database request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#delete_index

def delete_index(request, options = nil) -> ::Google::Protobuf::Empty
def delete_index(name: nil) -> ::Google::Protobuf::Empty

Deletes a composite index.

Overloads
def delete_index(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_index via a request object, either of type DeleteIndexRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Firestore::Admin::V1::DeleteIndexRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_index(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_index via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. A name of the form projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/firestore/admin/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Firestore::Admin::V1::DeleteIndexRequest.new

# Call the delete_index method.
result = client.delete_index request

# The returned object is of type Google::Protobuf::Empty.
p result

#export_documents

def export_documents(request, options = nil) -> ::Gapic::Operation
def export_documents(name: nil, collection_ids: nil, output_uri_prefix: nil, namespace_ids: nil, snapshot_time: nil) -> ::Gapic::Operation

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

Overloads
def export_documents(request, options = nil) -> ::Gapic::Operation
Pass arguments to export_documents via a request object, either of type ExportDocumentsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Firestore::Admin::V1::ExportDocumentsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def export_documents(name: nil, collection_ids: nil, output_uri_prefix: nil, namespace_ids: nil, snapshot_time: nil) -> ::Gapic::Operation
Pass arguments to export_documents via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. Database to export. Should be of the form: projects/{project_id}/databases/{database_id}.
  • collection_ids (::Array<::String>) — Which collection ids to export. Unspecified means all collections.
  • output_uri_prefix (::String) — The output URI. Currently only supports Google Cloud Storage URIs of the form: gs://BUCKET_NAME[/NAMESPACE_PATH], where BUCKET_NAME is the name of the Google Cloud Storage bucket and NAMESPACE_PATH is an optional Google Cloud Storage namespace path. When choosing a name, be sure to consider Google Cloud Storage naming guidelines: https://cloud.google.com/storage/docs/naming. If the URI is a bucket (without a namespace path), a prefix will be generated based on the start time.
  • namespace_ids (::Array<::String>) — An empty list represents all namespaces. This is the preferred usage for databases that don't use namespaces.

    An empty string element represents the default namespace. This should be used if the database has data in non-default namespaces, but doesn't want to include them. Each namespace in this list must be unique.

  • snapshot_time (::Google::Protobuf::Timestamp, ::Hash) — The timestamp that corresponds to the version of the database to be exported. The timestamp must be in the past, rounded to the minute and not older than earliestVersionTime. If specified, then the exported documents will represent a consistent view of the database at the provided time. Otherwise, there are no guarantees about the consistency of the exported documents.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/firestore/admin/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Firestore::Admin::V1::ExportDocumentsRequest.new

# Call the export_documents method.
result = client.export_documents request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#get_database

def get_database(request, options = nil) -> ::Google::Cloud::Firestore::Admin::V1::Database
def get_database(name: nil) -> ::Google::Cloud::Firestore::Admin::V1::Database

Gets information about a database.

Overloads
def get_database(request, options = nil) -> ::Google::Cloud::Firestore::Admin::V1::Database
Pass arguments to get_database via a request object, either of type GetDatabaseRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Firestore::Admin::V1::GetDatabaseRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_database(name: nil) -> ::Google::Cloud::Firestore::Admin::V1::Database
Pass arguments to get_database via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. A name of the form projects/{project_id}/databases/{database_id}
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/firestore/admin/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Firestore::Admin::V1::GetDatabaseRequest.new

# Call the get_database method.
result = client.get_database request

# The returned object is of type Google::Cloud::Firestore::Admin::V1::Database.
p result

#get_field

def get_field(request, options = nil) -> ::Google::Cloud::Firestore::Admin::V1::Field
def get_field(name: nil) -> ::Google::Cloud::Firestore::Admin::V1::Field

Gets the metadata and configuration for a Field.

Overloads
def get_field(request, options = nil) -> ::Google::Cloud::Firestore::Admin::V1::Field
Pass arguments to get_field via a request object, either of type GetFieldRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Firestore::Admin::V1::GetFieldRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_field(name: nil) -> ::Google::Cloud::Firestore::Admin::V1::Field
Pass arguments to get_field via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. A name of the form projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/firestore/admin/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Firestore::Admin::V1::GetFieldRequest.new

# Call the get_field method.
result = client.get_field request

# The returned object is of type Google::Cloud::Firestore::Admin::V1::Field.
p result

#get_index

def get_index(request, options = nil) -> ::Google::Cloud::Firestore::Admin::V1::Index
def get_index(name: nil) -> ::Google::Cloud::Firestore::Admin::V1::Index

Gets a composite index.

Overloads
def get_index(request, options = nil) -> ::Google::Cloud::Firestore::Admin::V1::Index
Pass arguments to get_index via a request object, either of type GetIndexRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Firestore::Admin::V1::GetIndexRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_index(name: nil) -> ::Google::Cloud::Firestore::Admin::V1::Index
Pass arguments to get_index via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. A name of the form projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/firestore/admin/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Firestore::Admin::V1::GetIndexRequest.new

# Call the get_index method.
result = client.get_index request

# The returned object is of type Google::Cloud::Firestore::Admin::V1::Index.
p result

#import_documents

def import_documents(request, options = nil) -> ::Gapic::Operation
def import_documents(name: nil, collection_ids: nil, input_uri_prefix: nil, namespace_ids: nil) -> ::Gapic::Operation

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.

Overloads
def import_documents(request, options = nil) -> ::Gapic::Operation
Pass arguments to import_documents via a request object, either of type ImportDocumentsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Firestore::Admin::V1::ImportDocumentsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def import_documents(name: nil, collection_ids: nil, input_uri_prefix: nil, namespace_ids: nil) -> ::Gapic::Operation
Pass arguments to import_documents via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. Database to import into. Should be of the form: projects/{project_id}/databases/{database_id}.
  • collection_ids (::Array<::String>) — Which collection ids to import. Unspecified means all collections included in the import.
  • input_uri_prefix (::String) — Location of the exported files. This must match the output_uri_prefix of an ExportDocumentsResponse from an export that has completed successfully. See: google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix.
  • namespace_ids (::Array<::String>) — An empty list represents all namespaces. This is the preferred usage for databases that don't use namespaces.

    An empty string element represents the default namespace. This should be used if the database has data in non-default namespaces, but doesn't want to include them. Each namespace in this list must be unique.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/firestore/admin/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Firestore::Admin::V1::ImportDocumentsRequest.new

# Call the import_documents method.
result = client.import_documents request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#initialize

def initialize() { |config| ... } -> Client

Create a new FirestoreAdmin client object.

Yields
  • (config) — Configure the FirestoreAdmin client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new do |config|
  config.timeout = 10.0
end

#list_databases

def list_databases(request, options = nil) -> ::Google::Cloud::Firestore::Admin::V1::ListDatabasesResponse
def list_databases(parent: nil) -> ::Google::Cloud::Firestore::Admin::V1::ListDatabasesResponse

List all the databases in the project.

Overloads
def list_databases(request, options = nil) -> ::Google::Cloud::Firestore::Admin::V1::ListDatabasesResponse
Pass arguments to list_databases via a request object, either of type ListDatabasesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Firestore::Admin::V1::ListDatabasesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_databases(parent: nil) -> ::Google::Cloud::Firestore::Admin::V1::ListDatabasesResponse
Pass arguments to list_databases via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • parent (::String) — Required. A parent name of the form projects/{project_id}
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/firestore/admin/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Firestore::Admin::V1::ListDatabasesRequest.new

# Call the list_databases method.
result = client.list_databases request

# The returned object is of type Google::Cloud::Firestore::Admin::V1::ListDatabasesResponse.
p result

#list_fields

def list_fields(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Field>
def list_fields(parent: nil, filter: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Field>

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:*`.

Overloads
def list_fields(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Field>
Pass arguments to list_fields via a request object, either of type ListFieldsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Firestore::Admin::V1::ListFieldsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_fields(parent: nil, filter: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Field>
Pass arguments to list_fields via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. A parent name of the form projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}
  • filter (::String) — The filter to apply to list results. Currently, FirestoreAdmin.ListFields only supports listing fields that have been explicitly overridden. To issue this query, call FirestoreAdmin.ListFields with a filter that includes indexConfig.usesAncestorConfig:false .
  • page_size (::Integer) — The number of results to return.
  • page_token (::String) — A page token, returned from a previous call to FirestoreAdmin.ListFields, that may be used to get the next page of results.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/firestore/admin/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Firestore::Admin::V1::ListFieldsRequest.new

# Call the list_fields method.
result = client.list_fields request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Firestore::Admin::V1::Field.
  p item
end

#list_indexes

def list_indexes(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Index>
def list_indexes(parent: nil, filter: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Index>

Lists composite indexes.

Overloads
def list_indexes(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Index>
Pass arguments to list_indexes via a request object, either of type ListIndexesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Firestore::Admin::V1::ListIndexesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_indexes(parent: nil, filter: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Index>
Pass arguments to list_indexes via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. A parent name of the form projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}
  • filter (::String) — The filter to apply to list results.
  • page_size (::Integer) — The number of results to return.
  • page_token (::String) — A page token, returned from a previous call to FirestoreAdmin.ListIndexes, that may be used to get the next page of results.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/firestore/admin/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Firestore::Admin::V1::ListIndexesRequest.new

# Call the list_indexes method.
result = client.list_indexes request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Firestore::Admin::V1::Index.
  p item
end

#location_client

def location_client() -> Google::Cloud::Location::Locations::Client

Get the associated client for mix-in of the Locations.

Returns
  • (Google::Cloud::Location::Locations::Client)

#operations_client

def operations_client() -> ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Operations

Get the associated client for long-running operations.

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_database

def update_database(request, options = nil) -> ::Gapic::Operation
def update_database(database: nil, update_mask: nil) -> ::Gapic::Operation

Updates a database.

Overloads
def update_database(request, options = nil) -> ::Gapic::Operation
Pass arguments to update_database via a request object, either of type UpdateDatabaseRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Firestore::Admin::V1::UpdateDatabaseRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_database(database: nil, update_mask: nil) -> ::Gapic::Operation
Pass arguments to update_database via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/firestore/admin/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Firestore::Admin::V1::UpdateDatabaseRequest.new

# Call the update_database method.
result = client.update_database request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#update_field

def update_field(request, options = nil) -> ::Gapic::Operation
def update_field(field: nil, update_mask: nil) -> ::Gapic::Operation

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/*.

Overloads
def update_field(request, options = nil) -> ::Gapic::Operation
Pass arguments to update_field via a request object, either of type UpdateFieldRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Firestore::Admin::V1::UpdateFieldRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_field(field: nil, update_mask: nil) -> ::Gapic::Operation
Pass arguments to update_field via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/firestore/admin/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Firestore::Admin::V1::UpdateFieldRequest.new

# Call the update_field method.
result = client.update_field request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end