Class: Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb

Overview

REST 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.

Defined Under Namespace

Classes: Configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#backup_path, #backup_schedule_path, #collection_group_path, #database_path, #field_path, #index_path, #location_path, #operation_path, #project_path

Constructor Details

#initialize {|config| ... } ⇒ Client

Create a new FirestoreAdmin REST client object.

Examples:


# Create a client using the default configuration
client = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Client.new

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

Yields:

  • (config)

    Configure the FirestoreAdmin client.

Yield Parameters:



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 190

def initialize
  # Create the configuration object
  @config = Configuration.new Client.configure

  # Yield the configuration if needed
  yield @config if block_given?

  # Create credentials
  credentials = @config.credentials
  # Use self-signed JWT if the endpoint is unchanged from default,
  # but only if the default endpoint does not have a region prefix.
  enable_self_signed_jwt = @config.endpoint.nil? ||
                           (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
                           !@config.endpoint.split(".").first.include?("-"))
  credentials ||= Credentials.default scope: @config.scope,
                                      enable_self_signed_jwt: enable_self_signed_jwt
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
    credentials = Credentials.new credentials, scope: @config.scope
  end

  @quota_project_id = @config.quota_project
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

  @operations_client = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Operations.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @config.endpoint
    config.universe_domain = @config.universe_domain
  end

  @firestore_admin_stub = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::ServiceStub.new(
    endpoint: @config.endpoint,
    endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
    universe_domain: @config.universe_domain,
    credentials: credentials
  )

  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @firestore_admin_stub.endpoint
    config.universe_domain = @firestore_admin_stub.universe_domain
  end
end

Instance Attribute Details

#location_clientGoogle::Cloud::Location::Locations::Rest::Client (readonly)

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

Returns:

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


247
248
249
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 247

def location_client
  @location_client
end

#operations_client::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Operations (readonly)

Get the associated client for long-running operations.



240
241
242
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 240

def operations_client
  @operations_client
end

Class Method Details

.configure {|config| ... } ⇒ Client::Configuration

Configure the FirestoreAdmin Client class.

See Configuration for a description of the configuration fields.

Examples:


# Modify the configuration for all FirestoreAdmin clients
::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 93

def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "Firestore", "Admin", "V1"]
    parent_config = while namespace.any?
                      parent_name = namespace.join "::"
                      parent_const = const_get parent_name
                      break parent_const.configure if parent_const.respond_to? :configure
                      namespace.pop
                    end
    default_config = Client::Configuration.new parent_config

    default_config.rpcs.create_index.timeout = 60.0

    default_config.rpcs.list_indexes.timeout = 60.0
    default_config.rpcs.list_indexes.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13, 4]
    }

    default_config.rpcs.get_index.timeout = 60.0
    default_config.rpcs.get_index.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13, 4]
    }

    default_config.rpcs.delete_index.timeout = 60.0
    default_config.rpcs.delete_index.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13, 4]
    }

    default_config.rpcs.get_field.timeout = 60.0
    default_config.rpcs.get_field.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13, 4]
    }

    default_config.rpcs.update_field.timeout = 60.0

    default_config.rpcs.list_fields.timeout = 60.0
    default_config.rpcs.list_fields.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13, 4]
    }

    default_config.rpcs.export_documents.timeout = 60.0

    default_config.rpcs.import_documents.timeout = 60.0

    default_config.rpcs.bulk_delete_documents.timeout = 60.0

    default_config
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

#bulk_delete_documents(request, options = nil) ⇒ ::Gapic::Operation #bulk_delete_documents(name: nil, collection_ids: nil, namespace_ids: nil) ⇒ ::Gapic::Operation

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

Examples:

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::Rest::Client.new

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

# Call the bulk_delete_documents method.
result = client.bulk_delete_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

Overloads:

  • #bulk_delete_documents(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to bulk_delete_documents via a request object, either of type BulkDeleteDocumentsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Firestore::Admin::V1::BulkDeleteDocumentsRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #bulk_delete_documents(name: nil, collection_ids: nil, namespace_ids: nil) ⇒ ::Gapic::Operation

    Pass arguments to bulk_delete_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) (defaults to: nil)

      Required. Database to operate. Should be of the form: projects/{project_id}/databases/{database_id}.

    • collection_ids (::Array<::String>) (defaults to: nil)

      Optional. IDs of the collection groups to delete. Unspecified means all collection groups.

      Each collection group in this list must be unique.

    • namespace_ids (::Array<::String>) (defaults to: nil)

      Optional. Namespaces to delete.

      An empty list means all namespaces. This is the recommended 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 delete from them.

      Each namespace in this list must be unique.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 1197

