google-cloud-spanner-admin-database-v1 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38ee8c5fec154d164e629a4f226041a9f69273fb639b262d9cd80e89d574320b
4
- data.tar.gz: a5c0f2f770d548ba477bc53dca80096167cdacc0285fa50e48642817da65dde0
3
+ metadata.gz: 8078024f318113ba800feb1bfc70266f9ed0f4640fdfc215ed5f235a725ceb00
4
+ data.tar.gz: f4415cad221d99bc1e911e947b2963e6dd2e13cd51502acf3f7491c89b6ffdfd
5
5
  SHA512:
6
- metadata.gz: 48408879b14ffb4ceb7ff4f550ac0e951005b1d226ef956d5a583051223ac1ee990be29e19771806e96dc2afa4857e815f89788f42a15aaeac885ae8a92dbb3c
7
- data.tar.gz: 842e7f21ba92b14c6667b29ecc95d80943dba1b75a07ce2ccb07728853296060790842cc3dc0d1804d1ba4819951354300299b55868af92e73aa52a8328e8ecc
6
+ metadata.gz: 0d10c204d73117ed4f73a7a166aa87ae22f8d2c253a7c5766048e7cb48dd0ae5a7d593f8b74c5e4fb62400a9524fd46ac7a03ffbe55bf25b731d83846677194c
7
+ data.tar.gz: b5c07d1b0149c3b639a8bbd85f7abebd7b37157c2062d837dc5cb8c528e5fd5e0f7bbf683e72a3fab56736d71b08a6b43a86d7f9222ca57f544c528cdec577be
data/README.md CHANGED
@@ -42,33 +42,43 @@ for class and method documentation.
42
42
  See also the [Product Documentation](https://cloud.google.com/spanner)
43
43
  for general usage information.
44
44
 
45
- ## Enabling Logging
46
-
47
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
48
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
49
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
50
- 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)
51
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
52
-
53
- Configuring a Ruby stdlib logger:
45
+ ## Debug Logging
46
+
47
+ This library comes with opt-in Debug Logging that can help you troubleshoot
48
+ your application's integration with the API. When logging is activated, key
49
+ events such as requests and responses, along with data payloads and metadata
50
+ such as headers and client configuration, are logged to the standard error
51
+ stream.
52
+
53
+ **WARNING:** Client Library Debug Logging includes your data payloads in
54
+ plaintext, which could include sensitive data such as PII for yourself or your
55
+ customers, private keys, or other security data that could be compromising if
56
+ leaked. Always practice good data hygiene with your application logs, and follow
57
+ the principle of least access. Google also recommends that Client Library Debug
58
+ Logging be enabled only temporarily during active debugging, and not used
59
+ permanently in production.
60
+
61
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
62
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
63
+ list of client library gem names. This will select the default logging behavior,
64
+ which writes logs to the standard error stream. On a local workstation, this may
65
+ result in logs appearing on the console. When running on a Google Cloud hosting
66
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
67
+ results in logs appearing alongside your application logs in the
68
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
69
+
70
+ You can customize logging by modifying the `logger` configuration when
71
+ constructing a client object. For example:
54
72
 
55
73
  ```ruby
74
+ require "google/cloud/spanner/admin/database/v1"
56
75
  require "logger"
57
76
 
58
- module MyLogger
59
- LOGGER = Logger.new $stderr, level: Logger::WARN
60
- def logger
61
- LOGGER
62
- end
63
- end
64
-
65
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
66
- module GRPC
67
- extend MyLogger
77
+ client = ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new do |config|
78
+ config.logger = Logger.new "my-app.log"
68
79
  end
69
80
  ```
70
81
 
71
-
72
82
  ## Google Cloud Samples
73
83
 
74
84
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
@@ -279,8 +279,19 @@ module Google
279
279
  universe_domain: @config.universe_domain,
280
280
  channel_args: @config.channel_args,
281
281
  interceptors: @config.interceptors,
282
- channel_pool_config: @config.channel_pool
282
+ channel_pool_config: @config.channel_pool,
283
+ logger: @config.logger
283
284
  )
