google-cloud-monitoring-v3 0.4.2 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/monitoring/v3/alert_policy_service/client.rb +157 -61
  3. data/lib/google/cloud/monitoring/v3/group_service/client.rb +189 -68
  4. data/lib/google/cloud/monitoring/v3/metric_service/client.rb +360 -80
  5. data/lib/google/cloud/monitoring/v3/notification_channel_service/client.rb +286 -87
  6. data/lib/google/cloud/monitoring/v3/query_service/client.rb +60 -41
  7. data/lib/google/cloud/monitoring/v3/service_monitoring_service/client.rb +281 -84
  8. data/lib/google/cloud/monitoring/v3/uptime_check_service/client.rb +182 -63
  9. data/lib/google/cloud/monitoring/v3/version.rb +1 -1
  10. data/lib/google/monitoring/v3/alert_pb.rb +17 -2
  11. data/lib/google/monitoring/v3/alert_service_pb.rb +2 -2
  12. data/lib/google/monitoring/v3/alert_service_services_pb.rb +1 -1
  13. data/lib/google/monitoring/v3/common_pb.rb +2 -2
  14. data/lib/google/monitoring/v3/group_pb.rb +1 -1
  15. data/lib/google/monitoring/v3/group_service_pb.rb +2 -2
  16. data/lib/google/monitoring/v3/group_service_services_pb.rb +1 -1
  17. data/lib/google/monitoring/v3/metric_pb.rb +2 -2
  18. data/lib/google/monitoring/v3/metric_service_pb.rb +2 -2
  19. data/lib/google/monitoring/v3/metric_service_services_pb.rb +13 -1
  20. data/lib/google/monitoring/v3/mutation_record_pb.rb +1 -1
  21. data/lib/google/monitoring/v3/notification_pb.rb +2 -2
  22. data/lib/google/monitoring/v3/notification_service_pb.rb +2 -2
  23. data/lib/google/monitoring/v3/notification_service_services_pb.rb +1 -1
  24. data/lib/google/monitoring/v3/query_service_pb.rb +2 -2
  25. data/lib/google/monitoring/v3/query_service_services_pb.rb +1 -1
  26. data/lib/google/monitoring/v3/service_pb.rb +5 -2
  27. data/lib/google/monitoring/v3/service_service_pb.rb +2 -2
  28. data/lib/google/monitoring/v3/service_service_services_pb.rb +1 -1
  29. data/lib/google/monitoring/v3/uptime_pb.rb +2 -2
  30. data/lib/google/monitoring/v3/uptime_service_pb.rb +3 -2
  31. data/lib/google/monitoring/v3/uptime_service_services_pb.rb +1 -1
  32. data/proto_docs/google/longrunning/operations.rb +164 -0
  33. data/proto_docs/google/monitoring/v3/alert.rb +68 -3
  34. data/proto_docs/google/monitoring/v3/alert_service.rb +4 -2
  35. data/proto_docs/google/monitoring/v3/common.rb +17 -5
  36. data/proto_docs/google/monitoring/v3/group_service.rb +4 -2
  37. data/proto_docs/google/monitoring/v3/metric.rb +3 -1
  38. data/proto_docs/google/monitoring/v3/metric_service.rb +13 -8
  39. data/proto_docs/google/monitoring/v3/notification_service.rb +8 -4
  40. data/proto_docs/google/monitoring/v3/service.rb +38 -6
  41. data/proto_docs/google/monitoring/v3/service_service.rb +4 -2
  42. data/proto_docs/google/monitoring/v3/span_context.rb +2 -2
  43. data/proto_docs/google/monitoring/v3/uptime.rb +5 -2
  44. data/proto_docs/google/monitoring/v3/uptime_service.rb +4 -2
  45. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7dec6d95d8bd4486aa11ae3ec9dff1d78bec82ab8e9a3cf05f9b46ad5d64dba2
4
- data.tar.gz: 1dbef9169213f4c1f5c359eed7303ea8c1bb7c28415be568dfde9b7a2f2ca817
3
+ metadata.gz: 135c4d1afadbf4c699971b07032372bd90c61c0848ab176ff5efdd5f294a1d01
4
+ data.tar.gz: 1a162a3e4b27d3d843b9348568ce58dcadb76a201af38fd419ecbae73c4d88e4
5
5
  SHA512:
6
- metadata.gz: 6bd4ed90760607805d6156f95224fd7552d3817826095f45fb252af63990417baa6f64f9dd82969d043093c08a70c1cdcc169f7e0c65145ab30ed869d6a885b9
7
- data.tar.gz: 0c2a694792313db4ed25401ff15c914e61ce1ea8f153b932741e57bc3c96381e40b8c522635c192fa069172d80975af2f071d74086064c5907851d5028ae2887
6
+ metadata.gz: 21d9c448175505c545653338caa4b45bf09b0bb572b353b8b1a6b450bc603475991c750d284b0ffa17bd7b2fee219c8bbf67179bfa3795e36b8e1df4ba4300cb
7
+ data.tar.gz: '087d61b21d791ffdd7e21739a4160825d80eaa642ee2b60e714963283c2e67f9a9916724c7753de98ea4f8c28ed2bf40c1f22bc7a1940987c4938275e9b2b49d'
@@ -49,13 +49,12 @@ module Google
49
49
  # See {::Google::Cloud::Monitoring::V3::AlertPolicyService::Client::Configuration}
50
50
  # for a description of the configuration fields.
51
51
  #
52
- # ## Example
52
+ # @example
53
53
  #
54
- # To modify the configuration for all AlertPolicyService clients:
55
- #
56
- # ::Google::Cloud::Monitoring::V3::AlertPolicyService::Client.configure do |config|
57
- # config.timeout = 10.0
58
- # end
54
+ # # Modify the configuration for all AlertPolicyService clients
55
+ # ::Google::Cloud::Monitoring::V3::AlertPolicyService::Client.configure do |config|
56
+ # config.timeout = 10.0
57
+ # end
59
58
  #
60
59
  # @yield [config] Configure the Client client.
61
60
  # @yieldparam config [Client::Configuration]
@@ -75,19 +74,19 @@ module Google
75
74
 
76
75
  default_config.rpcs.list_alert_policies.timeout = 30.0
77
76
  default_config.rpcs.list_alert_policies.retry_policy = {
78
- initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
77
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
79
78
  }
80
79
 
81
80
  default_config.rpcs.get_alert_policy.timeout = 30.0
82
81
  default_config.rpcs.get_alert_policy.retry_policy = {
83
- initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
82
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
84
83
  }
85
84
 
86
85
  default_config.rpcs.create_alert_policy.timeout = 30.0
87
86
 
88
87
  default_config.rpcs.delete_alert_policy.timeout = 30.0
89
88
  default_config.rpcs.delete_alert_policy.retry_policy = {
90
- initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
89
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
91
90
  }
92
91
 
93
92
  default_config.rpcs.update_alert_policy.timeout = 30.0
@@ -121,19 +120,15 @@ module Google
121
120
  ##
122
121
  # Create a new AlertPolicyService client object.
123
122
  #
124
- # ## Examples
125
- #
126
- # To create a new AlertPolicyService client with the default
127
- # configuration:
128
- #
129
- # client = ::Google::Cloud::Monitoring::V3::AlertPolicyService::Client.new
123
+ # @example
130
124
  #
131
- # To create a new AlertPolicyService client with a custom
132
- # configuration:
125
+ # # Create a client using the default configuration
126
+ # client = ::Google::Cloud::Monitoring::V3::AlertPolicyService::Client.new
133
127
  #
134
- # client = ::Google::Cloud::Monitoring::V3::AlertPolicyService::Client.new do |config|
135
- # config.timeout = 10.0
136
- # end
128
+ # # Create a client using a custom configuration
129
+ # client = ::Google::Cloud::Monitoring::V3::AlertPolicyService::Client.new do |config|
130
+ # config.timeout = 10.0
131
+ # end
137
132
  #
138
133
  # @yield [config] Configure the AlertPolicyService client.
139
134
  # @yieldparam config [Client::Configuration]
@@ -153,10 +148,9 @@ module Google
153
148
 
154
149
  # Create credentials
155
150
  credentials = @config.credentials
156
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
151
+ # Use self-signed JWT if the endpoint is unchanged from default,
157
152
  # but only if the default endpoint does not have a region prefix.
