google-cloud-monitoring-v3 0.4.2 → 0.6.1

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.
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
@@ -52,13 +52,12 @@ module Google
52
52
  # See {::Google::Cloud::Monitoring::V3::GroupService::Client::Configuration}
53
53
  # for a description of the configuration fields.
54
54
  #
55
- # ## Example
55
+ # @example
56
56
  #
57
- # To modify the configuration for all GroupService clients:
58
- #
59
- # ::Google::Cloud::Monitoring::V3::GroupService::Client.configure do |config|
60
- # config.timeout = 10.0
61
- # end
57
+ # # Modify the configuration for all GroupService clients
58
+ # ::Google::Cloud::Monitoring::V3::GroupService::Client.configure do |config|
59
+ # config.timeout = 10.0
60
+ # end
62
61
  #
63
62
  # @yield [config] Configure the Client client.
64
63
  # @yieldparam config [Client::Configuration]
@@ -78,29 +77,29 @@ module Google
78
77
 
79
78
  default_config.rpcs.list_groups.timeout = 30.0
80
79
  default_config.rpcs.list_groups.retry_policy = {
81
- initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
80
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
82
81
  }
83
82
 
84
83
  default_config.rpcs.get_group.timeout = 30.0
85
84
  default_config.rpcs.get_group.retry_policy = {
86
- initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
85
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
87
86
  }
88
87
 
89
88
  default_config.rpcs.create_group.timeout = 30.0
90
89
 
91
- default_config.rpcs.update_group.timeout = 30.0
90
+ default_config.rpcs.update_group.timeout = 180.0
92
91
  default_config.rpcs.update_group.retry_policy = {
93
- initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
92
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
94
93
  }
95
94
 
96
95
  default_config.rpcs.delete_group.timeout = 30.0
97
96
  default_config.rpcs.delete_group.retry_policy = {
98
- initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
97
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
99
98
  }
100
99
 
101
100
  default_config.rpcs.list_group_members.timeout = 30.0
102
101
  default_config.rpcs.list_group_members.retry_policy = {
103
- initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
102
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
104
103
  }
105
104
 
106
105
  default_config
@@ -132,19 +131,15 @@ module Google
132
131
  ##
133
132
  # Create a new GroupService client object.
134
133
  #
135
- # ## Examples
136
- #
137
- # To create a new GroupService client with the default
138
- # configuration:
134
+ # @example
139
135
  #
140
- # client = ::Google::Cloud::Monitoring::V3::GroupService::Client.new
136
+ # # Create a client using the default configuration
137
+ # client = ::Google::Cloud::Monitoring::V3::GroupService::Client.new
141
138
  #
142
- # To create a new GroupService client with a custom
143
- # configuration:
144
- #
145
- # client = ::Google::Cloud::Monitoring::V3::GroupService::Client.new do |config|
146
- # config.timeout = 10.0
147
- # end
139
+ # # Create a client using a custom configuration
140
+ # client = ::Google::Cloud::Monitoring::V3::GroupService::Client.new do |config|
141
+ # config.timeout = 10.0
142
+ # end
148
143
  #
149
144
  # @yield [config] Configure the GroupService client.
150
145
  # @yieldparam config [Client::Configuration]
@@ -164,10 +159,9 @@ module Google
164
159
 
165
160
  # Create credentials
166
161
  credentials = @config.credentials
167
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
162
+ # Use self-signed JWT if the endpoint is unchanged from default,
168
163
  # but only if the default endpoint does not have a region prefix.
169
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
170
- @config.endpoint == Client.configure.endpoint &&
164
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
171
165
  !@config.endpoint.split(".").first.include?("-")
172
166
  credentials ||= Credentials.default scope: @config.scope,
173
167
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -207,7 +201,8 @@ module Google
207
201
  # the default parameter values, pass an empty Hash as a request object (see above).
208
202
  #
209
203
  # @param name [::String]
210
- # Required. The project whose groups are to be listed. The format is:
204
+ # Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name)
205
+ # whose groups are to be listed. The format is:
211
206
  #
212
207
  # projects/[PROJECT_ID_OR_NUMBER]
213
208
  # @param children_of_group [::String]
@@ -249,6 +244,27 @@ module Google
249
244
  #
250
245
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
251
246
  #
