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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 791e8817365e1551c7a3a5af7fa870bd3673bad6c70836e4e6808f2a1a922d17
4
- data.tar.gz: 2bee8640f2e82e1dcc55a4b0992aeada245f2df0b0978e1b1553084cf742365f
3
+ metadata.gz: 3b1b02cb57341f17d61a337203d061eb767218515cfc726885c2d0010aaee1c1
4
+ data.tar.gz: 2805557adbcc9c49e5f15d02b8f164a2f5b445631c8f01c710d66f51a3e6a69a
5
5
  SHA512:
6
- metadata.gz: c2812fa7f3ad226e8480f3d3bfa60c07b52dd5e73aa9a6fabd0e76926affe68732044cf06146233ca19426c183a3dd8e408364304e6277ef224b1216bdbcbb8d
7
- data.tar.gz: 89525dc7de32203514bee177604e10e0ed08ecebf992fad9f26a4d9d1ac62a0b27abfc54f591d2be7df356f4cf2f706f6b8f50228415f92ec566de1e45b182b1
6
+ metadata.gz: a92345332832c667e1a086f7158ce4e4cee4ac42eaffcf9962d34e36daf9e538384a95e1021aa93331b6efff28a3ee8f4b3f65ce3d164c25e8b4524e9c2974bc
7
+ data.tar.gz: dda34536fa77261b90cd0bd4c1c087dc4acb180594cf66e77d025cf0ce520337e899fc3c9a866d483ff225f140d4582e6ed34a6edcb4aac7f054cb2e140959c4
data/README.md CHANGED
@@ -43,40 +43,50 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/dataproc-metastore/)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
48
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
-
54
- Configuring a Ruby stdlib logger:
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ You can customize logging by modifying the `logger` configuration when
72
+ constructing a client object. For example:
55
73
 
56
74
  ```ruby
75
+ require "google/cloud/metastore/v1beta"
57
76
  require "logger"
58
77
 
59
- module MyLogger
60
- LOGGER = Logger.new $stderr, level: Logger::WARN
61
- def logger
62
- LOGGER
63
- end
64
- end
65
-
66
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
67
- module GRPC
68
- extend MyLogger
78
+ client = ::Google::Cloud::Metastore::V1beta::DataprocMetastore::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
69
80
  end
70
81
  ```
71
82
 
72
-
73
83
  ## Google Cloud Samples
74
84
 
75
85
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
76
86
 
77
87
  ## Supported Ruby Versions
78
88
 
79
- This library is supported on Ruby 2.7+.
89
+ This library is supported on Ruby 3.0+.
80
90
 
81
91
  Google provides official support for Ruby versions that are actively supported
82
92
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -205,14 +205,26 @@ module Google
205
205
  universe_domain: @config.universe_domain,
206
206
  channel_args: @config.channel_args,
207
207
  interceptors: @config.interceptors,
208
- channel_pool_config: @config.channel_pool
208
+ channel_pool_config: @config.channel_pool,
209
+ logger: @config.logger
209
210
  )
210
211
 
212
+ @dataproc_metastore_stub.stub_logger&.info do |entry|
213
+ entry.set_system_name
214
+ entry.set_service
215
+ entry.message = "Created client for #{entry.service}"
216
+ entry.set_credentials_fields credentials
217
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
218
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
219
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
220
+ end
221
+
211
222
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
212
223
  config.credentials = credentials
213
224
  config.quota_project = @quota_project_id
214
225
  config.endpoint = @dataproc_metastore_stub.endpoint
215
226
  config.universe_domain = @dataproc_metastore_stub.universe_domain
227
+ config.logger = @dataproc_metastore_stub.logger if config.respond_to? :logger=
216
228
  end
217
229
 
218
230
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
@@ -220,6 +232,7 @@ module Google
220
232
  config.quota_project = @quota_project_id
221
233
  config.endpoint = @dataproc_metastore_stub.endpoint