def bulk_delete_documents request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::BulkDeleteDocumentsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.bulk_delete_documents..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.bulk_delete_documents.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.bulk_delete_documents.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.bulk_delete_documents request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#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 configure.

See Configuration for a description of the configuration fields.

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



160
161
162
163
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 160

def configure
  yield @config if block_given?
  @config
end

#create_backup_schedule(request, options = nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::BackupSchedule #create_backup_schedule(parent: nil, backup_schedule: nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::BackupSchedule

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.

Examples:

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::Rest::Client.new

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

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

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

Overloads:

  • #create_backup_schedule(request, options = nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::BackupSchedule

    Pass arguments to create_backup_schedule via a request object, either of type CreateBackupScheduleRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Firestore::Admin::V1::CreateBackupScheduleRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #create_backup_schedule(parent: nil, backup_schedule: nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::BackupSchedule

    Pass arguments to create_backup_schedule 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:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 2099

def create_backup_schedule request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::CreateBackupScheduleRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_backup_schedule..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.create_backup_schedule.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_backup_schedule.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.create_backup_schedule request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_database(request, options = nil) ⇒ ::Gapic::Operation #create_database(parent: nil, database: nil, database_id: nil) ⇒ ::Gapic::Operation

Create a database.

Examples:

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::Rest::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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) (defaults to: nil)

      Required. A parent name of the form projects/{project_id}

    • database (::Google::Cloud::Firestore::Admin::V1::Database, ::Hash) (defaults to: nil)

      Required. The Database to create.

    • database_id (::String) (defaults to: nil)

      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:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 1296

def create_database request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::CreateDatabaseRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_database..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.create_database.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_database.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.create_database request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_index(request, options = nil) ⇒ ::Gapic::Operation #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.

Examples:

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::Rest::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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) (defaults to: nil)

      Required. A parent name of the form projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}

    • index (::Google::Cloud::Firestore::Admin::V1::Index, ::Hash) (defaults to: nil)

      Required. The composite index to create.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 308

