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

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

Overview

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 client object.

Examples:


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

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

Yields:

  • (config)

    Configure the FirestoreAdmin client.

Yield Parameters:



188
189
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
234
235
236
237
238
239
240
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 188

def initialize
  # These require statements are intentionally placed here to initialize
  # the gRPC module only when it's required.
  # See https://github.com/googleapis/toolkit/issues/446
  require "gapic/grpc"
  require "google/firestore/admin/v1/firestore_admin_services_pb"

  # 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 = 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 = ::Gapic::ServiceStub.new(
    ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Stub,
    credentials: credentials,
    endpoint: @config.endpoint,
    endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
    universe_domain: @config.universe_domain,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors,
    channel_pool_config: @config.channel_pool
  )

  @location_client = Google::Cloud::Location::Locations::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::Client (readonly)

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

Returns:

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


254
255
256
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 254

def location_client
  @location_client
end

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

Get the associated client for long-running operations.



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

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::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



91
92
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
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 91

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

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

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

    if the RPC is aborted.



1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 1268

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :bulk_delete_documents, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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:



158
159
160
161
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 158

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

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 2240

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :create_backup_schedule, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

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

    if the RPC is aborted.



1374
1375
1376
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
1412
1413
1414
1415
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 1374

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :create_database, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

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

    if the RPC is aborted.



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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 316

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :create_index, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC 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
2049
2050
2051
2052
2053
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 2013

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :delete_backup, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 2594

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :delete_backup_schedule, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

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

    if the RPC is aborted.



1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 1745

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :delete_database, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 591

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :delete_index, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

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

    if the RPC is aborted.



1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 1035

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :export_documents, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 1834

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :get_backup, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
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
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 2329

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :get_backup_schedule, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



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
1494
1495
1496
1497
1498
1499
1500
1501
1502
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 1462

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :get_database, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 678

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :get_field, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 504

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :get_index, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

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

    if the RPC is aborted.



1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 1150

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :import_documents, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2417
2418
2419
2420
2421
2422
2423
2424
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
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 2417

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :list_backup_schedules, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 1925

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :list_backups, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



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
1583
1584
1585
1586
1587
1588
1589
1590
1591
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 1551

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :list_databases, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

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

Lists the field configuration and metadata for this database.

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

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

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 903

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :list_fields, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @firestore_admin_stub, :list_fields, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

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

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 416

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :list_indexes, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @firestore_admin_stub, :list_indexes, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

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

    if the RPC is aborted.



2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 2147

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :restore_database, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#universe_domainString

The effective universe domain

Returns:

  • (String)


168
169
170
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 168

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

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 2505

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.backup_schedule&.name
    header_params["backup_schedule.name"] = request.backup_schedule.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :update_backup_schedule, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

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

    if the RPC is aborted.



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
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 1646

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.database&.name
    header_params["database.name"] = request.database.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :update_database, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => 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::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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

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

    if the RPC is aborted.



789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/client.rb', line 789

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
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.field&.name
    header_params["field.name"] = request.field.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  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.call_rpc :update_field, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end