222
234
  config.universe_domain = @dataproc_metastore_stub.universe_domain
235
+ config.logger = @dataproc_metastore_stub.logger if config.respond_to? :logger=
223
236
  end
224
237
  end
225
238
 
@@ -244,6 +257,15 @@ module Google
244
257
  #
245
258
  attr_reader :iam_policy_client
246
259
 
260
+ ##
261
+ # The logger used for request/response debug logging.
262
+ #
263
+ # @return [Logger]
264
+ #
265
+ def logger
266
+ @dataproc_metastore_stub.logger
267
+ end
268
+
247
269
  # Service calls
248
270
 
249
271
  ##
@@ -355,7 +377,7 @@ module Google
355
377
  @dataproc_metastore_stub.call_rpc :list_services, request, options: options do |response, operation|
356
378
  response = ::Gapic::PagedEnumerable.new @dataproc_metastore_stub, :list_services, request, response, operation, options
357
379
  yield response, operation if block_given?
358
- return response
380
+ throw :response, response
359
381
  end
360
382
  rescue ::GRPC::BadStatus => e
361
383
  raise ::Google::Cloud::Error.from_error(e)
@@ -444,7 +466,6 @@ module Google
444
466
 
445
467
  @dataproc_metastore_stub.call_rpc :get_service, request, options: options do |response, operation|
446
468
  yield response, operation if block_given?
447
- return response
448
469
  end
449
470
  rescue ::GRPC::BadStatus => e
450
471
  raise ::Google::Cloud::Error.from_error(e)
@@ -565,7 +586,7 @@ module Google
565
586
  @dataproc_metastore_stub.call_rpc :create_service, request, options: options do |response, operation|
566
587
  response = ::Gapic::Operation.new response, @operations_client, options: options
567
588
  yield response, operation if block_given?
568
- return response
589
+ throw :response, response
569
590
  end
570
591
  rescue ::GRPC::BadStatus => e
571
592
  raise ::Google::Cloud::Error.from_error(e)
@@ -681,7 +702,7 @@ module Google
681
702
  @dataproc_metastore_stub.call_rpc :update_service, request, options: options do |response, operation|
682
703
  response = ::Gapic::Operation.new response, @operations_client, options: options
683
704
  yield response, operation if block_given?
684
- return response
705
+ throw :response, response
685
706
  end
686
707
  rescue ::GRPC::BadStatus => e
687
708
  raise ::Google::Cloud::Error.from_error(e)
@@ -791,7 +812,7 @@ module Google
791
812
  @dataproc_metastore_stub.call_rpc :delete_service, request, options: options do |response, operation|
792
813
  response = ::Gapic::Operation.new response, @operations_client, options: options
793
814
  yield response, operation if block_given?
794
- return response
815
+ throw :response, response
795
816
  end
796
817
  rescue ::GRPC::BadStatus => e
797
818
  raise ::Google::Cloud::Error.from_error(e)
@@ -905,7 +926,7 @@ module Google
905
926
  @dataproc_metastore_stub.call_rpc :list_metadata_imports, request, options: options do |response, operation|
906
927
  response = ::Gapic::PagedEnumerable.new @dataproc_metastore_stub, :list_metadata_imports, request, response, operation, options
907
928
  yield response, operation if block_given?
908
- return response
929
+ throw :response, response
909
930
  end
910
931
  rescue ::GRPC::BadStatus => e
911
932
  raise ::Google::Cloud::Error.from_error(e)
@@ -994,7 +1015,6 @@ module Google
994
1015
 
995
1016
  @dataproc_metastore_stub.call_rpc :get_metadata_import, request, options: options do |response, operation|
996
1017
  yield response, operation if block_given?
997
- return response
998
1018
  end
999
1019
  rescue ::GRPC::BadStatus => e
1000
1020
  raise ::Google::Cloud::Error.from_error(e)