247
+ # @example Basic example
248
+ # require "google/cloud/monitoring/v3"
249
+ #
250
+ # # Create a client object. The client can be reused for multiple calls.
251
+ # client = Google::Cloud::Monitoring::V3::GroupService::Client.new
252
+ #
253
+ # # Create a request. To set request fields, pass in keyword arguments.
254
+ # request = Google::Cloud::Monitoring::V3::ListGroupsRequest.new
255
+ #
256
+ # # Call the list_groups method.
257
+ # result = client.list_groups request
258
+ #
259
+ # # The returned object is of type Gapic::PagedEnumerable. You can
260
+ # # iterate over all elements by calling #each, and the enumerable
261
+ # # will lazily make API calls to fetch subsequent pages. Other
262
+ # # methods are also available for managing paging directly.
263
+ # result.each do |response|
264
+ # # Each element is of type ::Google::Cloud::Monitoring::V3::Group.
265
+ # p response
266
+ # end
267
+ #
252
268
  def list_groups request, options = nil
253
269
  raise ::ArgumentError, "request must be provided" if request.nil?
254
270
 
@@ -266,16 +282,20 @@ module Google
266
282
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
267
283
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
268
284
 
269
- header_params = {
270
- "name" => request.name
271
- }
285
+ header_params = {}
286
+ if request.name
287
+ header_params["name"] = request.name
288
+ end
289
+
272
290
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
273
291
  metadata[:"x-goog-request-params"] ||= request_params_header
274
292
 
275
293
  options.apply_defaults timeout: @config.rpcs.list_groups.timeout,
276
294
  metadata: metadata,
277
295
  retry_policy: @config.rpcs.list_groups.retry_policy
278
- options.apply_defaults metadata: @config.metadata,
296
+
297
+ options.apply_defaults timeout: @config.timeout,
298
+ metadata: @config.metadata,
279
299
  retry_policy: @config.retry_policy
280
300
 
281
301
  @group_service_stub.call_rpc :list_groups, request, options: options do |response, operation|
@@ -318,6 +338,21 @@ module Google
318
338
  #
319
339
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
320
340
  #
341
+ # @example Basic example
342
+ # require "google/cloud/monitoring/v3"
343
+ #
344
+ # # Create a client object. The client can be reused for multiple calls.
345
+ # client = Google::Cloud::Monitoring::V3::GroupService::Client.new
346
+ #
347
+ # # Create a request. To set request fields, pass in keyword arguments.
348
+ # request = Google::Cloud::Monitoring::V3::GetGroupRequest.new
349
+ #
350
+ # # Call the get_group method.
351
+ # result = client.get_group request
352
+ #
353
+ # # The returned object is of type Google::Cloud::Monitoring::V3::Group.
354
+ # p result
355
+ #
321
356
  def get_group request, options = nil
322
357
  raise ::ArgumentError, "request must be provided" if request.nil?
323
358
 
@@ -335,16 +370,20 @@ module Google
335
370
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
336
371
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
337
372
 
338
- header_params = {
339
- "name" => request.name
340
- }
373
+ header_params = {}
374
+ if request.name
375
+ header_params["name"] = request.name
376
+ end
377
+
341
378
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
342
379
  metadata[:"x-goog-request-params"] ||= request_params_header
343
380
 
344
381
  options.apply_defaults timeout: @config.rpcs.get_group.timeout,
345
382
  metadata: metadata,
346
383
  retry_policy: @config.rpcs.get_group.retry_policy
347
- options.apply_defaults metadata: @config.metadata,
384
+
385
+ options.apply_defaults timeout: @config.timeout,
386
+ metadata: @config.metadata,
348
387
  retry_policy: @config.retry_policy
349
388
 
350
389
  @group_service_stub.call_rpc :get_group, request, options: options do |response, operation|
@@ -374,7 +413,8 @@ module Google
374
413
  # the default parameter values, pass an empty Hash as a request object (see above).
375
414
  #
376
415
  # @param name [::String]
377
- # Required. The project in which to create the group. The format is:
416
+ # Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) in
417
+ # which to create the group. The format is:
378
418
  #
379
419
  # projects/[PROJECT_ID_OR_NUMBER]
380
420
  # @param group [::Google::Cloud::Monitoring::V3::Group, ::Hash]
@@ -391,6 +431,21 @@ module Google
391
431
  #
392
432
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
393
433
  #
