google-cloud-metastore-v1 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,8 +28,8 @@ module Google
28
28
  # Client for the DataprocMetastore service.
29
29
  #
30
30
  # Configures and manages metastore services.
31
- # Metastore services are fully managed, highly available, auto-scaled,
32
- # auto-healing, OSS-native deployments of technical metadata management
31
+ # Metastore services are fully managed, highly available, autoscaled,
32
+ # autohealing, OSS-native deployments of technical metadata management
33
33
  # software. Each metastore service exposes a network endpoint through which
34
34
  # metadata queries are served. Metadata queries can originate from a variety
35
35
  # of sources, including Apache Hive, Apache Presto, and Apache Spark.
@@ -57,13 +57,12 @@ module Google
57
57
  # See {::Google::Cloud::Metastore::V1::DataprocMetastore::Client::Configuration}
58
58
  # for a description of the configuration fields.
59
59
  #
60
- # ## Example
60
+ # @example
61
61
  #
62
- # To modify the configuration for all DataprocMetastore clients:
63
- #
64
- # ::Google::Cloud::Metastore::V1::DataprocMetastore::Client.configure do |config|
65
- # config.timeout = 10.0
66
- # end
62
+ # # Modify the configuration for all DataprocMetastore clients
63
+ # ::Google::Cloud::Metastore::V1::DataprocMetastore::Client.configure do |config|
64
+ # config.timeout = 10.0
65
+ # end
67
66
  #
68
67
  # @yield [config] Configure the Client client.
69
68
  # @yieldparam config [Client::Configuration]
@@ -83,10 +82,7 @@ module Google
83
82
 
84
83
  default_config.timeout = 60.0
85
84
  default_config.retry_policy = {
86
- initial_delay: 1.0,
87
- max_delay: 10.0,
88
- multiplier: 1.3,
89
- retry_codes: [14]
85
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
90
86
  }
91
87
 
92
88
  default_config.rpcs.create_service.timeout = 60.0
@@ -101,6 +97,12 @@ module Google
101
97
 
102
98
  default_config.rpcs.export_metadata.timeout = 60.0
103
99
 
100
+ default_config.rpcs.restore_service.timeout = 60.0
101
+
102
+ default_config.rpcs.create_backup.timeout = 60.0
103
+
104
+ default_config.rpcs.delete_backup.timeout = 60.0
105
+
104
106
  default_config
105
107
  end
106
108
  yield @configure if block_given?
@@ -130,19 +132,15 @@ module Google
130
132
  ##
131
133
  # Create a new DataprocMetastore client object.
132
134
  #
133
- # ## Examples
135
+ # @example
134
136
  #
135
- # To create a new DataprocMetastore client with the default
136
- # configuration:
137
+ # # Create a client using the default configuration
138
+ # client = ::Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
137
139
  #
138
- # client = ::Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
139
- #
140
- # To create a new DataprocMetastore client with a custom
141
- # configuration:
142
- #
143
- # client = ::Google::Cloud::Metastore::V1::DataprocMetastore::Client.new do |config|
144
- # config.timeout = 10.0
145
- # end
140
+ # # Create a client using a custom configuration
141
+ # client = ::Google::Cloud::Metastore::V1::DataprocMetastore::Client.new do |config|
142
+ # config.timeout = 10.0
143
+ # end
146
144
  #
147
145
  # @yield [config] Configure the DataprocMetastore client.
148
146
  # @yieldparam config [Client::Configuration]
@@ -162,14 +160,13 @@ module Google
162
160
 
163
161
  # Create credentials
164
162
  credentials = @config.credentials
165
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
163
+ # Use self-signed JWT if the endpoint is unchanged from default,
166
164
  # but only if the default endpoint does not have a region prefix.
167
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
168
- @config.endpoint == Client.configure.endpoint &&
165
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
169
166
  !@config.endpoint.split(".").first.include?("-")
170
167
  credentials ||= Credentials.default scope: @config.scope,
171
168
  enable_self_signed_jwt: enable_self_signed_jwt
172
- if credentials.is_a?(String) || credentials.is_a?(Hash)
169
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
173
170
  credentials = Credentials.new credentials, scope: @config.scope
174
171
  end
175
172
  @quota_project_id = @config.quota_project
@@ -249,6 +246,27 @@ module Google
249
246
  #
250
247
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
251
248
  #
249
+ # @example Basic example
250
+ # require "google/cloud/metastore/v1"
251
+ #
252
+ # # Create a client object. The client can be reused for multiple calls.
253
+ # client = Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
254
+ #
255
+ # # Create a request. To set request fields, pass in keyword arguments.
256
+ # request = Google::Cloud::Metastore::V1::ListServicesRequest.new
257
+ #
258
+ # # Call the list_services method.
259
+ # result = client.list_services request
260
+ #
261
+ # # The returned object is of type Gapic::PagedEnumerable. You can
262
+ # # iterate over all elements by calling #each, and the enumerable
263
+ # # will lazily make API calls to fetch subsequent pages. Other
264
+ # # methods are also available for managing paging directly.
265
+ # result.each do |response|
266
+ # # Each element is of type ::Google::Cloud::Metastore::V1::Service.
267
+ # p response
268
+ # end
269
+ #
252
270
  def list_services request, options = nil
253
271
  raise ::ArgumentError, "request must be provided" if request.nil?
254
272
 
@@ -266,16 +284,20 @@ module Google
266
284
  gapic_version: ::Google::Cloud::Metastore::V1::VERSION
267
285
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
268
286
 
269
- header_params = {
270
- "parent" => request.parent
271
- }
287
+ header_params = {}
288
+ if request.parent
289
+ header_params["parent"] = request.parent
290
+ end
291
+
272
292
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
273
293
  metadata[:"x-goog-request-params"] ||= request_params_header
274
294
 
275
295
  options.apply_defaults timeout: @config.rpcs.list_services.timeout,
276
296
  metadata: metadata,
277
297
  retry_policy: @config.rpcs.list_services.retry_policy
278
- options.apply_defaults metadata: @config.metadata,
298
+
299
+ options.apply_defaults timeout: @config.timeout,
300
+ metadata: @config.metadata,
279
301
  retry_policy: @config.retry_policy
280
302
 
281
303
  @dataproc_metastore_stub.call_rpc :list_services, request, options: options do |response, operation|
@@ -319,6 +341,21 @@ module Google
319
341
  #
320
342
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
321
343
  #