285
+
286
+ @database_admin_stub.stub_logger&.info do |entry|
287
+ entry.set_system_name
288
+ entry.set_service
289
+ entry.message = "Created client for #{entry.service}"
290
+ entry.set_credentials_fields credentials
291
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
292
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
293
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
294
+ end
284
295
  end
285
296
 
286
297
  ##
@@ -290,6 +301,15 @@ module Google
290
301
  #
291
302
  attr_reader :operations_client
292
303
 
304
+ ##
305
+ # The logger used for request/response debug logging.
306
+ #
307
+ # @return [Logger]
308
+ #
309
+ def logger
310
+ @database_admin_stub.logger
311
+ end
312
+
293
313
  # Service calls
294
314
 
295
315
  ##
@@ -386,7 +406,7 @@ module Google
386
406
  @database_admin_stub.call_rpc :list_databases, request, options: options do |response, operation|
387
407
  response = ::Gapic::PagedEnumerable.new @database_admin_stub, :list_databases, request, response, operation, options
388
408
  yield response, operation if block_given?
389
- return response
409
+ throw :response, response
390
410
  end
391
411
  rescue ::GRPC::BadStatus => e
392
412
  raise ::Google::Cloud::Error.from_error(e)
@@ -521,7 +541,7 @@ module Google
521
541
  @database_admin_stub.call_rpc :create_database, request, options: options do |response, operation|
522
542
  response = ::Gapic::Operation.new response, @operations_client, options: options
523
543
  yield response, operation if block_given?
524
- return response
544
+ throw :response, response
525
545
  end
526
546
  rescue ::GRPC::BadStatus => e
527
547
  raise ::Google::Cloud::Error.from_error(e)
@@ -608,7 +628,6 @@ module Google
608
628
 
609
629
  @database_admin_stub.call_rpc :get_database, request, options: options do |response, operation|
610
630
  yield response, operation if block_given?
611
- return response
612
631
  end
613
632
  rescue ::GRPC::BadStatus => e
614
633
  raise ::Google::Cloud::Error.from_error(e)
@@ -742,7 +761,7 @@ module Google
742
761
  @database_admin_stub.call_rpc :update_database, request, options: options do |response, operation|
743
762
  response = ::Gapic::Operation.new response, @operations_client, options: options
744
763
  yield response, operation if block_given?
745
- return response
764
+ throw :response, response
746
765
  end
747
766
  rescue ::GRPC::BadStatus => e
748
767
  raise ::Google::Cloud::Error.from_error(e)
@@ -882,7 +901,7 @@ module Google
882
901
  @database_admin_stub.call_rpc :update_database_ddl, request, options: options do |response, operation|
883
902
  response = ::Gapic::Operation.new response, @operations_client, options: options
884
903
  yield response, operation if block_given?
885
- return response
904
+ throw :response, response
886
905
  end
887
906
  rescue ::GRPC::BadStatus => e
888
907
  raise ::Google::Cloud::Error.from_error(e)
@@ -972,7 +991,6 @@ module Google
972
991
 
973
992
  @database_admin_stub.call_rpc :drop_database, request, options: options do |response, operation|
974
993
  yield response, operation if block_given?
975
- return response
976
994
  end
977
995
  rescue ::GRPC::BadStatus => e
978
996
  raise ::Google::Cloud::Error.from_error(e)
@@ -1062,7 +1080,6 @@ module Google
1062
1080
 
1063
1081
  @database_admin_stub.call_rpc :get_database_ddl, request, options: options do |response, operation|
1064
1082
  yield response, operation if block_given?
1065
- return response
1066
1083
  end
1067
1084
  rescue ::GRPC::BadStatus => e
1068
1085
  raise ::Google::Cloud::Error.from_error(e)
@@ -1166,7 +1183,6 @@ module Google
1166
1183
 
1167
1184
  @database_admin_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
1168
1185
  yield response, operation if block_given?
1169
- return response
1170
1186
  end
1171
1187
  rescue ::GRPC::BadStatus => e
1172
1188
  raise ::Google::Cloud::Error.from_error(e)
@@ -1263,7 +1279,6 @@ module Google
1263
1279
 