434
+ # @example Basic example
435
+ # require "google/cloud/monitoring/v3"
436
+ #
437
+ # # Create a client object. The client can be reused for multiple calls.
438
+ # client = Google::Cloud::Monitoring::V3::GroupService::Client.new
439
+ #
440
+ # # Create a request. To set request fields, pass in keyword arguments.
441
+ # request = Google::Cloud::Monitoring::V3::CreateGroupRequest.new
442
+ #
443
+ # # Call the create_group method.
444
+ # result = client.create_group request
445
+ #
446
+ # # The returned object is of type Google::Cloud::Monitoring::V3::Group.
447
+ # p result
448
+ #
394
449
  def create_group request, options = nil
395
450
  raise ::ArgumentError, "request must be provided" if request.nil?
396
451
 
@@ -408,16 +463,20 @@ module Google
408
463
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
409
464
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
410
465
 
411
- header_params = {
412
- "name" => request.name
413
- }
466
+ header_params = {}
467
+ if request.name
468
+ header_params["name"] = request.name
469
+ end
470
+
414
471
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
415
472
  metadata[:"x-goog-request-params"] ||= request_params_header
416
473
 
417
474
  options.apply_defaults timeout: @config.rpcs.create_group.timeout,
418
475
  metadata: metadata,
419
476
  retry_policy: @config.rpcs.create_group.retry_policy
420
- options.apply_defaults metadata: @config.metadata,
477
+
478
+ options.apply_defaults timeout: @config.timeout,
479
+ metadata: @config.metadata,
421
480
  retry_policy: @config.retry_policy
422
481
 
423
482
  @group_service_stub.call_rpc :create_group, request, options: options do |response, operation|
@@ -461,6 +520,21 @@ module Google
461
520
  #
462
521
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
463
522
  #
523
+ # @example Basic example
524
+ # require "google/cloud/monitoring/v3"
525
+ #
526
+ # # Create a client object. The client can be reused for multiple calls.
527
+ # client = Google::Cloud::Monitoring::V3::GroupService::Client.new
528
+ #
529
+ # # Create a request. To set request fields, pass in keyword arguments.
530
+ # request = Google::Cloud::Monitoring::V3::UpdateGroupRequest.new
531
+ #
532
+ # # Call the update_group method.
533
+ # result = client.update_group request
534
+ #
535
+ # # The returned object is of type Google::Cloud::Monitoring::V3::Group.
536
+ # p result
537
+ #
464
538
  def update_group request, options = nil
465
539
  raise ::ArgumentError, "request must be provided" if request.nil?
466
540
 
@@ -478,16 +552,20 @@ module Google
478
552
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
479
553
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
480
554
 
481
- header_params = {
482
- "group.name" => request.group.name
483
- }
555
+ header_params = {}
556
+ if request.group&.name
557
+ header_params["group.name"] = request.group.name
558
+ end
559
+
484
560
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
485
561
  metadata[:"x-goog-request-params"] ||= request_params_header
486
562
 
487
563
  options.apply_defaults timeout: @config.rpcs.update_group.timeout,
488
564
  metadata: metadata,
489
565
  retry_policy: @config.rpcs.update_group.retry_policy
490
- options.apply_defaults metadata: @config.metadata,
566
+
567
+ options.apply_defaults timeout: @config.timeout,
568
+ metadata: @config.metadata,
491
569
  retry_policy: @config.retry_policy
492
570
 
493
571
  @group_service_stub.call_rpc :update_group, request, options: options do |response, operation|
@@ -533,6 +611,21 @@ module Google
533
611
  #
534
612
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
535
613
  #
614
+ # @example Basic example
615
+ # require "google/cloud/monitoring/v3"
616
+ #
617
+ # # Create a client object. The client can be reused for multiple calls.
618
+ # client = Google::Cloud::Monitoring::V3::GroupService::Client.new
619
+ #
620
+ # # Create a request. To set request fields, pass in keyword arguments.
621
+ # request = Google::Cloud::Monitoring::V3::DeleteGroupRequest.new
622
+ #
623
+ # # Call the delete_group method.
624
+ # result = client.delete_group request
625
+ #
626
+ # # The returned object is of type Google::Protobuf::Empty.
627
+ # p result
628
+ #
536
629
  def delete_group request, options = nil
537
630
  raise ::ArgumentError, "request must be provided" if request.nil?
538
631
 
@@ -550,16 +643,20 @@ module Google
550
643
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
551
644
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
552
645
 
553
- header_params = {
554
- "name" => request.name
555
- }
646
+ header_params = {}
647
+ if request.name
648
+ header_params["name"] = request.name
649
+ end
650
+
556
651
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
557
652
  metadata[:"x-goog-request-params"] ||= request_params_header
