google-cloud-metastore-v1beta 0.13.1 → 0.15.0

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.
@@ -198,15 +198,27 @@ module Google
198
198
  endpoint: @config.endpoint,
199
199
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
200
200
  universe_domain: @config.universe_domain,
201
- credentials: credentials
201
+ credentials: credentials,
202
+ logger: @config.logger
202
203
  )
203
204
 
205
+ @dataproc_metastore_stub.logger(stub: true)&.info do |entry|
206
+ entry.set_system_name
207
+ entry.set_service
208
+ entry.message = "Created client for #{entry.service}"
209
+ entry.set_credentials_fields credentials
210
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
211
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
212
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
213
+ end
214
+
204
215
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
205
216
  config.credentials = credentials
206
217
  config.quota_project = @quota_project_id
207
218
  config.endpoint = @dataproc_metastore_stub.endpoint
208
219
  config.universe_domain = @dataproc_metastore_stub.universe_domain
209
220
  config.bindings_override = @config.bindings_override
221
+ config.logger = @dataproc_metastore_stub.logger if config.respond_to? :logger=
210
222
  end
211
223
 
212
224
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
@@ -215,6 +227,7 @@ module Google
215
227
  config.endpoint = @dataproc_metastore_stub.endpoint
216
228
  config.universe_domain = @dataproc_metastore_stub.universe_domain
217
229
  config.bindings_override = @config.bindings_override
230
+ config.logger = @dataproc_metastore_stub.logger if config.respond_to? :logger=
218
231
  end
219
232
  end
220
233
 
@@ -239,6 +252,15 @@ module Google
239
252
  #
240
253
  attr_reader :iam_policy_client
241
254
 
255
+ ##
256
+ # The logger used for request/response debug logging.
257
+ #
258
+ # @return [Logger]
259
+ #
260
+ def logger
261
+ @dataproc_metastore_stub.logger
262
+ end
263
+
242
264
  # Service calls
243
265
 
244
266
  ##
@@ -342,7 +364,6 @@ module Google
342
364
 
343
365
  @dataproc_metastore_stub.list_services request, options do |result, operation|
344
366
  yield result, operation if block_given?
345
- return result
346
367
  end
347
368
  rescue ::Gapic::Rest::Error => e
348
369
  raise ::Google::Cloud::Error.from_error(e)
@@ -424,7 +445,6 @@ module Google
424
445
 
425
446
  @dataproc_metastore_stub.get_service request, options do |result, operation|
426
447
  yield result, operation if block_given?
427
- return result
428
448
  end
429
449
  rescue ::Gapic::Rest::Error => e
430
450
  raise ::Google::Cloud::Error.from_error(e)
@@ -538,7 +558,7 @@ module Google
538
558
  @dataproc_metastore_stub.create_service request, options do |result, operation|
539
559
  result = ::Gapic::Operation.new result, @operations_client, options: options
540
560
  yield result, operation if block_given?
541
- return result
561
+ throw :response, result
542
562
  end
543
563
  rescue ::Gapic::Rest::Error => e
544
564
  raise ::Google::Cloud::Error.from_error(e)
@@ -647,7 +667,7 @@ module Google
647
667
  @dataproc_metastore_stub.update_service request, options do |result, operation|
648
668
  result = ::Gapic::Operation.new result, @operations_client, options: options
649
669
  yield result, operation if block_given?
650
- return result
670
+ throw :response, result
651
671
  end
652
672
  rescue ::Gapic::Rest::Error => e
653
673
  raise ::Google::Cloud::Error.from_error(e)
@@ -750,7 +770,7 @@ module Google
750
770
  @dataproc_metastore_stub.delete_service request, options do |result, operation|
751
771
  result = ::Gapic::Operation.new result, @operations_client, options: options
752
772
  yield result, operation if block_given?
753
- return result
773
+ throw :response, result
754
774
  end
755
775
  rescue ::Gapic::Rest::Error => e
756
776
  raise ::Google::Cloud::Error.from_error(e)
@@ -856,7 +876,6 @@ module Google
856
876
 
857
877
  @dataproc_metastore_stub.list_metadata_imports request, options do |result, operation|
858
878
  yield result, operation if block_given?
859
- return result
860
879
  end
861
880
  rescue ::Gapic::Rest::Error => e
862
881
  raise ::Google::Cloud::Error.from_error(e)
@@ -938,7 +957,6 @@ module Google
938
957
 
939
958
  @dataproc_metastore_stub.get_metadata_import request, options do |result, operation|
940
959
  yield result, operation if block_given?
941
- return result
942
960
  end
943
961
  rescue ::Gapic::Rest::Error => e
944
962
  raise ::Google::Cloud::Error.from_error(e)