@@ -1115,7 +1135,7 @@ module Google
1115
1135
  @dataproc_metastore_stub.call_rpc :create_metadata_import, request, options: options do |response, operation|
1116
1136
  response = ::Gapic::Operation.new response, @operations_client, options: options
1117
1137
  yield response, operation if block_given?
1118
- return response
1138
+ throw :response, response
1119
1139
  end
1120
1140
  rescue ::GRPC::BadStatus => e
1121
1141
  raise ::Google::Cloud::Error.from_error(e)
@@ -1232,7 +1252,7 @@ module Google
1232
1252
  @dataproc_metastore_stub.call_rpc :update_metadata_import, request, options: options do |response, operation|
1233
1253
  response = ::Gapic::Operation.new response, @operations_client, options: options
1234
1254
  yield response, operation if block_given?
1235
- return response
1255
+ throw :response, response
1236
1256
  end
1237
1257
  rescue ::GRPC::BadStatus => e
1238
1258
  raise ::Google::Cloud::Error.from_error(e)
@@ -1349,7 +1369,7 @@ module Google
1349
1369
  @dataproc_metastore_stub.call_rpc :export_metadata, request, options: options do |response, operation|
1350
1370
  response = ::Gapic::Operation.new response, @operations_client, options: options
1351
1371
  yield response, operation if block_given?
1352
- return response
1372
+ throw :response, response
1353
1373
  end
1354
1374
  rescue ::GRPC::BadStatus => e
1355
1375
  raise ::Google::Cloud::Error.from_error(e)
@@ -1466,7 +1486,7 @@ module Google
1466
1486
  @dataproc_metastore_stub.call_rpc :restore_service, request, options: options do |response, operation|
1467
1487
  response = ::Gapic::Operation.new response, @operations_client, options: options
1468
1488
  yield response, operation if block_given?
1469
- return response
1489
+ throw :response, response
1470
1490
  end
1471
1491
  rescue ::GRPC::BadStatus => e
1472
1492
  raise ::Google::Cloud::Error.from_error(e)
@@ -1580,7 +1600,7 @@ module Google
1580
1600
  @dataproc_metastore_stub.call_rpc :list_backups, request, options: options do |response, operation|
1581
1601
  response = ::Gapic::PagedEnumerable.new @dataproc_metastore_stub, :list_backups, request, response, operation, options
1582
1602
  yield response, operation if block_given?
1583
- return response
1603
+ throw :response, response
1584
1604
  end
1585
1605
  rescue ::GRPC::BadStatus => e
1586
1606
  raise ::Google::Cloud::Error.from_error(e)
@@ -1669,7 +1689,6 @@ module Google
1669
1689
 
1670
1690
  @dataproc_metastore_stub.call_rpc :get_backup, request, options: options do |response, operation|
1671
1691
  yield response, operation if block_given?
1672
- return response
1673
1692
  end
1674
1693
  rescue ::GRPC::BadStatus => e
1675
1694
  raise ::Google::Cloud::Error.from_error(e)
@@ -1789,7 +1808,7 @@ module Google
1789
1808
  @dataproc_metastore_stub.call_rpc :create_backup, request, options: options do |response, operation|
1790
1809
  response = ::Gapic::Operation.new response, @operations_client, options: options
1791
1810
  yield response, operation if block_given?
1792
- return response
1811
+ throw :response, response
1793
1812
  end
1794
1813
  rescue ::GRPC::BadStatus => e
1795
1814
  raise ::Google::Cloud::Error.from_error(e)
@@ -1899,7 +1918,7 @@ module Google
1899
1918
  @dataproc_metastore_stub.call_rpc :delete_backup, request, options: options do |response, operation|
1900
1919
  response = ::Gapic::Operation.new response, @operations_client, options: options
1901
1920
  yield response, operation if block_given?
1902
- return response
1921
+ throw :response, response
1903
1922
  end
