google-cloud-bigtable-admin-v2 1.4.0 → 1.6.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: 8bfb08244bfee66566a13ca94a19086f5999af43fab3f405cf5cee4d54098d9e
4
- data.tar.gz: 25f59cb1d60dcae80d8487dba620e8e37cf9f4255c4a104694e7427b4d2e3e6e
3
+ metadata.gz: 197232f51e8274c1efa7709e5d62352d683fad7369f755956d186f219041ec03
4
+ data.tar.gz: e7618dc182e1bd14157e3257c20c44baa381b245e5626c62d73d04b85aa5b2ea
5
5
  SHA512:
6
- metadata.gz: 50d87d3100fffea5dddd905d8557b57dd2471638103d80d3afaa89e8740fc374ee82df47332db877df69bff46db47f022e384e29a65b70f476fec54a19b2cd02
7
- data.tar.gz: c49863b2acb634fc9b20bf042cf8feb9c7c79544f54ba0529dfc58b98ce3f867fedecc621d44170c2e069e4f809af0237d71a53286e55541eb838a8da7cb376e
6
+ metadata.gz: dd2b95e23bdbe03f94a520577d6154ba1294c098016c591a8b48cd21de0c7af39f28b2366b3c8e7bdfedb41b1996fcfaddb2614ffa19ce18b822fe530d91e0bc
7
+ data.tar.gz: 9c715b9d67ececb6219b0773ed8ded71939623cb0287e5da724197d251655ac665deec9e25a3831c210d2d0435a1935fe8ad7c8ce64d1162080a980348ab7f78
data/README.md CHANGED
@@ -43,40 +43,50 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/bigtable)
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/bigtable/admin/v2"
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::Bigtable::Admin::V2::BigtableInstanceAdmin::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
@@ -246,8 +246,19 @@ module Google
246
246
  universe_domain: @config.universe_domain,
247
247
  channel_args: @config.channel_args,
248
248
  interceptors: @config.interceptors,
249
- channel_pool_config: @config.channel_pool
249
+ channel_pool_config: @config.channel_pool,
250
+ logger: @config.logger
250
251
  )
252
+
253
+ @bigtable_instance_admin_stub.stub_logger&.info do |entry|
254
+ entry.set_system_name
255
+ entry.set_service
256
+ entry.message = "Created client for #{entry.service}"
257
+ entry.set_credentials_fields credentials
258
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
259
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
260
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
261
+ end
251
262
  end
252
263
 
253
264
  ##
@@ -257,6 +268,15 @@ module Google
257
268
  #
258
269
  attr_reader :operations_client
259
270
 
271
+ ##
272
+ # The logger used for request/response debug logging.
273
+ #
274
+ # @return [Logger]
275
+ #
276
+ def logger
277
+ @bigtable_instance_admin_stub.logger
278
+ end
279
+
260
280
  # Service calls
261
281
 
262
282
  ##
@@ -367,7 +387,7 @@ module Google
367
387
  @bigtable_instance_admin_stub.call_rpc :create_instance, request, options: options do |response, operation|
368
388
  response = ::Gapic::Operation.new response, @operations_client, options: options
369
389
  yield response, operation if block_given?
370
- return response
390
+ throw :response, response
371
391
  end
372
392
  rescue ::GRPC::BadStatus => e
373
393
  raise ::Google::Cloud::Error.from_error(e)
@@ -454,7 +474,6 @@ module Google
454
474
 
455
475
  @bigtable_instance_admin_stub.call_rpc :get_instance, request, options: options do |response, operation|
456
476
  yield response, operation if block_given?
457
- return response
458
477
  end
459
478
  rescue ::GRPC::BadStatus => e
460
479
  raise ::Google::Cloud::Error.from_error(e)
@@ -543,7 +562,6 @@ module Google
543
562
 
544
563
  @bigtable_instance_admin_stub.call_rpc :list_instances, request, options: options do |response, operation|
545
564
  yield response, operation if block_given?
546
- return response
547
565
  end
548
566
  rescue ::GRPC::BadStatus => e
549
567
  raise ::Google::Cloud::Error.from_error(e)
@@ -653,7 +671,6 @@ module Google
653
671
 
654
672
  @bigtable_instance_admin_stub.call_rpc :update_instance, request, options: options do |response, operation|
655
673
  yield response, operation if block_given?
656
- return response
657
674
  end
658
675
  rescue ::GRPC::BadStatus => e
659
676
  raise ::Google::Cloud::Error.from_error(e)
