google-cloud-firestore-admin-v1 0.3.4 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,6 +28,32 @@ module Google
28
28
  ##
29
29
  # Client for the FirestoreAdmin service.
30
30
  #
31
+ # The Cloud Firestore Admin API.
32
+ #
33
+ # This API provides several administrative services for Cloud Firestore.
34
+ #
35
+ # Project, Database, Namespace, Collection, Collection Group, and Document are
36
+ # used as defined in the Google Cloud Firestore API.
37
+ #
38
+ # Operation: An Operation represents work being performed in the background.
39
+ #
40
+ # The index service manages Cloud Firestore indexes.
41
+ #
42
+ # Index creation is performed asynchronously.
43
+ # An Operation resource is created for each such asynchronous operation.
44
+ # The state of the operation (including any errors encountered)
45
+ # may be queried via the Operation resource.
46
+ #
47
+ # The Operations collection provides a record of actions performed for the
48
+ # specified Project (including any Operations in progress). Operations are not
49
+ # created directly but through calls on other collections or resources.
50
+ #
51
+ # An Operation that is done may be deleted so that it is no longer listed as
52
+ # part of the Operation collection. Operations are garbage collected after
53
+ # 30 days. By default, ListOperations will only return in progress and failed
54
+ # operations. To list completed operation, issue a ListOperations request with
55
+ # the filter `done: true`.
56
+ #
31
57
  # Operations are created by service `FirestoreAdmin`, but are accessed via
32
58
  # service `google.longrunning.Operations`.
33
59
  #
@@ -170,6 +196,7 @@ module Google
170
196
 
171
197
  @operations_client = Operations.new do |config|
172
198
  config.credentials = credentials
199
+ config.quota_project = @quota_project_id
173
200
  config.endpoint = @config.endpoint
174
201
  end
175
202
 
@@ -225,6 +252,28 @@ module Google
225
252
  #
226
253
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
227
254
  #
255
+ # @example Basic example
256
+ # require "google/cloud/firestore/admin/v1"
257
+ #
258
+ # # Create a client object. The client can be reused for multiple calls.
259
+ # client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new
260
+ #
261
+ # # Create a request. To set request fields, pass in keyword arguments.
262
+ # request = Google::Cloud::Firestore::Admin::V1::CreateIndexRequest.new
263
+ #
264
+ # # Call the create_index method.
265
+ # result = client.create_index request
266
+ #
267
+ # # The returned object is of type Gapic::Operation. You can use this
268
+ # # object to check the status of an operation, cancel it, or wait
269
+ # # for results. Here is how to block until completion:
270
+ # result.wait_until_done! timeout: 60
271
+ # if result.response?
272
+ # p result.response
273
+ # else
274
+ # puts "Error!"
275
+ # end
276
+ #
228
277
  def create_index request, options = nil
229
278
  raise ::ArgumentError, "request must be provided" if request.nil?
230
279
 
@@ -242,9 +291,11 @@ module Google
242
291
  gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
243
292
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
244
293
 
245
- header_params = {
246
- "parent" => request.parent
247
- }
294
+ header_params = {}
295
+ if request.parent
296
+ header_params["parent"] = request.parent
297
+ end
298
+
248
299
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
249
300
  metadata[:"x-goog-request-params"] ||= request_params_header
250
301
 
@@ -303,6 +354,27 @@ module Google
303
354
  #
304
355
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
305
356
  #
357
+ # @example Basic example
358
+ # require "google/cloud/firestore/admin/v1"
359
+ #
360
+ # # Create a client object. The client can be reused for multiple calls.
361
+ # client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new
362
+ #
363
+ # # Create a request. To set request fields, pass in keyword arguments.
364
+ # request = Google::Cloud::Firestore::Admin::V1::ListIndexesRequest.new
365
+ #
366
+ # # Call the list_indexes method.
367
+ # result = client.list_indexes request
368
+ #
369
+ # # The returned object is of type Gapic::PagedEnumerable. You can
370
+ # # iterate over all elements by calling #each, and the enumerable
371
+ # # will lazily make API calls to fetch subsequent pages. Other
372
+ # # methods are also available for managing paging directly.
373
+ # result.each do |response|
374
+ # # Each element is of type ::Google::Cloud::Firestore::Admin::V1::Index.
375
+ # p response
376
+ # end
377
+ #
306
378
  def list_indexes request, options = nil