1904
1923
  rescue ::GRPC::BadStatus => e
1905
1924
  raise ::Google::Cloud::Error.from_error(e)
@@ -1993,7 +2012,6 @@ module Google
1993
2012
 
1994
2013
  @dataproc_metastore_stub.call_rpc :remove_iam_policy, request, options: options do |response, operation|
1995
2014
  yield response, operation if block_given?
1996
- return response
1997
2015
  end
1998
2016
  rescue ::GRPC::BadStatus => e
1999
2017
  raise ::Google::Cloud::Error.from_error(e)
@@ -2093,7 +2111,7 @@ module Google
2093
2111
  @dataproc_metastore_stub.call_rpc :query_metadata, request, options: options do |response, operation|
2094
2112
  response = ::Gapic::Operation.new response, @operations_client, options: options
2095
2113
  yield response, operation if block_given?
2096
- return response
2114
+ throw :response, response
2097
2115
  end
2098
2116
  rescue ::GRPC::BadStatus => e
2099
2117
  raise ::Google::Cloud::Error.from_error(e)
@@ -2196,7 +2214,7 @@ module Google
2196
2214
  @dataproc_metastore_stub.call_rpc :move_table_to_database, request, options: options do |response, operation|
2197
2215
  response = ::Gapic::Operation.new response, @operations_client, options: options
2198
2216
  yield response, operation if block_given?
2199
- return response
2217
+ throw :response, response
2200
2218
  end
2201
2219
  rescue ::GRPC::BadStatus => e
2202
2220
  raise ::Google::Cloud::Error.from_error(e)
@@ -2306,7 +2324,7 @@ module Google
2306
2324
  @dataproc_metastore_stub.call_rpc :alter_metadata_resource_location, request, options: options do |response, operation|
2307
2325
  response = ::Gapic::Operation.new response, @operations_client, options: options
2308
2326
  yield response, operation if block_given?
2309
- return response
2327
+ throw :response, response
2310
2328
  end
2311
2329
  rescue ::GRPC::BadStatus => e
2312
2330
  raise ::Google::Cloud::Error.from_error(e)
@@ -2356,6 +2374,13 @@ module Google
2356
2374
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
2357
2375
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
2358
2376
  # * (`nil`) indicating no credentials
2377
+ #
2378
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
2379
+ # external source for authentication to Google Cloud, you must validate it before
2380
+ # providing it to a Google API client library. Providing an unvalidated credential
2381
+ # configuration to Google APIs can compromise the security of your systems and data.
2382
+ # For more information, refer to [Validate credential configurations from external
2383
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
2359
2384
  # @return [::Object]
2360
2385
  # @!attribute [rw] scope
2361
2386
  # The OAuth scopes
@@ -2395,6 +2420,11 @@ module Google
2395
2420
  # default endpoint URL. The default value of nil uses the environment
2396
2421
  # universe (usually the default "googleapis.com" universe).
2397
2422
  # @return [::String,nil]
2423
+ # @!attribute [rw] logger
2424
+ # A custom logger to use for request/response debug logging, or the value
2425
+ # `:default` (the default) to construct a default logger, or `nil` to
2426
+ # explicitly disable logging.
2427
+ # @return [::Logger,:default,nil]
2398
2428
  #
2399
2429
  class Configuration
2400
2430
  extend ::Gapic::Config
@@ -2419,6 +2449,7 @@ module Google
2419
2449
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2420
2450
  config_attr :quota_project, nil, ::String, nil
2421
2451
  config_attr :universe_domain, nil, ::String, nil
2452
+ config_attr :logger, :default, ::Logger, nil, :default
2422
2453
 
2423
2454
  # @private
2424
2455
  def initialize parent_config = nil
@@ -124,14 +124,6 @@ module Google
124
124
  # Lists operations that match the specified filter in the request. If the
125
125
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
126
126
  #