344
+ # @example Basic example
345
+ # require "google/cloud/metastore/v1"
346
+ #
347
+ # # Create a client object. The client can be reused for multiple calls.
348
+ # client = Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
349
+ #
350
+ # # Create a request. To set request fields, pass in keyword arguments.
351
+ # request = Google::Cloud::Metastore::V1::GetServiceRequest.new
352
+ #
353
+ # # Call the get_service method.
354
+ # result = client.get_service request
355
+ #
356
+ # # The returned object is of type Google::Cloud::Metastore::V1::Service.
357
+ # p result
358
+ #
322
359
  def get_service request, options = nil
323
360
  raise ::ArgumentError, "request must be provided" if request.nil?
324
361
 
@@ -336,16 +373,20 @@ module Google
336
373
  gapic_version: ::Google::Cloud::Metastore::V1::VERSION
337
374
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
338
375
 
339
- header_params = {
340
- "name" => request.name
341
- }
376
+ header_params = {}
377
+ if request.name
378
+ header_params["name"] = request.name
379
+ end
380
+
342
381
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
343
382
  metadata[:"x-goog-request-params"] ||= request_params_header
344
383
 
345
384
  options.apply_defaults timeout: @config.rpcs.get_service.timeout,
346
385
  metadata: metadata,
347
386
  retry_policy: @config.rpcs.get_service.retry_policy
348
- options.apply_defaults metadata: @config.metadata,
387
+
388
+ options.apply_defaults timeout: @config.timeout,
389
+ metadata: @config.metadata,
349
390
  retry_policy: @config.retry_policy
350
391
 
351
392
  @dataproc_metastore_stub.call_rpc :get_service, request, options: options do |response, operation|
@@ -412,6 +453,28 @@ module Google
412
453
  #
413
454
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
414
455
  #
456
+ # @example Basic example
457
+ # require "google/cloud/metastore/v1"
458
+ #
459
+ # # Create a client object. The client can be reused for multiple calls.
460
+ # client = Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
461
+ #
462
+ # # Create a request. To set request fields, pass in keyword arguments.
463
+ # request = Google::Cloud::Metastore::V1::CreateServiceRequest.new
464
+ #
465
+ # # Call the create_service method.
466
+ # result = client.create_service request
467
+ #
468
+ # # The returned object is of type Gapic::Operation. You can use this
469
+ # # object to check the status of an operation, cancel it, or wait
470
+ # # for results. Here is how to block until completion:
471
+ # result.wait_until_done! timeout: 60
472
+ # if result.response?
473
+ # p result.response
474
+ # else
475
+ # puts "Error!"
476
+ # end
477
+ #
415
478
  def create_service request, options = nil
416
479
  raise ::ArgumentError, "request must be provided" if request.nil?
417
480
 
@@ -429,16 +492,20 @@ module Google
429
492
  gapic_version: ::Google::Cloud::Metastore::V1::VERSION
430
493
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
431
494
 
432
- header_params = {
433
- "parent" => request.parent
434
- }
495
+ header_params = {}
496
+ if request.parent
497
+ header_params["parent"] = request.parent
498
+ end
499
+
435
500
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
436
501
  metadata[:"x-goog-request-params"] ||= request_params_header
437
502
 
438
503
  options.apply_defaults timeout: @config.rpcs.create_service.timeout,
439
504
  metadata: metadata,
440
505
  retry_policy: @config.rpcs.create_service.retry_policy
441
- options.apply_defaults metadata: @config.metadata,
506
+
507
+ options.apply_defaults timeout: @config.timeout,
508
+ metadata: @config.metadata,
442
509
  retry_policy: @config.retry_policy
443
510
 
444
511
  @dataproc_metastore_stub.call_rpc :create_service, request, options: options do |response, operation|
@@ -501,6 +568,28 @@ module Google
501
568
  #
502
569
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
503
570
  #
571
+ # @example Basic example
572
+ # require "google/cloud/metastore/v1"
573
+ #
574
+ # # Create a client object. The client can be reused for multiple calls.
575
+ # client = Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
576
+ #
577
+ # # Create a request. To set request fields, pass in keyword arguments.
578
+ # request = Google::Cloud::Metastore::V1::UpdateServiceRequest.new
579
+ #
580
+ # # Call the update_service method.
581
+ # result = client.update_service request
582
+ #
583
+ # # The returned object is of type Gapic::Operation. You can use this
584
+ # # object to check the status of an operation, cancel it, or wait
585
+ # # for results. Here is how to block until completion:
586
+ # result.wait_until_done! timeout: 60
587
+ # if result.response?
588
+ # p result.response
589
+ # else
590
+ # puts "Error!"
591
+ # end
592
+ #
504
593
  def update_service request, options = nil
505
594
  raise ::ArgumentError, "request must be provided" if request.nil?
506
595
 
@@ -518,16 +607,20 @@ module Google
518
607
  gapic_version: ::Google::Cloud::Metastore::V1::VERSION
519
608
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
520
609
 
521
- header_params = {
522
- "service.name" => request.service.name
523
- }
610
+ header_params = {}
611
+ if request.service&.name
612
+ header_params["service.name"] = request.service.name
613
+ end
614
+
524
615
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
525
616
  metadata[:"x-goog-request-params"] ||= request_params_header
526
617
 
527
618
  options.apply_defaults timeout: @config.rpcs.update_service.timeout,
528
619
  metadata: metadata,
529
620
  retry_policy: @config.rpcs.update_service.retry_policy
530
- options.apply_defaults metadata: @config.metadata,
621
+
622
+ options.apply_defaults timeout: @config.timeout,
623
+ metadata: @config.metadata,
531
624
  retry_policy: @config.retry_policy
532
625
 
533
626
  @dataproc_metastore_stub.call_rpc :update_service, request, options: options do |response, operation|
@@ -584,6 +677,28 @@ module Google
584
677
  #
585
678
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
586
679
  #
680
+ # @example Basic example
681
+ # require "google/cloud/metastore/v1"
682
+ #
683
+ # # Create a client object. The client can be reused for multiple calls.
684
+ # client = Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
685
+ #
686
+ # # Create a request. To set request fields, pass in keyword arguments.
687
+ # request = Google::Cloud::Metastore::V1::DeleteServiceRequest.new
688
+ #
689
+ # # Call the delete_service method.
690
+ # result = client.delete_service request
691
+ #
692
+ # # The returned object is of type Gapic::Operation. You can use this
693
+ # # object to check the status of an operation, cancel it, or wait
694
+ # # for results. Here is how to block until completion:
695
+ # result.wait_until_done! timeout: 60
696
+ # if result.response?
697
+ # p result.response
698
+ # else
699
+ # puts "Error!"
700
+ # end
701
+ #
587
702
  def delete_service request, options = nil
