google-cloud-config_service-v1 1.0.2 → 1.1.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: 44b5ed5ca70a38edea6050b3fca661b2a578577480bcb8b70cedaeb5b9f973d9
4
- data.tar.gz: 6ba25f32fe6b98548812a09b56c22b82ae91a29e8714e3a31099745a6ce7e263
3
+ metadata.gz: d29fc0a76cc7304aba4c5859df4d949935862c406638d12f9206bc74c1ae4004
4
+ data.tar.gz: bdf28e997ec1dac5823d9bc6617681dce9a689e1a1d534437d08b7855d0859f8
5
5
  SHA512:
6
- metadata.gz: ba9fde87d1a2291a10b7b31718af945870fe9cd142fcf599a616a883e47608fc53f1c29ca703d5d9faff8be5919897fffebe566a0ea0de80a548a4738d505424
7
- data.tar.gz: c1c2313c31bf372aca612cc381ac0028d995e4373093cd7115723e66cc64f73fee9228f7bf15e9ef635232eff6bc9ab230fbd01997e22f8bbb4015c6b09dfdd6
6
+ metadata.gz: d2c57361aa4819836c54df408835d160f191941dd62ab94aaaa6653dd59f1c7f25344de136c50a891406b04fca1de6b239b163784af935cf03817caf7538b83c
7
+ data.tar.gz: c8116af5086e3a65b411030c7841234ab6a4a568cc4f3b6538b392cf475e28f0a115f13a0ba481efbc7f0844d93325952795a849f60832a87db82a7101ef78c1
data/README.md CHANGED
@@ -42,33 +42,43 @@ for class and method documentation.
42
42
  See also the [Product Documentation](https://cloud.google.com/infrastructure-manager/docs/overview)
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/config_service/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::ConfigService::V1::Config::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).
@@ -167,14 +167,26 @@ module Google
167
167
  universe_domain: @config.universe_domain,
168
168
  channel_args: @config.channel_args,
169
169
  interceptors: @config.interceptors,
170
- channel_pool_config: @config.channel_pool
170
+ channel_pool_config: @config.channel_pool,
171
+ logger: @config.logger
171
172
  )
172
173
 
174
+ @config_stub.stub_logger&.info do |entry|
175
+ entry.set_system_name
176
+ entry.set_service
177
+ entry.message = "Created client for #{entry.service}"
178
+ entry.set_credentials_fields credentials
179
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
180
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
181
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
182
+ end
183
+
173
184
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
174
185
  config.credentials = credentials
175
186
  config.quota_project = @quota_project_id
176
187
  config.endpoint = @config_stub.endpoint
177
188
  config.universe_domain = @config_stub.universe_domain
189
+ config.logger = @config_stub.logger if config.respond_to? :logger=
178
190
  end
179
191
 
180
192
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
@@ -182,6 +194,7 @@ module Google
182
194
  config.quota_project = @quota_project_id
183
195
  config.endpoint = @config_stub.endpoint
184
196
  config.universe_domain = @config_stub.universe_domain
197
+ config.logger = @config_stub.logger if config.respond_to? :logger=
185
198
  end
186
199
  end
187
200
 
@@ -206,6 +219,15 @@ module Google
206
219
  #
207
220
  attr_reader :iam_policy_client
208
221
 
222
+ ##
223
+ # The logger used for request/response debug logging.
224
+ #
225
+ # @return [Logger]
226
+ #
227
+ def logger
228
+ @config_stub.logger
229
+ end
230
+
209
231
  # Service calls
210
232
 
211
233
  ##
@@ -327,7 +349,7 @@ module Google
327
349
  @config_stub.call_rpc :list_deployments, request, options: options do |response, operation|
328
350
  response = ::Gapic::PagedEnumerable.new @config_stub, :list_deployments, request, response, operation, options
329
351
  yield response, operation if block_given?
330
- return response
352
+ throw :response, response
331
353
  end
332
354
  rescue ::GRPC::BadStatus => e
333
355
  raise ::Google::Cloud::Error.from_error(e)
@@ -414,7 +436,6 @@ module Google
414
436
 
415
437
  @config_stub.call_rpc :get_deployment, request, options: options do |response, operation|
416
438
  yield response, operation if block_given?
417
- return response
418
439
  end
419
440
  rescue ::GRPC::BadStatus => e
420
441
  raise ::Google::Cloud::Error.from_error(e)
@@ -528,7 +549,7 @@ module Google
528
549
  @config_stub.call_rpc :create_deployment, request, options: options do |response, operation|
529
550
  response = ::Gapic::Operation.new response, @operations_client, options: options
530
551
  yield response, operation if block_given?
531
- return response
552
+ throw :response, response
532
553
  end
533
554
  rescue ::GRPC::BadStatus => e
534
555
  raise ::Google::Cloud::Error.from_error(e)