158
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
159
- @config.endpoint == Client.configure.endpoint &&
153
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
160
154
  !@config.endpoint.split(".").first.include?("-")
161
155
  credentials ||= Credentials.default scope: @config.scope,
162
156
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -196,7 +190,8 @@ module Google
196
190
  # the default parameter values, pass an empty Hash as a request object (see above).
197
191
  #
198
192
  # @param name [::String]
199
- # Required. The project whose alert policies are to be listed. The format is:
193
+ # Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name)
194
+ # whose alert policies are to be listed. The format is:
200
195
  #
201
196
  # projects/[PROJECT_ID_OR_NUMBER]
202
197
  #
@@ -233,6 +228,27 @@ module Google
233
228
  #
234
229
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
235
230
  #
231
+ # @example Basic example
232
+ # require "google/cloud/monitoring/v3"
233
+ #
234
+ # # Create a client object. The client can be reused for multiple calls.
235
+ # client = Google::Cloud::Monitoring::V3::AlertPolicyService::Client.new
236
+ #
237
+ # # Create a request. To set request fields, pass in keyword arguments.
238
+ # request = Google::Cloud::Monitoring::V3::ListAlertPoliciesRequest.new
239
+ #
240
+ # # Call the list_alert_policies method.
241
+ # result = client.list_alert_policies request
242
+ #
243
+ # # The returned object is of type Gapic::PagedEnumerable. You can
244
+ # # iterate over all elements by calling #each, and the enumerable
245
+ # # will lazily make API calls to fetch subsequent pages. Other
246
+ # # methods are also available for managing paging directly.
247
+ # result.each do |response|
248
+ # # Each element is of type ::Google::Cloud::Monitoring::V3::AlertPolicy.
249
+ # p response
250
+ # end
251
+ #
236
252
  def list_alert_policies request, options = nil
237
253
  raise ::ArgumentError, "request must be provided" if request.nil?
238
254
 
@@ -250,16 +266,20 @@ module Google
250
266
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
251
267
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
252
268
 
253
- header_params = {
254
- "name" => request.name
255
- }
269
+ header_params = {}
270
+ if request.name
271
+ header_params["name"] = request.name
272
+ end
273
+
256
274
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
257
275
  metadata[:"x-goog-request-params"] ||= request_params_header
258
276
 
259
277
  options.apply_defaults timeout: @config.rpcs.list_alert_policies.timeout,
260
278
  metadata: metadata,
261
279
  retry_policy: @config.rpcs.list_alert_policies.retry_policy
262
- options.apply_defaults metadata: @config.metadata,
280
+
281
+ options.apply_defaults timeout: @config.timeout,
282
+ metadata: @config.metadata,
263
283
  retry_policy: @config.retry_policy
264
284
 
265
285
  @alert_policy_service_stub.call_rpc :list_alert_policies, request, options: options do |response, operation|
@@ -302,6 +322,21 @@ module Google
302
322
  #
303
323
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
304
324
  #
325
+ # @example Basic example
326
+ # require "google/cloud/monitoring/v3"
327
+ #
328
+ # # Create a client object. The client can be reused for multiple calls.
329
+ # client = Google::Cloud::Monitoring::V3::AlertPolicyService::Client.new
330
+ #
331
+ # # Create a request. To set request fields, pass in keyword arguments.
332
+ # request = Google::Cloud::Monitoring::V3::GetAlertPolicyRequest.new
333
+ #
334
+ # # Call the get_alert_policy method.
335
+ # result = client.get_alert_policy request
336
+ #
337
+ # # The returned object is of type Google::Cloud::Monitoring::V3::AlertPolicy.
338
+ # p result
339
+ #
305
340
  def get_alert_policy request, options = nil
306
341
  raise ::ArgumentError, "request must be provided" if request.nil?
307
342
 
@@ -319,16 +354,20 @@ module Google
319
354
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
320
355
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
321
356
 
322
- header_params = {
323
- "name" => request.name
324
- }
357
+ header_params = {}
358
+ if request.name
359
+ header_params["name"] = request.name
360
+ end
361
+
325
362
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
326
363
  metadata[:"x-goog-request-params"] ||= request_params_header
327
364
 
