google-cloud-monitoring-v3 1.0.1 → 1.2.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: 64c0163eb35d7a4cacb390280641c21807d3abda0a5521ed7169e957fee072bf
4
- data.tar.gz: 33edd7ede5a7b78a5f301f0c7e63aa7ce193dae963d14a800751c1355c36dc4e
3
+ metadata.gz: 4be5ac1912b41c8aab4d67be4962d856d925567e327a755948149fe4892d3577
4
+ data.tar.gz: 74e022ab43e924a6900386f69ff40ca2201423c6008de345f06a39b73d41e895
5
5
  SHA512:
6
- metadata.gz: ca23769f796020f1dab9882578336074bb78d689ee32ed12572ca2361fe5b55749058197e05038d4b7b558e2ba73bd4139dc289df9e7a0bb7368808b7a522c46
7
- data.tar.gz: 02c545db6ffea87b67d416940d7eddac8717ac98454c35ab9e23734fba8bc41e4be88d8387ec3b0c072a5cc0c9f9f14502224583545f4e6057ae0ec27f02e751
6
+ metadata.gz: 9af069883b3e5184bed83308502be8aead3f6180fda6d909b5df9b72f31ceba18ab5a02a12f7ba0c2fbda5a0442bc1202abd303747e00c717e6a72ca14f5ae62
7
+ data.tar.gz: 31d6108c7be91eb2c22cb2dd6498eb640b10bf004157704ebb941047211296fab7ca9b68568b374905483c51322842bf8dae11665cf532672f45ea9110cd3efe
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/monitoring)
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/monitoring/v3"
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::Monitoring::V3::AlertPolicyService::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).
@@ -184,8 +184,28 @@ module Google
184
184
  universe_domain: @config.universe_domain,
185
185
  channel_args: @config.channel_args,
186
186
  interceptors: @config.interceptors,
187
- channel_pool_config: @config.channel_pool
187
+ channel_pool_config: @config.channel_pool,
188
+ logger: @config.logger
188
189
  )
190
+
191
+ @alert_policy_service_stub.stub_logger&.info do |entry|
192
+ entry.set_system_name
193
+ entry.set_service
194
+ entry.message = "Created client for #{entry.service}"
195
+ entry.set_credentials_fields credentials
196
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
197
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
198
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
199
+ end
200
+ end
201
+
202
+ ##
203
+ # The logger used for request/response debug logging.
204
+ #
205
+ # @return [Logger]
206
+ #
207
+ def logger
208
+ @alert_policy_service_stub.logger
189
209
  end
190
210
 
191
211
  # Service calls
@@ -221,24 +241,25 @@ module Google
221
241
  # {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client#get_alert_policy GetAlertPolicy}
222
242
  # operation, instead.
223
243
  # @param filter [::String]
224
- # If provided, this field specifies the criteria that must be met by
225
- # alert policies to be included in the response.
244
+ # Optional. If provided, this field specifies the criteria that must be met
245
+ # by alert policies to be included in the response.
226
246
  #
227
247
  # For more details, see [sorting and
228
248
  # filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
229
249
  # @param order_by [::String]
230
- # A comma-separated list of fields by which to sort the result. Supports
231
- # the same set of field references as the `filter` field. Entries can be
232
- # prefixed with a minus sign to sort by the field in descending order.
250
+ # Optional. A comma-separated list of fields by which to sort the result.
251
+ # Supports the same set of field references as the `filter` field. Entries
252
+ # can be prefixed with a minus sign to sort by the field in descending order.
233
253
  #
234
254
  # For more details, see [sorting and
235
255
  # filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
236
256
  # @param page_size [::Integer]
237
- # The maximum number of results to return in a single response.
257
+ # Optional. The maximum number of results to return in a single response.
238
258
  # @param page_token [::String]
239
- # If this field is not empty then it must contain the `nextPageToken` value
240
- # returned by a previous call to this method. Using this field causes the
241
- # method to return more results from the previous method call.
259
+ # Optional. If this field is not empty then it must contain the
260
+ # `nextPageToken` value returned by a previous call to this method. Using
261
+ # this field causes the method to return more results from the previous
262
+ # method call.
242
263
  #