@@ -751,7 +768,7 @@ module Google
751
768
  @bigtable_instance_admin_stub.call_rpc :partial_update_instance, request, options: options do |response, operation|
752
769
  response = ::Gapic::Operation.new response, @operations_client, options: options
753
770
  yield response, operation if block_given?
754
- return response
771
+ throw :response, response
755
772
  end
756
773
  rescue ::GRPC::BadStatus => e
757
774
  raise ::Google::Cloud::Error.from_error(e)
@@ -838,7 +855,6 @@ module Google
838
855
 
839
856
  @bigtable_instance_admin_stub.call_rpc :delete_instance, request, options: options do |response, operation|
840
857
  yield response, operation if block_given?
841
- return response
842
858
  end
843
859
  rescue ::GRPC::BadStatus => e
844
860
  raise ::Google::Cloud::Error.from_error(e)
@@ -946,7 +962,7 @@ module Google
946
962
  @bigtable_instance_admin_stub.call_rpc :create_cluster, request, options: options do |response, operation|
947
963
  response = ::Gapic::Operation.new response, @operations_client, options: options
948
964
  yield response, operation if block_given?
949
- return response
965
+ throw :response, response
950
966
  end
951
967
  rescue ::GRPC::BadStatus => e
952
968
  raise ::Google::Cloud::Error.from_error(e)
@@ -1033,7 +1049,6 @@ module Google
1033
1049
 
1034
1050
  @bigtable_instance_admin_stub.call_rpc :get_cluster, request, options: options do |response, operation|
1035
1051
  yield response, operation if block_given?
1036
- return response
1037
1052
  end
1038
1053
  rescue ::GRPC::BadStatus => e
1039
1054
  raise ::Google::Cloud::Error.from_error(e)
@@ -1125,7 +1140,6 @@ module Google
1125
1140
 
1126
1141
  @bigtable_instance_admin_stub.call_rpc :list_clusters, request, options: options do |response, operation|
1127
1142
  yield response, operation if block_given?
1128
- return response
1129
1143
  end
1130
1144
  rescue ::GRPC::BadStatus => e
1131
1145
  raise ::Google::Cloud::Error.from_error(e)
@@ -1241,7 +1255,7 @@ module Google
1241
1255
  @bigtable_instance_admin_stub.call_rpc :update_cluster, request, options: options do |response, operation|
1242
1256
  response = ::Gapic::Operation.new response, @operations_client, options: options
1243
1257
  yield response, operation if block_given?
1244
- return response
1258
+ throw :response, response
1245
1259
  end
1246
1260
  rescue ::GRPC::BadStatus => e
1247
1261
  raise ::Google::Cloud::Error.from_error(e)
@@ -1349,7 +1363,7 @@ module Google
1349
1363
  @bigtable_instance_admin_stub.call_rpc :partial_update_cluster, request, options: options do |response, operation|
1350
1364
  response = ::Gapic::Operation.new response, @operations_client, options: options
1351
1365
  yield response, operation if block_given?
1352
- return response
1366
+ throw :response, response
1353
1367
  end
1354
1368
  rescue ::GRPC::BadStatus => e
1355
1369
  raise ::Google::Cloud::Error.from_error(e)
@@ -1436,7 +1450,6 @@ module Google
1436
1450
 
1437
1451
  @bigtable_instance_admin_stub.call_rpc :delete_cluster, request, options: options do |response, operation|
1438
1452
  yield response, operation if block_given?
1439
- return response
1440
1453
  end
1441
1454
  rescue ::GRPC::BadStatus => e
1442
1455
  raise ::Google::Cloud::Error.from_error(e)
@@ -1532,7 +1545,6 @@ module Google
1532
1545
 
1533
1546
  @bigtable_instance_admin_stub.call_rpc :create_app_profile, request, options: options do |response, operation|
1534
1547
  yield response, operation if block_given?
1535
- return response
1536
1548
  end
1537
1549
  rescue ::GRPC::BadStatus => e
1538
1550
  raise ::Google::Cloud::Error.from_error(e)
@@ -1619,7 +1631,6 @@ module Google
1619
1631
 
1620
1632
  @bigtable_instance_admin_stub.call_rpc :get_app_profile, request, options: options do |response, operation|
1621
1633
  yield response, operation if block_given?
1622
- return response
1623
1634
  end
1624
1635
  rescue ::GRPC::BadStatus => e
1625
1636
  raise ::Google::Cloud::Error.from_error(e)
