Client for the FirestoreAdmin service.
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.
- (config) — Configure the Client client.
- config (Client::Configuration)
# 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.
- (config) — Configure the Client client.
- config (Client::Configuration)
#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.
def create_index(request, options = nil) -> ::Gapic::Operation
create_index
via a request object, either of type
CreateIndexRequest or an equivalent Hash.
- 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
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).
-
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.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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 this # object to check the status of an operation, cancel it, or wait # for results. Here is how to block until completion: result.wait_until_done! timeout: 60 if result.response? p result.response else puts "Error!" end
#delete_index
def delete_index(request, options = nil) -> ::Google::Protobuf::Empty
def delete_index(name: nil) -> ::Google::Protobuf::Empty
Deletes a composite index.
def delete_index(request, options = nil) -> ::Google::Protobuf::Empty
delete_index
via a request object, either of type
DeleteIndexRequest or an equivalent Hash.
- 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
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).
-
name (::String) — Required. A name of the form
projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Protobuf::Empty)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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) -> ::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.
def export_documents(request, options = nil) -> ::Gapic::Operation
export_documents
via a request object, either of type
ExportDocumentsRequest or an equivalent Hash.
- 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) -> ::Gapic::Operation
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).
-
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]
, whereBUCKET_NAME
is the name of the Google Cloud Storage bucket andNAMESPACE_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.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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 this # object to check the status of an operation, cancel it, or wait # for results. Here is how to block until completion: result.wait_until_done! timeout: 60 if result.response? p result.response else puts "Error!" end
#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.
def get_field(request, options = nil) -> ::Google::Cloud::Firestore::Admin::V1::Field
get_field
via a request object, either of type
GetFieldRequest or an equivalent Hash.
- 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
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).
-
name (::String) — Required. A name of the form
projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Firestore::Admin::V1::Field)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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.
def get_index(request, options = nil) -> ::Google::Cloud::Firestore::Admin::V1::Index
get_index
via a request object, either of type
GetIndexRequest or an equivalent Hash.
- 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
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).
-
name (::String) — Required. A name of the form
projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Firestore::Admin::V1::Index)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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) -> ::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.
def import_documents(request, options = nil) -> ::Gapic::Operation
import_documents
via a request object, either of type
ImportDocumentsRequest or an equivalent Hash.
- 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) -> ::Gapic::Operation
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).
-
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.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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 this # object to check the status of an operation, cancel it, or wait # for results. Here is how to block until completion: result.wait_until_done! timeout: 60 if result.response? p result.response else puts "Error!" end
#initialize
def initialize() { |config| ... } -> Client
Create a new FirestoreAdmin client object.
- (config) — Configure the FirestoreAdmin client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# 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_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
.
def list_fields(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Field>
list_fields
via a request object, either of type
ListFieldsRequest or an equivalent Hash.
- 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>
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).
-
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 the filter set to
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.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Field>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Field>)
- (::Google::Cloud::Error) — if the RPC is aborted.
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 all elements by calling #each, and the enumerable # will lazily make API calls to fetch subsequent pages. Other # methods are also available for managing paging directly. result.each do |response| # Each element is of type ::Google::Cloud::Firestore::Admin::V1::Field. p response 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.
def list_indexes(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Index>
list_indexes
via a request object, either of type
ListIndexesRequest or an equivalent Hash.
- 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>
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).
-
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.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Index>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Index>)
- (::Google::Cloud::Error) — if the RPC is aborted.
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 all elements by calling #each, and the enumerable # will lazily make API calls to fetch subsequent pages. Other # methods are also available for managing paging directly. result.each do |response| # Each element is of type ::Google::Cloud::Firestore::Admin::V1::Index. p response end
#operations_client
def operations_client() -> ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Operations
Get the associated client for long-running operations.
#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/*
.
def update_field(request, options = nil) -> ::Gapic::Operation
update_field
via a request object, either of type
UpdateFieldRequest or an equivalent Hash.
- 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
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).
- field (::Google::Cloud::Firestore::Admin::V1::Field, ::Hash) — Required. The field to be updated.
- update_mask (::Google::Protobuf::FieldMask, ::Hash) — A mask, relative to the field. If specified, only configuration specified by this field_mask will be updated in the field.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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 this # object to check the status of an operation, cancel it, or wait # for results. Here is how to block until completion: result.wait_until_done! timeout: 60 if result.response? p result.response else puts "Error!" end