243
264
  # @yield [response, operation] Access the result along with the RPC operation
244
265
  # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::AlertPolicy>]
@@ -304,7 +325,7 @@ module Google
304
325
  @alert_policy_service_stub.call_rpc :list_alert_policies, request, options: options do |response, operation|
305
326
  response = ::Gapic::PagedEnumerable.new @alert_policy_service_stub, :list_alert_policies, request, response, operation, options
306
327
  yield response, operation if block_given?
307
- return response
328
+ throw :response, response
308
329
  end
309
330
  rescue ::GRPC::BadStatus => e
310
331
  raise ::Google::Cloud::Error.from_error(e)
@@ -392,7 +413,6 @@ module Google
392
413
 
393
414
  @alert_policy_service_stub.call_rpc :get_alert_policy, request, options: options do |response, operation|
394
415
  yield response, operation if block_given?
395
- return response
396
416
  end
397
417
  rescue ::GRPC::BadStatus => e
398
418
  raise ::Google::Cloud::Error.from_error(e)
@@ -498,7 +518,6 @@ module Google
498
518
 
499
519
  @alert_policy_service_stub.call_rpc :create_alert_policy, request, options: options do |response, operation|
500
520
  yield response, operation if block_given?
501
- return response
502
521
  end
503
522
  rescue ::GRPC::BadStatus => e
504
523
  raise ::Google::Cloud::Error.from_error(e)
@@ -592,7 +611,6 @@ module Google
592
611
 
593
612
  @alert_policy_service_stub.call_rpc :delete_alert_policy, request, options: options do |response, operation|
594
613
  yield response, operation if block_given?
595
- return response
596
614
  end
597
615
  rescue ::GRPC::BadStatus => e
598
616
  raise ::Google::Cloud::Error.from_error(e)
@@ -710,7 +728,6 @@ module Google
710
728
 
711
729
  @alert_policy_service_stub.call_rpc :update_alert_policy, request, options: options do |response, operation|
712
730
  yield response, operation if block_given?
713
- return response
714
731
  end
715
732
  rescue ::GRPC::BadStatus => e
716
733
  raise ::Google::Cloud::Error.from_error(e)
@@ -799,6 +816,11 @@ module Google
799
816
  # default endpoint URL. The default value of nil uses the environment
800
817
  # universe (usually the default "googleapis.com" universe).
801
818
  # @return [::String,nil]
819
+ # @!attribute [rw] logger
820
+ # A custom logger to use for request/response debug logging, or the value
821
+ # `:default` (the default) to construct a default logger, or `nil` to
822
+ # explicitly disable logging.
823
+ # @return [::Logger,:default,nil]
802
824
  #
803
825
  class Configuration
804
826
  extend ::Gapic::Config
@@ -823,6 +845,7 @@ module Google
823
845
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
824
846
  config_attr :quota_project, nil, ::String, nil
825
847
  config_attr :universe_domain, nil, ::String, nil
848
+ config_attr :logger, :default, ::Logger, nil, :default
826
849
 
827
850
  # @private
828
851
  def initialize parent_config = nil
@@ -195,8 +195,28 @@ module Google
195
195
  universe_domain: @config.universe_domain,
196
196
  channel_args: @config.channel_args,
197
197
  interceptors: @config.interceptors,
198
- channel_pool_config: @config.channel_pool
198
+ channel_pool_config: @config.channel_pool,
199
+ logger: @config.logger
199
200
  )
201
+
202
+ @group_service_stub.stub_logger&.info do |entry|
203
+ entry.set_system_name
204
+ entry.set_service
205
+ entry.message = "Created client for #{entry.service}"
206
+ entry.set_credentials_fields credentials
207
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
208
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
209
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
210
+ end
211
+ end
212
+
213
+ ##
214
+ # The logger used for request/response debug logging.
215
+ #
216
+ # @return [Logger]
217
+ #
218
+ def logger
219
+ @group_service_stub.logger
200
220
  end
201
221
 
202
222
  # Service calls
