google-cloud-gke_backup-v1 0.10.1 → 0.11.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: f8c957721d2727ec0c185f91a6911c513bcd9482179d4fad0f74823237d267a6
4
- data.tar.gz: 48ded999cc4e655b11f706f26ef68f3a00e25a6911feef34ef4b7024027115a8
3
+ metadata.gz: baa9b28d49e55fb3ab4bd4d5b6fbf0da67fc634baf8b11a72090c30c3426bcf6
4
+ data.tar.gz: 370f26944669fee873e983d2156f17ba225ed1cb0c137bba767fea5faba1b623
5
5
  SHA512:
6
- metadata.gz: 2d35c2a14538e98cc0f76991676e5fac8a08a4d120a07d175edb75293050046a9b48451eed6378accb73f1537b60753a64015388e4a832934f4c53c8dc4bc55a
7
- data.tar.gz: 81641804104cbbc3e94e3c4d54dd37ce43c5820e48d7ab71da2221cecfe48eca24cdd68336d1c3ee9e46ff1c0839744eba8d20fb8ddafe6220501df92c229637
6
+ metadata.gz: 2e5f7b4a08f3222790c6587aa9bf74bb24b07933d7e35d6a2aed554a1b8795af9ff9ddf3d79e4c1240010d4a1547a1ce782f451908d454b0f4c3d2bac8ac1013
7
+ data.tar.gz: f4c82e6c180c22b3e634116452c01d8e03ee6291ba1a577f9e638fb9c809ab274df754313a4745396ce5b42544f08452f7fb1e44022f6c095d28c41b47a2bf60
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke/)
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/gke_backup/v1"
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::GkeBackup::V1::BackupForGKE::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).
@@ -256,14 +256,26 @@ module Google
256
256
  universe_domain: @config.universe_domain,
257
257
  channel_args: @config.channel_args,
258
258
  interceptors: @config.interceptors,
259
- channel_pool_config: @config.channel_pool
259
+ channel_pool_config: @config.channel_pool,
260
+ logger: @config.logger
260
261
  )
261
262
 
263
+ @backup_for_gke_stub.stub_logger&.info do |entry|
264
+ entry.set_system_name
265
+ entry.set_service
266
+ entry.message = "Created client for #{entry.service}"
267
+ entry.set_credentials_fields credentials
268
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
269
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
270
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
271
+ end
272
+
262
273
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
263
274
  config.credentials = credentials
264
275
  config.quota_project = @quota_project_id
265
276
  config.endpoint = @backup_for_gke_stub.endpoint
266
277
  config.universe_domain = @backup_for_gke_stub.universe_domain
278
+ config.logger = @backup_for_gke_stub.logger if config.respond_to? :logger=
267
279
  end
268
280
 
269
281
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
@@ -271,6 +283,7 @@ module Google
271
283
  config.quota_project = @quota_project_id
272
284
  config.endpoint = @backup_for_gke_stub.endpoint
273
285
  config.universe_domain = @backup_for_gke_stub.universe_domain
286
+ config.logger = @backup_for_gke_stub.logger if config.respond_to? :logger=
274
287
  end
275
288
  end
276
289
 
@@ -295,6 +308,15 @@ module Google
295
308
  #
296
309
  attr_reader :iam_policy_client
297
310
 
311
+ ##
312
+ # The logger used for request/response debug logging.
313
+ #
314
+ # @return [Logger]
315
+ #
316
+ def logger
317
+ @backup_for_gke_stub.logger
318
+ end
319
+
298
320
  # Service calls
299
321
 
300
322
  ##
@@ -397,7 +419,7 @@ module Google
397
419
  @backup_for_gke_stub.call_rpc :create_backup_plan, request, options: options do |response, operation|
398
420
  response = ::Gapic::Operation.new response, @operations_client, options: options
399
421
  yield response, operation if block_given?
400
- return response
422
+ throw :response, response
401
423
  end
402
424
  rescue ::GRPC::BadStatus => e
403
425
  raise ::Google::Cloud::Error.from_error(e)
@@ -507,7 +529,7 @@ module Google
507
529
  @backup_for_gke_stub.call_rpc :list_backup_plans, request, options: options do |response, operation|
508
530
  response = ::Gapic::PagedEnumerable.new @backup_for_gke_stub, :list_backup_plans, request, response, operation, options
509
531
  yield response, operation if block_given?
