google-cloud-firestore-admin-v1 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1289 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/firestore/admin/v1/firestore_admin_pb"
21
+ require "google/cloud/firestore/admin/v1/firestore_admin/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Firestore
27
+ module Admin
28
+ module V1
29
+ module FirestoreAdmin
30
+ module Rest
31
+ ##
32
+ # REST client for the FirestoreAdmin service.
33
+ #
34
+ # The Cloud Firestore Admin API.
35
+ #
36
+ # This API provides several administrative services for Cloud Firestore.
37
+ #
38
+ # Project, Database, Namespace, Collection, Collection Group, and Document are
39
+ # used as defined in the Google Cloud Firestore API.
40
+ #
41
+ # Operation: An Operation represents work being performed in the background.
42
+ #
43
+ # The index service manages Cloud Firestore indexes.
44
+ #
45
+ # Index creation is performed asynchronously.
46
+ # An Operation resource is created for each such asynchronous operation.
47
+ # The state of the operation (including any errors encountered)
48
+ # may be queried via the Operation resource.
49
+ #
50
+ # The Operations collection provides a record of actions performed for the
51
+ # specified Project (including any Operations in progress). Operations are not
52
+ # created directly but through calls on other collections or resources.
53
+ #
54
+ # An Operation that is done may be deleted so that it is no longer listed as
55
+ # part of the Operation collection. Operations are garbage collected after
56
+ # 30 days. By default, ListOperations will only return in progress and failed
57
+ # operations. To list completed operation, issue a ListOperations request with
58
+ # the filter `done: true`.
59
+ #
60
+ # Operations are created by service `FirestoreAdmin`, but are accessed via
61
+ # service `google.longrunning.Operations`.
62
+ #
63
+ class Client
64
+ include Paths
65
+
66
+ # @private
67
+ attr_reader :firestore_admin_stub
68
+
69
+ ##
70
+ # Configure the FirestoreAdmin Client class.
71
+ #
72
+ # See {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Client::Configuration}
73
+ # for a description of the configuration fields.
74
+ #
75
+ # @example
76
+ #
77
+ # # Modify the configuration for all FirestoreAdmin clients
78
+ # ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Client.configure do |config|
79
+ # config.timeout = 10.0
80
+ # end
81
+ #
82
+ # @yield [config] Configure the Client client.
83
+ # @yieldparam config [Client::Configuration]
84
+ #
85
+ # @return [Client::Configuration]
86
+ #
87
+ def self.configure
88
+ @configure ||= begin
89
+ namespace = ["Google", "Cloud", "Firestore", "Admin", "V1"]
90
+ parent_config = while namespace.any?
91
+ parent_name = namespace.join "::"
92
+ parent_const = const_get parent_name
93
+ break parent_const.configure if parent_const.respond_to? :configure
94
+ namespace.pop
95
+ end
96
+ default_config = Client::Configuration.new parent_config
97
+
98
+ default_config.rpcs.create_index.timeout = 60.0
99
+
100
+ default_config.rpcs.list_indexes.timeout = 60.0
101
+ default_config.rpcs.list_indexes.retry_policy = {
102
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13, 4]
103
+ }
104
+
105
+ default_config.rpcs.get_index.timeout = 60.0
106
+ default_config.rpcs.get_index.retry_policy = {
107
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13, 4]
108
+ }
109
+
110
+ default_config.rpcs.delete_index.timeout = 60.0
111
+ default_config.rpcs.delete_index.retry_policy = {
112
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13, 4]
113
+ }
114
+
115
+ default_config.rpcs.get_field.timeout = 60.0
116
+ default_config.rpcs.get_field.retry_policy = {
117
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13, 4]
118
+ }
119
+
120
+ default_config.rpcs.update_field.timeout = 60.0
121
+
122
+ default_config.rpcs.list_fields.timeout = 60.0
123
+ default_config.rpcs.list_fields.retry_policy = {
124
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 13, 4]
125
+ }
126
+
127
+ default_config.rpcs.export_documents.timeout = 60.0
128
+
129
+ default_config.rpcs.import_documents.timeout = 60.0
130
+
131
+ default_config
132
+ end
133
+ yield @configure if block_given?
134
+ @configure
135
+ end
136
+
137
+ ##
138
+ # Configure the FirestoreAdmin Client instance.
139
+ #
140
+ # The configuration is set to the derived mode, meaning that values can be changed,
141
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
142
+ # should be made on {Client.configure}.
143
+ #
144
+ # See {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Client::Configuration}
145
+ # for a description of the configuration fields.
146
+ #
147
+ # @yield [config] Configure the Client client.
148
+ # @yieldparam config [Client::Configuration]
149
+ #
150
+ # @return [Client::Configuration]
151
+ #
152
+ def configure
153
+ yield @config if block_given?
154
+ @config
155
+ end
156
+
157
+ ##
158
+ # Create a new FirestoreAdmin REST client object.
159
+ #
160
+ # @example
161
+ #
162
+ # # Create a client using the default configuration
163
+ # client = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Client.new
164
+ #
165
+ # # Create a client using a custom configuration
166
+ # client = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Client.new do |config|
167
+ # config.timeout = 10.0
168
+ # end
169
+ #
170
+ # @yield [config] Configure the FirestoreAdmin client.
171
+ # @yieldparam config [Client::Configuration]
172
+ #
173
+ def initialize
174
+ # Create the configuration object
175
+ @config = Configuration.new Client.configure
176
+
177
+ # Yield the configuration if needed
178
+ yield @config if block_given?
179
+
180
+ # Create credentials
181
+ credentials = @config.credentials
182
+ # Use self-signed JWT if the endpoint is unchanged from default,
183
+ # but only if the default endpoint does not have a region prefix.
184
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
185
+ !@config.endpoint.split(".").first.include?("-")
186
+ credentials ||= Credentials.default scope: @config.scope,
187
+ enable_self_signed_jwt: enable_self_signed_jwt
188
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
189
+ credentials = Credentials.new credentials, scope: @config.scope
190
+ end
191
+
192
+ @quota_project_id = @config.quota_project
193
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
194
+
195
+ @operations_client = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Operations.new do |config|
196
+ config.credentials = credentials
197
+ config.quota_project = @quota_project_id
198
+ config.endpoint = @config.endpoint
199
+ end
200
+
201
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
202
+ config.credentials = credentials
203
+ config.quota_project = @quota_project_id
204
+ config.endpoint = @config.endpoint
205
+ end
206
+
207
+ @firestore_admin_stub = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
208
+ end
209
+
210
+ ##
211
+ # Get the associated client for long-running operations.
212
+ #
213
+ # @return [::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Operations]
214
+ #
215
+ attr_reader :operations_client
216
+
217
+ ##
218
+ # Get the associated client for mix-in of the Locations.
219
+ #
220
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
221
+ #
222
+ attr_reader :location_client
223
+
224
+ # Service calls
225
+
226
+ ##
227
+ # Creates a composite index. This returns a {::Google::Longrunning::Operation google.longrunning.Operation}
228
+ # which may be used to track the status of the creation. The metadata for
229
+ # the operation will be the type {::Google::Cloud::Firestore::Admin::V1::IndexOperationMetadata IndexOperationMetadata}.
230
+ #
231
+ # @overload create_index(request, options = nil)
232
+ # Pass arguments to `create_index` via a request object, either of type
233
+ # {::Google::Cloud::Firestore::Admin::V1::CreateIndexRequest} or an equivalent Hash.
234
+ #
235
+ # @param request [::Google::Cloud::Firestore::Admin::V1::CreateIndexRequest, ::Hash]
236
+ # A request object representing the call parameters. Required. To specify no
237
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
238
+ # @param options [::Gapic::CallOptions, ::Hash]
239
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
240
+ #
241
+ # @overload create_index(parent: nil, index: nil)
242
+ # Pass arguments to `create_index` via keyword arguments. Note that at
243
+ # least one keyword argument is required. To specify no parameters, or to keep all
244
+ # the default parameter values, pass an empty Hash as a request object (see above).
245
+ #
246
+ # @param parent [::String]
247
+ # Required. A parent name of the form
248
+ # `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
249
+ # @param index [::Google::Cloud::Firestore::Admin::V1::Index, ::Hash]
250
+ # Required. The composite index to create.
251
+ # @yield [result, operation] Access the result along with the TransportOperation object
252
+ # @yieldparam result [::Gapic::Operation]
253
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
254
+ #
255
+ # @return [::Gapic::Operation]
256
+ #
257
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
258
+ def create_index request, options = nil
259
+ raise ::ArgumentError, "request must be provided" if request.nil?
260
+
261
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::CreateIndexRequest
262
+
263
+ # Converts hash and nil to an options object
264
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
265
+
266
+ # Customize the options with defaults
267
+ call_metadata = @config.rpcs.create_index.metadata.to_h
268
+
269
+ # Set x-goog-api-client and x-goog-user-project headers
270
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
271
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
272
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
273
+ transports_version_send: [:rest]
274
+
275
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
276
+
277
+ options.apply_defaults timeout: @config.rpcs.create_index.timeout,
278
+ metadata: call_metadata,
279
+ retry_policy: @config.rpcs.create_index.retry_policy
280
+
281
+ options.apply_defaults timeout: @config.timeout,
282
+ metadata: @config.metadata,
283
+ retry_policy: @config.retry_policy
284
+
285
+ @firestore_admin_stub.create_index request, options do |result, operation|
286
+ result = ::Gapic::Operation.new result, @operations_client, options: options
287
+ yield result, operation if block_given?
288
+ return result
289
+ end
290
+ rescue ::Gapic::Rest::Error => e
291
+ raise ::Google::Cloud::Error.from_error(e)
292
+ end
293
+
294
+ ##
295
+ # Lists composite indexes.
296
+ #
297
+ # @overload list_indexes(request, options = nil)
298
+ # Pass arguments to `list_indexes` via a request object, either of type
299
+ # {::Google::Cloud::Firestore::Admin::V1::ListIndexesRequest} or an equivalent Hash.
300
+ #
301
+ # @param request [::Google::Cloud::Firestore::Admin::V1::ListIndexesRequest, ::Hash]
302
+ # A request object representing the call parameters. Required. To specify no
303
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
304
+ # @param options [::Gapic::CallOptions, ::Hash]
305
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
306
+ #
307
+ # @overload list_indexes(parent: nil, filter: nil, page_size: nil, page_token: nil)
308
+ # Pass arguments to `list_indexes` via keyword arguments. Note that at
309
+ # least one keyword argument is required. To specify no parameters, or to keep all
310
+ # the default parameter values, pass an empty Hash as a request object (see above).
311
+ #
312
+ # @param parent [::String]
313
+ # Required. A parent name of the form
314
+ # `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
315
+ # @param filter [::String]
316
+ # The filter to apply to list results.
317
+ # @param page_size [::Integer]
318
+ # The number of results to return.
319
+ # @param page_token [::String]
320
+ # A page token, returned from a previous call to
321
+ # {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Client#list_indexes FirestoreAdmin.ListIndexes}, that may be used to get the next
322
+ # page of results.
323
+ # @yield [result, operation] Access the result along with the TransportOperation object
324
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Index>]
325
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
326
+ #
327
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Index>]
328
+ #
329
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
330
+ def list_indexes request, options = nil
331
+ raise ::ArgumentError, "request must be provided" if request.nil?
332
+
333
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::ListIndexesRequest
334
+
335
+ # Converts hash and nil to an options object
336
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
337
+
338
+ # Customize the options with defaults
339
+ call_metadata = @config.rpcs.list_indexes.metadata.to_h
340
+
341
+ # Set x-goog-api-client and x-goog-user-project headers
342
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
343
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
344
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
345
+ transports_version_send: [:rest]
346
+
347
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
348
+
349
+ options.apply_defaults timeout: @config.rpcs.list_indexes.timeout,
350
+ metadata: call_metadata,
351
+ retry_policy: @config.rpcs.list_indexes.retry_policy
352
+
353
+ options.apply_defaults timeout: @config.timeout,
354
+ metadata: @config.metadata,
355
+ retry_policy: @config.retry_policy
356
+
357
+ @firestore_admin_stub.list_indexes request, options do |result, operation|
358
+ result = ::Gapic::Rest::PagedEnumerable.new @firestore_admin_stub, :list_indexes, "indexes", request, result, options
359
+ yield result, operation if block_given?
360
+ return result
361
+ end
362
+ rescue ::Gapic::Rest::Error => e
363
+ raise ::Google::Cloud::Error.from_error(e)
364
+ end
365
+
366
+ ##
367
+ # Gets a composite index.
368
+ #
369
+ # @overload get_index(request, options = nil)
370
+ # Pass arguments to `get_index` via a request object, either of type
371
+ # {::Google::Cloud::Firestore::Admin::V1::GetIndexRequest} or an equivalent Hash.
372
+ #
373
+ # @param request [::Google::Cloud::Firestore::Admin::V1::GetIndexRequest, ::Hash]
374
+ # A request object representing the call parameters. Required. To specify no
375
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
376
+ # @param options [::Gapic::CallOptions, ::Hash]
377
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
378
+ #
379
+ # @overload get_index(name: nil)
380
+ # Pass arguments to `get_index` via keyword arguments. Note that at
381
+ # least one keyword argument is required. To specify no parameters, or to keep all
382
+ # the default parameter values, pass an empty Hash as a request object (see above).
383
+ #
384
+ # @param name [::String]
385
+ # Required. A name of the form
386
+ # `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
387
+ # @yield [result, operation] Access the result along with the TransportOperation object
388
+ # @yieldparam result [::Google::Cloud::Firestore::Admin::V1::Index]
389
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
390
+ #
391
+ # @return [::Google::Cloud::Firestore::Admin::V1::Index]
392
+ #
393
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
394
+ def get_index request, options = nil
395
+ raise ::ArgumentError, "request must be provided" if request.nil?
396
+
397
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::GetIndexRequest
398
+
399
+ # Converts hash and nil to an options object
400
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
401
+
402
+ # Customize the options with defaults
403
+ call_metadata = @config.rpcs.get_index.metadata.to_h
404
+
405
+ # Set x-goog-api-client and x-goog-user-project headers
406
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
407
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
408
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
409
+ transports_version_send: [:rest]
410
+
411
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
412
+
413
+ options.apply_defaults timeout: @config.rpcs.get_index.timeout,
414
+ metadata: call_metadata,
415
+ retry_policy: @config.rpcs.get_index.retry_policy
416
+
417
+ options.apply_defaults timeout: @config.timeout,
418
+ metadata: @config.metadata,
419
+ retry_policy: @config.retry_policy
420
+
421
+ @firestore_admin_stub.get_index request, options do |result, operation|
422
+ yield result, operation if block_given?
423
+ return result
424
+ end
425
+ rescue ::Gapic::Rest::Error => e
426
+ raise ::Google::Cloud::Error.from_error(e)
427
+ end
428
+
429
+ ##
430
+ # Deletes a composite index.
431
+ #
432
+ # @overload delete_index(request, options = nil)
433
+ # Pass arguments to `delete_index` via a request object, either of type
434
+ # {::Google::Cloud::Firestore::Admin::V1::DeleteIndexRequest} or an equivalent Hash.
435
+ #
436
+ # @param request [::Google::Cloud::Firestore::Admin::V1::DeleteIndexRequest, ::Hash]
437
+ # A request object representing the call parameters. Required. To specify no
438
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
439
+ # @param options [::Gapic::CallOptions, ::Hash]
440
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
441
+ #
442
+ # @overload delete_index(name: nil)
443
+ # Pass arguments to `delete_index` via keyword arguments. Note that at
444
+ # least one keyword argument is required. To specify no parameters, or to keep all
445
+ # the default parameter values, pass an empty Hash as a request object (see above).
446
+ #
447
+ # @param name [::String]
448
+ # Required. A name of the form
449
+ # `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
450
+ # @yield [result, operation] Access the result along with the TransportOperation object
451
+ # @yieldparam result [::Google::Protobuf::Empty]
452
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
453
+ #
454
+ # @return [::Google::Protobuf::Empty]
455
+ #
456
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
457
+ def delete_index request, options = nil
458
+ raise ::ArgumentError, "request must be provided" if request.nil?
459
+
460
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::DeleteIndexRequest
461
+
462
+ # Converts hash and nil to an options object
463
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
464
+
465
+ # Customize the options with defaults
466
+ call_metadata = @config.rpcs.delete_index.metadata.to_h
467
+
468
+ # Set x-goog-api-client and x-goog-user-project headers
469
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
470
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
471
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
472
+ transports_version_send: [:rest]
473
+
474
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
475
+
476
+ options.apply_defaults timeout: @config.rpcs.delete_index.timeout,
477
+ metadata: call_metadata,
478
+ retry_policy: @config.rpcs.delete_index.retry_policy
479
+
480
+ options.apply_defaults timeout: @config.timeout,
481
+ metadata: @config.metadata,
482
+ retry_policy: @config.retry_policy
483
+
484
+ @firestore_admin_stub.delete_index request, options do |result, operation|
485
+ yield result, operation if block_given?
486
+ return result
487
+ end
488
+ rescue ::Gapic::Rest::Error => e
489
+ raise ::Google::Cloud::Error.from_error(e)
490
+ end
491
+
492
+ ##
493
+ # Gets the metadata and configuration for a Field.
494
+ #
495
+ # @overload get_field(request, options = nil)
496
+ # Pass arguments to `get_field` via a request object, either of type
497
+ # {::Google::Cloud::Firestore::Admin::V1::GetFieldRequest} or an equivalent Hash.
498
+ #
499
+ # @param request [::Google::Cloud::Firestore::Admin::V1::GetFieldRequest, ::Hash]
500
+ # A request object representing the call parameters. Required. To specify no
501
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
502
+ # @param options [::Gapic::CallOptions, ::Hash]
503
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
504
+ #
505
+ # @overload get_field(name: nil)
506
+ # Pass arguments to `get_field` via keyword arguments. Note that at
507
+ # least one keyword argument is required. To specify no parameters, or to keep all
508
+ # the default parameter values, pass an empty Hash as a request object (see above).
509
+ #
510
+ # @param name [::String]
511
+ # Required. A name of the form
512
+ # `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}`
513
+ # @yield [result, operation] Access the result along with the TransportOperation object
514
+ # @yieldparam result [::Google::Cloud::Firestore::Admin::V1::Field]
515
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
516
+ #
517
+ # @return [::Google::Cloud::Firestore::Admin::V1::Field]
518
+ #
519
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
520
+ def get_field request, options = nil
521
+ raise ::ArgumentError, "request must be provided" if request.nil?
522
+
523
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::GetFieldRequest
524
+
525
+ # Converts hash and nil to an options object
526
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
527
+
528
+ # Customize the options with defaults
529
+ call_metadata = @config.rpcs.get_field.metadata.to_h
530
+
531
+ # Set x-goog-api-client and x-goog-user-project headers
532
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
533
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
534
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
535
+ transports_version_send: [:rest]
536
+
537
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
538
+
539
+ options.apply_defaults timeout: @config.rpcs.get_field.timeout,
540
+ metadata: call_metadata,
541
+ retry_policy: @config.rpcs.get_field.retry_policy
542
+
543
+ options.apply_defaults timeout: @config.timeout,
544
+ metadata: @config.metadata,
545
+ retry_policy: @config.retry_policy
546
+
547
+ @firestore_admin_stub.get_field request, options do |result, operation|
548
+ yield result, operation if block_given?
549
+ return result
550
+ end
551
+ rescue ::Gapic::Rest::Error => e
552
+ raise ::Google::Cloud::Error.from_error(e)
553
+ end
554
+
555
+ ##
556
+ # Updates a field configuration. Currently, field updates apply only to
557
+ # single field index configuration. However, calls to
558
+ # {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Client#update_field FirestoreAdmin.UpdateField} should provide a field mask to avoid
559
+ # changing any configuration that the caller isn't aware of. The field mask
560
+ # should be specified as: `{ paths: "index_config" }`.
561
+ #
562
+ # This call returns a {::Google::Longrunning::Operation google.longrunning.Operation} which may be used to
563
+ # track the status of the field update. The metadata for
564
+ # the operation will be the type {::Google::Cloud::Firestore::Admin::V1::FieldOperationMetadata FieldOperationMetadata}.
565
+ #
566
+ # To configure the default field settings for the database, use
567
+ # the special `Field` with resource name:
568
+ # `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`.
569
+ #
570
+ # @overload update_field(request, options = nil)
571
+ # Pass arguments to `update_field` via a request object, either of type
572
+ # {::Google::Cloud::Firestore::Admin::V1::UpdateFieldRequest} or an equivalent Hash.
573
+ #
574
+ # @param request [::Google::Cloud::Firestore::Admin::V1::UpdateFieldRequest, ::Hash]
575
+ # A request object representing the call parameters. Required. To specify no
576
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
577
+ # @param options [::Gapic::CallOptions, ::Hash]
578
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
579
+ #
580
+ # @overload update_field(field: nil, update_mask: nil)
581
+ # Pass arguments to `update_field` via keyword arguments. Note that at
582
+ # least one keyword argument is required. To specify no parameters, or to keep all
583
+ # the default parameter values, pass an empty Hash as a request object (see above).
584
+ #
585
+ # @param field [::Google::Cloud::Firestore::Admin::V1::Field, ::Hash]
586
+ # Required. The field to be updated.
587
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
588
+ # A mask, relative to the field. If specified, only configuration specified
589
+ # by this field_mask will be updated in the field.
590
+ # @yield [result, operation] Access the result along with the TransportOperation object
591
+ # @yieldparam result [::Gapic::Operation]
592
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
593
+ #
594
+ # @return [::Gapic::Operation]
595
+ #
596
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
597
+ def update_field request, options = nil
598
+ raise ::ArgumentError, "request must be provided" if request.nil?
599
+
600
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::UpdateFieldRequest
601
+
602
+ # Converts hash and nil to an options object
603
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
604
+
605
+ # Customize the options with defaults
606
+ call_metadata = @config.rpcs.update_field.metadata.to_h
607
+
608
+ # Set x-goog-api-client and x-goog-user-project headers
609
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
610
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
611
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
612
+ transports_version_send: [:rest]
613
+
614
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
615
+
616
+ options.apply_defaults timeout: @config.rpcs.update_field.timeout,
617
+ metadata: call_metadata,
618
+ retry_policy: @config.rpcs.update_field.retry_policy
619
+
620
+ options.apply_defaults timeout: @config.timeout,
621
+ metadata: @config.metadata,
622
+ retry_policy: @config.retry_policy
623
+
624
+ @firestore_admin_stub.update_field request, options do |result, operation|
625
+ result = ::Gapic::Operation.new result, @operations_client, options: options
626
+ yield result, operation if block_given?
627
+ return result
628
+ end
629
+ rescue ::Gapic::Rest::Error => e
630
+ raise ::Google::Cloud::Error.from_error(e)
631
+ end
632
+
633
+ ##
634
+ # Lists the field configuration and metadata for this database.
635
+ #
636
+ # Currently, {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Client#list_fields FirestoreAdmin.ListFields} only supports listing fields
637
+ # that have been explicitly overridden. To issue this query, call
638
+ # {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Client#list_fields FirestoreAdmin.ListFields} with the filter set to
639
+ # `indexConfig.usesAncestorConfig:false` .
640
+ #
641
+ # @overload list_fields(request, options = nil)
642
+ # Pass arguments to `list_fields` via a request object, either of type
643
+ # {::Google::Cloud::Firestore::Admin::V1::ListFieldsRequest} or an equivalent Hash.
644
+ #
645
+ # @param request [::Google::Cloud::Firestore::Admin::V1::ListFieldsRequest, ::Hash]
646
+ # A request object representing the call parameters. Required. To specify no
647
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
648
+ # @param options [::Gapic::CallOptions, ::Hash]
649
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
650
+ #
651
+ # @overload list_fields(parent: nil, filter: nil, page_size: nil, page_token: nil)
652
+ # Pass arguments to `list_fields` via keyword arguments. Note that at
653
+ # least one keyword argument is required. To specify no parameters, or to keep all
654
+ # the default parameter values, pass an empty Hash as a request object (see above).
655
+ #
656
+ # @param parent [::String]
657
+ # Required. A parent name of the form
658
+ # `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
659
+ # @param filter [::String]
660
+ # The filter to apply to list results. Currently,
661
+ # {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Client#list_fields FirestoreAdmin.ListFields} only supports listing fields
662
+ # that have been explicitly overridden. To issue this query, call
663
+ # {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Client#list_fields FirestoreAdmin.ListFields} with a filter that includes
664
+ # `indexConfig.usesAncestorConfig:false` .
665
+ # @param page_size [::Integer]
666
+ # The number of results to return.
667
+ # @param page_token [::String]
668
+ # A page token, returned from a previous call to
669
+ # {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Client#list_fields FirestoreAdmin.ListFields}, that may be used to get the next
670
+ # page of results.
671
+ # @yield [result, operation] Access the result along with the TransportOperation object
672
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Field>]
673
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
674
+ #
675
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Firestore::Admin::V1::Field>]
676
+ #
677
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
678
+ def list_fields request, options = nil
679
+ raise ::ArgumentError, "request must be provided" if request.nil?
680
+
681
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::ListFieldsRequest
682
+
683
+ # Converts hash and nil to an options object
684
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
685
+
686
+ # Customize the options with defaults
687
+ call_metadata = @config.rpcs.list_fields.metadata.to_h
688
+
689
+ # Set x-goog-api-client and x-goog-user-project headers
690
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
691
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
692
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
693
+ transports_version_send: [:rest]
694
+
695
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
696
+
697
+ options.apply_defaults timeout: @config.rpcs.list_fields.timeout,
698
+ metadata: call_metadata,
699
+ retry_policy: @config.rpcs.list_fields.retry_policy
700
+
701
+ options.apply_defaults timeout: @config.timeout,
702
+ metadata: @config.metadata,
703
+ retry_policy: @config.retry_policy
704
+
705
+ @firestore_admin_stub.list_fields request, options do |result, operation|
706
+ result = ::Gapic::Rest::PagedEnumerable.new @firestore_admin_stub, :list_fields, "fields", request, result, options
707
+ yield result, operation if block_given?
708
+ return result
709
+ end
710
+ rescue ::Gapic::Rest::Error => e
711
+ raise ::Google::Cloud::Error.from_error(e)
712
+ end
713
+
714
+ ##
715
+ # Exports a copy of all or a subset of documents from Google Cloud Firestore
716
+ # to another storage system, such as Google Cloud Storage. Recent updates to
717
+ # documents may not be reflected in the export. The export occurs in the
718
+ # background and its progress can be monitored and managed via the
719
+ # Operation resource that is created. The output of an export may only be
720
+ # used once the associated operation is done. If an export operation is
721
+ # cancelled before completion it may leave partial data behind in Google
722
+ # Cloud Storage.
723
+ #
724
+ # For more details on export behavior and output format, refer to:
725
+ # https://cloud.google.com/firestore/docs/manage-data/export-import
726
+ #
727
+ # @overload export_documents(request, options = nil)
728
+ # Pass arguments to `export_documents` via a request object, either of type
729
+ # {::Google::Cloud::Firestore::Admin::V1::ExportDocumentsRequest} or an equivalent Hash.
730
+ #
731
+ # @param request [::Google::Cloud::Firestore::Admin::V1::ExportDocumentsRequest, ::Hash]
732
+ # A request object representing the call parameters. Required. To specify no
733
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
734
+ # @param options [::Gapic::CallOptions, ::Hash]
735
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
736
+ #
737
+ # @overload export_documents(name: nil, collection_ids: nil, output_uri_prefix: nil)
738
+ # Pass arguments to `export_documents` via keyword arguments. Note that at
739
+ # least one keyword argument is required. To specify no parameters, or to keep all
740
+ # the default parameter values, pass an empty Hash as a request object (see above).
741
+ #
742
+ # @param name [::String]
743
+ # Required. Database to export. Should be of the form:
744
+ # `projects/{project_id}/databases/{database_id}`.
745
+ # @param collection_ids [::Array<::String>]
746
+ # Which collection ids to export. Unspecified means all collections.
747
+ # @param output_uri_prefix [::String]
748
+ # The output URI. Currently only supports Google Cloud Storage URIs of the
749
+ # form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the name
750
+ # of the Google Cloud Storage bucket and `NAMESPACE_PATH` is an optional
751
+ # Google Cloud Storage namespace path. When
752
+ # choosing a name, be sure to consider Google Cloud Storage naming
753
+ # guidelines: https://cloud.google.com/storage/docs/naming.
754
+ # If the URI is a bucket (without a namespace path), a prefix will be
755
+ # generated based on the start time.
756
+ # @yield [result, operation] Access the result along with the TransportOperation object
757
+ # @yieldparam result [::Gapic::Operation]
758
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
759
+ #
760
+ # @return [::Gapic::Operation]
761
+ #
762
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
763
+ def export_documents request, options = nil
764
+ raise ::ArgumentError, "request must be provided" if request.nil?
765
+
766
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::ExportDocumentsRequest
767
+
768
+ # Converts hash and nil to an options object
769
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
770
+
771
+ # Customize the options with defaults
772
+ call_metadata = @config.rpcs.export_documents.metadata.to_h
773
+
774
+ # Set x-goog-api-client and x-goog-user-project headers
775
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
776
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
777
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
778
+ transports_version_send: [:rest]
779
+
780
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
781
+
782
+ options.apply_defaults timeout: @config.rpcs.export_documents.timeout,
783
+ metadata: call_metadata,
784
+ retry_policy: @config.rpcs.export_documents.retry_policy
785
+
786
+ options.apply_defaults timeout: @config.timeout,
787
+ metadata: @config.metadata,
788
+ retry_policy: @config.retry_policy
789
+
790
+ @firestore_admin_stub.export_documents request, options do |result, operation|
791
+ result = ::Gapic::Operation.new result, @operations_client, options: options
792
+ yield result, operation if block_given?
793
+ return result
794
+ end
795
+ rescue ::Gapic::Rest::Error => e
796
+ raise ::Google::Cloud::Error.from_error(e)
797
+ end
798
+
799
+ ##
800
+ # Imports documents into Google Cloud Firestore. Existing documents with the
801
+ # same name are overwritten. The import occurs in the background and its
802
+ # progress can be monitored and managed via the Operation resource that is
803
+ # created. If an ImportDocuments operation is cancelled, it is possible
804
+ # that a subset of the data has already been imported to Cloud Firestore.
805
+ #
806
+ # @overload import_documents(request, options = nil)
807
+ # Pass arguments to `import_documents` via a request object, either of type
808
+ # {::Google::Cloud::Firestore::Admin::V1::ImportDocumentsRequest} or an equivalent Hash.
809
+ #
810
+ # @param request [::Google::Cloud::Firestore::Admin::V1::ImportDocumentsRequest, ::Hash]
811
+ # A request object representing the call parameters. Required. To specify no
812
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
813
+ # @param options [::Gapic::CallOptions, ::Hash]
814
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
815
+ #
816
+ # @overload import_documents(name: nil, collection_ids: nil, input_uri_prefix: nil)
817
+ # Pass arguments to `import_documents` via keyword arguments. Note that at
818
+ # least one keyword argument is required. To specify no parameters, or to keep all
819
+ # the default parameter values, pass an empty Hash as a request object (see above).
820
+ #
821
+ # @param name [::String]
822
+ # Required. Database to import into. Should be of the form:
823
+ # `projects/{project_id}/databases/{database_id}`.
824
+ # @param collection_ids [::Array<::String>]
825
+ # Which collection ids to import. Unspecified means all collections included
826
+ # in the import.
827
+ # @param input_uri_prefix [::String]
828
+ # Location of the exported files.
829
+ # This must match the output_uri_prefix of an ExportDocumentsResponse from
830
+ # an export that has completed successfully.
831
+ # See:
832
+ # {::Google::Cloud::Firestore::Admin::V1::ExportDocumentsResponse#output_uri_prefix google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix}.
833
+ # @yield [result, operation] Access the result along with the TransportOperation object
834
+ # @yieldparam result [::Gapic::Operation]
835
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
836
+ #
837
+ # @return [::Gapic::Operation]
838
+ #
839
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
840
+ def import_documents request, options = nil
841
+ raise ::ArgumentError, "request must be provided" if request.nil?
842
+
843
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::ImportDocumentsRequest
844
+
845
+ # Converts hash and nil to an options object
846
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
847
+
848
+ # Customize the options with defaults
849
+ call_metadata = @config.rpcs.import_documents.metadata.to_h
850
+
851
+ # Set x-goog-api-client and x-goog-user-project headers
852
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
853
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
854
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
855
+ transports_version_send: [:rest]
856
+
857
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
858
+
859
+ options.apply_defaults timeout: @config.rpcs.import_documents.timeout,
860
+ metadata: call_metadata,
861
+ retry_policy: @config.rpcs.import_documents.retry_policy
862
+
863
+ options.apply_defaults timeout: @config.timeout,
864
+ metadata: @config.metadata,
865
+ retry_policy: @config.retry_policy
866
+
867
+ @firestore_admin_stub.import_documents request, options do |result, operation|
868
+ result = ::Gapic::Operation.new result, @operations_client, options: options
869
+ yield result, operation if block_given?
870
+ return result
871
+ end
872
+ rescue ::Gapic::Rest::Error => e
873
+ raise ::Google::Cloud::Error.from_error(e)
874
+ end
875
+
876
+ ##
877
+ # Gets information about a database.
878
+ #
879
+ # @overload get_database(request, options = nil)
880
+ # Pass arguments to `get_database` via a request object, either of type
881
+ # {::Google::Cloud::Firestore::Admin::V1::GetDatabaseRequest} or an equivalent Hash.
882
+ #
883
+ # @param request [::Google::Cloud::Firestore::Admin::V1::GetDatabaseRequest, ::Hash]
884
+ # A request object representing the call parameters. Required. To specify no
885
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
886
+ # @param options [::Gapic::CallOptions, ::Hash]
887
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
888
+ #
889
+ # @overload get_database(name: nil)
890
+ # Pass arguments to `get_database` via keyword arguments. Note that at
891
+ # least one keyword argument is required. To specify no parameters, or to keep all
892
+ # the default parameter values, pass an empty Hash as a request object (see above).
893
+ #
894
+ # @param name [::String]
895
+ # Required. A name of the form
896
+ # `projects/{project_id}/databases/{database_id}`
897
+ # @yield [result, operation] Access the result along with the TransportOperation object
898
+ # @yieldparam result [::Google::Cloud::Firestore::Admin::V1::Database]
899
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
900
+ #
901
+ # @return [::Google::Cloud::Firestore::Admin::V1::Database]
902
+ #
903
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
904
+ def get_database request, options = nil
905
+ raise ::ArgumentError, "request must be provided" if request.nil?
906
+
907
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::GetDatabaseRequest
908
+
909
+ # Converts hash and nil to an options object
910
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
911
+
912
+ # Customize the options with defaults
913
+ call_metadata = @config.rpcs.get_database.metadata.to_h
914
+
915
+ # Set x-goog-api-client and x-goog-user-project headers
916
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
917
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
918
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
919
+ transports_version_send: [:rest]
920
+
921
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
922
+
923
+ options.apply_defaults timeout: @config.rpcs.get_database.timeout,
924
+ metadata: call_metadata,
925
+ retry_policy: @config.rpcs.get_database.retry_policy
926
+
927
+ options.apply_defaults timeout: @config.timeout,
928
+ metadata: @config.metadata,
929
+ retry_policy: @config.retry_policy
930
+
931
+ @firestore_admin_stub.get_database request, options do |result, operation|
932
+ yield result, operation if block_given?
933
+ return result
934
+ end
935
+ rescue ::Gapic::Rest::Error => e
936
+ raise ::Google::Cloud::Error.from_error(e)
937
+ end
938
+
939
+ ##
940
+ # List all the databases in the project.
941
+ #
942
+ # @overload list_databases(request, options = nil)
943
+ # Pass arguments to `list_databases` via a request object, either of type
944
+ # {::Google::Cloud::Firestore::Admin::V1::ListDatabasesRequest} or an equivalent Hash.
945
+ #
946
+ # @param request [::Google::Cloud::Firestore::Admin::V1::ListDatabasesRequest, ::Hash]
947
+ # A request object representing the call parameters. Required. To specify no
948
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
949
+ # @param options [::Gapic::CallOptions, ::Hash]
950
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
951
+ #
952
+ # @overload list_databases(parent: nil)
953
+ # Pass arguments to `list_databases` via keyword arguments. Note that at
954
+ # least one keyword argument is required. To specify no parameters, or to keep all
955
+ # the default parameter values, pass an empty Hash as a request object (see above).
956
+ #
957
+ # @param parent [::String]
958
+ # Required. A parent name of the form
959
+ # `projects/{project_id}`
960
+ # @yield [result, operation] Access the result along with the TransportOperation object
961
+ # @yieldparam result [::Google::Cloud::Firestore::Admin::V1::ListDatabasesResponse]
962
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
963
+ #
964
+ # @return [::Google::Cloud::Firestore::Admin::V1::ListDatabasesResponse]
965
+ #
966
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
967
+ def list_databases request, options = nil
968
+ raise ::ArgumentError, "request must be provided" if request.nil?
969
+
970
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::ListDatabasesRequest
971
+
972
+ # Converts hash and nil to an options object
973
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
974
+
975
+ # Customize the options with defaults
976
+ call_metadata = @config.rpcs.list_databases.metadata.to_h
977
+
978
+ # Set x-goog-api-client and x-goog-user-project headers
979
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
980
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
981
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
982
+ transports_version_send: [:rest]
983
+
984
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
985
+
986
+ options.apply_defaults timeout: @config.rpcs.list_databases.timeout,
987
+ metadata: call_metadata,
988
+ retry_policy: @config.rpcs.list_databases.retry_policy
989
+
990
+ options.apply_defaults timeout: @config.timeout,
991
+ metadata: @config.metadata,
992
+ retry_policy: @config.retry_policy
993
+
994
+ @firestore_admin_stub.list_databases request, options do |result, operation|
995
+ yield result, operation if block_given?
996
+ return result
997
+ end
998
+ rescue ::Gapic::Rest::Error => e
999
+ raise ::Google::Cloud::Error.from_error(e)
1000
+ end
1001
+
1002
+ ##
1003
+ # Updates a database.
1004
+ #
1005
+ # @overload update_database(request, options = nil)
1006
+ # Pass arguments to `update_database` via a request object, either of type
1007
+ # {::Google::Cloud::Firestore::Admin::V1::UpdateDatabaseRequest} or an equivalent Hash.
1008
+ #
1009
+ # @param request [::Google::Cloud::Firestore::Admin::V1::UpdateDatabaseRequest, ::Hash]
1010
+ # A request object representing the call parameters. Required. To specify no
1011
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1012
+ # @param options [::Gapic::CallOptions, ::Hash]
1013
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1014
+ #
1015
+ # @overload update_database(database: nil, update_mask: nil)
1016
+ # Pass arguments to `update_database` via keyword arguments. Note that at
1017
+ # least one keyword argument is required. To specify no parameters, or to keep all
1018
+ # the default parameter values, pass an empty Hash as a request object (see above).
1019
+ #
1020
+ # @param database [::Google::Cloud::Firestore::Admin::V1::Database, ::Hash]
1021
+ # Required. The database to update.
1022
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1023
+ # The list of fields to be updated.
1024
+ # @yield [result, operation] Access the result along with the TransportOperation object
1025
+ # @yieldparam result [::Gapic::Operation]
1026
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1027
+ #
1028
+ # @return [::Gapic::Operation]
1029
+ #
1030
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1031
+ def update_database request, options = nil
1032
+ raise ::ArgumentError, "request must be provided" if request.nil?
1033
+
1034
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::UpdateDatabaseRequest
1035
+
1036
+ # Converts hash and nil to an options object
1037
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1038
+
1039
+ # Customize the options with defaults
1040
+ call_metadata = @config.rpcs.update_database.metadata.to_h
1041
+
1042
+ # Set x-goog-api-client and x-goog-user-project headers
1043
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1044
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1045
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION,
1046
+ transports_version_send: [:rest]
1047
+
1048
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1049
+
1050
+ options.apply_defaults timeout: @config.rpcs.update_database.timeout,
1051
+ metadata: call_metadata,
1052
+ retry_policy: @config.rpcs.update_database.retry_policy
1053
+
1054
+ options.apply_defaults timeout: @config.timeout,
1055
+ metadata: @config.metadata,
1056
+ retry_policy: @config.retry_policy
1057
+
1058
+ @firestore_admin_stub.update_database request, options do |result, operation|
1059
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1060
+ yield result, operation if block_given?
1061
+ return result
1062
+ end
1063
+ rescue ::Gapic::Rest::Error => e
1064
+ raise ::Google::Cloud::Error.from_error(e)
1065
+ end
1066
+
1067
+ ##
1068
+ # Configuration class for the FirestoreAdmin REST API.
1069
+ #
1070
+ # This class represents the configuration for FirestoreAdmin REST,
1071
+ # providing control over timeouts, retry behavior, logging, transport
1072
+ # parameters, and other low-level controls. Certain parameters can also be
1073
+ # applied individually to specific RPCs. See
1074
+ # {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Client::Configuration::Rpcs}
1075
+ # for a list of RPCs that can be configured independently.
1076
+ #
1077
+ # Configuration can be applied globally to all clients, or to a single client
1078
+ # on construction.
1079
+ #
1080
+ # @example
1081
+ #
1082
+ # # Modify the global config, setting the timeout for
1083
+ # # create_index to 20 seconds,
1084
+ # # and all remaining timeouts to 10 seconds.
1085
+ # ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Client.configure do |config|
1086
+ # config.timeout = 10.0
1087
+ # config.rpcs.create_index.timeout = 20.0
1088
+ # end
1089
+ #
1090
+ # # Apply the above configuration only to a new client.
1091
+ # client = ::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Rest::Client.new do |config|
1092
+ # config.timeout = 10.0
1093
+ # config.rpcs.create_index.timeout = 20.0
1094
+ # end
1095
+ #
1096
+ # @!attribute [rw] endpoint
1097
+ # The hostname or hostname:port of the service endpoint.
1098
+ # Defaults to `"firestore.googleapis.com"`.
1099
+ # @return [::String]
1100
+ # @!attribute [rw] credentials
1101
+ # Credentials to send with calls. You may provide any of the following types:
1102
+ # * (`String`) The path to a service account key file in JSON format
1103
+ # * (`Hash`) A service account key as a Hash
1104
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1105
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1106
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1107
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1108
+ # * (`nil`) indicating no credentials
1109
+ # @return [::Object]
1110
+ # @!attribute [rw] scope
1111
+ # The OAuth scopes
1112
+ # @return [::Array<::String>]
1113
+ # @!attribute [rw] lib_name
1114
+ # The library name as recorded in instrumentation and logging
1115
+ # @return [::String]
1116
+ # @!attribute [rw] lib_version
1117
+ # The library version as recorded in instrumentation and logging
1118
+ # @return [::String]
1119
+ # @!attribute [rw] timeout
1120
+ # The call timeout in seconds.
1121
+ # @return [::Numeric]
1122
+ # @!attribute [rw] metadata
1123
+ # Additional headers to be sent with the call.
1124
+ # @return [::Hash{::Symbol=>::String}]
1125
+ # @!attribute [rw] retry_policy
1126
+ # The retry policy. The value is a hash with the following keys:
1127
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1128
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1129
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1130
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1131
+ # trigger a retry.
1132
+ # @return [::Hash]
1133
+ # @!attribute [rw] quota_project
1134
+ # A separate project against which to charge quota.
1135
+ # @return [::String]
1136
+ #
1137
+ class Configuration
1138
+ extend ::Gapic::Config
1139
+
1140
+ config_attr :endpoint, "firestore.googleapis.com", ::String
1141
+ config_attr :credentials, nil do |value|
1142
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1143
+ allowed.any? { |klass| klass === value }
1144
+ end
1145
+ config_attr :scope, nil, ::String, ::Array, nil
1146
+ config_attr :lib_name, nil, ::String, nil
1147
+ config_attr :lib_version, nil, ::String, nil
1148
+ config_attr :timeout, nil, ::Numeric, nil
1149
+ config_attr :metadata, nil, ::Hash, nil
1150
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1151
+ config_attr :quota_project, nil, ::String, nil
1152
+
1153
+ # @private
1154
+ def initialize parent_config = nil
1155
+ @parent_config = parent_config unless parent_config.nil?
1156
+
1157
+ yield self if block_given?
1158
+ end
1159
+
1160
+ ##
1161
+ # Configurations for individual RPCs
1162
+ # @return [Rpcs]
1163
+ #
1164
+ def rpcs
1165
+ @rpcs ||= begin
1166
+ parent_rpcs = nil
1167
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1168
+ Rpcs.new parent_rpcs
1169
+ end
1170
+ end
1171
+
1172
+ ##
1173
+ # Configuration RPC class for the FirestoreAdmin API.
1174
+ #
1175
+ # Includes fields providing the configuration for each RPC in this service.
1176
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1177
+ # the following configuration fields:
1178
+ #
1179
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1180
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1181
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1182
+ # include the following keys:
1183
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1184
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1185
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1186
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1187
+ # trigger a retry.
1188
+ #
1189
+ class Rpcs
1190
+ ##
1191
+ # RPC-specific configuration for `create_index`
1192
+ # @return [::Gapic::Config::Method]
1193
+ #
1194
+ attr_reader :create_index
1195
+ ##
1196
+ # RPC-specific configuration for `list_indexes`
1197
+ # @return [::Gapic::Config::Method]
1198
+ #
1199
+ attr_reader :list_indexes
1200
+ ##
1201
+ # RPC-specific configuration for `get_index`
1202
+ # @return [::Gapic::Config::Method]
1203
+ #
1204
+ attr_reader :get_index
1205
+ ##
1206
+ # RPC-specific configuration for `delete_index`
1207
+ # @return [::Gapic::Config::Method]
1208
+ #
1209
+ attr_reader :delete_index
1210
+ ##
1211
+ # RPC-specific configuration for `get_field`
1212
+ # @return [::Gapic::Config::Method]
1213
+ #
1214
+ attr_reader :get_field
1215
+ ##
1216
+ # RPC-specific configuration for `update_field`
1217
+ # @return [::Gapic::Config::Method]
1218
+ #
1219
+ attr_reader :update_field
1220
+ ##
1221
+ # RPC-specific configuration for `list_fields`
1222
+ # @return [::Gapic::Config::Method]
1223
+ #
1224
+ attr_reader :list_fields
1225
+ ##
1226
+ # RPC-specific configuration for `export_documents`
1227
+ # @return [::Gapic::Config::Method]
1228
+ #
1229
+ attr_reader :export_documents
1230
+ ##
1231
+ # RPC-specific configuration for `import_documents`
1232
+ # @return [::Gapic::Config::Method]
1233
+ #
1234
+ attr_reader :import_documents
1235
+ ##
1236
+ # RPC-specific configuration for `get_database`
1237
+ # @return [::Gapic::Config::Method]
1238
+ #
1239
+ attr_reader :get_database
1240
+ ##
1241
+ # RPC-specific configuration for `list_databases`
1242
+ # @return [::Gapic::Config::Method]
1243
+ #
1244
+ attr_reader :list_databases
1245
+ ##
1246
+ # RPC-specific configuration for `update_database`
1247
+ # @return [::Gapic::Config::Method]
1248
+ #
1249
+ attr_reader :update_database
1250
+
1251
+ # @private
1252
+ def initialize parent_rpcs = nil
1253
+ create_index_config = parent_rpcs.create_index if parent_rpcs.respond_to? :create_index
1254
+ @create_index = ::Gapic::Config::Method.new create_index_config
1255
+ list_indexes_config = parent_rpcs.list_indexes if parent_rpcs.respond_to? :list_indexes
1256
+ @list_indexes = ::Gapic::Config::Method.new list_indexes_config
1257
+ get_index_config = parent_rpcs.get_index if parent_rpcs.respond_to? :get_index
1258
+ @get_index = ::Gapic::Config::Method.new get_index_config
1259
+ delete_index_config = parent_rpcs.delete_index if parent_rpcs.respond_to? :delete_index
1260
+ @delete_index = ::Gapic::Config::Method.new delete_index_config
1261
+ get_field_config = parent_rpcs.get_field if parent_rpcs.respond_to? :get_field
1262
+ @get_field = ::Gapic::Config::Method.new get_field_config
1263
+ update_field_config = parent_rpcs.update_field if parent_rpcs.respond_to? :update_field
1264
+ @update_field = ::Gapic::Config::Method.new update_field_config
1265
+ list_fields_config = parent_rpcs.list_fields if parent_rpcs.respond_to? :list_fields
1266
+ @list_fields = ::Gapic::Config::Method.new list_fields_config
1267
+ export_documents_config = parent_rpcs.export_documents if parent_rpcs.respond_to? :export_documents
1268
+ @export_documents = ::Gapic::Config::Method.new export_documents_config
1269
+ import_documents_config = parent_rpcs.import_documents if parent_rpcs.respond_to? :import_documents
1270
+ @import_documents = ::Gapic::Config::Method.new import_documents_config
1271
+ get_database_config = parent_rpcs.get_database if parent_rpcs.respond_to? :get_database
1272
+ @get_database = ::Gapic::Config::Method.new get_database_config
1273
+ list_databases_config = parent_rpcs.list_databases if parent_rpcs.respond_to? :list_databases
1274
+ @list_databases = ::Gapic::Config::Method.new list_databases_config
1275
+ update_database_config = parent_rpcs.update_database if parent_rpcs.respond_to? :update_database
1276
+ @update_database = ::Gapic::Config::Method.new update_database_config
1277
+
1278
+ yield self if block_given?
1279
+ end
1280
+ end
1281
+ end
1282
+ end
1283
+ end
1284
+ end
1285
+ end
1286
+ end
1287
+ end
1288
+ end
1289
+ end