@@ -320,7 +340,7 @@ module Google
320
340
  @group_service_stub.call_rpc :list_groups, request, options: options do |response, operation|
321
341
  response = ::Gapic::PagedEnumerable.new @group_service_stub, :list_groups, request, response, operation, options
322
342
  yield response, operation if block_given?
323
- return response
343
+ throw :response, response
324
344
  end
325
345
  rescue ::GRPC::BadStatus => e
326
346
  raise ::Google::Cloud::Error.from_error(e)
@@ -408,7 +428,6 @@ module Google
408
428
 
409
429
  @group_service_stub.call_rpc :get_group, request, options: options do |response, operation|
410
430
  yield response, operation if block_given?
411
- return response
412
431
  end
413
432
  rescue ::GRPC::BadStatus => e
414
433
  raise ::Google::Cloud::Error.from_error(e)
@@ -503,7 +522,6 @@ module Google
503
522
 
504
523
  @group_service_stub.call_rpc :create_group, request, options: options do |response, operation|
505
524
  yield response, operation if block_given?
506
- return response
507
525
  end
508
526
  rescue ::GRPC::BadStatus => e
509
527
  raise ::Google::Cloud::Error.from_error(e)
@@ -594,7 +612,6 @@ module Google
594
612
 
595
613
  @group_service_stub.call_rpc :update_group, request, options: options do |response, operation|
596
614
  yield response, operation if block_given?
597
- return response
598
615
  end
599
616
  rescue ::GRPC::BadStatus => e
600
617
  raise ::Google::Cloud::Error.from_error(e)
@@ -686,7 +703,6 @@ module Google
686
703
 
687
704
  @group_service_stub.call_rpc :delete_group, request, options: options do |response, operation|
688
705
  yield response, operation if block_given?
689
- return response
690
706
  end
691
707
  rescue ::GRPC::BadStatus => e
692
708
  raise ::Google::Cloud::Error.from_error(e)
@@ -799,7 +815,7 @@ module Google
799
815
  @group_service_stub.call_rpc :list_group_members, request, options: options do |response, operation|
800
816
  response = ::Gapic::PagedEnumerable.new @group_service_stub, :list_group_members, request, response, operation, options
801
817
  yield response, operation if block_given?
802
- return response
818
+ throw :response, response
803
819
  end
804
820
  rescue ::GRPC::BadStatus => e
805
821
  raise ::Google::Cloud::Error.from_error(e)
@@ -888,6 +904,11 @@ module Google
888
904
  # default endpoint URL. The default value of nil uses the environment
889
905
  # universe (usually the default "googleapis.com" universe).
890
906
  # @return [::String,nil]
907
+ # @!attribute [rw] logger
908
+ # A custom logger to use for request/response debug logging, or the value
909
+ # `:default` (the default) to construct a default logger, or `nil` to
910
+ # explicitly disable logging.
911
+ # @return [::Logger,:default,nil]
891
912
  #
892
913
  class Configuration
893
914
  extend ::Gapic::Config
@@ -912,6 +933,7 @@ module Google
912
933
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
913
934
  config_attr :quota_project, nil, ::String, nil
914
935
  config_attr :universe_domain, nil, ::String, nil
936
+ config_attr :logger, :default, ::Logger, nil, :default
915
937
 
916
938
  # @private
917
939
  def initialize parent_config = nil
@@ -192,8 +192,28 @@ module Google
192
192
  universe_domain: @config.universe_domain,
193
193
  channel_args: @config.channel_args,
194
194
  interceptors: @config.interceptors,
195
- channel_pool_config: @config.channel_pool
195
+ channel_pool_config: @config.channel_pool,
196
+ logger: @config.logger
196
197
  )
198
+
199
+ @metric_service_stub.stub_logger&.info do |entry|
200
+ entry.set_system_name
201
+ entry.set_service
202
+ entry.message = "Created client for #{entry.service}"
203
+ entry.set_credentials_fields credentials
204
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
205
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
206
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
207
+ end
208
+ end
209
+
210
+ ##
211
+ # The logger used for request/response debug logging.
212
+ #
213
+ # @return [Logger]
214
+ #
215
+ def logger
216
+ @metric_service_stub.logger
197
217
  end