510
- return response
532
+ throw :response, response
511
533
  end
512
534
  rescue ::GRPC::BadStatus => e
513
535
  raise ::Google::Cloud::Error.from_error(e)
@@ -594,7 +616,6 @@ module Google
594
616
 
595
617
  @backup_for_gke_stub.call_rpc :get_backup_plan, request, options: options do |response, operation|
596
618
  yield response, operation if block_given?
597
- return response
598
619
  end
599
620
  rescue ::GRPC::BadStatus => e
600
621
  raise ::Google::Cloud::Error.from_error(e)
@@ -699,7 +720,7 @@ module Google
699
720
  @backup_for_gke_stub.call_rpc :update_backup_plan, request, options: options do |response, operation|
700
721
  response = ::Gapic::Operation.new response, @operations_client, options: options
701
722
  yield response, operation if block_given?
702
- return response
723
+ throw :response, response
703
724
  end
704
725
  rescue ::GRPC::BadStatus => e
705
726
  raise ::Google::Cloud::Error.from_error(e)
@@ -798,7 +819,7 @@ module Google
798
819
  @backup_for_gke_stub.call_rpc :delete_backup_plan, request, options: options do |response, operation|
799
820
  response = ::Gapic::Operation.new response, @operations_client, options: options
800
821
  yield response, operation if block_given?
801
- return response
822
+ throw :response, response
802
823
  end
803
824
  rescue ::GRPC::BadStatus => e
804
825
  raise ::Google::Cloud::Error.from_error(e)
@@ -904,7 +925,7 @@ module Google
904
925
  @backup_for_gke_stub.call_rpc :create_backup, request, options: options do |response, operation|
905
926
  response = ::Gapic::Operation.new response, @operations_client, options: options
906
927
  yield response, operation if block_given?
907
- return response
928
+ throw :response, response
908
929
  end
909
930
  rescue ::GRPC::BadStatus => e
910
931
  raise ::Google::Cloud::Error.from_error(e)
@@ -1014,7 +1035,7 @@ module Google
1014
1035
  @backup_for_gke_stub.call_rpc :list_backups, request, options: options do |response, operation|
1015
1036
  response = ::Gapic::PagedEnumerable.new @backup_for_gke_stub, :list_backups, request, response, operation, options
1016
1037
  yield response, operation if block_given?
1017
- return response
1038
+ throw :response, response
1018
1039
  end
1019
1040
  rescue ::GRPC::BadStatus => e
1020
1041
  raise ::Google::Cloud::Error.from_error(e)
@@ -1101,7 +1122,6 @@ module Google
1101
1122
 
1102
1123
  @backup_for_gke_stub.call_rpc :get_backup, request, options: options do |response, operation|
1103
1124
  yield response, operation if block_given?
1104
- return response
1105
1125
  end
1106
1126
  rescue ::GRPC::BadStatus => e
1107
1127
  raise ::Google::Cloud::Error.from_error(e)
@@ -1205,7 +1225,7 @@ module Google
1205
1225
  @backup_for_gke_stub.call_rpc :update_backup, request, options: options do |response, operation|
1206
1226
  response = ::Gapic::Operation.new response, @operations_client, options: options
1207
1227
  yield response, operation if block_given?
1208
- return response
1228
+ throw :response, response
1209
1229
  end
1210
1230
  rescue ::GRPC::BadStatus => e
1211
1231
  raise ::Google::Cloud::Error.from_error(e)
@@ -1308,7 +1328,7 @@ module Google
1308
1328
  @backup_for_gke_stub.call_rpc :delete_backup, request, options: options do |response, operation|
1309
1329
  response = ::Gapic::Operation.new response, @operations_client, options: options
1310
1330
  yield response, operation if block_given?
1311
- return response
1331
+ throw :response, response
1312
1332
  end
1313
1333
  rescue ::GRPC::BadStatus => e
1314
1334
  raise ::Google::Cloud::Error.from_error(e)
@@ -1418,7 +1438,7 @@ module Google
1418
1438
  @backup_for_gke_stub.call_rpc :list_volume_backups, request, options: options do |response, operation|
1419
1439
  response = ::Gapic::PagedEnumerable.new @backup_for_gke_stub, :list_volume_backups, request, response, operation, options
1420
1440
  yield response, operation if block_given?
1421
- return response
1441
+ throw :response, response
1422
1442
  end
1423
1443
  rescue ::GRPC::BadStatus => e