588
703
  raise ::ArgumentError, "request must be provided" if request.nil?
589
704
 
@@ -601,16 +716,20 @@ module Google
601
716
  gapic_version: ::Google::Cloud::Metastore::V1::VERSION
602
717
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
603
718
 
604
- header_params = {
605
- "name" => request.name
606
- }
719
+ header_params = {}
720
+ if request.name
721
+ header_params["name"] = request.name
722
+ end
723
+
607
724
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
608
725
  metadata[:"x-goog-request-params"] ||= request_params_header
609
726
 
610
727
  options.apply_defaults timeout: @config.rpcs.delete_service.timeout,
611
728
  metadata: metadata,
612
729
  retry_policy: @config.rpcs.delete_service.retry_policy
613
- options.apply_defaults metadata: @config.metadata,
730
+
731
+ options.apply_defaults timeout: @config.timeout,
732
+ metadata: @config.metadata,
614
733
  retry_policy: @config.retry_policy
615
734
 
616
735
  @dataproc_metastore_stub.call_rpc :delete_service, request, options: options do |response, operation|
@@ -673,6 +792,27 @@ module Google
673
792
  #
674
793
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
675
794
  #
795
+ # @example Basic example
796
+ # require "google/cloud/metastore/v1"
797
+ #
798
+ # # Create a client object. The client can be reused for multiple calls.
799
+ # client = Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
800
+ #
801
+ # # Create a request. To set request fields, pass in keyword arguments.
802
+ # request = Google::Cloud::Metastore::V1::ListMetadataImportsRequest.new
803
+ #
804
+ # # Call the list_metadata_imports method.
805
+ # result = client.list_metadata_imports request
806
+ #
807
+ # # The returned object is of type Gapic::PagedEnumerable. You can
808
+ # # iterate over all elements by calling #each, and the enumerable
809
+ # # will lazily make API calls to fetch subsequent pages. Other
810
+ # # methods are also available for managing paging directly.
811
+ # result.each do |response|
812
+ # # Each element is of type ::Google::Cloud::Metastore::V1::MetadataImport.
813
+ # p response
814
+ # end
815
+ #
676
816
  def list_metadata_imports request, options = nil
677
817
  raise ::ArgumentError, "request must be provided" if request.nil?
678
818
 
@@ -690,16 +830,20 @@ module Google
690
830
  gapic_version: ::Google::Cloud::Metastore::V1::VERSION
691
831
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
692
832
 
693
- header_params = {
694
- "parent" => request.parent
695
- }
833
+ header_params = {}
834
+ if request.parent
835
+ header_params["parent"] = request.parent
836
+ end
837
+
696
838
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
697
839
  metadata[:"x-goog-request-params"] ||= request_params_header
698
840
 
699
841
  options.apply_defaults timeout: @config.rpcs.list_metadata_imports.timeout,
700
842
  metadata: metadata,
701
843
  retry_policy: @config.rpcs.list_metadata_imports.retry_policy
702
- options.apply_defaults metadata: @config.metadata,
844
+
845
+ options.apply_defaults timeout: @config.timeout,
846
+ metadata: @config.metadata,
703
847
  retry_policy: @config.retry_policy
704
848
 
705
849
  @dataproc_metastore_stub.call_rpc :list_metadata_imports, request, options: options do |response, operation|
@@ -743,6 +887,21 @@ module Google
743
887
  #
744
888
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
745
889
  #
890
+ # @example Basic example
891
+ # require "google/cloud/metastore/v1"
892
+ #
893
+ # # Create a client object. The client can be reused for multiple calls.
894
+ # client = Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
895
+ #
896
+ # # Create a request. To set request fields, pass in keyword arguments.
897
+ # request = Google::Cloud::Metastore::V1::GetMetadataImportRequest.new
898
+ #
899
+ # # Call the get_metadata_import method.
900
+ # result = client.get_metadata_import request
901
+ #
902
+ # # The returned object is of type Google::Cloud::Metastore::V1::MetadataImport.
903
+ # p result
904
+ #
746
905
  def get_metadata_import request, options = nil
747
906
  raise ::ArgumentError, "request must be provided" if request.nil?
748
907
 
@@ -760,16 +919,20 @@ module Google
760
919
  gapic_version: ::Google::Cloud::Metastore::V1::VERSION
761
920
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
762
921
 
763
- header_params = {
764
- "name" => request.name
765
- }
922
+ header_params = {}
923
+ if request.name
924
+ header_params["name"] = request.name
925
+ end
926
+
766
927
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
767
928
  metadata[:"x-goog-request-params"] ||= request_params_header
768
929
 
769
930
  options.apply_defaults timeout: @config.rpcs.get_metadata_import.timeout,
770
931
  metadata: metadata,
771
932
  retry_policy: @config.rpcs.get_metadata_import.retry_policy
772
- options.apply_defaults metadata: @config.metadata,
933
+
934
+ options.apply_defaults timeout: @config.timeout,
935
+ metadata: @config.metadata,
773
936
  retry_policy: @config.retry_policy
774
937
 
775
938
  @dataproc_metastore_stub.call_rpc :get_metadata_import, request, options: options do |response, operation|
@@ -836,6 +999,28 @@ module Google
836
999
  #
837
1000
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
838
1001
  #
1002
+ # @example Basic example
1003
+ # require "google/cloud/metastore/v1"
1004
+ #
1005
+ # # Create a client object. The client can be reused for multiple calls.
1006
+ # client = Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
1007
+ #
1008
+ # # Create a request. To set request fields, pass in keyword arguments.
1009
+ # request = Google::Cloud::Metastore::V1::CreateMetadataImportRequest.new
1010
+ #
1011
+ # # Call the create_metadata_import method.
1012
+ # result = client.create_metadata_import request
1013
+ #
1014
+ # # The returned object is of type Gapic::Operation. You can use this
1015
+ # # object to check the status of an operation, cancel it, or wait
1016
+ # # for results. Here is how to block until completion:
1017
+ # result.wait_until_done! timeout: 60
1018
+ # if result.response?
1019
+ # p result.response
1020
+ # else
1021
+ # puts "Error!"
1022
+ # end
1023
+ #
839
1024
  def create_metadata_import request, options = nil
840
1025
  raise ::ArgumentError, "request must be provided" if request.nil?
841
1026
 
@@ -853,16 +1038,20 @@ module Google
853
1038
  gapic_version: ::Google::Cloud::Metastore::V1::VERSION
854
1039
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
855
1040
 