307
379
  raise ::ArgumentError, "request must be provided" if request.nil?
308
380
 
@@ -320,9 +392,11 @@ module Google
320
392
  gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
321
393
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
322
394
 
323
- header_params = {
324
- "parent" => request.parent
325
- }
395
+ header_params = {}
396
+ if request.parent
397
+ header_params["parent"] = request.parent
398
+ end
399
+
326
400
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
327
401
  metadata[:"x-goog-request-params"] ||= request_params_header
328
402
 
@@ -373,6 +447,21 @@ module Google
373
447
  #
374
448
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
375
449
  #
450
+ # @example Basic example
451
+ # require "google/cloud/firestore/admin/v1"
452
+ #
453
+ # # Create a client object. The client can be reused for multiple calls.
454
+ # client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new
455
+ #
456
+ # # Create a request. To set request fields, pass in keyword arguments.
457
+ # request = Google::Cloud::Firestore::Admin::V1::GetIndexRequest.new
458
+ #
459
+ # # Call the get_index method.
460
+ # result = client.get_index request
461
+ #
462
+ # # The returned object is of type Google::Cloud::Firestore::Admin::V1::Index.
463
+ # p result
464
+ #
376
465
  def get_index request, options = nil
377
466
  raise ::ArgumentError, "request must be provided" if request.nil?
378
467
 
@@ -390,9 +479,11 @@ module Google
390
479
  gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
391
480
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
392
481
 
393
- header_params = {
394
- "name" => request.name
395
- }
482
+ header_params = {}
483
+ if request.name
484
+ header_params["name"] = request.name
485
+ end
486
+
396
487
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
397
488
  metadata[:"x-goog-request-params"] ||= request_params_header
398
489
 
@@ -442,6 +533,21 @@ module Google
442
533
  #
443
534
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
444
535
  #
536
+ # @example Basic example
537
+ # require "google/cloud/firestore/admin/v1"
538
+ #
539
+ # # Create a client object. The client can be reused for multiple calls.
540
+ # client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new
541
+ #
542
+ # # Create a request. To set request fields, pass in keyword arguments.
543
+ # request = Google::Cloud::Firestore::Admin::V1::DeleteIndexRequest.new
544
+ #
545
+ # # Call the delete_index method.
546
+ # result = client.delete_index request
547
+ #
548
+ # # The returned object is of type Google::Protobuf::Empty.
549
+ # p result
550
+ #
445
551
  def delete_index request, options = nil
446
552
  raise ::ArgumentError, "request must be provided" if request.nil?
447
553
 
@@ -459,9 +565,11 @@ module Google
459
565
  gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
460
566
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
461
567
 
462
- header_params = {
463
- "name" => request.name
464
- }
568
+ header_params = {}
569
+ if request.name
570
+ header_params["name"] = request.name
571
+ end
572
+
465
573
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
466
574
  metadata[:"x-goog-request-params"] ||= request_params_header
467
575
 
@@ -511,6 +619,21 @@ module Google
511
619
  #
512
620
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
513
621
  #
622
+ # @example Basic example
623
+ # require "google/cloud/firestore/admin/v1"
624
+ #
625
+ # # Create a client object. The client can be reused for multiple calls.
626
+ # client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new
627
+ #
628
+ # # Create a request. To set request fields, pass in keyword arguments.
629
+ # request = Google::Cloud::Firestore::Admin::V1::GetFieldRequest.new
630
+ #
631
+ # # Call the get_field method.
632
+ # result = client.get_field request
633
+ #
634
+ # # The returned object is of type Google::Cloud::Firestore::Admin::V1::Field.
635
+ # p result
636
+ #
514
637
  def get_field request, options = nil
515
638
  raise ::ArgumentError, "request must be provided" if request.nil?
516
639
 
@@ -528,9 +651,11 @@ module Google
528
651
  gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
529
652
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
530
653
 
531
- header_params = {
532
- "name" => request.name
533
- }
654
+ header_params = {}
655
+ if request.name
656
+ header_params["name"] = request.name
657
+ end
658
+
534
659
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
535
660
  metadata[:"x-goog-request-params"] ||= request_params_header