198
218
 
199
219
  # Service calls
@@ -300,7 +320,7 @@ module Google
300
320
  @metric_service_stub.call_rpc :list_monitored_resource_descriptors, request, options: options do |response, operation|
301
321
  response = ::Gapic::PagedEnumerable.new @metric_service_stub, :list_monitored_resource_descriptors, request, response, operation, options
302
322
  yield response, operation if block_given?
303
- return response
323
+ throw :response, response
304
324
  end
305
325
  rescue ::GRPC::BadStatus => e
306
326
  raise ::Google::Cloud::Error.from_error(e)
@@ -391,7 +411,6 @@ module Google
391
411
 
392
412
  @metric_service_stub.call_rpc :get_monitored_resource_descriptor, request, options: options do |response, operation|
393
413
  yield response, operation if block_given?
394
- return response
395
414
  end
396
415
  rescue ::GRPC::BadStatus => e
397
416
  raise ::Google::Cloud::Error.from_error(e)
@@ -503,7 +522,7 @@ module Google
503
522
  @metric_service_stub.call_rpc :list_metric_descriptors, request, options: options do |response, operation|
504
523
  response = ::Gapic::PagedEnumerable.new @metric_service_stub, :list_metric_descriptors, request, response, operation, options
505
524
  yield response, operation if block_given?
506
- return response
525
+ throw :response, response
507
526
  end
508
527
  rescue ::GRPC::BadStatus => e
509
528
  raise ::Google::Cloud::Error.from_error(e)
@@ -595,7 +614,6 @@ module Google
595
614
 
596
615
  @metric_service_stub.call_rpc :get_metric_descriptor, request, options: options do |response, operation|
597
616
  yield response, operation if block_given?
598
- return response
599
617
  end
600
618
  rescue ::GRPC::BadStatus => e
601
619
  raise ::Google::Cloud::Error.from_error(e)
@@ -693,7 +711,6 @@ module Google
693
711
 
694
712
  @metric_service_stub.call_rpc :create_metric_descriptor, request, options: options do |response, operation|
695
713
  yield response, operation if block_given?
696
- return response
697
714
  end
698
715
  rescue ::GRPC::BadStatus => e
699
716
  raise ::Google::Cloud::Error.from_error(e)
@@ -787,7 +804,6 @@ module Google
787
804
 
788
805
  @metric_service_stub.call_rpc :delete_metric_descriptor, request, options: options do |response, operation|
789
806
  yield response, operation if block_given?
790
- return response
791
807
  end
792
808
  rescue ::GRPC::BadStatus => e
793
809
  raise ::Google::Cloud::Error.from_error(e)
@@ -921,7 +937,7 @@ module Google
921
937
  @metric_service_stub.call_rpc :list_time_series, request, options: options do |response, operation|
922
938
  response = ::Gapic::PagedEnumerable.new @metric_service_stub, :list_time_series, request, response, operation, options
923
939
  yield response, operation if block_given?
924
- return response
940
+ throw :response, response
925
941
  end
926
942
  rescue ::GRPC::BadStatus => e
927
943
  raise ::Google::Cloud::Error.from_error(e)
@@ -1025,7 +1041,6 @@ module Google
1025
1041
 
1026
1042
  @metric_service_stub.call_rpc :create_time_series, request, options: options do |response, operation|
1027
1043
  yield response, operation if block_given?
1028
- return response
1029
1044
  end
1030
1045
  rescue ::GRPC::BadStatus => e
1031
1046
  raise ::Google::Cloud::Error.from_error(e)
@@ -1131,7 +1146,6 @@ module Google
1131
1146
 
1132
1147
  @metric_service_stub.call_rpc :create_service_time_series, request, options: options do |response, operation|
1133
1148
  yield response, operation if block_given?
1134
- return response
1135
1149
  end
1136
1150
  rescue ::GRPC::BadStatus => e
1137
1151
  raise ::Google::Cloud::Error.from_error(e)
