google-cloud-container-v1 1.4.0 → 1.5.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: cd146a77b25e1eefe12dcc191e140db3ae243830fb6073a9183bfd70de6d326e
4
- data.tar.gz: e26017283b6afaf246effd560ed4eb9688f8229facb24347e5d916151812495d
3
+ metadata.gz: 107dd801240873dc8fad1ea7728399ad37473c98c6d748d68f90d831346204bd
4
+ data.tar.gz: a6971cd24fdf306c6ac3b53a03856ca6bb6bede1b29e13ef6fbdc36e1bd833de
5
5
  SHA512:
6
- metadata.gz: 36b402e7fcf74c24ac3520a833f248c40c9be7bd153445adf537bd76687842c3fed7516e5f3b4b4b471303a09d6b2db43063bb68e620c418c3947725b861b37f
7
- data.tar.gz: 4d9a09dd1cd7dd48ef840651a6c31f364920d1656d4b26541382a4ee171f45890c165e00c82e5870ee2b6e9abb2c5210fc0cb78d17218dd52fe682caa9d030e3
6
+ metadata.gz: 3fcc52bc14b0a6035b304d2bbfcb1d01cd3807d68f054061ee0094a4d3bc1a43298c98abb13266569fb81f90a7f7634c94d2ce54dc9f3e71c2ed257427a75ef2
7
+ data.tar.gz: 196d24d46b6b0065e978a072144295754ad2c2de746cd11ae61b678f182cbdd914baaf20faeeef0848ac5181cf724ea545256ef51577f2ffdc613a19be93aa74
data/README.md CHANGED
@@ -42,33 +42,43 @@ for class and method documentation.
42
42
  See also the [Product Documentation](https://cloud.google.com/kubernetes-engine)
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/container/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::Container::V1::ClusterManager::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).
@@ -244,8 +244,28 @@ module Google
244
244
  universe_domain: @config.universe_domain,
245
245
  channel_args: @config.channel_args,
246
246
  interceptors: @config.interceptors,
247
- channel_pool_config: @config.channel_pool
247
+ channel_pool_config: @config.channel_pool,
248
+ logger: @config.logger
248
249
  )
250
+
251
+ @cluster_manager_stub.stub_logger&.info do |entry|
252
+ entry.set_system_name
253
+ entry.set_service
254
+ entry.message = "Created client for #{entry.service}"
255
+ entry.set_credentials_fields credentials
256
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
257
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
258
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
259
+ end
260
+ end
261
+
262
+ ##
263
+ # The logger used for request/response debug logging.
264
+ #
265
+ # @return [Logger]
266
+ #
267
+ def logger
268
+ @cluster_manager_stub.logger
249
269
  end
250
270
 
251
271
  # Service calls
@@ -342,7 +362,6 @@ module Google
342
362
 
343
363
  @cluster_manager_stub.call_rpc :list_clusters, request, options: options do |response, operation|
344
364
  yield response, operation if block_given?
345
- return response
346
365
  end
347
366
  rescue ::GRPC::BadStatus => e
348
367
  raise ::Google::Cloud::Error.from_error(e)
@@ -441,7 +460,6 @@ module Google
441
460
 
442
461
  @cluster_manager_stub.call_rpc :get_cluster, request, options: options do |response, operation|
443
462
  yield response, operation if block_given?
444
- return response
445
463
  end
446
464
  rescue ::GRPC::BadStatus => e
447
465
  raise ::Google::Cloud::Error.from_error(e)
@@ -553,7 +571,6 @@ module Google
553
571
 
554
572
  @cluster_manager_stub.call_rpc :create_cluster, request, options: options do |response, operation|
555
573
  yield response, operation if block_given?
556
- return response
557
574
  end
558
575
  rescue ::GRPC::BadStatus => e
559
576
  raise ::Google::Cloud::Error.from_error(e)
@@ -654,7 +671,6 @@ module Google
654
671
 
655
672
  @cluster_manager_stub.call_rpc :update_cluster, request, options: options do |response, operation|
656
673
  yield response, operation if block_given?
657
- return response
658
674
  end
659
675
  rescue ::GRPC::BadStatus => e
660
676
  raise ::Google::Cloud::Error.from_error(e)
@@ -853,7 +869,6 @@ module Google
853
869
 
854
870
  @cluster_manager_stub.call_rpc :update_node_pool, request, options: options do |response, operation|
855
871
  yield response, operation if block_given?