328
365
  options.apply_defaults timeout: @config.rpcs.get_alert_policy.timeout,
329
366
  metadata: metadata,
330
367
  retry_policy: @config.rpcs.get_alert_policy.retry_policy
331
- options.apply_defaults metadata: @config.metadata,
368
+
369
+ options.apply_defaults timeout: @config.timeout,
370
+ metadata: @config.metadata,
332
371
  retry_policy: @config.retry_policy
333
372
 
334
373
  @alert_policy_service_stub.call_rpc :get_alert_policy, request, options: options do |response, operation|
@@ -358,7 +397,8 @@ module Google
358
397
  # the default parameter values, pass an empty Hash as a request object (see above).
359
398
  #
360
399
  # @param name [::String]
361
- # Required. The project in which to create the alerting policy. The format is:
400
+ # Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) in
401
+ # which to create the alerting policy. The format is:
362
402
  #
363
403
  # projects/[PROJECT_ID_OR_NUMBER]
364
404
  #
@@ -382,6 +422,21 @@ module Google
382
422
  #
383
423
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
384
424
  #
425
+ # @example Basic example
426
+ # require "google/cloud/monitoring/v3"
427
+ #
428
+ # # Create a client object. The client can be reused for multiple calls.
429
+ # client = Google::Cloud::Monitoring::V3::AlertPolicyService::Client.new
430
+ #
431
+ # # Create a request. To set request fields, pass in keyword arguments.
432
+ # request = Google::Cloud::Monitoring::V3::CreateAlertPolicyRequest.new
433
+ #
434
+ # # Call the create_alert_policy method.
435
+ # result = client.create_alert_policy request
436
+ #
437
+ # # The returned object is of type Google::Cloud::Monitoring::V3::AlertPolicy.
438
+ # p result
439
+ #
385
440
  def create_alert_policy request, options = nil
386
441
  raise ::ArgumentError, "request must be provided" if request.nil?
387
442
 
@@ -399,16 +454,20 @@ module Google
399
454
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
400
455
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
401
456
 
402
- header_params = {
403
- "name" => request.name
404
- }
457
+ header_params = {}
458
+ if request.name
459
+ header_params["name"] = request.name
460
+ end
461
+
405
462
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
406
463
  metadata[:"x-goog-request-params"] ||= request_params_header
407
464
 
408
465
  options.apply_defaults timeout: @config.rpcs.create_alert_policy.timeout,
409
466
  metadata: metadata,
410
467
  retry_policy: @config.rpcs.create_alert_policy.retry_policy
411
- options.apply_defaults metadata: @config.metadata,
468
+
469
+ options.apply_defaults timeout: @config.timeout,
470
+ metadata: @config.metadata,
412
471
  retry_policy: @config.retry_policy
413
472
 
414
473
  @alert_policy_service_stub.call_rpc :create_alert_policy, request, options: options do |response, operation|
@@ -452,6 +511,21 @@ module Google
452
511
  #
453
512
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
454
513
  #
514
+ # @example Basic example
515
+ # require "google/cloud/monitoring/v3"
516
+ #
517
+ # # Create a client object. The client can be reused for multiple calls.
518
+ # client = Google::Cloud::Monitoring::V3::AlertPolicyService::Client.new
519
+ #
520
+ # # Create a request. To set request fields, pass in keyword arguments.
521
+ # request = Google::Cloud::Monitoring::V3::DeleteAlertPolicyRequest.new
522
+ #
523
+ # # Call the delete_alert_policy method.
524
+ # result = client.delete_alert_policy request
525
+ #
526
+ # # The returned object is of type Google::Protobuf::Empty.
527
+ # p result
528
+ #
455
529
  def delete_alert_policy request, options = nil
456
530
  raise ::ArgumentError, "request must be provided" if request.nil?
457
531
 
@@ -469,16 +543,20 @@ module Google
469
543
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
470
544
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
471
545
 
472
- header_params = {
473
- "name" => request.name
474
- }
546
+ header_params = {}
547
+ if request.name
548
+ header_params["name"] = request.name
549
+ end
550
+
475
551
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
476
552
  metadata[:"x-goog-request-params"] ||= request_params_header
477
553
 
478
554
  options.apply_defaults timeout: @config.rpcs.delete_alert_policy.timeout,