1264
1280
  @database_admin_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
1265
1281
  yield response, operation if block_given?
1266
- return response
1267
1282
  end
1268
1283
  rescue ::GRPC::BadStatus => e
1269
1284
  raise ::Google::Cloud::Error.from_error(e)
@@ -1364,7 +1379,6 @@ module Google
1364
1379
 
1365
1380
  @database_admin_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
1366
1381
  yield response, operation if block_given?
1367
- return response
1368
1382
  end
1369
1383
  rescue ::GRPC::BadStatus => e
1370
1384
  raise ::Google::Cloud::Error.from_error(e)
@@ -1486,7 +1500,7 @@ module Google
1486
1500
  @database_admin_stub.call_rpc :create_backup, request, options: options do |response, operation|
1487
1501
  response = ::Gapic::Operation.new response, @operations_client, options: options
1488
1502
  yield response, operation if block_given?
1489
- return response
1503
+ throw :response, response
1490
1504
  end
1491
1505
  rescue ::GRPC::BadStatus => e
1492
1506
  raise ::Google::Cloud::Error.from_error(e)
@@ -1616,7 +1630,7 @@ module Google
1616
1630
  @database_admin_stub.call_rpc :copy_backup, request, options: options do |response, operation|
1617
1631
  response = ::Gapic::Operation.new response, @operations_client, options: options
1618
1632
  yield response, operation if block_given?
1619
- return response
1633
+ throw :response, response
1620
1634
  end
1621
1635
  rescue ::GRPC::BadStatus => e
1622
1636
  raise ::Google::Cloud::Error.from_error(e)
@@ -1705,7 +1719,6 @@ module Google
1705
1719
 
1706
1720
  @database_admin_stub.call_rpc :get_backup, request, options: options do |response, operation|
1707
1721
  yield response, operation if block_given?
1708
- return response
1709
1722
  end
1710
1723
  rescue ::GRPC::BadStatus => e
1711
1724
  raise ::Google::Cloud::Error.from_error(e)
@@ -1801,7 +1814,6 @@ module Google
1801
1814
 
1802
1815
  @database_admin_stub.call_rpc :update_backup, request, options: options do |response, operation|
1803
1816
  yield response, operation if block_given?
1804
- return response
1805
1817
  end
1806
1818
  rescue ::GRPC::BadStatus => e
1807
1819
  raise ::Google::Cloud::Error.from_error(e)
@@ -1890,7 +1902,6 @@ module Google
1890
1902
 
1891
1903
  @database_admin_stub.call_rpc :delete_backup, request, options: options do |response, operation|
1892
1904
  yield response, operation if block_given?
1893
- return response
1894
1905
  end
1895
1906
  rescue ::GRPC::BadStatus => e
1896
1907
  raise ::Google::Cloud::Error.from_error(e)
@@ -2034,7 +2045,7 @@ module Google
2034
2045
  @database_admin_stub.call_rpc :list_backups, request, options: options do |response, operation|
2035
2046
  response = ::Gapic::PagedEnumerable.new @database_admin_stub, :list_backups, request, response, operation, options
2036
2047
  yield response, operation if block_given?
2037
- return response
2048
+ throw :response, response
2038
2049
  end
2039
2050
  rescue ::GRPC::BadStatus => e
2040
2051
  raise ::Google::Cloud::Error.from_error(e)
@@ -2163,7 +2174,7 @@ module Google
2163
2174
  @database_admin_stub.call_rpc :restore_database, request, options: options do |response, operation|
2164
2175
  response = ::Gapic::Operation.new response, @operations_client, options: options
2165
2176
  yield response, operation if block_given?
2166
- return response
2177
+ throw :response, response
2167
2178
  end
2168
2179
  rescue ::GRPC::BadStatus => e
2169
2180
  raise ::Google::Cloud::Error.from_error(e)
@@ -2318,7 +2329,7 @@ module Google
2318
2329
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
2319
2330
  response = ::Gapic::PagedEnumerable.new @database_admin_stub, :list_database_operations, request, response, operation, options, format_resource: wrap_lro_operation