856
- return response
857
872
  end
858
873
  rescue ::GRPC::BadStatus => e
859
874
  raise ::Google::Cloud::Error.from_error(e)
@@ -958,7 +973,6 @@ module Google
958
973
 
959
974
  @cluster_manager_stub.call_rpc :set_node_pool_autoscaling, request, options: options do |response, operation|
960
975
  yield response, operation if block_given?
961
- return response
962
976
  end
963
977
  rescue ::GRPC::BadStatus => e
964
978
  raise ::Google::Cloud::Error.from_error(e)
@@ -1069,7 +1083,6 @@ module Google
1069
1083
 
1070
1084
  @cluster_manager_stub.call_rpc :set_logging_service, request, options: options do |response, operation|
1071
1085
  yield response, operation if block_given?
1072
- return response
1073
1086
  end
1074
1087
  rescue ::GRPC::BadStatus => e
1075
1088
  raise ::Google::Cloud::Error.from_error(e)
@@ -1180,7 +1193,6 @@ module Google
1180
1193
 
1181
1194
  @cluster_manager_stub.call_rpc :set_monitoring_service, request, options: options do |response, operation|
1182
1195
  yield response, operation if block_given?
1183
- return response
1184
1196
  end
1185
1197
  rescue ::GRPC::BadStatus => e
1186
1198
  raise ::Google::Cloud::Error.from_error(e)
@@ -1282,7 +1294,6 @@ module Google
1282
1294
 
1283
1295
  @cluster_manager_stub.call_rpc :set_addons_config, request, options: options do |response, operation|
1284
1296
  yield response, operation if block_given?
1285
- return response
1286
1297
  end
1287
1298
  rescue ::GRPC::BadStatus => e
1288
1299
  raise ::Google::Cloud::Error.from_error(e)
@@ -1394,7 +1405,6 @@ module Google
1394
1405
 
1395
1406
  @cluster_manager_stub.call_rpc :set_locations, request, options: options do |response, operation|
1396
1407
  yield response, operation if block_given?
1397
- return response
1398
1408
  end
1399
1409
  rescue ::GRPC::BadStatus => e
1400
1410
  raise ::Google::Cloud::Error.from_error(e)
@@ -1504,7 +1514,6 @@ module Google
1504
1514
 
1505
1515
  @cluster_manager_stub.call_rpc :update_master, request, options: options do |response, operation|
1506
1516
  yield response, operation if block_given?
1507
- return response
1508
1517
  end
1509
1518
  rescue ::GRPC::BadStatus => e
1510
1519
  raise ::Google::Cloud::Error.from_error(e)
@@ -1609,7 +1618,6 @@ module Google
1609
1618
 
1610
1619
  @cluster_manager_stub.call_rpc :set_master_auth, request, options: options do |response, operation|
1611
1620
  yield response, operation if block_given?
1612
- return response
1613
1621
  end
1614
1622
  rescue ::GRPC::BadStatus => e
1615
1623
  raise ::Google::Cloud::Error.from_error(e)
@@ -1716,7 +1724,6 @@ module Google
1716
1724
 
1717
1725
  @cluster_manager_stub.call_rpc :delete_cluster, request, options: options do |response, operation|
1718
1726
  yield response, operation if block_given?
1719
- return response
1720
1727
  end
1721
1728
  rescue ::GRPC::BadStatus => e
1722
1729
  raise ::Google::Cloud::Error.from_error(e)
@@ -1813,7 +1820,6 @@ module Google
1813
1820
 
1814
1821
  @cluster_manager_stub.call_rpc :list_operations, request, options: options do |response, operation|
1815
1822
  yield response, operation if block_given?
1816
- return response
1817
1823
  end
1818
1824
  rescue ::GRPC::BadStatus => e
1819
1825
  raise ::Google::Cloud::Error.from_error(e)
@@ -1912,7 +1918,6 @@ module Google
1912
1918
 
1913
1919
  @cluster_manager_stub.call_rpc :get_operation, request, options: options do |response, operation|
1914
1920
  yield response, operation if block_given?
1915
- return response
1916
1921
  end
1917
1922
  rescue ::GRPC::BadStatus => e
1918
1923
  raise ::Google::Cloud::Error.from_error(e)
@@ -2011,7 +2016,6 @@ module Google
2011
2016
 
2012
2017
  @cluster_manager_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
2013
2018
  yield response, operation if block_given?