1424
1444
  raise ::Google::Cloud::Error.from_error(e)
@@ -1505,7 +1525,6 @@ module Google
1505
1525
 
1506
1526
  @backup_for_gke_stub.call_rpc :get_volume_backup, request, options: options do |response, operation|
1507
1527
  yield response, operation if block_given?
1508
- return response
1509
1528
  end
1510
1529
  rescue ::GRPC::BadStatus => e
1511
1530
  raise ::Google::Cloud::Error.from_error(e)
@@ -1611,7 +1630,7 @@ module Google
1611
1630
  @backup_for_gke_stub.call_rpc :create_restore_plan, request, options: options do |response, operation|
1612
1631
  response = ::Gapic::Operation.new response, @operations_client, options: options
1613
1632
  yield response, operation if block_given?
1614
- return response
1633
+ throw :response, response
1615
1634
  end
1616
1635
  rescue ::GRPC::BadStatus => e
1617
1636
  raise ::Google::Cloud::Error.from_error(e)
@@ -1721,7 +1740,7 @@ module Google
1721
1740
  @backup_for_gke_stub.call_rpc :list_restore_plans, request, options: options do |response, operation|
1722
1741
  response = ::Gapic::PagedEnumerable.new @backup_for_gke_stub, :list_restore_plans, request, response, operation, options
1723
1742
  yield response, operation if block_given?
1724
- return response
1743
+ throw :response, response
1725
1744
  end
1726
1745
  rescue ::GRPC::BadStatus => e
1727
1746
  raise ::Google::Cloud::Error.from_error(e)
@@ -1808,7 +1827,6 @@ module Google
1808
1827
 
1809
1828
  @backup_for_gke_stub.call_rpc :get_restore_plan, request, options: options do |response, operation|
1810
1829
  yield response, operation if block_given?
1811
- return response
1812
1830
  end
1813
1831
  rescue ::GRPC::BadStatus => e
1814
1832
  raise ::Google::Cloud::Error.from_error(e)
@@ -1912,7 +1930,7 @@ module Google
1912
1930
  @backup_for_gke_stub.call_rpc :update_restore_plan, request, options: options do |response, operation|
1913
1931
  response = ::Gapic::Operation.new response, @operations_client, options: options
1914
1932
  yield response, operation if block_given?
1915
- return response
1933
+ throw :response, response
1916
1934
  end
1917
1935
  rescue ::GRPC::BadStatus => e
1918
1936
  raise ::Google::Cloud::Error.from_error(e)
@@ -2015,7 +2033,7 @@ module Google
2015
2033
  @backup_for_gke_stub.call_rpc :delete_restore_plan, request, options: options do |response, operation|
2016
2034
  response = ::Gapic::Operation.new response, @operations_client, options: options
2017
2035
  yield response, operation if block_given?
2018
- return response
2036
+ throw :response, response
2019
2037
  end
2020
2038
  rescue ::GRPC::BadStatus => e
2021
2039
  raise ::Google::Cloud::Error.from_error(e)
@@ -2121,7 +2139,7 @@ module Google
2121
2139
  @backup_for_gke_stub.call_rpc :create_restore, request, options: options do |response, operation|
2122
2140
  response = ::Gapic::Operation.new response, @operations_client, options: options
2123
2141
  yield response, operation if block_given?
2124
- return response
2142
+ throw :response, response
2125
2143
  end
2126
2144
  rescue ::GRPC::BadStatus => e
2127
2145
  raise ::Google::Cloud::Error.from_error(e)
@@ -2231,7 +2249,7 @@ module Google
2231
2249
  @backup_for_gke_stub.call_rpc :list_restores, request, options: options do |response, operation|
2232
2250
  response = ::Gapic::PagedEnumerable.new @backup_for_gke_stub, :list_restores, request, response, operation, options
2233
2251
  yield response, operation if block_given?
2234
- return response
2252
+ throw :response, response
2235
2253
  end
2236
2254
  rescue ::GRPC::BadStatus => e
2237
2255
  raise ::Google::Cloud::Error.from_error(e)
@@ -2318,7 +2336,6 @@ module Google
2318
2336
 
2319
2337
  @backup_for_gke_stub.call_rpc :get_restore, request, options: options do |response, operation|
2320
2338
  yield response, operation if block_given?
2321
- return response
2322
2339
  end
2323
2340
  rescue ::GRPC::BadStatus => e