@@ -1052,7 +1070,7 @@ module Google
1052
1070
  @dataproc_metastore_stub.create_metadata_import request, options do |result, operation|
1053
1071
  result = ::Gapic::Operation.new result, @operations_client, options: options
1054
1072
  yield result, operation if block_given?
1055
- return result
1073
+ throw :response, result
1056
1074
  end
1057
1075
  rescue ::Gapic::Rest::Error => e
1058
1076
  raise ::Google::Cloud::Error.from_error(e)
@@ -1162,7 +1180,7 @@ module Google
1162
1180
  @dataproc_metastore_stub.update_metadata_import request, options do |result, operation|
1163
1181
  result = ::Gapic::Operation.new result, @operations_client, options: options
1164
1182
  yield result, operation if block_given?
1165
- return result
1183
+ throw :response, result
1166
1184
  end
1167
1185
  rescue ::Gapic::Rest::Error => e
1168
1186
  raise ::Google::Cloud::Error.from_error(e)
@@ -1272,7 +1290,7 @@ module Google
1272
1290
  @dataproc_metastore_stub.export_metadata request, options do |result, operation|
1273
1291
  result = ::Gapic::Operation.new result, @operations_client, options: options
1274
1292
  yield result, operation if block_given?
1275
- return result
1293
+ throw :response, result
1276
1294
  end
1277
1295
  rescue ::Gapic::Rest::Error => e
1278
1296
  raise ::Google::Cloud::Error.from_error(e)
@@ -1382,7 +1400,7 @@ module Google
1382
1400
  @dataproc_metastore_stub.restore_service request, options do |result, operation|
1383
1401
  result = ::Gapic::Operation.new result, @operations_client, options: options
1384
1402
  yield result, operation if block_given?
1385
- return result
1403
+ throw :response, result
1386
1404
  end
1387
1405
  rescue ::Gapic::Rest::Error => e
1388
1406
  raise ::Google::Cloud::Error.from_error(e)
@@ -1488,7 +1506,6 @@ module Google
1488
1506
 
1489
1507
  @dataproc_metastore_stub.list_backups request, options do |result, operation|
1490
1508
  yield result, operation if block_given?
1491
- return result
1492
1509
  end
1493
1510
  rescue ::Gapic::Rest::Error => e
1494
1511
  raise ::Google::Cloud::Error.from_error(e)
@@ -1570,7 +1587,6 @@ module Google
1570
1587
 
1571
1588
  @dataproc_metastore_stub.get_backup request, options do |result, operation|
1572
1589
  yield result, operation if block_given?
1573
- return result
1574
1590
  end
1575
1591
  rescue ::Gapic::Rest::Error => e
1576
1592
  raise ::Google::Cloud::Error.from_error(e)
@@ -1683,7 +1699,7 @@ module Google
1683
1699
  @dataproc_metastore_stub.create_backup request, options do |result, operation|
1684
1700
  result = ::Gapic::Operation.new result, @operations_client, options: options
1685
1701
  yield result, operation if block_given?
1686
- return result
1702
+ throw :response, result
1687
1703
  end
1688
1704
  rescue ::Gapic::Rest::Error => e
1689
1705
  raise ::Google::Cloud::Error.from_error(e)
@@ -1786,7 +1802,7 @@ module Google
1786
1802
  @dataproc_metastore_stub.delete_backup request, options do |result, operation|
1787
1803
  result = ::Gapic::Operation.new result, @operations_client, options: options
1788
1804
  yield result, operation if block_given?
1789
- return result
1805
+ throw :response, result
1790
1806
  end
1791
1807
  rescue ::Gapic::Rest::Error => e
1792
1808
  raise ::Google::Cloud::Error.from_error(e)
@@ -1873,7 +1889,6 @@ module Google
1873
1889
 
1874
1890
  @dataproc_metastore_stub.remove_iam_policy request, options do |result, operation|
1875
1891
  yield result, operation if block_given?
1876
- return result
1877
1892
  end
1878
1893
  rescue ::Gapic::Rest::Error => e
1879
1894
  raise ::Google::Cloud::Error.from_error(e)
@@ -1966,7 +1981,7 @@ module Google
1966
1981
  @dataproc_metastore_stub.query_metadata request, options do |result, operation|
1967
1982
  result = ::Gapic::Operation.new result, @operations_client, options: options
1968
1983
  yield result, operation if block_given?
1969
- return result
1984
+ throw :response, result
1970
1985
  end
1971
1986
  rescue ::Gapic::Rest::Error => e
1972
1987
  raise ::Google::Cloud::Error.from_error(e)