@@ -1726,7 +1737,7 @@ module Google
1726
1737
  @bigtable_instance_admin_stub.call_rpc :list_app_profiles, request, options: options do |response, operation|
1727
1738
  response = ::Gapic::PagedEnumerable.new @bigtable_instance_admin_stub, :list_app_profiles, request, response, operation, options
1728
1739
  yield response, operation if block_given?
1729
- return response
1740
+ throw :response, response
1730
1741
  end
1731
1742
  rescue ::GRPC::BadStatus => e
1732
1743
  raise ::Google::Cloud::Error.from_error(e)
@@ -1825,7 +1836,7 @@ module Google
1825
1836
  @bigtable_instance_admin_stub.call_rpc :update_app_profile, request, options: options do |response, operation|
1826
1837
  response = ::Gapic::Operation.new response, @operations_client, options: options
1827
1838
  yield response, operation if block_given?
1828
- return response
1839
+ throw :response, response
1829
1840
  end
1830
1841
  rescue ::GRPC::BadStatus => e
1831
1842
  raise ::Google::Cloud::Error.from_error(e)
@@ -1915,7 +1926,6 @@ module Google
1915
1926
 
1916
1927
  @bigtable_instance_admin_stub.call_rpc :delete_app_profile, request, options: options do |response, operation|
1917
1928
  yield response, operation if block_given?
1918
- return response
1919
1929
  end
1920
1930
  rescue ::GRPC::BadStatus => e
1921
1931
  raise ::Google::Cloud::Error.from_error(e)
@@ -2006,7 +2016,6 @@ module Google
2006
2016
 
2007
2017
  @bigtable_instance_admin_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
2008
2018
  yield response, operation if block_given?
2009
- return response
2010
2019
  end
2011
2020
  rescue ::GRPC::BadStatus => e
2012
2021
  raise ::Google::Cloud::Error.from_error(e)
@@ -2105,7 +2114,6 @@ module Google
2105
2114
 
2106
2115
  @bigtable_instance_admin_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
2107
2116
  yield response, operation if block_given?
2108
- return response
2109
2117
  end
2110
2118
  rescue ::GRPC::BadStatus => e
2111
2119
  raise ::Google::Cloud::Error.from_error(e)
@@ -2197,7 +2205,6 @@ module Google
2197
2205
 
2198
2206
  @bigtable_instance_admin_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
2199
2207
  yield response, operation if block_given?
2200
- return response
2201
2208
  end
2202
2209
  rescue ::GRPC::BadStatus => e
2203
2210
  raise ::Google::Cloud::Error.from_error(e)
@@ -2312,7 +2319,7 @@ module Google
2312
2319
  @bigtable_instance_admin_stub.call_rpc :list_hot_tablets, request, options: options do |response, operation|
2313
2320
  response = ::Gapic::PagedEnumerable.new @bigtable_instance_admin_stub, :list_hot_tablets, request, response, operation, options
2314
2321
  yield response, operation if block_given?
2315
- return response
2322
+ throw :response, response
2316
2323
  end
2317
2324
  rescue ::GRPC::BadStatus => e
2318
2325
  raise ::Google::Cloud::Error.from_error(e)
@@ -2362,6 +2369,13 @@ module Google
2362
2369
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
2363
2370
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
2364
2371
  # * (`nil`) indicating no credentials
2372
+ #
2373
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
2374
+ # external source for authentication to Google Cloud, you must validate it before
2375
+ # providing it to a Google API client library. Providing an unvalidated credential
2376
+ # configuration to Google APIs can compromise the security of your systems and data.
2377
+ # For more information, refer to [Validate credential configurations from external
2378
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
2365
2379
  # @return [::Object]
2366
2380
  # @!attribute [rw] scope
2367
2381
  # The OAuth scopes
@@ -2401,6 +2415,11 @@ module Google
2401
2415
  # default endpoint URL. The default value of nil uses the environment
2402
2416
  # universe (usually the default "googleapis.com" universe).
2403
2417
  # @return [::String,nil]
2418
+ # @!attribute [rw] logger
2419
+ # A custom logger to use for request/response debug logging, or the value
2420
+ # `:default` (the default) to construct a default logger, or `nil` to
2421
+ # explicitly disable logging.
2422
+ # @return [::Logger,:default,nil]
2404
2423
  #
2405
2424
  class Configuration
2406
2425
  extend ::Gapic::Config
@@ -2425,6 +2444,7 @@ module Google
2425
2444
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2426
2445
  config_attr :quota_project, nil, ::String, nil