536
661
 
@@ -594,6 +719,28 @@ module Google
594
719
  #
595
720
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
596
721
  #
722
+ # @example Basic example
723
+ # require "google/cloud/firestore/admin/v1"
724
+ #
725
+ # # Create a client object. The client can be reused for multiple calls.
726
+ # client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new
727
+ #
728
+ # # Create a request. To set request fields, pass in keyword arguments.
729
+ # request = Google::Cloud::Firestore::Admin::V1::UpdateFieldRequest.new
730
+ #
731
+ # # Call the update_field method.
732
+ # result = client.update_field request
733
+ #
734
+ # # The returned object is of type Gapic::Operation. You can use this
735
+ # # object to check the status of an operation, cancel it, or wait
736
+ # # for results. Here is how to block until completion:
737
+ # result.wait_until_done! timeout: 60
738
+ # if result.response?
739
+ # p result.response
740
+ # else
741
+ # puts "Error!"
742
+ # end
743
+ #
597
744
  def update_field request, options = nil
598
745
  raise ::ArgumentError, "request must be provided" if request.nil?
599
746
 
@@ -611,9 +758,11 @@ module Google
611
758
  gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
612
759
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
613
760
 
614
- header_params = {
615
- "field.name" => request.field.name
616
- }
761
+ header_params = {}
762
+ if request.field&.name
763
+ header_params["field.name"] = request.field.name
764
+ end
765
+
617
766
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
618
767
  metadata[:"x-goog-request-params"] ||= request_params_header
619
768
 
@@ -640,7 +789,7 @@ module Google
640
789
  # Currently, {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields FirestoreAdmin.ListFields} only supports listing fields
641
790
  # that have been explicitly overridden. To issue this query, call
642
791
  # {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields FirestoreAdmin.ListFields} with the filter set to
643
- # `indexConfig.usesAncestorConfig:false`.
792
+ # `indexConfig.usesAncestorConfig:false` .
644
793
  #
645
794
  # @overload list_fields(request, options = nil)
646
795
  # Pass arguments to `list_fields` via a request object, either of type
@@ -664,8 +813,8 @@ module Google
664
813
  # The filter to apply to list results. Currently,
665
814
  # {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields FirestoreAdmin.ListFields} only supports listing fields
666
815
  # that have been explicitly overridden. To issue this query, call
667
- # {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields FirestoreAdmin.ListFields} with the filter set to
668
- # `indexConfig.usesAncestorConfig:false`.
816
+ # {::Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client#list_fields FirestoreAdmin.ListFields} with a filter that includes
817
+ # `indexConfig.usesAncestorConfig:false` .
669
818
  # @param page_size [::Integer]
670
819
  # The number of results to return.
671
820
  # @param page_token [::String]
@@ -681,6 +830,27 @@ module Google
681
830
  #
682
831
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
683
832
  #
833
+ # @example Basic example
834
+ # require "google/cloud/firestore/admin/v1"
835
+ #
836
+ # # Create a client object. The client can be reused for multiple calls.
837
+ # client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new
838
+ #
839
+ # # Create a request. To set request fields, pass in keyword arguments.
840
+ # request = Google::Cloud::Firestore::Admin::V1::ListFieldsRequest.new
841
+ #
842
+ # # Call the list_fields method.
843
+ # result = client.list_fields request
844
+ #
845
+ # # The returned object is of type Gapic::PagedEnumerable. You can
846
+ # # iterate over all elements by calling #each, and the enumerable
847
+ # # will lazily make API calls to fetch subsequent pages. Other
848
+ # # methods are also available for managing paging directly.
849
+ # result.each do |response|
850
+ # # Each element is of type ::Google::Cloud::Firestore::Admin::V1::Field.
851
+ # p response
852
+ # end
853
+ #
684
854
  def list_fields request, options = nil
685
855
  raise ::ArgumentError, "request must be provided" if request.nil?
686
856
 
@@ -698,9 +868,11 @@ module Google
698
868
  gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
699
869
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
700
870
 
701
- header_params = {
702
- "parent" => request.parent
703
- }
871
+ header_params = {}
872
+ if request.parent
873
+ header_params["parent"] = request.parent
874
+ end
875
+
704
876
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
705
877
  metadata[:"x-goog-request-params"] ||= request_params_header