558
653
 
559
654
  options.apply_defaults timeout: @config.rpcs.delete_group.timeout,
560
655
  metadata: metadata,
561
656
  retry_policy: @config.rpcs.delete_group.retry_policy
562
- options.apply_defaults metadata: @config.metadata,
657
+
658
+ options.apply_defaults timeout: @config.timeout,
659
+ metadata: @config.metadata,
563
660
  retry_policy: @config.retry_policy
564
661
 
565
662
  @group_service_stub.call_rpc :delete_group, request, options: options do |response, operation|
@@ -621,6 +718,27 @@ module Google
621
718
  #
622
719
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
623
720
  #
721
+ # @example Basic example
722
+ # require "google/cloud/monitoring/v3"
723
+ #
724
+ # # Create a client object. The client can be reused for multiple calls.
725
+ # client = Google::Cloud::Monitoring::V3::GroupService::Client.new
726
+ #
727
+ # # Create a request. To set request fields, pass in keyword arguments.
728
+ # request = Google::Cloud::Monitoring::V3::ListGroupMembersRequest.new
729
+ #
730
+ # # Call the list_group_members method.
731
+ # result = client.list_group_members request
732
+ #
733
+ # # The returned object is of type Gapic::PagedEnumerable. You can
734
+ # # iterate over all elements by calling #each, and the enumerable
735
+ # # will lazily make API calls to fetch subsequent pages. Other
736
+ # # methods are also available for managing paging directly.
737
+ # result.each do |response|
738
+ # # Each element is of type ::Google::Api::MonitoredResource.
739
+ # p response
740
+ # end
741
+ #
624
742
  def list_group_members request, options = nil
625
743
  raise ::ArgumentError, "request must be provided" if request.nil?
626
744
 
@@ -638,16 +756,20 @@ module Google
638
756
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
639
757
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
640
758
 
641
- header_params = {
642
- "name" => request.name
643
- }
759
+ header_params = {}
760
+ if request.name
761
+ header_params["name"] = request.name
762
+ end
763
+
644
764
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
645
765
  metadata[:"x-goog-request-params"] ||= request_params_header
646
766
 
647
767
  options.apply_defaults timeout: @config.rpcs.list_group_members.timeout,
648
768
  metadata: metadata,
649
769
  retry_policy: @config.rpcs.list_group_members.retry_policy
650
- options.apply_defaults metadata: @config.metadata,
770
+
771
+ options.apply_defaults timeout: @config.timeout,
772
+ metadata: @config.metadata,
651
773
  retry_policy: @config.retry_policy
652
774
 
653
775
  @group_service_stub.call_rpc :list_group_members, request, options: options do |response, operation|
@@ -672,22 +794,21 @@ module Google
672
794
  # Configuration can be applied globally to all clients, or to a single client
673
795
  # on construction.
674
796
  #
675
- # # Examples
676
- #
677
- # To modify the global config, setting the timeout for list_groups
678
- # to 20 seconds, and all remaining timeouts to 10 seconds:
679
- #
680
- # ::Google::Cloud::Monitoring::V3::GroupService::Client.configure do |config|
681
- # config.timeout = 10.0
682
- # config.rpcs.list_groups.timeout = 20.0
683
- # end
684
- #
685
- # To apply the above configuration only to a new client:
686
- #
687
- # client = ::Google::Cloud::Monitoring::V3::GroupService::Client.new do |config|
688
- # config.timeout = 10.0
689
- # config.rpcs.list_groups.timeout = 20.0
690
- # end
797
+ # @example
798
+ #
799
+ # # Modify the global config, setting the timeout for
800
+ # # list_groups to 20 seconds,
801
+ # # and all remaining timeouts to 10 seconds.
802
+ # ::Google::Cloud::Monitoring::V3::GroupService::Client.configure do |config|
803
+ # config.timeout = 10.0
804
+ # config.rpcs.list_groups.timeout = 20.0
805
+ # end
806
+ #
807
+ # # Apply the above configuration only to a new client.
808
+ # client = ::Google::Cloud::Monitoring::V3::GroupService::Client.new do |config|
809
+ # config.timeout = 10.0
810
+ # config.rpcs.list_groups.timeout = 20.0
811
+ # end
691
812
  #
692
813
  # @!attribute [rw] endpoint
693
814
  # The hostname or hostname:port of the service endpoint.