479
555
  metadata: metadata,
480
556
  retry_policy: @config.rpcs.delete_alert_policy.retry_policy
481
- options.apply_defaults metadata: @config.metadata,
557
+
558
+ options.apply_defaults timeout: @config.timeout,
559
+ metadata: @config.metadata,
482
560
  retry_policy: @config.retry_policy
483
561
 
484
562
  @alert_policy_service_stub.call_rpc :delete_alert_policy, request, options: options do |response, operation|
@@ -546,6 +624,21 @@ module Google
546
624
  #
547
625
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
548
626
  #
627
+ # @example Basic example
628
+ # require "google/cloud/monitoring/v3"
629
+ #
630
+ # # Create a client object. The client can be reused for multiple calls.
631
+ # client = Google::Cloud::Monitoring::V3::AlertPolicyService::Client.new
632
+ #
633
+ # # Create a request. To set request fields, pass in keyword arguments.
634
+ # request = Google::Cloud::Monitoring::V3::UpdateAlertPolicyRequest.new
635
+ #
636
+ # # Call the update_alert_policy method.
637
+ # result = client.update_alert_policy request
638
+ #
639
+ # # The returned object is of type Google::Cloud::Monitoring::V3::AlertPolicy.
640
+ # p result
641
+ #
549
642
  def update_alert_policy request, options = nil
550
643
  raise ::ArgumentError, "request must be provided" if request.nil?
551
644
 
@@ -563,16 +656,20 @@ module Google
563
656
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
564
657
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
565
658
 
566
- header_params = {
567
- "alert_policy.name" => request.alert_policy.name
568
- }
659
+ header_params = {}
660
+ if request.alert_policy&.name
661
+ header_params["alert_policy.name"] = request.alert_policy.name
662
+ end
663
+
569
664
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
570
665
  metadata[:"x-goog-request-params"] ||= request_params_header
571
666
 
572
667
  options.apply_defaults timeout: @config.rpcs.update_alert_policy.timeout,
573
668
  metadata: metadata,
574
669
  retry_policy: @config.rpcs.update_alert_policy.retry_policy
575
- options.apply_defaults metadata: @config.metadata,
670
+
671
+ options.apply_defaults timeout: @config.timeout,
672
+ metadata: @config.metadata,
576
673
  retry_policy: @config.retry_policy
577
674
 
578
675
  @alert_policy_service_stub.call_rpc :update_alert_policy, request, options: options do |response, operation|
@@ -596,22 +693,21 @@ module Google
596
693
  # Configuration can be applied globally to all clients, or to a single client
597
694
  # on construction.
598
695
  #
599
- # # Examples
600
- #
601
- # To modify the global config, setting the timeout for list_alert_policies
602
- # to 20 seconds, and all remaining timeouts to 10 seconds:
603
- #
604
- # ::Google::Cloud::Monitoring::V3::AlertPolicyService::Client.configure do |config|
605
- # config.timeout = 10.0
606
- # config.rpcs.list_alert_policies.timeout = 20.0
607
- # end
608
- #
609
- # To apply the above configuration only to a new client:
610
- #
611
- # client = ::Google::Cloud::Monitoring::V3::AlertPolicyService::Client.new do |config|
612
- # config.timeout = 10.0
613
- # config.rpcs.list_alert_policies.timeout = 20.0
614
- # end
696
+ # @example
697
+ #
698
+ # # Modify the global config, setting the timeout for
699
+ # # list_alert_policies to 20 seconds,
700
+ # # and all remaining timeouts to 10 seconds.
701
+ # ::Google::Cloud::Monitoring::V3::AlertPolicyService::Client.configure do |config|
702
+ # config.timeout = 10.0
703
+ # config.rpcs.list_alert_policies.timeout = 20.0
704
+ # end
705
+ #
706
+ # # Apply the above configuration only to a new client.
707
+ # client = ::Google::Cloud::Monitoring::V3::AlertPolicyService::Client.new do |config|
708
+ # config.timeout = 10.0
709
+ # config.rpcs.list_alert_policies.timeout = 20.0
710
+ # end
615
711
  #
616
712
  # @!attribute [rw] endpoint
617
713
  # The hostname or hostname:port of the service endpoint.