706
878
 
@@ -731,6 +903,9 @@ module Google
731
903
  # cancelled before completion it may leave partial data behind in Google
732
904
  # Cloud Storage.
733
905
  #
906
+ # For more details on export behavior and output format, refer to:
907
+ # https://cloud.google.com/firestore/docs/manage-data/export-import
908
+ #
734
909
  # @overload export_documents(request, options = nil)
735
910
  # Pass arguments to `export_documents` via a request object, either of type
736
911
  # {::Google::Cloud::Firestore::Admin::V1::ExportDocumentsRequest} or an equivalent Hash.
@@ -769,6 +944,28 @@ module Google
769
944
  #
770
945
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
771
946
  #
947
+ # @example Basic example
948
+ # require "google/cloud/firestore/admin/v1"
949
+ #
950
+ # # Create a client object. The client can be reused for multiple calls.
951
+ # client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new
952
+ #
953
+ # # Create a request. To set request fields, pass in keyword arguments.
954
+ # request = Google::Cloud::Firestore::Admin::V1::ExportDocumentsRequest.new
955
+ #
956
+ # # Call the export_documents method.
957
+ # result = client.export_documents request
958
+ #
959
+ # # The returned object is of type Gapic::Operation. You can use this
960
+ # # object to check the status of an operation, cancel it, or wait
961
+ # # for results. Here is how to block until completion:
962
+ # result.wait_until_done! timeout: 60
963
+ # if result.response?
964
+ # p result.response
965
+ # else
966
+ # puts "Error!"
967
+ # end
968
+ #
772
969
  def export_documents request, options = nil
773
970
  raise ::ArgumentError, "request must be provided" if request.nil?
774
971
 
@@ -786,9 +983,11 @@ module Google
786
983
  gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
787
984
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
788
985
 
789
- header_params = {
790
- "name" => request.name
791
- }
986
+ header_params = {}
987
+ if request.name
988
+ header_params["name"] = request.name
989
+ end
990
+
792
991
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
793
992
  metadata[:"x-goog-request-params"] ||= request_params_header
794
993
 
@@ -852,6 +1051,28 @@ module Google
852
1051
  #
853
1052
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
854
1053
  #
1054
+ # @example Basic example
1055
+ # require "google/cloud/firestore/admin/v1"
1056
+ #
1057
+ # # Create a client object. The client can be reused for multiple calls.
1058
+ # client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new
1059
+ #
1060
+ # # Create a request. To set request fields, pass in keyword arguments.
1061
+ # request = Google::Cloud::Firestore::Admin::V1::ImportDocumentsRequest.new
1062
+ #
1063
+ # # Call the import_documents method.
1064
+ # result = client.import_documents request
1065
+ #
1066
+ # # The returned object is of type Gapic::Operation. You can use this
1067
+ # # object to check the status of an operation, cancel it, or wait
1068
+ # # for results. Here is how to block until completion:
1069
+ # result.wait_until_done! timeout: 60
1070
+ # if result.response?
1071
+ # p result.response
1072
+ # else
1073
+ # puts "Error!"
1074
+ # end
1075
+ #
855
1076
  def import_documents request, options = nil
856
1077
  raise ::ArgumentError, "request must be provided" if request.nil?
857
1078
 
@@ -869,9 +1090,11 @@ module Google
869
1090
  gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
870
1091
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
871
1092
 
872
- header_params = {
873
- "name" => request.name
874
- }
1093
+ header_params = {}
1094
+ if request.name
1095
+ header_params["name"] = request.name
1096
+ end
1097
+
875
1098
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
876
1099
  metadata[:"x-goog-request-params"] ||= request_params_header
877
1100
 
@@ -892,6 +1115,273 @@ module Google
892
1115
  raise ::Google::Cloud::Error.from_error(e)
893
1116
  end
894
1117
 