2324
2341
  raise ::Google::Cloud::Error.from_error(e)
@@ -2422,7 +2439,7 @@ module Google
2422
2439
  @backup_for_gke_stub.call_rpc :update_restore, request, options: options do |response, operation|
2423
2440
  response = ::Gapic::Operation.new response, @operations_client, options: options
2424
2441
  yield response, operation if block_given?
2425
- return response
2442
+ throw :response, response
2426
2443
  end
2427
2444
  rescue ::GRPC::BadStatus => e
2428
2445
  raise ::Google::Cloud::Error.from_error(e)
@@ -2525,7 +2542,7 @@ module Google
2525
2542
  @backup_for_gke_stub.call_rpc :delete_restore, request, options: options do |response, operation|
2526
2543
  response = ::Gapic::Operation.new response, @operations_client, options: options
2527
2544
  yield response, operation if block_given?
2528
- return response
2545
+ throw :response, response
2529
2546
  end
2530
2547
  rescue ::GRPC::BadStatus => e
2531
2548
  raise ::Google::Cloud::Error.from_error(e)
@@ -2635,7 +2652,7 @@ module Google
2635
2652
  @backup_for_gke_stub.call_rpc :list_volume_restores, request, options: options do |response, operation|
2636
2653
  response = ::Gapic::PagedEnumerable.new @backup_for_gke_stub, :list_volume_restores, request, response, operation, options
2637
2654
  yield response, operation if block_given?
2638
- return response
2655
+ throw :response, response
2639
2656
  end
2640
2657
  rescue ::GRPC::BadStatus => e
2641
2658
  raise ::Google::Cloud::Error.from_error(e)
@@ -2722,7 +2739,6 @@ module Google
2722
2739
 
2723
2740
  @backup_for_gke_stub.call_rpc :get_volume_restore, request, options: options do |response, operation|
2724
2741
  yield response, operation if block_given?
2725
- return response
2726
2742
  end
2727
2743
  rescue ::GRPC::BadStatus => e
2728
2744
  raise ::Google::Cloud::Error.from_error(e)
@@ -2810,7 +2826,6 @@ module Google
2810
2826
 
2811
2827
  @backup_for_gke_stub.call_rpc :get_backup_index_download_url, request, options: options do |response, operation|
2812
2828
  yield response, operation if block_given?
2813
- return response
2814
2829
  end
2815
2830
  rescue ::GRPC::BadStatus => e
2816
2831
  raise ::Google::Cloud::Error.from_error(e)
@@ -2899,6 +2914,11 @@ module Google
2899
2914
  # default endpoint URL. The default value of nil uses the environment
2900
2915
  # universe (usually the default "googleapis.com" universe).
2901
2916
  # @return [::String,nil]
2917
+ # @!attribute [rw] logger
2918
+ # A custom logger to use for request/response debug logging, or the value
2919
+ # `:default` (the default) to construct a default logger, or `nil` to
2920
+ # explicitly disable logging.
2921
+ # @return [::Logger,:default,nil]
2902
2922
  #
2903
2923
  class Configuration
2904
2924
  extend ::Gapic::Config
@@ -2923,6 +2943,7 @@ module Google
2923
2943
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2924
2944
  config_attr :quota_project, nil, ::String, nil
2925
2945
  config_attr :universe_domain, nil, ::String, nil
2946
+ config_attr :logger, :default, ::Logger, nil, :default
2926
2947
 
2927
2948
  # @private
2928
2949
  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)
@@ -688,6 +679,11 @@ module Google
688
679
  # default endpoint URL. The default value of nil uses the environment
689
680
  # universe (usually the default "googleapis.com" universe).
690
681
  # @return [::String,nil]
682
+ # @!attribute [rw] logger
683
+ # A custom logger to use for request/response debug logging, or the value
684
+ # `:default` (the default) to construct a default logger, or `nil` to
685
+ # explicitly disable logging.
686
+ # @return [::Logger,:default,nil]
691
687
  #
692
688
  class Configuration
693
689
  extend ::Gapic::Config
@@ -712,6 +708,7 @@ module Google
712
708
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
713
709
  config_attr :quota_project, nil, ::String, nil
714
710
  config_attr :universe_domain, nil, ::String, nil
711
+ config_attr :logger, :default, ::Logger, nil, :default
715
712
 
716
713
  # @private
717
714
  def initialize parent_config = nil