def create_index request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::CreateIndexRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_index..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.create_index.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_index.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.create_index request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_backup(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_backup(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes a backup.

Examples:

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::Rest::Client.new

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

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

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

Overloads:

  • #delete_backup(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_backup via a request object, either of type DeleteBackupRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Firestore::Admin::V1::DeleteBackupRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #delete_backup(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_backup 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) (defaults to: nil)

      Required. Name of the backup to delete.

      format is projects/{project}/locations/{location}/backups/{backup}.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 1886

def delete_backup request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::DeleteBackupRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_backup..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.delete_backup.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_backup.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.delete_backup request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_backup_schedule(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_backup_schedule(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes a backup schedule.

Examples:

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::Rest::Client.new

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

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

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

Overloads:

  • #delete_backup_schedule(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_backup_schedule via a request object, either of type DeleteBackupScheduleRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Firestore::Admin::V1::DeleteBackupScheduleRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #delete_backup_schedule(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_backup_schedule 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) (defaults to: nil)

      Required. The name of the backup schedule.

      Format projects/{project}/databases/{database}/backupSchedules/{backup_schedule}

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 2425

def delete_backup_schedule request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::DeleteBackupScheduleRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_backup_schedule..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.delete_backup_schedule.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_backup_schedule.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.delete_backup_schedule request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_database(request, options = nil) ⇒ ::Gapic::Operation #delete_database(name: nil, etag: nil) ⇒ ::Gapic::Operation

Deletes a database.

Examples:

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::Rest::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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) (defaults to: nil)

      Required. A name of the form projects/{project_id}/databases/{database_id}

    • etag (::String) (defaults to: nil)

      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:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 1639

def delete_database request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::DeleteDatabaseRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_database..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.delete_database.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_database.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.delete_database request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_index(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_index(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes a composite index.

Examples:

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::Rest::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. A name of the form projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 562

def delete_index request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::DeleteIndexRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_index..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.delete_index.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_index.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.delete_index request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#export_documents(request, options = nil) ⇒ ::Gapic::Operation #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

Examples:

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::Rest::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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) (defaults to: nil)

      Required. Database to export. Should be of the form: projects/{project_id}/databases/{database_id}.

    • collection_ids (::Array<::String>) (defaults to: nil)

      Which collection IDs to export. Unspecified means all collections. Each collection ID in this list must be unique.

    • output_uri_prefix (::String) (defaults to: nil)

      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>) (defaults to: nil)

      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) (defaults to: nil)

      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:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 978

def export_documents request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::ExportDocumentsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.export_documents..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.export_documents.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.export_documents.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.export_documents request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_backup(request, options = nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::Backup #get_backup(name: nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::Backup

Gets information about a backup.

Examples:

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::Rest::Client.new

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

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

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

Overloads:

  • #get_backup(request, options = nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::Backup

    Pass arguments to get_backup via a request object, either of type GetBackupRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Firestore::Admin::V1::GetBackupRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #get_backup(name: nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::Backup

    Pass arguments to get_backup 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) (defaults to: nil)

      Required. Name of the backup to fetch.

      Format is projects/{project}/locations/{location}/backups/{backup}.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 1721

def get_backup request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::GetBackupRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_backup..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_backup.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_backup.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.get_backup request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_backup_schedule(request, options = nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::BackupSchedule #get_backup_schedule(name: nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::BackupSchedule

Gets information about a backup schedule.

Examples:

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::Rest::Client.new

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

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

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

Overloads:

  • #get_backup_schedule(request, options = nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::BackupSchedule

    Pass arguments to get_backup_schedule via a request object, either of type GetBackupScheduleRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Firestore::Admin::V1::GetBackupScheduleRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #get_backup_schedule(name: nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::BackupSchedule

    Pass arguments to get_backup_schedule 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) (defaults to: nil)

      Required. The name of the backup schedule.

      Format projects/{project}/databases/{database}/backupSchedules/{backup_schedule}

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 2181

def get_backup_schedule request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::GetBackupScheduleRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_backup_schedule..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_backup_schedule.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_backup_schedule.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.get_backup_schedule request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_database(request, options = nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::Database #get_database(name: nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::Database

Gets information about a database.

Examples:

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::Rest::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. A name of the form projects/{project_id}/databases/{database_id}

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 1377

def get_database request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::GetDatabaseRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_database..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_database.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_database.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.get_database request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_field(request, options = nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::Field #get_field(name: nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::Field

Gets the metadata and configuration for a Field.

Examples:

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::Rest::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. A name of the form projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 642

def get_field request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::GetFieldRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_field..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_field.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_field.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.get_field request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_index(request, options = nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::Index #get_index(name: nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::Index

Gets a composite index.

Examples:

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::Rest::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. A name of the form projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 482

def get_index request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::GetIndexRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_index..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_index.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_index.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.get_index request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#import_documents(request, options = nil) ⇒ ::Gapic::Operation #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.

Examples:

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::Rest::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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) (defaults to: nil)

      Required. Database to import into. Should be of the form: projects/{project_id}/databases/{database_id}.

    • collection_ids (::Array<::String>) (defaults to: nil)

      Which collection IDs to import. Unspecified means all collections included in the import. Each collection ID in this list must be unique.

    • input_uri_prefix (::String) (defaults to: nil)

      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>) (defaults to: nil)

      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:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 1086

def import_documents request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::ImportDocumentsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.import_documents..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.import_documents.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.import_documents.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.import_documents request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_backup_schedules(request, options = nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::ListBackupSchedulesResponse #list_backup_schedules(parent: nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::ListBackupSchedulesResponse

List backup schedules.

Examples:

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::Rest::Client.new

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

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

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

Overloads:

  • #list_backup_schedules(request, options = nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::ListBackupSchedulesResponse

    Pass arguments to list_backup_schedules via a request object, either of type ListBackupSchedulesRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Firestore::Admin::V1::ListBackupSchedulesRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #list_backup_schedules(parent: nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::ListBackupSchedulesResponse

    Pass arguments to list_backup_schedules 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) (defaults to: nil)

      Required. The parent database.

      Format is projects/{project}/databases/{database}.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 2262

def list_backup_schedules request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::ListBackupSchedulesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_backup_schedules..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.list_backup_schedules.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_backup_schedules.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.list_backup_schedules request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_backups(request, options = nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::ListBackupsResponse #list_backups(parent: nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::ListBackupsResponse

Lists all the backups.

Examples:

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::Rest::Client.new

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

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

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

Overloads:

  • #list_backups(request, options = nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::ListBackupsResponse

    Pass arguments to list_backups via a request object, either of type ListBackupsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Firestore::Admin::V1::ListBackupsRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #list_backups(parent: nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::ListBackupsResponse

    Pass arguments to list_backups 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) (defaults to: nil)

      Required. The location to list backups from.

      Format is projects/{project}/locations/{location}. Use {location} = '-' to list backups from all locations for the given project. This allows listing backups from a single location or from all locations.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 1805

def list_backups request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::ListBackupsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_backups..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.list_backups.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_backups.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.list_backups request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_databases(request, options = nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::ListDatabasesResponse #list_databases(parent: nil, show_deleted: nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::ListDatabasesResponse

List all the databases in the project.

Examples:

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::Rest::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #list_databases(parent: nil, show_deleted: 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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. A parent name of the form projects/{project_id}

    • show_deleted (::Boolean) (defaults to: nil)

      If true, also returns deleted resources.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 1459

def list_databases request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::ListDatabasesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_databases..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.list_databases.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_databases.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.list_databases request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_fields(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Field> #list_fields(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::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:*.

Examples:

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::Rest::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

Overloads:

  • #list_fields(request, options = nil) ⇒ ::Gapic::Rest::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #list_fields(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::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) (defaults to: nil)

      Required. A parent name of the form projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}

    • filter (::String) (defaults to: nil)

      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 or ttlConfig:*.

    • page_size (::Integer) (defaults to: nil)

      The number of results to return.

    • page_token (::String) (defaults to: nil)

      A page token, returned from a previous call to FirestoreAdmin.ListFields, that may be used to get the next page of results.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 853

def list_fields request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::ListFieldsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_fields..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.list_fields.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_fields.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.list_fields request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @firestore_admin_stub, :list_fields, "fields", request, result, options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

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

Lists composite indexes.

Examples:

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::Rest::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

Overloads:

  • #list_indexes(request, options = nil) ⇒ ::Gapic::Rest::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #list_indexes(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::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) (defaults to: nil)

      Required. A parent name of the form projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}

    • filter (::String) (defaults to: nil)

      The filter to apply to list results.

    • page_size (::Integer) (defaults to: nil)

      The number of results to return.

    • page_token (::String) (defaults to: nil)

      A page token, returned from a previous call to FirestoreAdmin.ListIndexes, that may be used to get the next page of results.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 401

def list_indexes request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::ListIndexesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_indexes..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.list_indexes.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_indexes.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.list_indexes request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @firestore_admin_stub, :list_indexes, "indexes", request, result, options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#restore_database(request, options = nil) ⇒ ::Gapic::Operation #restore_database(parent: nil, database_id: nil, backup: nil, encryption_config: nil) ⇒ ::Gapic::Operation

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.

Examples:

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::Rest::Client.new

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

# Call the restore_database method.
result = client.restore_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

Overloads:

  • #restore_database(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to restore_database via a request object, either of type RestoreDatabaseRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Firestore::Admin::V1::RestoreDatabaseRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #restore_database(parent: nil, database_id: nil, backup: nil, encryption_config: nil) ⇒ ::Gapic::Operation

    Pass arguments to restore_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) (defaults to: nil)

      Required. The project to restore the database in. Format is projects/{project_id}.

    • database_id (::String) (defaults to: nil)

      Required. The ID to use for the database, which will become the final component of the database's resource name. This database ID must not be associated with an existing database.

      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.

    • backup (::String) (defaults to: nil)

      Required. Backup to restore from. Must be from the same project as the parent.

      The restored database will be created in the same location as the source backup.

      Format is: projects/{project_id}/locations/{location}/backups/{backup}

    • encryption_config (::Google::Cloud::Firestore::Admin::V1::Database::EncryptionConfig, ::Hash) (defaults to: nil)

      Optional. Encryption configuration for the restored database.

      If this field is not specified, the restored database will use the same encryption configuration as the backup, namely use_source_encryption.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 2013

def restore_database request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::RestoreDatabaseRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.restore_database..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.restore_database.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.restore_database.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.restore_database request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#universe_domainString

The effective universe domain

Returns:

  • (String)


170
171
172
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 170

def universe_domain
  @firestore_admin_stub.universe_domain
end

#update_backup_schedule(request, options = nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::BackupSchedule #update_backup_schedule(backup_schedule: nil, update_mask: nil) ⇒ ::Google::Cloud::Firestore::Admin::V1::BackupSchedule

Updates a backup schedule.

Examples:

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::Rest::Client.new

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

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

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

Overloads:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 2343

def update_backup_schedule request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::UpdateBackupScheduleRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_backup_schedule..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.update_backup_schedule.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_backup_schedule.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.update_backup_schedule request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_database(request, options = nil) ⇒ ::Gapic::Operation #update_database(database: nil, update_mask: nil) ⇒ ::Gapic::Operation

Updates a database.

Examples:

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::Rest::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 1547

def update_database request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::UpdateDatabaseRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_database..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.update_database.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_database.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.update_database request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_field(request, options = nil) ⇒ ::Gapic::Operation #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/*.

Examples:

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::Rest::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/rest/client.rb', line 746

def update_field request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::UpdateFieldRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_field..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.update_field.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_field.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @firestore_admin_stub.update_field request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end