1118
+ ##
1119
+ # Gets information about a database.
1120
+ #
1121
+ # @overload get_database(request, options = nil)
1122
+ # Pass arguments to `get_database` via a request object, either of type
1123
+ # {::Google::Cloud::Firestore::Admin::V1::GetDatabaseRequest} or an equivalent Hash.
1124
+ #
1125
+ # @param request [::Google::Cloud::Firestore::Admin::V1::GetDatabaseRequest, ::Hash]
1126
+ # A request object representing the call parameters. Required. To specify no
1127
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1128
+ # @param options [::Gapic::CallOptions, ::Hash]
1129
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1130
+ #
1131
+ # @overload get_database(name: nil)
1132
+ # Pass arguments to `get_database` via keyword arguments. Note that at
1133
+ # least one keyword argument is required. To specify no parameters, or to keep all
1134
+ # the default parameter values, pass an empty Hash as a request object (see above).
1135
+ #
1136
+ # @param name [::String]
1137
+ # Required. A name of the form
1138
+ # `projects/{project_id}/databases/{database_id}`
1139
+ #
1140
+ # @yield [response, operation] Access the result along with the RPC operation
1141
+ # @yieldparam response [::Google::Cloud::Firestore::Admin::V1::Database]
1142
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1143
+ #
1144
+ # @return [::Google::Cloud::Firestore::Admin::V1::Database]
1145
+ #
1146
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1147
+ #
1148
+ # @example Basic example
1149
+ # require "google/cloud/firestore/admin/v1"
1150
+ #
1151
+ # # Create a client object. The client can be reused for multiple calls.
1152
+ # client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new
1153
+ #
1154
+ # # Create a request. To set request fields, pass in keyword arguments.
1155
+ # request = Google::Cloud::Firestore::Admin::V1::GetDatabaseRequest.new
1156
+ #
1157
+ # # Call the get_database method.
1158
+ # result = client.get_database request
1159
+ #
1160
+ # # The returned object is of type Google::Cloud::Firestore::Admin::V1::Database.
1161
+ # p result
1162
+ #
1163
+ def get_database request, options = nil
1164
+ raise ::ArgumentError, "request must be provided" if request.nil?
1165
+
1166
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::GetDatabaseRequest
1167
+
1168
+ # Converts hash and nil to an options object
1169
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1170
+
1171
+ # Customize the options with defaults
1172
+ metadata = @config.rpcs.get_database.metadata.to_h
1173
+
1174
+ # Set x-goog-api-client and x-goog-user-project headers
1175
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1176
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1177
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
1178
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1179
+
1180
+ header_params = {}
1181
+ if request.name
1182
+ header_params["name"] = request.name
1183
+ end
1184
+
1185
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1186
+ metadata[:"x-goog-request-params"] ||= request_params_header
1187
+
1188
+ options.apply_defaults timeout: @config.rpcs.get_database.timeout,
1189
+ metadata: metadata,
1190
+ retry_policy: @config.rpcs.get_database.retry_policy
1191
+
1192
+ options.apply_defaults timeout: @config.timeout,
1193
+ metadata: @config.metadata,
1194
+ retry_policy: @config.retry_policy
1195
+
1196
+ @firestore_admin_stub.call_rpc :get_database, request, options: options do |response, operation|
1197
+ yield response, operation if block_given?
1198
+ return response
1199
+ end
1200
+ rescue ::GRPC::BadStatus => e
1201
+ raise ::Google::Cloud::Error.from_error(e)
1202
+ end
1203
+
1204
+ ##
1205
+ # List all the databases in the project.
1206
+ #
1207
+ # @overload list_databases(request, options = nil)
1208
+ # Pass arguments to `list_databases` via a request object, either of type
1209
+ # {::Google::Cloud::Firestore::Admin::V1::ListDatabasesRequest} or an equivalent Hash.
1210
+ #
1211
+ # @param request [::Google::Cloud::Firestore::Admin::V1::ListDatabasesRequest, ::Hash]
1212
+ # A request object representing the call parameters. Required. To specify no
1213
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1214
+ # @param options [::Gapic::CallOptions, ::Hash]
1215
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1216
+ #
1217
+ # @overload list_databases(parent: nil)
1218
+ # Pass arguments to `list_databases` via keyword arguments. Note that at
1219
+ # least one keyword argument is required. To specify no parameters, or to keep all
1220
+ # the default parameter values, pass an empty Hash as a request object (see above).
1221
+ #
1222
+ # @param parent [::String]
1223
+ # Required. A parent name of the form
1224
+ # `projects/{project_id}`
1225
+ #
1226
+ # @yield [response, operation] Access the result along with the RPC operation
1227
+ # @yieldparam response [::Google::Cloud::Firestore::Admin::V1::ListDatabasesResponse]
1228
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1229
+ #
1230
+ # @return [::Google::Cloud::Firestore::Admin::V1::ListDatabasesResponse]
1231
+ #
1232
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1233
+ #
1234
+ # @example Basic example
1235
+ # require "google/cloud/firestore/admin/v1"
1236
+ #
1237
+ # # Create a client object. The client can be reused for multiple calls.
1238
+ # client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new
1239
+ #
1240
+ # # Create a request. To set request fields, pass in keyword arguments.
1241
+ # request = Google::Cloud::Firestore::Admin::V1::ListDatabasesRequest.new
1242
+ #
1243
+ # # Call the list_databases method.
1244
+ # result = client.list_databases request
1245
+ #
1246
+ # # The returned object is of type Google::Cloud::Firestore::Admin::V1::ListDatabasesResponse.
1247
+ # p result
1248
+ #
1249
+ def list_databases request, options = nil
1250
+ raise ::ArgumentError, "request must be provided" if request.nil?
1251
+
1252
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::ListDatabasesRequest
1253
+
1254
+ # Converts hash and nil to an options object
1255
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1256
+
1257
+ # Customize the options with defaults
1258
+ metadata = @config.rpcs.list_databases.metadata.to_h
1259
+
1260
+ # Set x-goog-api-client and x-goog-user-project headers
1261
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1262
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1263
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
1264
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1265
+
1266
+ header_params = {}
1267
+ if request.parent
1268
+ header_params["parent"] = request.parent
1269
+ end
1270
+
1271
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1272
+ metadata[:"x-goog-request-params"] ||= request_params_header
1273
+
1274
+ options.apply_defaults timeout: @config.rpcs.list_databases.timeout,
1275
+ metadata: metadata,
1276
+ retry_policy: @config.rpcs.list_databases.retry_policy
1277
+
1278
+ options.apply_defaults timeout: @config.timeout,
1279
+ metadata: @config.metadata,
1280
+ retry_policy: @config.retry_policy
1281
+
1282
+ @firestore_admin_stub.call_rpc :list_databases, request, options: options do |response, operation|
1283
+ yield response, operation if block_given?
1284
+ return response
1285
+ end
1286
+ rescue ::GRPC::BadStatus => e
1287
+ raise ::Google::Cloud::Error.from_error(e)
1288
+ end
1289
+
1290
+ ##
1291
+ # Updates a database.
1292
+ #
1293
+ # @overload update_database(request, options = nil)
1294
+ # Pass arguments to `update_database` via a request object, either of type
1295
+ # {::Google::Cloud::Firestore::Admin::V1::UpdateDatabaseRequest} or an equivalent Hash.
1296
+ #
1297
+ # @param request [::Google::Cloud::Firestore::Admin::V1::UpdateDatabaseRequest, ::Hash]
1298
+ # A request object representing the call parameters. Required. To specify no
1299
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1300
+ # @param options [::Gapic::CallOptions, ::Hash]
1301
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1302
+ #
1303
+ # @overload update_database(database: nil, update_mask: nil)
1304
+ # Pass arguments to `update_database` via keyword arguments. Note that at
1305
+ # least one keyword argument is required. To specify no parameters, or to keep all
1306
+ # the default parameter values, pass an empty Hash as a request object (see above).
1307
+ #
1308
+ # @param database [::Google::Cloud::Firestore::Admin::V1::Database, ::Hash]
1309
+ # Required. The database to update.
1310
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1311
+ # The list of fields to be updated.
1312
+ #
1313
+ # @yield [response, operation] Access the result along with the RPC operation
1314
+ # @yieldparam response [::Gapic::Operation]
1315
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1316
+ #
1317
+ # @return [::Gapic::Operation]
1318
+ #
1319
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1320
+ #
1321
+ # @example Basic example
1322
+ # require "google/cloud/firestore/admin/v1"
1323
+ #
1324
+ # # Create a client object. The client can be reused for multiple calls.
1325
+ # client = Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Client.new
1326
+ #
1327
+ # # Create a request. To set request fields, pass in keyword arguments.
1328
+ # request = Google::Cloud::Firestore::Admin::V1::UpdateDatabaseRequest.new
1329
+ #
1330
+ # # Call the update_database method.
1331
+ # result = client.update_database request
1332
+ #
1333
+ # # The returned object is of type Gapic::Operation. You can use this
1334
+ # # object to check the status of an operation, cancel it, or wait
1335
+ # # for results. Here is how to block until completion:
1336
+ # result.wait_until_done! timeout: 60
1337
+ # if result.response?
1338
+ # p result.response
1339
+ # else
1340
+ # puts "Error!"
1341
+ # end
1342
+ #
1343
+ def update_database request, options = nil
1344
+ raise ::ArgumentError, "request must be provided" if request.nil?
1345
+
1346
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::Admin::V1::UpdateDatabaseRequest
1347
+
1348
+ # Converts hash and nil to an options object
1349
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1350
+
1351
+ # Customize the options with defaults
1352
+ metadata = @config.rpcs.update_database.metadata.to_h
1353
+
1354
+ # Set x-goog-api-client and x-goog-user-project headers
1355
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1356
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1357
+ gapic_version: ::Google::Cloud::Firestore::Admin::V1::VERSION
1358
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1359
+
1360
+ header_params = {}
1361
+ if request.database&.name
1362
+ header_params["database.name"] = request.database.name
1363
+ end
1364
+
1365
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1366
+ metadata[:"x-goog-request-params"] ||= request_params_header
1367
+
1368
+ options.apply_defaults timeout: @config.rpcs.update_database.timeout,
1369
+ metadata: metadata,
1370
+ retry_policy: @config.rpcs.update_database.retry_policy
1371
+
1372
+ options.apply_defaults timeout: @config.timeout,
1373
+ metadata: @config.metadata,
1374
+ retry_policy: @config.retry_policy
1375
+
1376
+ @firestore_admin_stub.call_rpc :update_database, request, options: options do |response, operation|
1377
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1378
+ yield response, operation if block_given?
1379
+ return response
1380
+ end
1381
+ rescue ::GRPC::BadStatus => e
1382
+ raise ::Google::Cloud::Error.from_error(e)
1383
+ end
1384
+
895
1385
  ##