@@ -1220,6 +1234,11 @@ module Google
1220
1234
  # default endpoint URL. The default value of nil uses the environment
1221
1235
  # universe (usually the default "googleapis.com" universe).
1222
1236
  # @return [::String,nil]
1237
+ # @!attribute [rw] logger
1238
+ # A custom logger to use for request/response debug logging, or the value
1239
+ # `:default` (the default) to construct a default logger, or `nil` to
1240
+ # explicitly disable logging.
1241
+ # @return [::Logger,:default,nil]
1223
1242
  #
1224
1243
  class Configuration
1225
1244
  extend ::Gapic::Config
@@ -1244,6 +1263,7 @@ module Google
1244
1263
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1245
1264
  config_attr :quota_project, nil, ::String, nil
1246
1265
  config_attr :universe_domain, nil, ::String, nil
1266
+ config_attr :logger, :default, ::Logger, nil, :default
1247
1267
 
1248
1268
  # @private
1249
1269
  def initialize parent_config = nil
@@ -199,8 +199,28 @@ module Google
199
199
  universe_domain: @config.universe_domain,
200
200
  channel_args: @config.channel_args,
201
201
  interceptors: @config.interceptors,
202
- channel_pool_config: @config.channel_pool
202
+ channel_pool_config: @config.channel_pool,
203
+ logger: @config.logger
203
204
  )
205
+
206
+ @notification_channel_service_stub.stub_logger&.info do |entry|
207
+ entry.set_system_name
208
+ entry.set_service
209
+ entry.message = "Created client for #{entry.service}"
210
+ entry.set_credentials_fields credentials
211
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
212
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
213
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
214
+ end
215
+ end
216
+
217
+ ##
218
+ # The logger used for request/response debug logging.
219
+ #
220
+ # @return [Logger]
221
+ #
222
+ def logger
223
+ @notification_channel_service_stub.logger
204
224
  end
205
225
 
206
226
  # Service calls
@@ -309,7 +329,7 @@ module Google
309
329
  @notification_channel_service_stub.call_rpc :list_notification_channel_descriptors, request, options: options do |response, operation|
310
330
  response = ::Gapic::PagedEnumerable.new @notification_channel_service_stub, :list_notification_channel_descriptors, request, response, operation, options
311
331
  yield response, operation if block_given?
312
- return response
332
+ throw :response, response
313
333
  end
314
334
  rescue ::GRPC::BadStatus => e
315
335
  raise ::Google::Cloud::Error.from_error(e)
@@ -398,7 +418,6 @@ module Google
398
418
 
399
419
  @notification_channel_service_stub.call_rpc :get_notification_channel_descriptor, request, options: options do |response, operation|
400
420
  yield response, operation if block_given?
401
- return response
402
421
  end
403
422
  rescue ::GRPC::BadStatus => e
404
423
  raise ::Google::Cloud::Error.from_error(e)
@@ -438,24 +457,24 @@ module Google
438
457
  # {::Google::Cloud::Monitoring::V3::NotificationChannelService::Client#get_notification_channel `GetNotificationChannel`}
439
458
  # operation.
440
459
  # @param filter [::String]
441
- # If provided, this field specifies the criteria that must be met by
442
- # notification channels to be included in the response.
460
+ # Optional. If provided, this field specifies the criteria that must be met
461
+ # by notification channels to be included in the response.
443
462
  #
444
463
  # For more details, see [sorting and
445
464
  # filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
446
465
  # @param order_by [::String]
447
- # A comma-separated list of fields by which to sort the result. Supports
448
- # the same set of fields as in `filter`. Entries can be prefixed with
449
- # a minus sign to sort in descending rather than ascending order.
466
+ # Optional. A comma-separated list of fields by which to sort the result.
467
+ # Supports the same set of fields as in `filter`. Entries can be prefixed
468
+ # with a minus sign to sort in descending rather than ascending order.
450
469
  #
451
470
  # For more details, see [sorting and
452
471
  # filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
453
472
  # @param page_size [::Integer]