856
- header_params = {
857
- "parent" => request.parent
858
- }
1041
+ header_params = {}
1042
+ if request.parent
1043
+ header_params["parent"] = request.parent
1044
+ end
1045
+
859
1046
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
860
1047
  metadata[:"x-goog-request-params"] ||= request_params_header
861
1048
 
862
1049
  options.apply_defaults timeout: @config.rpcs.create_metadata_import.timeout,
863
1050
  metadata: metadata,
864
1051
  retry_policy: @config.rpcs.create_metadata_import.retry_policy
865
- options.apply_defaults metadata: @config.metadata,
1052
+
1053
+ options.apply_defaults timeout: @config.timeout,
1054
+ metadata: @config.metadata,
866
1055
  retry_policy: @config.retry_policy
867
1056
 
868
1057
  @dataproc_metastore_stub.call_rpc :create_metadata_import, request, options: options do |response, operation|
@@ -926,6 +1115,28 @@ module Google
926
1115
  #
927
1116
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
928
1117
  #
1118
+ # @example Basic example
1119
+ # require "google/cloud/metastore/v1"
1120
+ #
1121
+ # # Create a client object. The client can be reused for multiple calls.
1122
+ # client = Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
1123
+ #
1124
+ # # Create a request. To set request fields, pass in keyword arguments.
1125
+ # request = Google::Cloud::Metastore::V1::UpdateMetadataImportRequest.new
1126
+ #
1127
+ # # Call the update_metadata_import method.
1128
+ # result = client.update_metadata_import request
1129
+ #
1130
+ # # The returned object is of type Gapic::Operation. You can use this
1131
+ # # object to check the status of an operation, cancel it, or wait
1132
+ # # for results. Here is how to block until completion:
1133
+ # result.wait_until_done! timeout: 60
1134
+ # if result.response?
1135
+ # p result.response
1136
+ # else
1137
+ # puts "Error!"
1138
+ # end
1139
+ #
929
1140
  def update_metadata_import request, options = nil
930
1141
  raise ::ArgumentError, "request must be provided" if request.nil?
931
1142
 
@@ -943,16 +1154,20 @@ module Google
943
1154
  gapic_version: ::Google::Cloud::Metastore::V1::VERSION
944
1155
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
945
1156
 
946
- header_params = {
947
- "metadata_import.name" => request.metadata_import.name
948
- }
1157
+ header_params = {}
1158
+ if request.metadata_import&.name
1159
+ header_params["metadata_import.name"] = request.metadata_import.name
1160
+ end
1161
+
949
1162
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
950
1163
  metadata[:"x-goog-request-params"] ||= request_params_header
951
1164
 
952
1165
  options.apply_defaults timeout: @config.rpcs.update_metadata_import.timeout,
953
1166
  metadata: metadata,
954
1167
  retry_policy: @config.rpcs.update_metadata_import.retry_policy
955
- options.apply_defaults metadata: @config.metadata,
1168
+
1169
+ options.apply_defaults timeout: @config.timeout,
1170
+ metadata: @config.metadata,
956
1171
  retry_policy: @config.retry_policy
957
1172
 
958
1173
  @dataproc_metastore_stub.call_rpc :update_metadata_import, request, options: options do |response, operation|
@@ -1015,6 +1230,28 @@ module Google
1015
1230
  #
1016
1231
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1017
1232
  #
1233
+ # @example Basic example
1234
+ # require "google/cloud/metastore/v1"
1235
+ #
1236
+ # # Create a client object. The client can be reused for multiple calls.
1237
+ # client = Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
1238
+ #
1239
+ # # Create a request. To set request fields, pass in keyword arguments.
1240
+ # request = Google::Cloud::Metastore::V1::ExportMetadataRequest.new
1241
+ #
1242
+ # # Call the export_metadata method.
1243
+ # result = client.export_metadata request
1244
+ #
1245
+ # # The returned object is of type Gapic::Operation. You can use this
1246
+ # # object to check the status of an operation, cancel it, or wait
1247
+ # # for results. Here is how to block until completion:
1248
+ # result.wait_until_done! timeout: 60
1249
+ # if result.response?
1250
+ # p result.response
1251
+ # else
1252
+ # puts "Error!"
1253
+ # end
1254
+ #
1018
1255
  def export_metadata request, options = nil
1019
1256
  raise ::ArgumentError, "request must be provided" if request.nil?
1020
1257
 
@@ -1032,16 +1269,20 @@ module Google
1032
1269
  gapic_version: ::Google::Cloud::Metastore::V1::VERSION
1033
1270
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1034
1271
 
1035
- header_params = {
1036
- "service" => request.service
1037
- }
1272
+ header_params = {}
1273
+ if request.service
1274
+ header_params["service"] = request.service
1275
+ end
1276
+
1038
1277
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1039
1278
  metadata[:"x-goog-request-params"] ||= request_params_header
1040
1279
 
1041
1280
  options.apply_defaults timeout: @config.rpcs.export_metadata.timeout,
1042
1281
  metadata: metadata,
1043
1282
  retry_policy: @config.rpcs.export_metadata.retry_policy
1044
- options.apply_defaults metadata: @config.metadata,
1283
+
1284
+ options.apply_defaults timeout: @config.timeout,
1285
+ metadata: @config.metadata,
1045
1286
  retry_policy: @config.retry_policy
1046
1287
 
1047
1288
  @dataproc_metastore_stub.call_rpc :export_metadata, request, options: options do |response, operation|
@@ -1053,6 +1294,552 @@ module Google
1053
1294
  raise ::Google::Cloud::Error.from_error(e)
1054
1295
  end
1055
1296
 