2320
2331
  yield response, operation if block_given?
2321
- return response
2332
+ throw :response, response
2322
2333
  end
2323
2334
  rescue ::GRPC::BadStatus => e
2324
2335
  raise ::Google::Cloud::Error.from_error(e)
@@ -2500,7 +2511,7 @@ module Google
2500
2511
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
2501
2512
  response = ::Gapic::PagedEnumerable.new @database_admin_stub, :list_backup_operations, request, response, operation, options, format_resource: wrap_lro_operation
2502
2513
  yield response, operation if block_given?
2503
- return response
2514
+ throw :response, response
2504
2515
  end
2505
2516
  rescue ::GRPC::BadStatus => e
2506
2517
  raise ::Google::Cloud::Error.from_error(e)
@@ -2601,7 +2612,7 @@ module Google
2601
2612
  @database_admin_stub.call_rpc :list_database_roles, request, options: options do |response, operation|
2602
2613
  response = ::Gapic::PagedEnumerable.new @database_admin_stub, :list_database_roles, request, response, operation, options
2603
2614
  yield response, operation if block_given?
2604
- return response
2615
+ throw :response, response
2605
2616
  end
2606
2617
  rescue ::GRPC::BadStatus => e
2607
2618
  raise ::Google::Cloud::Error.from_error(e)
@@ -2693,7 +2704,6 @@ module Google
2693
2704
 
2694
2705
  @database_admin_stub.call_rpc :create_backup_schedule, request, options: options do |response, operation|
2695
2706
  yield response, operation if block_given?
2696
- return response
2697
2707
  end
2698
2708
  rescue ::GRPC::BadStatus => e
2699
2709
  raise ::Google::Cloud::Error.from_error(e)
@@ -2781,7 +2791,6 @@ module Google
2781
2791
 
2782
2792
  @database_admin_stub.call_rpc :get_backup_schedule, request, options: options do |response, operation|
2783
2793
  yield response, operation if block_given?
2784
- return response
2785
2794
  end
2786
2795
  rescue ::GRPC::BadStatus => e
2787
2796
  raise ::Google::Cloud::Error.from_error(e)
@@ -2875,7 +2884,6 @@ module Google
2875
2884
 
2876
2885
  @database_admin_stub.call_rpc :update_backup_schedule, request, options: options do |response, operation|
2877
2886
  yield response, operation if block_given?
2878
- return response
2879
2887
  end
2880
2888
  rescue ::GRPC::BadStatus => e
2881
2889
  raise ::Google::Cloud::Error.from_error(e)
@@ -2963,7 +2971,6 @@ module Google
2963
2971
 
2964
2972
  @database_admin_stub.call_rpc :delete_backup_schedule, request, options: options do |response, operation|
2965
2973
  yield response, operation if block_given?
2966
- return response
2967
2974
  end
2968
2975
  rescue ::GRPC::BadStatus => e
2969
2976
  raise ::Google::Cloud::Error.from_error(e)
@@ -3065,7 +3072,7 @@ module Google
3065
3072
  @database_admin_stub.call_rpc :list_backup_schedules, request, options: options do |response, operation|
3066
3073
  response = ::Gapic::PagedEnumerable.new @database_admin_stub, :list_backup_schedules, request, response, operation, options
3067
3074
  yield response, operation if block_given?
3068
- return response
3075
+ throw :response, response
3069
3076
  end
3070
3077
  rescue ::GRPC::BadStatus => e
3071
3078
  raise ::Google::Cloud::Error.from_error(e)
@@ -3154,6 +3161,11 @@ module Google
3154
3161
  # default endpoint URL. The default value of nil uses the environment
3155
3162
  # universe (usually the default "googleapis.com" universe).
3156
3163
  # @return [::String,nil]
3164
+ # @!attribute [rw] logger
3165
+ # A custom logger to use for request/response debug logging, or the value
3166
+ # `:default` (the default) to construct a default logger, or `nil` to
3167
+ # explicitly disable logging.
3168
+ # @return [::Logger,:default,nil]
3157
3169
  #
3158
3170
  class Configuration
3159
3171
  extend ::Gapic::Config