@@ -2062,7 +2077,7 @@ module Google
2062
2077
  @dataproc_metastore_stub.move_table_to_database request, options do |result, operation|
2063
2078
  result = ::Gapic::Operation.new result, @operations_client, options: options
2064
2079
  yield result, operation if block_given?
2065
- return result
2080
+ throw :response, result
2066
2081
  end
2067
2082
  rescue ::Gapic::Rest::Error => e
2068
2083
  raise ::Google::Cloud::Error.from_error(e)
@@ -2165,7 +2180,7 @@ module Google
2165
2180
  @dataproc_metastore_stub.alter_metadata_resource_location request, options do |result, operation|
2166
2181
  result = ::Gapic::Operation.new result, @operations_client, options: options
2167
2182
  yield result, operation if block_given?
2168
- return result
2183
+ throw :response, result
2169
2184
  end
2170
2185
  rescue ::Gapic::Rest::Error => e
2171
2186
  raise ::Google::Cloud::Error.from_error(e)
@@ -2213,6 +2228,13 @@ module Google
2213
2228
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
2214
2229
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
2215
2230
  # * (`nil`) indicating no credentials
2231
+ #
2232
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
2233
+ # external source for authentication to Google Cloud, you must validate it before
2234
+ # providing it to a Google API client library. Providing an unvalidated credential
2235
+ # configuration to Google APIs can compromise the security of your systems and data.
2236
+ # For more information, refer to [Validate credential configurations from external
2237
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
2216
2238
  # @return [::Object]
2217
2239
  # @!attribute [rw] scope
2218
2240
  # The OAuth scopes
@@ -2245,6 +2267,11 @@ module Google
2245
2267
  # default endpoint URL. The default value of nil uses the environment
2246
2268
  # universe (usually the default "googleapis.com" universe).
2247
2269
  # @return [::String,nil]
2270
+ # @!attribute [rw] logger
2271
+ # A custom logger to use for request/response debug logging, or the value
2272
+ # `:default` (the default) to construct a default logger, or `nil` to
2273
+ # explicitly disable logging.
2274
+ # @return [::Logger,:default,nil]
2248
2275
  #
2249
2276
  class Configuration
2250
2277
  extend ::Gapic::Config
@@ -2273,6 +2300,7 @@ module Google
2273
2300
  # by the host service.
2274
2301
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
2275
2302
  config_attr :bindings_override, {}, ::Hash, nil
2303
+ config_attr :logger, :default, ::Logger, nil, :default
2276
2304
 
2277
2305
  # @private
2278
2306
  def initialize parent_config = nil
@@ -115,14 +115,6 @@ module Google
115
115
  # Lists operations that match the specified filter in the request. If the
116
116
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
117
117
  #
118
- # NOTE: the `name` binding allows API services to override the binding
119
- # to use different resource name schemes, such as `users/*/operations`. To
120
- # override the binding, API services can add a binding such as
121
- # `"/v1/{name=users/*}/operations"` to their service configuration.
122
- # For backwards compatibility, the default name includes the operations
123
- # collection id, however overriding users must ensure the name binding
124
- # is the parent resource, without the operations collection id.
125
- #
126
118
  # @overload list_operations(request, options = nil)
127
119
  # Pass arguments to `list_operations` via a request object, either of type
128
120
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -204,7 +196,7 @@ module Google
204
196
  @operations_stub.list_operations request, options do |result, operation|
205
197
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
206
198
  yield result, operation if block_given?
207
- return result
199
+ throw :response, result
208
200
  end
209
201
  rescue ::Gapic::Rest::Error => e
210
202
  raise ::Google::Cloud::Error.from_error(e)
@@ -293,7 +285,7 @@ module Google
293
285
  @operations_stub.get_operation request, options do |result, operation|
294
286
  result = ::Gapic::Operation.new result, @operations_client, options: options
295
287
  yield result, operation if block_given?
296
- return result
288
+ throw :response, result
297
289
  end
298
290
  rescue ::Gapic::Rest::Error => e
299
291
  raise ::Google::Cloud::Error.from_error(e)
@@ -375,7 +367,6 @@ module Google
375
367
 
376
368
  @operations_stub.delete_operation request, options do |result, operation|
377
369
  yield result, operation if block_given?
378
- return result
379
370
  end
380
371
  rescue ::Gapic::Rest::Error => e
381
372
  raise ::Google::Cloud::Error.from_error(e)
@@ -390,8 +381,9 @@ module Google
390
381
  # other methods to check whether the cancellation succeeded or whether the
391
382
  # operation completed despite cancellation. On successful cancellation,
392
383
  # the operation is not deleted; instead, it becomes an operation with
393
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
394
- # corresponding to `Code.CANCELLED`.
384
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
385
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
386
+ # `Code.CANCELLED`.
395
387
  #