896
1386
  # Configuration class for the FirestoreAdmin API.
897
1387
  #
@@ -1072,6 +1562,21 @@ module Google
1072
1562
  # @return [::Gapic::Config::Method]
1073
1563
  #
1074
1564
  attr_reader :import_documents
1565
+ ##
1566
+ # RPC-specific configuration for `get_database`
1567
+ # @return [::Gapic::Config::Method]
1568
+ #
1569
+ attr_reader :get_database
1570
+ ##
1571
+ # RPC-specific configuration for `list_databases`
1572
+ # @return [::Gapic::Config::Method]
1573
+ #
1574
+ attr_reader :list_databases
1575
+ ##
1576
+ # RPC-specific configuration for `update_database`
1577
+ # @return [::Gapic::Config::Method]
1578
+ #
1579
+ attr_reader :update_database
1075
1580
 
1076
1581
  # @private
1077
1582
  def initialize parent_rpcs = nil
@@ -1093,6 +1598,12 @@ module Google
1093
1598
  @export_documents = ::Gapic::Config::Method.new export_documents_config
1094
1599
  import_documents_config = parent_rpcs.import_documents if parent_rpcs.respond_to? :import_documents
1095
1600
  @import_documents = ::Gapic::Config::Method.new import_documents_config
1601
+ get_database_config = parent_rpcs.get_database if parent_rpcs.respond_to? :get_database
1602
+ @get_database = ::Gapic::Config::Method.new get_database_config
1603
+ list_databases_config = parent_rpcs.list_databases if parent_rpcs.respond_to? :list_databases
1604
+ @list_databases = ::Gapic::Config::Method.new list_databases_config
1605
+ update_database_config = parent_rpcs.update_database if parent_rpcs.respond_to? :update_database
1606
+ @update_database = ::Gapic::Config::Method.new update_database_config
1096
1607
 
1097
1608
  yield self if block_given?
1098
1609
  end