2014
- return response
2015
2019
  end
2016
2020
  rescue ::GRPC::BadStatus => e
2017
2021
  raise ::Google::Cloud::Error.from_error(e)
@@ -2107,7 +2111,6 @@ module Google
2107
2111
 
2108
2112
  @cluster_manager_stub.call_rpc :get_server_config, request, options: options do |response, operation|
2109
2113
  yield response, operation if block_given?
2110
- return response
2111
2114
  end
2112
2115
  rescue ::GRPC::BadStatus => e
2113
2116
  raise ::Google::Cloud::Error.from_error(e)
@@ -2195,7 +2198,6 @@ module Google
2195
2198
 
2196
2199
  @cluster_manager_stub.call_rpc :get_json_web_keys, request, options: options do |response, operation|
2197
2200
  yield response, operation if block_given?
2198
- return response
2199
2201
  end
2200
2202
  rescue ::GRPC::BadStatus => e
2201
2203
  raise ::Google::Cloud::Error.from_error(e)
@@ -2294,7 +2296,6 @@ module Google
2294
2296
 
2295
2297
  @cluster_manager_stub.call_rpc :list_node_pools, request, options: options do |response, operation|
2296
2298
  yield response, operation if block_given?
2297
- return response
2298
2299
  end
2299
2300
  rescue ::GRPC::BadStatus => e
2300
2301
  raise ::Google::Cloud::Error.from_error(e)
@@ -2397,7 +2398,6 @@ module Google
2397
2398
 
2398
2399
  @cluster_manager_stub.call_rpc :get_node_pool, request, options: options do |response, operation|
2399
2400
  yield response, operation if block_given?
2400
- return response
2401
2401
  end
2402
2402
  rescue ::GRPC::BadStatus => e
2403
2403
  raise ::Google::Cloud::Error.from_error(e)
@@ -2499,7 +2499,6 @@ module Google
2499
2499
 
2500
2500
  @cluster_manager_stub.call_rpc :create_node_pool, request, options: options do |response, operation|
2501
2501
  yield response, operation if block_given?
2502
- return response
2503
2502
  end
2504
2503
  rescue ::GRPC::BadStatus => e
2505
2504
  raise ::Google::Cloud::Error.from_error(e)
@@ -2602,7 +2601,6 @@ module Google
2602
2601
 
2603
2602
  @cluster_manager_stub.call_rpc :delete_node_pool, request, options: options do |response, operation|
2604
2603
  yield response, operation if block_given?
2605
- return response
2606
2604
  end
2607
2605
  rescue ::GRPC::BadStatus => e
2608
2606
  raise ::Google::Cloud::Error.from_error(e)
@@ -2691,7 +2689,6 @@ module Google
2691
2689
 
2692
2690
  @cluster_manager_stub.call_rpc :complete_node_pool_upgrade, request, options: options do |response, operation|
2693
2691
  yield response, operation if block_given?
2694
- return response
2695
2692
  end
2696
2693
  rescue ::GRPC::BadStatus => e
2697
2694
  raise ::Google::Cloud::Error.from_error(e)
@@ -2798,7 +2795,6 @@ module Google
2798
2795
 
2799
2796
  @cluster_manager_stub.call_rpc :rollback_node_pool_upgrade, request, options: options do |response, operation|
2800
2797
  yield response, operation if block_given?
2801
- return response
2802
2798
  end
2803
2799
  rescue ::GRPC::BadStatus => e
2804
2800
  raise ::Google::Cloud::Error.from_error(e)
@@ -2903,7 +2899,6 @@ module Google
2903
2899
 
2904
2900
  @cluster_manager_stub.call_rpc :set_node_pool_management, request, options: options do |response, operation|
2905
2901
  yield response, operation if block_given?
2906
- return response
2907
2902
  end
2908
2903
  rescue ::GRPC::BadStatus => e
2909
2904
  raise ::Google::Cloud::Error.from_error(e)
@@ -3011,7 +3006,6 @@ module Google
3011
3006
 
3012
3007
  @cluster_manager_stub.call_rpc :set_labels, request, options: options do |response, operation|
3013
3008
  yield response, operation if block_given?
3014
- return response
3015
3009
  end
3016
3010
  rescue ::GRPC::BadStatus => e
3017
3011
  raise ::Google::Cloud::Error.from_error(e)
@@ -3112,7 +3106,6 @@ module Google
3112
3106
 