1297
+ ##
1298
+ # Restores a service from a backup.
1299
+ #
1300
+ # @overload restore_service(request, options = nil)
1301
+ # Pass arguments to `restore_service` via a request object, either of type
1302
+ # {::Google::Cloud::Metastore::V1::RestoreServiceRequest} or an equivalent Hash.
1303
+ #
1304
+ # @param request [::Google::Cloud::Metastore::V1::RestoreServiceRequest, ::Hash]
1305
+ # A request object representing the call parameters. Required. To specify no
1306
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1307
+ # @param options [::Gapic::CallOptions, ::Hash]
1308
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1309
+ #
1310
+ # @overload restore_service(service: nil, backup: nil, restore_type: nil, request_id: nil)
1311
+ # Pass arguments to `restore_service` via keyword arguments. Note that at
1312
+ # least one keyword argument is required. To specify no parameters, or to keep all
1313
+ # the default parameter values, pass an empty Hash as a request object (see above).
1314
+ #
1315
+ # @param service [::String]
1316
+ # Required. The relative resource name of the metastore service to run restore, in the
1317
+ # following form:
1318
+ #
1319
+ # `projects/{project_id}/locations/{location_id}/services/{service_id}`.
1320
+ # @param backup [::String]
1321
+ # Required. The relative resource name of the metastore service backup to restore
1322
+ # from, in the following form:
1323
+ #
1324
+ # `projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}`.
1325
+ # @param restore_type [::Google::Cloud::Metastore::V1::Restore::RestoreType]
1326
+ # Optional. The type of restore. If unspecified, defaults to `METADATA_ONLY`.
1327
+ # @param request_id [::String]
1328
+ # Optional. A request ID. Specify a unique request ID to allow the server to ignore the
1329
+ # request if it has completed. The server will ignore subsequent requests
1330
+ # that provide a duplicate request ID for at least 60 minutes after the first
1331
+ # request.
1332
+ #
1333
+ # For example, if an initial request times out, followed by another request
1334
+ # with the same request ID, the server ignores the second request to prevent
1335
+ # the creation of duplicate commitments.
1336
+ #
1337
+ # The request ID must be a valid
1338
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format).
1339
+ # A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
1340
+ #
1341
+ # @yield [response, operation] Access the result along with the RPC operation
1342
+ # @yieldparam response [::Gapic::Operation]
1343
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1344
+ #
1345
+ # @return [::Gapic::Operation]
1346
+ #
1347
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1348
+ #
1349
+ # @example Basic example
1350
+ # require "google/cloud/metastore/v1"
1351
+ #
1352
+ # # Create a client object. The client can be reused for multiple calls.
1353
+ # client = Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
1354
+ #
1355
+ # # Create a request. To set request fields, pass in keyword arguments.
1356
+ # request = Google::Cloud::Metastore::V1::RestoreServiceRequest.new
1357
+ #
1358
+ # # Call the restore_service method.
1359
+ # result = client.restore_service request
1360
+ #
1361
+ # # The returned object is of type Gapic::Operation. You can use this
1362
+ # # object to check the status of an operation, cancel it, or wait
1363
+ # # for results. Here is how to block until completion:
1364
+ # result.wait_until_done! timeout: 60
1365
+ # if result.response?
1366
+ # p result.response
1367
+ # else
1368
+ # puts "Error!"
1369
+ # end
1370
+ #
1371
+ def restore_service request, options = nil
1372
+ raise ::ArgumentError, "request must be provided" if request.nil?
1373
+
1374
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::RestoreServiceRequest
1375
+
1376
+ # Converts hash and nil to an options object
1377
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1378
+
1379
+ # Customize the options with defaults
1380
+ metadata = @config.rpcs.restore_service.metadata.to_h
1381
+
1382
+ # Set x-goog-api-client and x-goog-user-project headers
1383
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1384
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1385
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION
1386
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1387
+
1388
+ header_params = {}
1389
+ if request.service
1390
+ header_params["service"] = request.service
1391
+ end
1392
+
1393
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1394
+ metadata[:"x-goog-request-params"] ||= request_params_header
1395
+
1396
+ options.apply_defaults timeout: @config.rpcs.restore_service.timeout,
1397
+ metadata: metadata,
1398
+ retry_policy: @config.rpcs.restore_service.retry_policy
1399
+
1400
+ options.apply_defaults timeout: @config.timeout,
1401
+ metadata: @config.metadata,
1402
+ retry_policy: @config.retry_policy
1403
+
1404
+ @dataproc_metastore_stub.call_rpc :restore_service, request, options: options do |response, operation|
1405
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1406
+ yield response, operation if block_given?
1407
+ return response
1408
+ end
1409
+ rescue ::GRPC::BadStatus => e
1410
+ raise ::Google::Cloud::Error.from_error(e)
1411
+ end
1412
+
1413
+ ##
1414
+ # Lists backups in a service.
1415
+ #
1416
+ # @overload list_backups(request, options = nil)
1417
+ # Pass arguments to `list_backups` via a request object, either of type
1418
+ # {::Google::Cloud::Metastore::V1::ListBackupsRequest} or an equivalent Hash.
1419
+ #
1420
+ # @param request [::Google::Cloud::Metastore::V1::ListBackupsRequest, ::Hash]
1421
+ # A request object representing the call parameters. Required. To specify no
1422
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1423
+ # @param options [::Gapic::CallOptions, ::Hash]
1424
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1425
+ #
1426
+ # @overload list_backups(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
1427
+ # Pass arguments to `list_backups` via keyword arguments. Note that at
1428
+ # least one keyword argument is required. To specify no parameters, or to keep all
1429
+ # the default parameter values, pass an empty Hash as a request object (see above).
1430
+ #
1431
+ # @param parent [::String]
1432
+ # Required. The relative resource name of the service whose backups to
1433
+ # list, in the following form:
1434
+ #
1435
+ # `projects/{project_number}/locations/{location_id}/services/{service_id}/backups`.
1436
+ # @param page_size [::Integer]
1437
+ # Optional. The maximum number of backups to return. The response may contain less
1438
+ # than the maximum number. If unspecified, no more than 500 backups are
1439
+ # returned. The maximum value is 1000; values above 1000 are changed to 1000.
1440
+ # @param page_token [::String]
1441
+ # Optional. A page token, received from a previous {::Google::Cloud::Metastore::V1::DataprocMetastore::Client#list_backups DataprocMetastore.ListBackups}
1442
+ # call. Provide this token to retrieve the subsequent page.
1443
+ #
1444
+ # To retrieve the first page, supply an empty page token.
1445
+ #
1446
+ # When paginating, other parameters provided to
1447
+ # {::Google::Cloud::Metastore::V1::DataprocMetastore::Client#list_backups DataprocMetastore.ListBackups} must match the call that provided the
1448
+ # page token.
1449
+ # @param filter [::String]
1450
+ # Optional. The filter to apply to list results.
1451
+ # @param order_by [::String]
1452
+ # Optional. Specify the ordering of results as described in [Sorting
1453
+ # Order](https://cloud.google.com/apis/design/design_patterns#sorting_order).
1454
+ # If not specified, the results will be sorted in the default order.
1455
+ #
1456
+ # @yield [response, operation] Access the result along with the RPC operation
1457
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Metastore::V1::Backup>]
1458
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1459
+ #
1460
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Metastore::V1::Backup>]
1461
+ #
1462
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1463
+ #
1464
+ # @example Basic example
1465
+ # require "google/cloud/metastore/v1"
1466
+ #
1467
+ # # Create a client object. The client can be reused for multiple calls.
1468
+ # client = Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
1469
+ #
1470
+ # # Create a request. To set request fields, pass in keyword arguments.
1471
+ # request = Google::Cloud::Metastore::V1::ListBackupsRequest.new
1472
+ #
1473
+ # # Call the list_backups method.
1474
+ # result = client.list_backups request
1475
+ #
1476
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1477
+ # # iterate over all elements by calling #each, and the enumerable
1478
+ # # will lazily make API calls to fetch subsequent pages. Other
1479
+ # # methods are also available for managing paging directly.
1480
+ # result.each do |response|
1481
+ # # Each element is of type ::Google::Cloud::Metastore::V1::Backup.
1482
+ # p response
1483
+ # end
1484
+ #
1485
+ def list_backups request, options = nil
1486
+ raise ::ArgumentError, "request must be provided" if request.nil?
1487
+
1488
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::ListBackupsRequest
1489
+
1490
+ # Converts hash and nil to an options object
1491
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1492
+
1493
+ # Customize the options with defaults
1494
+ metadata = @config.rpcs.list_backups.metadata.to_h
1495
+
1496
+ # Set x-goog-api-client and x-goog-user-project headers
1497
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1498
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1499
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION
1500
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1501
+
1502
+ header_params = {}
1503
+ if request.parent
1504
+ header_params["parent"] = request.parent
1505
+ end
1506
+
1507
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1508
+ metadata[:"x-goog-request-params"] ||= request_params_header
1509
+
1510
+ options.apply_defaults timeout: @config.rpcs.list_backups.timeout,
1511
+ metadata: metadata,
1512
+ retry_policy: @config.rpcs.list_backups.retry_policy
1513
+
1514
+ options.apply_defaults timeout: @config.timeout,
1515
+ metadata: @config.metadata,
1516
+ retry_policy: @config.retry_policy
1517
+
1518
+ @dataproc_metastore_stub.call_rpc :list_backups, request, options: options do |response, operation|
1519
+ response = ::Gapic::PagedEnumerable.new @dataproc_metastore_stub, :list_backups, request, response, operation, options
1520
+ yield response, operation if block_given?
1521
+ return response
1522
+ end
1523
+ rescue ::GRPC::BadStatus => e
1524
+ raise ::Google::Cloud::Error.from_error(e)
1525
+ end
1526
+
1527
+ ##
1528
+ # Gets details of a single backup.
1529
+ #
1530
+ # @overload get_backup(request, options = nil)
1531
+ # Pass arguments to `get_backup` via a request object, either of type
1532
+ # {::Google::Cloud::Metastore::V1::GetBackupRequest} or an equivalent Hash.
1533
+ #
1534
+ # @param request [::Google::Cloud::Metastore::V1::GetBackupRequest, ::Hash]
1535
+ # A request object representing the call parameters. Required. To specify no
1536
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1537
+ # @param options [::Gapic::CallOptions, ::Hash]
1538
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1539
+ #
1540
+ # @overload get_backup(name: nil)
1541
+ # Pass arguments to `get_backup` via keyword arguments. Note that at
1542
+ # least one keyword argument is required. To specify no parameters, or to keep all
1543
+ # the default parameter values, pass an empty Hash as a request object (see above).
1544
+ #
1545
+ # @param name [::String]
1546
+ # Required. The relative resource name of the backup to retrieve, in the
1547
+ # following form:
1548
+ #
1549
+ # `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`.
1550
+ #
1551
+ # @yield [response, operation] Access the result along with the RPC operation
1552
+ # @yieldparam response [::Google::Cloud::Metastore::V1::Backup]
1553
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1554
+ #
1555
+ # @return [::Google::Cloud::Metastore::V1::Backup]
1556
+ #
1557
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1558
+ #
1559
+ # @example Basic example
1560
+ # require "google/cloud/metastore/v1"
1561
+ #
1562
+ # # Create a client object. The client can be reused for multiple calls.
1563
+ # client = Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
1564
+ #
1565
+ # # Create a request. To set request fields, pass in keyword arguments.
1566
+ # request = Google::Cloud::Metastore::V1::GetBackupRequest.new
1567
+ #
1568
+ # # Call the get_backup method.
1569
+ # result = client.get_backup request
1570
+ #
1571
+ # # The returned object is of type Google::Cloud::Metastore::V1::Backup.
1572
+ # p result
1573
+ #
1574
+ def get_backup request, options = nil
1575
+ raise ::ArgumentError, "request must be provided" if request.nil?
1576
+
1577
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::GetBackupRequest
1578
+
1579
+ # Converts hash and nil to an options object
1580
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1581
+
1582
+ # Customize the options with defaults
1583
+ metadata = @config.rpcs.get_backup.metadata.to_h
1584
+
1585
+ # Set x-goog-api-client and x-goog-user-project headers
1586
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1587
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1588
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION
1589
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1590
+
1591
+ header_params = {}
1592
+ if request.name
1593
+ header_params["name"] = request.name
1594
+ end
1595
+
1596
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1597
+ metadata[:"x-goog-request-params"] ||= request_params_header
1598
+
1599
+ options.apply_defaults timeout: @config.rpcs.get_backup.timeout,
1600
+ metadata: metadata,
1601
+ retry_policy: @config.rpcs.get_backup.retry_policy
1602
+
1603
+ options.apply_defaults timeout: @config.timeout,
1604
+ metadata: @config.metadata,
1605
+ retry_policy: @config.retry_policy
1606
+
1607
+ @dataproc_metastore_stub.call_rpc :get_backup, request, options: options do |response, operation|
1608
+ yield response, operation if block_given?
1609
+ return response
1610
+ end
1611
+ rescue ::GRPC::BadStatus => e
1612
+ raise ::Google::Cloud::Error.from_error(e)
1613
+ end
1614
+
1615
+ ##
1616
+ # Creates a new backup in a given project and location.
1617
+ #
1618
+ # @overload create_backup(request, options = nil)
1619
+ # Pass arguments to `create_backup` via a request object, either of type
1620
+ # {::Google::Cloud::Metastore::V1::CreateBackupRequest} or an equivalent Hash.
1621
+ #
1622
+ # @param request [::Google::Cloud::Metastore::V1::CreateBackupRequest, ::Hash]
1623
+ # A request object representing the call parameters. Required. To specify no
1624
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1625
+ # @param options [::Gapic::CallOptions, ::Hash]
1626
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1627
+ #
1628
+ # @overload create_backup(parent: nil, backup_id: nil, backup: nil, request_id: nil)
1629
+ # Pass arguments to `create_backup` via keyword arguments. Note that at
1630
+ # least one keyword argument is required. To specify no parameters, or to keep all
1631
+ # the default parameter values, pass an empty Hash as a request object (see above).
1632
+ #
1633
+ # @param parent [::String]
1634
+ # Required. The relative resource name of the service in which to create a backup
1635
+ # of the following form:
1636
+ #
1637
+ # `projects/{project_number}/locations/{location_id}/services/{service_id}`.
1638
+ # @param backup_id [::String]
1639
+ # Required. The ID of the backup, which is used as the final component of the
1640
+ # backup's name.
1641
+ #
1642
+ # This value must be between 1 and 64 characters long, begin with a letter,
1643
+ # end with a letter or number, and consist of alpha-numeric ASCII characters
1644
+ # or hyphens.
1645
+ # @param backup [::Google::Cloud::Metastore::V1::Backup, ::Hash]
1646
+ # Required. The backup to create. The `name` field is ignored. The ID of the created
1647
+ # backup must be provided in the request's `backup_id` field.
1648
+ # @param request_id [::String]
1649
+ # Optional. A request ID. Specify a unique request ID to allow the server to ignore the
1650
+ # request if it has completed. The server will ignore subsequent requests
1651
+ # that provide a duplicate request ID for at least 60 minutes after the first
1652
+ # request.
1653
+ #
1654
+ # For example, if an initial request times out, followed by another request
1655
+ # with the same request ID, the server ignores the second request to prevent
1656
+ # the creation of duplicate commitments.
1657
+ #
1658
+ # The request ID must be a valid
1659
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
1660
+ # A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
1661
+ #
1662
+ # @yield [response, operation] Access the result along with the RPC operation
1663
+ # @yieldparam response [::Gapic::Operation]
1664
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1665
+ #
1666
+ # @return [::Gapic::Operation]
1667
+ #
1668
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1669
+ #
1670
+ # @example Basic example
1671
+ # require "google/cloud/metastore/v1"
1672
+ #
1673
+ # # Create a client object. The client can be reused for multiple calls.
1674
+ # client = Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
1675
+ #
1676
+ # # Create a request. To set request fields, pass in keyword arguments.
1677
+ # request = Google::Cloud::Metastore::V1::CreateBackupRequest.new
1678
+ #
1679
+ # # Call the create_backup method.
1680
+ # result = client.create_backup request
1681
+ #
1682
+ # # The returned object is of type Gapic::Operation. You can use this
1683
+ # # object to check the status of an operation, cancel it, or wait
1684
+ # # for results. Here is how to block until completion:
1685
+ # result.wait_until_done! timeout: 60
1686
+ # if result.response?
1687
+ # p result.response
1688
+ # else
1689
+ # puts "Error!"
1690
+ # end
1691
+ #
1692
+ def create_backup request, options = nil
1693
+ raise ::ArgumentError, "request must be provided" if request.nil?
1694
+
1695
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::CreateBackupRequest
1696
+
1697
+ # Converts hash and nil to an options object
1698
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1699
+
1700
+ # Customize the options with defaults
1701
+ metadata = @config.rpcs.create_backup.metadata.to_h
1702
+
1703
+ # Set x-goog-api-client and x-goog-user-project headers
1704
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1705
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1706
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION
1707
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1708
+
1709
+ header_params = {}
1710
+ if request.parent
1711
+ header_params["parent"] = request.parent
1712
+ end
1713
+
1714
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1715
+ metadata[:"x-goog-request-params"] ||= request_params_header
1716
+
1717
+ options.apply_defaults timeout: @config.rpcs.create_backup.timeout,
1718
+ metadata: metadata,
1719
+ retry_policy: @config.rpcs.create_backup.retry_policy
1720
+
1721
+ options.apply_defaults timeout: @config.timeout,
1722
+ metadata: @config.metadata,
1723
+ retry_policy: @config.retry_policy
1724
+
1725
+ @dataproc_metastore_stub.call_rpc :create_backup, request, options: options do |response, operation|
1726
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1727
+ yield response, operation if block_given?
1728
+ return response
1729
+ end
1730
+ rescue ::GRPC::BadStatus => e
1731
+ raise ::Google::Cloud::Error.from_error(e)
1732
+ end
1733
+
1734
+ ##
1735
+ # Deletes a single backup.
1736
+ #
1737
+ # @overload delete_backup(request, options = nil)
1738
+ # Pass arguments to `delete_backup` via a request object, either of type
1739
+ # {::Google::Cloud::Metastore::V1::DeleteBackupRequest} or an equivalent Hash.
1740
+ #
1741
+ # @param request [::Google::Cloud::Metastore::V1::DeleteBackupRequest, ::Hash]
1742
+ # A request object representing the call parameters. Required. To specify no
1743
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1744
+ # @param options [::Gapic::CallOptions, ::Hash]
1745
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1746
+ #
1747
+ # @overload delete_backup(name: nil, request_id: nil)
1748
+ # Pass arguments to `delete_backup` via keyword arguments. Note that at
1749
+ # least one keyword argument is required. To specify no parameters, or to keep all
1750
+ # the default parameter values, pass an empty Hash as a request object (see above).
1751
+ #
1752
+ # @param name [::String]
1753
+ # Required. The relative resource name of the backup to delete, in the
1754
+ # following form:
1755
+ #
1756
+ # `projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}`.
1757
+ # @param request_id [::String]
1758
+ # Optional. A request ID. Specify a unique request ID to allow the server to ignore the
1759
+ # request if it has completed. The server will ignore subsequent requests
1760
+ # that provide a duplicate request ID for at least 60 minutes after the first
1761
+ # request.
1762
+ #
1763
+ # For example, if an initial request times out, followed by another request
1764
+ # with the same request ID, the server ignores the second request to prevent
1765
+ # the creation of duplicate commitments.
1766
+ #
1767
+ # The request ID must be a valid
1768
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format)
1769
+ # A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
1770
+ #
1771
+ # @yield [response, operation] Access the result along with the RPC operation
1772
+ # @yieldparam response [::Gapic::Operation]
1773
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1774
+ #
1775
+ # @return [::Gapic::Operation]
1776
+ #
1777
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1778
+ #
1779
+ # @example Basic example
1780
+ # require "google/cloud/metastore/v1"
1781
+ #
1782
+ # # Create a client object. The client can be reused for multiple calls.
1783
+ # client = Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
1784
+ #
1785
+ # # Create a request. To set request fields, pass in keyword arguments.
1786
+ # request = Google::Cloud::Metastore::V1::DeleteBackupRequest.new
1787
+ #
1788
+ # # Call the delete_backup method.
1789
+ # result = client.delete_backup request
1790
+ #
1791
+ # # The returned object is of type Gapic::Operation. You can use this
1792
+ # # object to check the status of an operation, cancel it, or wait
1793
+ # # for results. Here is how to block until completion:
1794
+ # result.wait_until_done! timeout: 60
1795
+ # if result.response?
1796
+ # p result.response
1797
+ # else
1798
+ # puts "Error!"
1799
+ # end
1800
+ #
1801
+ def delete_backup request, options = nil
1802
+ raise ::ArgumentError, "request must be provided" if request.nil?
1803
+
1804
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::DeleteBackupRequest
1805
+
1806
+ # Converts hash and nil to an options object
1807
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1808
+
1809
+ # Customize the options with defaults
1810
+ metadata = @config.rpcs.delete_backup.metadata.to_h
1811
+
1812
+ # Set x-goog-api-client and x-goog-user-project headers
1813
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1814
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1815
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION
1816
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1817
+
1818
+ header_params = {}
1819
+ if request.name
1820
+ header_params["name"] = request.name
1821
+ end
1822
+
1823
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1824
+ metadata[:"x-goog-request-params"] ||= request_params_header
1825
+
1826
+ options.apply_defaults timeout: @config.rpcs.delete_backup.timeout,
1827
+ metadata: metadata,
1828
+ retry_policy: @config.rpcs.delete_backup.retry_policy
1829
+
1830
+ options.apply_defaults timeout: @config.timeout,
1831
+ metadata: @config.metadata,
1832
+ retry_policy: @config.retry_policy
1833
+
1834
+ @dataproc_metastore_stub.call_rpc :delete_backup, request, options: options do |response, operation|
1835
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1836
+ yield response, operation if block_given?
1837
+ return response
1838
+ end
1839
+ rescue ::GRPC::BadStatus => e
1840
+ raise ::Google::Cloud::Error.from_error(e)
1841
+ end
1842
+
1056
1843
  ##