454
- # The maximum number of results to return in a single response. If
473
+ # Optional. The maximum number of results to return in a single response. If
455
474
  # not set to a positive number, a reasonable value will be chosen by the
456
475
  # service.
457
476
  # @param page_token [::String]
458
- # If non-empty, `page_token` must contain a value returned as the
477
+ # Optional. If non-empty, `page_token` must contain a value returned as the
459
478
  # `next_page_token` in a previous response to request the next set
460
479
  # of results.
461
480
  #
@@ -523,7 +542,7 @@ module Google
523
542
  @notification_channel_service_stub.call_rpc :list_notification_channels, request, options: options do |response, operation|
524
543
  response = ::Gapic::PagedEnumerable.new @notification_channel_service_stub, :list_notification_channels, request, response, operation, options
525
544
  yield response, operation if block_given?
526
- return response
545
+ throw :response, response
527
546
  end
528
547
  rescue ::GRPC::BadStatus => e
529
548
  raise ::Google::Cloud::Error.from_error(e)
@@ -615,7 +634,6 @@ module Google
615
634
 
616
635
  @notification_channel_service_stub.call_rpc :get_notification_channel, request, options: options do |response, operation|
617
636
  yield response, operation if block_given?
618
- return response
619
637
  end
620
638
  rescue ::GRPC::BadStatus => e
621
639
  raise ::Google::Cloud::Error.from_error(e)
@@ -718,7 +736,6 @@ module Google
718
736
 
719
737
  @notification_channel_service_stub.call_rpc :create_notification_channel, request, options: options do |response, operation|
720
738
  yield response, operation if block_given?
721
- return response
722
739
  end
723
740
  rescue ::GRPC::BadStatus => e
724
741
  raise ::Google::Cloud::Error.from_error(e)
@@ -749,7 +766,7 @@ module Google
749
766
  # the default parameter values, pass an empty Hash as a request object (see above).
750
767
  #
751
768
  # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
752
- # The fields to update.
769
+ # Optional. The fields to update.
753
770
  # @param notification_channel [::Google::Cloud::Monitoring::V3::NotificationChannel, ::Hash]
754
771
  # Required. A description of the changes to be applied to the specified
755
772
  # notification channel. The description must provide a definition for
@@ -815,7 +832,6 @@ module Google
815
832
 
816
833
  @notification_channel_service_stub.call_rpc :update_notification_channel, request, options: options do |response, operation|
817
834
  yield response, operation if block_given?
818
- return response
819
835
  end
820
836
  rescue ::GRPC::BadStatus => e
821
837
  raise ::Google::Cloud::Error.from_error(e)
@@ -851,8 +867,8 @@ module Google
851
867
  # @param force [::Boolean]
852
868
  # If true, the notification channel will be deleted regardless of its
853
869
  # use in alert policies (the policies will be updated to remove the
854
- # channel). If false, channels that are still referenced by an existing
855
- # alerting policy will fail to be deleted in a delete operation.
870
+ # channel). If false, this operation will fail if the notification channel
871
+ # is referenced by existing alerting policies.
856
872
  #
857
873
  # @yield [response, operation] Access the result along with the RPC operation
858
874
  # @yieldparam response [::Google::Protobuf::Empty]
@@ -913,7 +929,6 @@ module Google
913
929
 
914
930
  @notification_channel_service_stub.call_rpc :delete_notification_channel, request, options: options do |response, operation|
915
931
  yield response, operation if block_given?
916
- return response
917
932
  end
918
933
  rescue ::GRPC::BadStatus => e
919
934
  raise ::Google::Cloud::Error.from_error(e)
@@ -1000,7 +1015,6 @@ module Google
1000
1015
 
1001
1016
  @notification_channel_service_stub.call_rpc :send_notification_channel_verification_code, request, options: options do |response, operation|
1002
1017
  yield response, operation if block_given?
1003
- return response
1004
1018
  end
1005
1019
  rescue ::GRPC::BadStatus => e
1006
1020
  raise ::Google::Cloud::Error.from_error(e)
@@ -1118,7 +1132,6 @@ module Google
1118
1132
 