3113
3107
  @cluster_manager_stub.call_rpc :set_legacy_abac, request, options: options do |response, operation|
3114
3108
  yield response, operation if block_given?
3115
- return response
3116
3109
  end
3117
3110
  rescue ::GRPC::BadStatus => e
3118
3111
  raise ::Google::Cloud::Error.from_error(e)
@@ -3213,7 +3206,6 @@ module Google
3213
3206
 
3214
3207
  @cluster_manager_stub.call_rpc :start_ip_rotation, request, options: options do |response, operation|
3215
3208
  yield response, operation if block_given?
3216
- return response
3217
3209
  end
3218
3210
  rescue ::GRPC::BadStatus => e
3219
3211
  raise ::Google::Cloud::Error.from_error(e)
@@ -3312,7 +3304,6 @@ module Google
3312
3304
 
3313
3305
  @cluster_manager_stub.call_rpc :complete_ip_rotation, request, options: options do |response, operation|
3314
3306
  yield response, operation if block_given?
3315
- return response
3316
3307
  end
3317
3308
  rescue ::GRPC::BadStatus => e
3318
3309
  raise ::Google::Cloud::Error.from_error(e)
@@ -3419,7 +3410,6 @@ module Google
3419
3410
 
3420
3411
  @cluster_manager_stub.call_rpc :set_node_pool_size, request, options: options do |response, operation|
3421
3412
  yield response, operation if block_given?
3422
- return response
3423
3413
  end
3424
3414
  rescue ::GRPC::BadStatus => e
3425
3415
  raise ::Google::Cloud::Error.from_error(e)
@@ -3520,7 +3510,6 @@ module Google
3520
3510
 
3521
3511
  @cluster_manager_stub.call_rpc :set_network_policy, request, options: options do |response, operation|
3522
3512
  yield response, operation if block_given?
3523
- return response
3524
3513
  end
3525
3514
  rescue ::GRPC::BadStatus => e
3526
3515
  raise ::Google::Cloud::Error.from_error(e)
@@ -3620,7 +3609,6 @@ module Google
3620
3609
 
3621
3610
  @cluster_manager_stub.call_rpc :set_maintenance_policy, request, options: options do |response, operation|
3622
3611
  yield response, operation if block_given?
3623
- return response
3624
3612
  end
3625
3613
  rescue ::GRPC::BadStatus => e
3626
3614
  raise ::Google::Cloud::Error.from_error(e)
@@ -3725,7 +3713,7 @@ module Google
3725
3713
  @cluster_manager_stub.call_rpc :list_usable_subnetworks, request, options: options do |response, operation|
3726
3714
  response = ::Gapic::PagedEnumerable.new @cluster_manager_stub, :list_usable_subnetworks, request, response, operation, options
3727
3715
  yield response, operation if block_given?
3728
- return response
3716
+ throw :response, response
3729
3717
  end
3730
3718
  rescue ::GRPC::BadStatus => e
3731
3719
  raise ::Google::Cloud::Error.from_error(e)
@@ -3813,7 +3801,6 @@ module Google
3813
3801
 
3814
3802
  @cluster_manager_stub.call_rpc :check_autopilot_compatibility, request, options: options do |response, operation|
3815
3803
  yield response, operation if block_given?
3816
- return response
3817
3804
  end
3818
3805
  rescue ::GRPC::BadStatus => e
3819
3806
  raise ::Google::Cloud::Error.from_error(e)
@@ -3902,6 +3889,11 @@ module Google
3902
3889
  # default endpoint URL. The default value of nil uses the environment
3903
3890
  # universe (usually the default "googleapis.com" universe).
3904
3891
  # @return [::String,nil]
3892
+ # @!attribute [rw] logger
3893
+ # A custom logger to use for request/response debug logging, or the value
3894
+ # `:default` (the default) to construct a default logger, or `nil` to
3895
+ # explicitly disable logging.
3896
+ # @return [::Logger,:default,nil]
3905
3897
  #
3906
3898
  class Configuration
3907
3899
  extend ::Gapic::Config
@@ -3926,6 +3918,7 @@ module Google
3926
3918
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
3927
3919
  config_attr :quota_project, nil, ::String, nil
3928
3920
  config_attr :universe_domain, nil, ::String, nil
3921
+ config_attr :logger, :default, ::Logger, nil, :default
3929
3922
 
3930
3923
  # @private
3931
3924
  def initialize parent_config = nil