@@ -647,7 +668,7 @@ module Google
647
668
  @config_stub.call_rpc :update_deployment, request, options: options do |response, operation|
648
669
  response = ::Gapic::Operation.new response, @operations_client, options: options
649
670
  yield response, operation if block_given?
650
- return response
671
+ throw :response, response
651
672
  end
652
673
  rescue ::GRPC::BadStatus => e
653
674
  raise ::Google::Cloud::Error.from_error(e)
@@ -764,7 +785,7 @@ module Google
764
785
  @config_stub.call_rpc :delete_deployment, request, options: options do |response, operation|
765
786
  response = ::Gapic::Operation.new response, @operations_client, options: options
766
787
  yield response, operation if block_given?
767
- return response
788
+ throw :response, response
768
789
  end
769
790
  rescue ::GRPC::BadStatus => e
770
791
  raise ::Google::Cloud::Error.from_error(e)
@@ -888,7 +909,7 @@ module Google
888
909
  @config_stub.call_rpc :list_revisions, request, options: options do |response, operation|
889
910
  response = ::Gapic::PagedEnumerable.new @config_stub, :list_revisions, request, response, operation, options
890
911
  yield response, operation if block_given?
891
- return response
912
+ throw :response, response
892
913
  end
893
914
  rescue ::GRPC::BadStatus => e
894
915
  raise ::Google::Cloud::Error.from_error(e)
@@ -975,7 +996,6 @@ module Google
975
996
 
976
997
  @config_stub.call_rpc :get_revision, request, options: options do |response, operation|
977
998
  yield response, operation if block_given?
978
- return response
979
999
  end
980
1000
  rescue ::GRPC::BadStatus => e
981
1001
  raise ::Google::Cloud::Error.from_error(e)
@@ -1063,7 +1083,6 @@ module Google
1063
1083
 
1064
1084
  @config_stub.call_rpc :get_resource, request, options: options do |response, operation|
1065
1085
  yield response, operation if block_given?
1066
- return response
1067
1086
  end
1068
1087
  rescue ::GRPC::BadStatus => e
1069
1088
  raise ::Google::Cloud::Error.from_error(e)
@@ -1179,7 +1198,7 @@ module Google
1179
1198
  @config_stub.call_rpc :list_resources, request, options: options do |response, operation|
1180
1199
  response = ::Gapic::PagedEnumerable.new @config_stub, :list_resources, request, response, operation, options
1181
1200
  yield response, operation if block_given?
1182
- return response
1201
+ throw :response, response
1183
1202
  end
1184
1203
  rescue ::GRPC::BadStatus => e
1185
1204
  raise ::Google::Cloud::Error.from_error(e)
@@ -1271,7 +1290,6 @@ module Google
1271
1290
 
1272
1291
  @config_stub.call_rpc :export_deployment_statefile, request, options: options do |response, operation|
1273
1292
  yield response, operation if block_given?
1274
- return response
1275
1293
  end
1276
1294
  rescue ::GRPC::BadStatus => e
1277
1295
  raise ::Google::Cloud::Error.from_error(e)
@@ -1359,7 +1377,6 @@ module Google
1359
1377
 
1360
1378
  @config_stub.call_rpc :export_revision_statefile, request, options: options do |response, operation|
1361
1379
  yield response, operation if block_given?
1362
- return response
1363
1380
  end
1364
1381
  rescue ::GRPC::BadStatus => e
1365
1382
  raise ::Google::Cloud::Error.from_error(e)
@@ -1453,7 +1470,6 @@ module Google
1453
1470
 
1454
1471
  @config_stub.call_rpc :import_statefile, request, options: options do |response, operation|
1455
1472
  yield response, operation if block_given?
1456
- return response
1457
1473
  end
1458
1474
  rescue ::GRPC::BadStatus => e
1459
1475
  raise ::Google::Cloud::Error.from_error(e)
@@ -1543,7 +1559,6 @@ module Google
1543
1559
 
1544
1560
  @config_stub.call_rpc :delete_statefile, request, options: options do |response, operation|
1545
1561
  yield response, operation if block_given?
1546
- return response
1547
1562
  end
1548
1563
  rescue ::GRPC::BadStatus => e
1549
1564
  raise ::Google::Cloud::Error.from_error(e)
@@ -1638,7 +1653,7 @@ module Google
1638
1653
  @config_stub.call_rpc :lock_deployment, request, options: options do |response, operation|
1639
1654
  response = ::Gapic::Operation.new response, @operations_client, options: options
1640
1655
  yield response, operation if block_given?
1641
- return response
1656
+ throw :response, response
1642
1657
  end
1643
1658
  rescue ::GRPC::BadStatus => e
1644
1659
  raise ::Google::Cloud::Error.from_error(e)
@@ -1735,7 +1750,7 @@ module Google
1735
1750
  @config_stub.call_rpc :unlock_deployment, request, options: options do |response, operation|
1736
1751
  response = ::Gapic::Operation.new response, @operations_client, options: options