396
388
  # @overload cancel_operation(request, options = nil)
397
389
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -463,7 +455,6 @@ module Google
463
455
 
464
456
  @operations_stub.cancel_operation request, options do |result, operation|
465
457
  yield result, operation if block_given?
466
- return result
467
458
  end
468
459
  rescue ::Gapic::Rest::Error => e
469
460
  raise ::Google::Cloud::Error.from_error(e)
@@ -511,6 +502,13 @@ module Google
511
502
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
512
503
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
513
504
  # * (`nil`) indicating no credentials
505
+ #
506
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
507
+ # external source for authentication to Google Cloud, you must validate it before
508
+ # providing it to a Google API client library. Providing an unvalidated credential
509
+ # configuration to Google APIs can compromise the security of your systems and data.
510
+ # For more information, refer to [Validate credential configurations from external
511
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
514
512
  # @return [::Object]
515
513
  # @!attribute [rw] scope
516
514
  # The OAuth scopes
@@ -543,6 +541,11 @@ module Google
543
541
  # default endpoint URL. The default value of nil uses the environment
544
542
  # universe (usually the default "googleapis.com" universe).
545
543
  # @return [::String,nil]
544
+ # @!attribute [rw] logger
545
+ # A custom logger to use for request/response debug logging, or the value
546
+ # `:default` (the default) to construct a default logger, or `nil` to
547
+ # explicitly disable logging.
548
+ # @return [::Logger,:default,nil]
546
549
  #
547
550
  class Configuration
548
551
  extend ::Gapic::Config
@@ -564,6 +567,7 @@ module Google
564
567
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
565
568
  config_attr :quota_project, nil, ::String, nil
566
569
  config_attr :universe_domain, nil, ::String, nil
570
+ config_attr :logger, :default, ::Logger, nil, :default
567
571
 
568
572
  # @private
569
573
  def initialize parent_config = nil
@@ -683,16 +687,18 @@ module Google
683
687
 
684
688
  response = @client_stub.make_http_request(
685
689
  verb,
686
- uri: uri,
687
- body: body || "",
688
- params: query_string_params,
690
+ uri: uri,
691
+ body: body || "",
692
+ params: query_string_params,
693
+ method_name: "list_operations",
689
694
  options: options
690
695
  )
691
696
  operation = ::Gapic::Rest::TransportOperation.new response
692
697
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
693
-
694
- yield result, operation if block_given?
695
- result
698
+ catch :response do
699
+ yield result, operation if block_given?
700
+ result
701
+ end
696
702
  end
697
703
 
698
704
  ##
@@ -721,16 +727,18 @@ module Google
721
727
 
722
728
  response = @client_stub.make_http_request(
723
729
  verb,
724
- uri: uri,
725
- body: body || "",
726
- params: query_string_params,
730
+ uri: uri,
731
+ body: body || "",
732
+ params: query_string_params,
733
+ method_name: "get_operation",
727
734
  options: options
728
735
  )
729
736
  operation = ::Gapic::Rest::TransportOperation.new response
730
737
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
731
-
732
- yield result, operation if block_given?
733
- result
738
+ catch :response do
739
+ yield result, operation if block_given?
740
+ result
741
+ end
734
742
  end
735
743
 
736
744
  ##
@@ -759,16 +767,18 @@ module Google
759
767
 
760
768
  response = @client_stub.make_http_request(
761
769
  verb,
762
- uri: uri,
763
- body: body || "",
764
- params: query_string_params,
770
+ uri: uri,
771
+ body: body || "",
772
+ params: query_string_params,
773
+ method_name: "delete_operation",
765
774
  options: options
766
775
  )
767
776
  operation = ::Gapic::Rest::TransportOperation.new response
768
777
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
769
-
770
- yield result, operation if block_given?
771
- result
778
+ catch :response do
779
+ yield result, operation if block_given?
780
+ result
781
+ end
772
782
  end
773
783
 
774
784
  ##
@@ -797,16 +807,18 @@ module Google
797
807
 
798
808
  response = @client_stub.make_http_request(
799
809
  verb,
800
- uri: uri,
801
- body: body || "",
802
- params: query_string_params,
810
+ uri: uri,
811
+ body: body || "",
812
+ params: query_string_params,
813
+ method_name: "cancel_operation",
803
814
  options: options
804
815
  )
805
816
  operation = ::Gapic::Rest::TransportOperation.new response
806
817
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
807
-
808
- yield result, operation if block_given?
809
- result
818
+ catch :response do
819
+ yield result, operation if block_given?
820
+ result
821
+ end
810
822
  end
811
823
 
812
824
  ##