@@ -3178,6 +3190,7 @@ module Google
3178
3190
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
3179
3191
  config_attr :quota_project, nil, ::String, nil
3180
3192
  config_attr :universe_domain, nil, ::String, nil
3193
+ config_attr :logger, :default, ::Logger, nil, :default
3181
3194
 
3182
3195
  # @private
3183
3196
  def initialize parent_config = nil
@@ -126,14 +126,6 @@ module Google
126
126
  # Lists operations that match the specified filter in the request. If the
127
127
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
128
128
  #
129
- # NOTE: the `name` binding allows API services to override the binding
130
- # to use different resource name schemes, such as `users/*/operations`. To
131
- # override the binding, API services can add a binding such as
132
- # `"/v1/{name=users/*}/operations"` to their service configuration.
133
- # For backwards compatibility, the default name includes the operations
134
- # collection id, however overriding users must ensure the name binding
135
- # is the parent resource, without the operations collection id.
136
- #
137
129
  # @overload list_operations(request, options = nil)
138
130
  # Pass arguments to `list_operations` via a request object, either of type
139
131
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -223,7 +215,7 @@ module Google
223
215
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
224
216
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
225
217
  yield response, operation if block_given?
226
- return response
218
+ throw :response, response
227
219
  end
228
220
  rescue ::GRPC::BadStatus => e
229
221
  raise ::Google::Cloud::Error.from_error(e)
@@ -319,7 +311,7 @@ module Google
319
311
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
320
312
  response = ::Gapic::Operation.new response, @operations_client, options: options
321
313
  yield response, operation if block_given?
322
- return response
314
+ throw :response, response
323
315
  end
324
316
  rescue ::GRPC::BadStatus => e
325
317
  raise ::Google::Cloud::Error.from_error(e)
@@ -408,7 +400,6 @@ module Google
408
400
 
409
401
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
410
402
  yield response, operation if block_given?
411
- return response
412
403
  end
413
404
  rescue ::GRPC::BadStatus => e
414
405
  raise ::Google::Cloud::Error.from_error(e)
@@ -423,8 +414,9 @@ module Google
423
414
  # other methods to check whether the cancellation succeeded or whether the
424
415
  # operation completed despite cancellation. On successful cancellation,
425
416
  # the operation is not deleted; instead, it becomes an operation with
426
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
427
- # corresponding to `Code.CANCELLED`.
417
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
418
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
419
+ # `Code.CANCELLED`.
428
420
  #
429
421
  # @overload cancel_operation(request, options = nil)
430
422
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -503,7 +495,6 @@ module Google
503
495
 
504
496
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
505
497
  yield response, operation if block_given?
506
- return response
507
498
  end
508
499
  rescue ::GRPC::BadStatus => e
509
500
  raise ::Google::Cloud::Error.from_error(e)
@@ -601,7 +592,7 @@ module Google
601
592
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
602
593
  response = ::Gapic::Operation.new response, @operations_client, options: options
603
594
  yield response, operation if block_given?
604
- return response
595
+ throw :response, response
605
596
  end
606
597
  rescue ::GRPC::BadStatus => e
607
598
  raise ::Google::Cloud::Error.from_error(e)
@@ -690,6 +681,11 @@ module Google
690
681
  # default endpoint URL. The default value of nil uses the environment
691
682
  # universe (usually the default "googleapis.com" universe).
692
683
  # @return [::String,nil]
684
+ # @!attribute [rw] logger
685
+ # A custom logger to use for request/response debug logging, or the value
686
+ # `:default` (the default) to construct a default logger, or `nil` to
687
+ # explicitly disable logging.
688
+ # @return [::Logger,:default,nil]
693
689
  #
694
690
  class Configuration
695
691
  extend ::Gapic::Config
@@ -714,6 +710,7 @@ module Google
714
710
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
715
711
  config_attr :quota_project, nil, ::String, nil
716
712
  config_attr :universe_domain, nil, ::String, nil
713
+ config_attr :logger, :default, ::Logger, nil, :default
717
714
 
718
715
  # @private
719
716
  def initialize parent_config = nil