2427
2446
  config_attr :universe_domain, nil, ::String, nil
2447
+ config_attr :logger, :default, ::Logger, nil, :default
2428
2448
 
2429
2449
  # @private
2430
2450
  def initialize parent_config = nil
@@ -125,14 +125,6 @@ module Google
125
125
  # Lists operations that match the specified filter in the request. If the
126
126
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
127
127
  #
128
- # NOTE: the `name` binding allows API services to override the binding
129
- # to use different resource name schemes, such as `users/*/operations`. To
130
- # override the binding, API services can add a binding such as
131
- # `"/v1/{name=users/*}/operations"` to their service configuration.
132
- # For backwards compatibility, the default name includes the operations
133
- # collection id, however overriding users must ensure the name binding
134
- # is the parent resource, without the operations collection id.
135
- #
136
128
  # @overload list_operations(request, options = nil)
137
129
  # Pass arguments to `list_operations` via a request object, either of type
138
130
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -222,7 +214,7 @@ module Google
222
214
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
223
215
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
224
216
  yield response, operation if block_given?
225
- return response
217
+ throw :response, response
226
218
  end
227
219
  rescue ::GRPC::BadStatus => e
228
220
  raise ::Google::Cloud::Error.from_error(e)
@@ -318,7 +310,7 @@ module Google
318
310
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
319
311
  response = ::Gapic::Operation.new response, @operations_client, options: options
320
312
  yield response, operation if block_given?
321
- return response
313
+ throw :response, response
322
314
  end
323
315
  rescue ::GRPC::BadStatus => e
324
316
  raise ::Google::Cloud::Error.from_error(e)
@@ -407,7 +399,6 @@ module Google
407
399
 
408
400
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
409
401
  yield response, operation if block_given?
410
- return response
411
402
  end
412
403
  rescue ::GRPC::BadStatus => e
413
404
  raise ::Google::Cloud::Error.from_error(e)
@@ -422,8 +413,9 @@ module Google
422
413
  # other methods to check whether the cancellation succeeded or whether the
423
414
  # operation completed despite cancellation. On successful cancellation,
424
415
  # the operation is not deleted; instead, it becomes an operation with
425
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
426
- # corresponding to `Code.CANCELLED`.
416
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
417
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
418
+ # `Code.CANCELLED`.
427
419
  #
428
420
  # @overload cancel_operation(request, options = nil)
429
421
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -502,7 +494,6 @@ module Google
502
494
 
503
495
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
504
496
  yield response, operation if block_given?
505
- return response
506
497
  end
507
498
  rescue ::GRPC::BadStatus => e
508
499
  raise ::Google::Cloud::Error.from_error(e)
@@ -600,7 +591,7 @@ module Google
600
591
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
601
592
  response = ::Gapic::Operation.new response, @operations_client, options: options
602
593
  yield response, operation if block_given?
603
- return response
594
+ throw :response, response
604
595
  end
605
596
  rescue ::GRPC::BadStatus => e
606
597
  raise ::Google::Cloud::Error.from_error(e)
@@ -650,6 +641,13 @@ module Google
650
641
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
651
642
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
652
643
  # * (`nil`) indicating no credentials
644
+ #
645
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
646
+ # external source for authentication to Google Cloud, you must validate it before
647
+ # providing it to a Google API client library. Providing an unvalidated credential
648
+ # configuration to Google APIs can compromise the security of your systems and data.
649
+ # For more information, refer to [Validate credential configurations from external
650
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
653
651
  # @return [::Object]
654
652
  # @!attribute [rw] scope
655
653
  # The OAuth scopes
@@ -689,6 +687,11 @@ module Google
689
687
  # default endpoint URL. The default value of nil uses the environment
690
688
  # universe (usually the default "googleapis.com" universe).
691
689
  # @return [::String,nil]
690
+ # @!attribute [rw] logger
691
+ # A custom logger to use for request/response debug logging, or the value
692
+ # `:default` (the default) to construct a default logger, or `nil` to
693
+ # explicitly disable logging.
694
+ # @return [::Logger,:default,nil]
692
695
  #
693
696
  class Configuration
694
697
  extend ::Gapic::Config
@@ -713,6 +716,7 @@ module Google
713
716
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
714
717
  config_attr :quota_project, nil, ::String, nil
715
718
  config_attr :universe_domain, nil, ::String, nil
719
+ config_attr :logger, :default, ::Logger, nil, :default
716
720
 
717
721
  # @private
718
722
  def initialize parent_config = nil