1057
1844
  # Configuration class for the DataprocMetastore API.
1058
1845
  #
@@ -1066,22 +1853,21 @@ module Google
1066
1853
  # Configuration can be applied globally to all clients, or to a single client
1067
1854
  # on construction.
1068
1855
  #
1069
- # # Examples
1856
+ # @example
1070
1857
  #
1071
- # To modify the global config, setting the timeout for list_services
1072
- # to 20 seconds, and all remaining timeouts to 10 seconds:
1858
+ # # Modify the global config, setting the timeout for
1859
+ # # list_services to 20 seconds,
1860
+ # # and all remaining timeouts to 10 seconds.
1861
+ # ::Google::Cloud::Metastore::V1::DataprocMetastore::Client.configure do |config|
1862
+ # config.timeout = 10.0
1863
+ # config.rpcs.list_services.timeout = 20.0
1864
+ # end
1073
1865
  #
1074
- # ::Google::Cloud::Metastore::V1::DataprocMetastore::Client.configure do |config|
1075
- # config.timeout = 10.0
1076
- # config.rpcs.list_services.timeout = 20.0
1077
- # end
1078
- #
1079
- # To apply the above configuration only to a new client:
1080
- #
1081
- # client = ::Google::Cloud::Metastore::V1::DataprocMetastore::Client.new do |config|
1082
- # config.timeout = 10.0
1083
- # config.rpcs.list_services.timeout = 20.0
1084
- # end
1866
+ # # Apply the above configuration only to a new client.
1867
+ # client = ::Google::Cloud::Metastore::V1::DataprocMetastore::Client.new do |config|
1868
+ # config.timeout = 10.0
1869
+ # config.rpcs.list_services.timeout = 20.0
1870
+ # end
1085
1871
  #