1737
1752
  yield response, operation if block_given?
1738
- return response
1753
+ throw :response, response
1739
1754
  end
1740
1755
  rescue ::GRPC::BadStatus => e
1741
1756
  raise ::Google::Cloud::Error.from_error(e)
@@ -1822,7 +1837,6 @@ module Google
1822
1837
 
1823
1838
  @config_stub.call_rpc :export_lock_info, request, options: options do |response, operation|
1824
1839
  yield response, operation if block_given?
1825
- return response
1826
1840
  end
1827
1841
  rescue ::GRPC::BadStatus => e
1828
1842
  raise ::Google::Cloud::Error.from_error(e)
@@ -1935,7 +1949,7 @@ module Google
1935
1949
  @config_stub.call_rpc :create_preview, request, options: options do |response, operation|
1936
1950
  response = ::Gapic::Operation.new response, @operations_client, options: options
1937
1951
  yield response, operation if block_given?
1938
- return response
1952
+ throw :response, response
1939
1953
  end
1940
1954
  rescue ::GRPC::BadStatus => e
1941
1955
  raise ::Google::Cloud::Error.from_error(e)
@@ -2022,7 +2036,6 @@ module Google
2022
2036
 
2023
2037
  @config_stub.call_rpc :get_preview, request, options: options do |response, operation|
2024
2038
  yield response, operation if block_given?
2025
- return response
2026
2039
  end
2027
2040
  rescue ::GRPC::BadStatus => e
2028
2041
  raise ::Google::Cloud::Error.from_error(e)
@@ -2147,7 +2160,7 @@ module Google
2147
2160
  @config_stub.call_rpc :list_previews, request, options: options do |response, operation|
2148
2161
  response = ::Gapic::PagedEnumerable.new @config_stub, :list_previews, request, response, operation, options
2149
2162
  yield response, operation if block_given?
2150
- return response
2163
+ throw :response, response
2151
2164
  end
2152
2165
  rescue ::GRPC::BadStatus => e
2153
2166
  raise ::Google::Cloud::Error.from_error(e)
@@ -2256,7 +2269,7 @@ module Google
2256
2269
  @config_stub.call_rpc :delete_preview, request, options: options do |response, operation|
2257
2270
  response = ::Gapic::Operation.new response, @operations_client, options: options
2258
2271
  yield response, operation if block_given?
2259
- return response
2272
+ throw :response, response
2260
2273
  end
2261
2274
  rescue ::GRPC::BadStatus => e
2262
2275
  raise ::Google::Cloud::Error.from_error(e)
@@ -2344,7 +2357,6 @@ module Google
2344
2357
 
2345
2358
  @config_stub.call_rpc :export_preview_result, request, options: options do |response, operation|
2346
2359
  yield response, operation if block_given?
2347
- return response
2348
2360
  end
2349
2361
  rescue ::GRPC::BadStatus => e
2350
2362
  raise ::Google::Cloud::Error.from_error(e)
@@ -2457,7 +2469,7 @@ module Google
2457
2469
  @config_stub.call_rpc :list_terraform_versions, request, options: options do |response, operation|
2458
2470
  response = ::Gapic::PagedEnumerable.new @config_stub, :list_terraform_versions, request, response, operation, options
2459
2471
  yield response, operation if block_given?
2460
- return response
2472
+ throw :response, response
2461
2473
  end
2462
2474
  rescue ::GRPC::BadStatus => e
2463
2475
  raise ::Google::Cloud::Error.from_error(e)
@@ -2545,7 +2557,6 @@ module Google
2545
2557
 
2546
2558
  @config_stub.call_rpc :get_terraform_version, request, options: options do |response, operation|
2547
2559
  yield response, operation if block_given?
2548
- return response
2549
2560
  end
2550
2561
  rescue ::GRPC::BadStatus => e
2551
2562
  raise ::Google::Cloud::Error.from_error(e)
@@ -2634,6 +2645,11 @@ module Google
2634
2645
  # default endpoint URL. The default value of nil uses the environment
2635
2646
  # universe (usually the default "googleapis.com" universe).
2636
2647
  # @return [::String,nil]
2648
+ # @!attribute [rw] logger
2649
+ # A custom logger to use for request/response debug logging, or the value
2650
+ # `:default` (the default) to construct a default logger, or `nil` to
2651
+ # explicitly disable logging.
2652
+ # @return [::Logger,:default,nil]
2637
2653
  #
2638
2654
  class Configuration
2639
2655
  extend ::Gapic::Config
@@ -2658,6 +2674,7 @@ module Google
2658
2674
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2659
2675
  config_attr :quota_project, nil, ::String, nil
2660
2676
  config_attr :universe_domain, nil, ::String, nil
2677
+ config_attr :logger, :default, ::Logger, nil, :default
2661
2678
 
2662
2679
  # @private
2663
2680
  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