127
- # NOTE: the `name` binding allows API services to override the binding
128
- # to use different resource name schemes, such as `users/*/operations`. To
129
- # override the binding, API services can add a binding such as
130
- # `"/v1/{name=users/*}/operations"` to their service configuration.
131
- # For backwards compatibility, the default name includes the operations
132
- # collection id, however overriding users must ensure the name binding
133
- # is the parent resource, without the operations collection id.
134
- #
135
127
  # @overload list_operations(request, options = nil)
136
128
  # Pass arguments to `list_operations` via a request object, either of type
137
129
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -221,7 +213,7 @@ module Google
221
213
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
222
214
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
223
215
  yield response, operation if block_given?
224
- return response
216
+ throw :response, response
225
217
  end
226
218
  rescue ::GRPC::BadStatus => e
227
219
  raise ::Google::Cloud::Error.from_error(e)
@@ -317,7 +309,7 @@ module Google
317
309
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
318
310
  response = ::Gapic::Operation.new response, @operations_client, options: options
319
311
  yield response, operation if block_given?
320
- return response
312
+ throw :response, response
321
313
  end
322
314
  rescue ::GRPC::BadStatus => e
323
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -406,7 +398,6 @@ module Google
406
398
 
407
399
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
408
400
  yield response, operation if block_given?
409
- return response
410
401
  end
411
402
  rescue ::GRPC::BadStatus => e
412
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -421,8 +412,9 @@ module Google
421
412
  # other methods to check whether the cancellation succeeded or whether the
422
413
  # operation completed despite cancellation. On successful cancellation,
423
414
  # the operation is not deleted; instead, it becomes an operation with
424
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
425
- # corresponding to `Code.CANCELLED`.
415
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
416
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
417
+ # `Code.CANCELLED`.
426
418
  #
427
419
  # @overload cancel_operation(request, options = nil)
428
420
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -501,7 +493,6 @@ module Google
501
493
 
502
494
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
503
495
  yield response, operation if block_given?
504
- return response
505
496
  end
506
497
  rescue ::GRPC::BadStatus => e
507
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -599,7 +590,7 @@ module Google
599
590
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
600
591
  response = ::Gapic::Operation.new response, @operations_client, options: options
601
592
  yield response, operation if block_given?
602
- return response
593
+ throw :response, response
603
594
  end
604
595
  rescue ::GRPC::BadStatus => e
605
596
  raise ::Google::Cloud::Error.from_error(e)
@@ -649,6 +640,13 @@ module Google
649
640
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
650
641
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
651
642
  # * (`nil`) indicating no credentials
643
+ #
644
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
645
+ # external source for authentication to Google Cloud, you must validate it before
646
+ # providing it to a Google API client library. Providing an unvalidated credential
647
+ # configuration to Google APIs can compromise the security of your systems and data.
648
+ # For more information, refer to [Validate credential configurations from external
649
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
652
650
  # @return [::Object]
653
651
  # @!attribute [rw] scope
654
652
  # The OAuth scopes
@@ -688,6 +686,11 @@ module Google
688
686
  # default endpoint URL. The default value of nil uses the environment
689
687
  # universe (usually the default "googleapis.com" universe).
690
688
  # @return [::String,nil]
689
+ # @!attribute [rw] logger
690
+ # A custom logger to use for request/response debug logging, or the value
691
+ # `:default` (the default) to construct a default logger, or `nil` to
692
+ # explicitly disable logging.
693
+ # @return [::Logger,:default,nil]
691
694
  #
692
695
  class Configuration
693
696
  extend ::Gapic::Config
@@ -712,6 +715,7 @@ module Google
712
715
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
713
716
  config_attr :quota_project, nil, ::String, nil
714
717
  config_attr :universe_domain, nil, ::String, nil
718
+ config_attr :logger, :default, ::Logger, nil, :default
715
719
 
716
720
  # @private
717
721
  def initialize parent_config = nil