1086
1872
  # @!attribute [rw] endpoint
1087
1873
  # The hostname or hostname:port of the service endpoint.
@@ -1239,6 +2025,31 @@ module Google
1239
2025
  # @return [::Gapic::Config::Method]
1240
2026
  #
1241
2027
  attr_reader :export_metadata
2028
+ ##
2029
+ # RPC-specific configuration for `restore_service`
2030
+ # @return [::Gapic::Config::Method]
2031
+ #
2032
+ attr_reader :restore_service
2033
+ ##
2034
+ # RPC-specific configuration for `list_backups`
2035
+ # @return [::Gapic::Config::Method]
2036
+ #
2037
+ attr_reader :list_backups
2038
+ ##
2039
+ # RPC-specific configuration for `get_backup`
2040
+ # @return [::Gapic::Config::Method]
2041
+ #
2042
+ attr_reader :get_backup
2043
+ ##
2044
+ # RPC-specific configuration for `create_backup`
2045
+ # @return [::Gapic::Config::Method]
2046
+ #
2047
+ attr_reader :create_backup
2048
+ ##
2049
+ # RPC-specific configuration for `delete_backup`
2050
+ # @return [::Gapic::Config::Method]
2051
+ #
2052
+ attr_reader :delete_backup
1242
2053
 