1119
1133
  @notification_channel_service_stub.call_rpc :get_notification_channel_verification_code, request, options: options do |response, operation|
1120
1134
  yield response, operation if block_given?
1121
- return response
1122
1135
  end
1123
1136
  rescue ::GRPC::BadStatus => e
1124
1137
  raise ::Google::Cloud::Error.from_error(e)
@@ -1214,7 +1227,6 @@ module Google
1214
1227
 
1215
1228
  @notification_channel_service_stub.call_rpc :verify_notification_channel, request, options: options do |response, operation|
1216
1229
  yield response, operation if block_given?
1217
- return response
1218
1230
  end
1219
1231
  rescue ::GRPC::BadStatus => e
1220
1232
  raise ::Google::Cloud::Error.from_error(e)
@@ -1303,6 +1315,11 @@ module Google
1303
1315
  # default endpoint URL. The default value of nil uses the environment
1304
1316
  # universe (usually the default "googleapis.com" universe).
1305
1317
  # @return [::String,nil]
1318
+ # @!attribute [rw] logger
1319
+ # A custom logger to use for request/response debug logging, or the value
1320
+ # `:default` (the default) to construct a default logger, or `nil` to
1321
+ # explicitly disable logging.
1322
+ # @return [::Logger,:default,nil]
1306
1323
  #
1307
1324
  class Configuration
1308
1325
  extend ::Gapic::Config
@@ -1327,6 +1344,7 @@ module Google
1327
1344
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1328
1345
  config_attr :quota_project, nil, ::String, nil
1329
1346
  config_attr :universe_domain, nil, ::String, nil
1347
+ config_attr :logger, :default, ::Logger, nil, :default
1330
1348
 
1331
1349
  # @private
1332
1350
  def initialize parent_config = nil
@@ -157,8 +157,28 @@ module Google
157
157
  universe_domain: @config.universe_domain,
158
158
  channel_args: @config.channel_args,
159
159
  interceptors: @config.interceptors,
160
- channel_pool_config: @config.channel_pool
160
+ channel_pool_config: @config.channel_pool,
161
+ logger: @config.logger
161
162
  )
163
+
164
+ @query_service_stub.stub_logger&.info do |entry|
165
+ entry.set_system_name
166
+ entry.set_service
167
+ entry.message = "Created client for #{entry.service}"
168
+ entry.set_credentials_fields credentials
169
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
170
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
171
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
172
+ end
173
+ end
174
+
175
+ ##
176
+ # The logger used for request/response debug logging.
177
+ #
178
+ # @return [Logger]
179
+ #
180
+ def logger
181
+ @query_service_stub.logger
162
182
  end
163
183
 
164
184
  # Service calls
@@ -262,7 +282,7 @@ module Google
262
282
  @query_service_stub.call_rpc :query_time_series, request, options: options do |response, operation|
263
283
  response = ::Gapic::PagedEnumerable.new @query_service_stub, :query_time_series, request, response, operation, options
264
284
  yield response, operation if block_given?
265
- return response
285
+ throw :response, response
266
286
  end
267
287
  rescue ::GRPC::BadStatus => e
268
288
  raise ::Google::Cloud::Error.from_error(e)
@@ -351,6 +371,11 @@ module Google
351
371
  # default endpoint URL. The default value of nil uses the environment
352
372
  # universe (usually the default "googleapis.com" universe).
353
373
  # @return [::String,nil]
374
+ # @!attribute [rw] logger
375
+ # A custom logger to use for request/response debug logging, or the value
376
+ # `:default` (the default) to construct a default logger, or `nil` to
377
+ # explicitly disable logging.
378
+ # @return [::Logger,:default,nil]
354
379
  #
355
380
  class Configuration
356
381
  extend ::Gapic::Config
@@ -375,6 +400,7 @@ module Google
375
400
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
376
401
  config_attr :quota_project, nil, ::String, nil
377
402
  config_attr :universe_domain, nil, ::String, nil
403
+ config_attr :logger, :default, ::Logger, nil, :default
378
404
 
379
405
  # @private
380
406
  def initialize parent_config = nil