1243
2054
  # @private
1244
2055
  def initialize parent_rpcs = nil
@@ -1262,6 +2073,16 @@ module Google
1262
2073
  @update_metadata_import = ::Gapic::Config::Method.new update_metadata_import_config
1263
2074
  export_metadata_config = parent_rpcs.export_metadata if parent_rpcs.respond_to? :export_metadata
1264
2075
  @export_metadata = ::Gapic::Config::Method.new export_metadata_config
2076
+ restore_service_config = parent_rpcs.restore_service if parent_rpcs.respond_to? :restore_service
2077
+ @restore_service = ::Gapic::Config::Method.new restore_service_config
2078
+ list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups
2079
+ @list_backups = ::Gapic::Config::Method.new list_backups_config
2080
+ get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup
2081
+ @get_backup = ::Gapic::Config::Method.new get_backup_config
2082
+ create_backup_config = parent_rpcs.create_backup if parent_rpcs.respond_to? :create_backup
2083
+ @create_backup = ::Gapic::Config::Method.new create_backup_config
2084
+ delete_backup_config = parent_rpcs.delete_backup if parent_rpcs.respond_to? :delete_backup
2085
+ @delete_backup = ::Gapic::Config::Method.new delete_backup_config
1265
2086
 
1266
2087
  yield self if block_given?
1267
2088
  end