google-cloud-monitoring-v3 0.5.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/AUTHENTICATION.md +7 -25
  4. data/lib/google/cloud/monitoring/v3/alert_policy_service/client.rb +106 -15
  5. data/lib/google/cloud/monitoring/v3/group_service/client.rb +132 -18
  6. data/lib/google/cloud/monitoring/v3/metric_service/client.rb +291 -24
  7. data/lib/google/cloud/monitoring/v3/notification_channel_service/client.rb +212 -30
  8. data/lib/google/cloud/monitoring/v3/query_service/client.rb +26 -3
  9. data/lib/google/cloud/monitoring/v3/service_monitoring_service/client.rb +212 -30
  10. data/lib/google/cloud/monitoring/v3/uptime_check_service/client.rb +127 -15
  11. data/lib/google/cloud/monitoring/v3/version.rb +1 -1
  12. data/lib/google/monitoring/v3/alert_pb.rb +3 -2
  13. data/lib/google/monitoring/v3/alert_service_pb.rb +2 -2
  14. data/lib/google/monitoring/v3/alert_service_services_pb.rb +1 -1
  15. data/lib/google/monitoring/v3/common_pb.rb +8 -2
  16. data/lib/google/monitoring/v3/group_pb.rb +1 -1
  17. data/lib/google/monitoring/v3/group_service_pb.rb +2 -2
  18. data/lib/google/monitoring/v3/group_service_services_pb.rb +1 -1
  19. data/lib/google/monitoring/v3/metric_pb.rb +2 -2
  20. data/lib/google/monitoring/v3/metric_service_pb.rb +2 -2
  21. data/lib/google/monitoring/v3/metric_service_services_pb.rb +13 -1
  22. data/lib/google/monitoring/v3/mutation_record_pb.rb +1 -1
  23. data/lib/google/monitoring/v3/notification_pb.rb +4 -2
  24. data/lib/google/monitoring/v3/notification_service_pb.rb +2 -2
  25. data/lib/google/monitoring/v3/notification_service_services_pb.rb +1 -1
  26. data/lib/google/monitoring/v3/query_service_pb.rb +2 -2
  27. data/lib/google/monitoring/v3/query_service_services_pb.rb +1 -1
  28. data/lib/google/monitoring/v3/service_pb.rb +3 -2
  29. data/lib/google/monitoring/v3/service_service_pb.rb +2 -2
  30. data/lib/google/monitoring/v3/service_service_services_pb.rb +1 -1
  31. data/lib/google/monitoring/v3/uptime_pb.rb +2 -2
  32. data/lib/google/monitoring/v3/uptime_service_pb.rb +2 -2
  33. data/lib/google/monitoring/v3/uptime_service_services_pb.rb +1 -1
  34. data/proto_docs/google/api/resource.rb +10 -71
  35. data/proto_docs/google/monitoring/v3/alert.rb +9 -5
  36. data/proto_docs/google/monitoring/v3/common.rb +25 -1
  37. data/proto_docs/google/monitoring/v3/notification.rb +4 -0
  38. metadata +3 -3
@@ -224,6 +224,27 @@ module Google
224
224
  #
225
225
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
226
226
  #
227
+ # @example Basic example
228
+ # require "google/cloud/monitoring/v3"
229
+ #
230
+ # # Create a client object. The client can be reused for multiple calls.
231
+ # client = Google::Cloud::Monitoring::V3::MetricService::Client.new
232
+ #
233
+ # # Create a request. To set request fields, pass in keyword arguments.
234
+ # request = Google::Cloud::Monitoring::V3::ListMonitoredResourceDescriptorsRequest.new
235
+ #
236
+ # # Call the list_monitored_resource_descriptors method.
237
+ # result = client.list_monitored_resource_descriptors request
238
+ #
239
+ # # The returned object is of type Gapic::PagedEnumerable. You can
240
+ # # iterate over all elements by calling #each, and the enumerable
241
+ # # will lazily make API calls to fetch subsequent pages. Other
242
+ # # methods are also available for managing paging directly.
243
+ # result.each do |response|
244
+ # # Each element is of type ::Google::Api::MonitoredResourceDescriptor.
245
+ # p response
246
+ # end
247
+ #
227
248
  def list_monitored_resource_descriptors request, options = nil
228
249
  raise ::ArgumentError, "request must be provided" if request.nil?
229
250
 
@@ -241,9 +262,11 @@ module Google
241
262
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
242
263
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
243
264
 
244
- header_params = {
245
- "name" => request.name
246
- }
265
+ header_params = {}
266
+ if request.name
267
+ header_params["name"] = request.name
268
+ end
269
+
247
270
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
248
271
  metadata[:"x-goog-request-params"] ||= request_params_header
249
272
 
@@ -298,6 +321,21 @@ module Google
298
321
  #
299
322
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
300
323
  #
324
+ # @example Basic example
325
+ # require "google/cloud/monitoring/v3"
326
+ #
327
+ # # Create a client object. The client can be reused for multiple calls.
328
+ # client = Google::Cloud::Monitoring::V3::MetricService::Client.new
329
+ #
330
+ # # Create a request. To set request fields, pass in keyword arguments.
331
+ # request = Google::Cloud::Monitoring::V3::GetMonitoredResourceDescriptorRequest.new
332
+ #
333
+ # # Call the get_monitored_resource_descriptor method.
334
+ # result = client.get_monitored_resource_descriptor request
335
+ #
336
+ # # The returned object is of type Google::Api::MonitoredResourceDescriptor.
337
+ # p result
338
+ #
301
339
  def get_monitored_resource_descriptor request, options = nil
302
340
  raise ::ArgumentError, "request must be provided" if request.nil?
303
341
 
@@ -315,9 +353,11 @@ module Google
315
353
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
316
354
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
317
355
 
318
- header_params = {
319
- "name" => request.name
320
- }
356
+ header_params = {}
357
+ if request.name
358
+ header_params["name"] = request.name
359
+ end
360
+
321
361
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
322
362
  metadata[:"x-goog-request-params"] ||= request_params_header
323
363
 
@@ -384,6 +424,27 @@ module Google
384
424
  #
385
425
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
386
426
  #
427
+ # @example Basic example
428
+ # require "google/cloud/monitoring/v3"
429
+ #
430
+ # # Create a client object. The client can be reused for multiple calls.
431
+ # client = Google::Cloud::Monitoring::V3::MetricService::Client.new
432
+ #
433
+ # # Create a request. To set request fields, pass in keyword arguments.
434
+ # request = Google::Cloud::Monitoring::V3::ListMetricDescriptorsRequest.new
435
+ #
436
+ # # Call the list_metric_descriptors method.
437
+ # result = client.list_metric_descriptors request
438
+ #
439
+ # # The returned object is of type Gapic::PagedEnumerable. You can
440
+ # # iterate over all elements by calling #each, and the enumerable
441
+ # # will lazily make API calls to fetch subsequent pages. Other
442
+ # # methods are also available for managing paging directly.
443
+ # result.each do |response|
444
+ # # Each element is of type ::Google::Api::MetricDescriptor.
445
+ # p response
446
+ # end
447
+ #
387
448
  def list_metric_descriptors request, options = nil
388
449
  raise ::ArgumentError, "request must be provided" if request.nil?
389
450
 
@@ -401,9 +462,11 @@ module Google
401
462
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
402
463
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
403
464
 
404
- header_params = {
405
- "name" => request.name
406
- }
465
+ header_params = {}
466
+ if request.name
467
+ header_params["name"] = request.name
468
+ end
469
+
407
470
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
408
471
  metadata[:"x-goog-request-params"] ||= request_params_header
409
472
 
@@ -458,6 +521,21 @@ module Google
458
521
  #
459
522
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
460
523
  #
524
+ # @example Basic example
525
+ # require "google/cloud/monitoring/v3"
526
+ #
527
+ # # Create a client object. The client can be reused for multiple calls.
528
+ # client = Google::Cloud::Monitoring::V3::MetricService::Client.new
529
+ #
530
+ # # Create a request. To set request fields, pass in keyword arguments.
531
+ # request = Google::Cloud::Monitoring::V3::GetMetricDescriptorRequest.new
532
+ #
533
+ # # Call the get_metric_descriptor method.
534
+ # result = client.get_metric_descriptor request
535
+ #
536
+ # # The returned object is of type Google::Api::MetricDescriptor.
537
+ # p result
538
+ #
461
539
  def get_metric_descriptor request, options = nil
462
540
  raise ::ArgumentError, "request must be provided" if request.nil?
463
541
 
@@ -475,9 +553,11 @@ module Google
475
553
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
476
554
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
477
555
 
478
- header_params = {
479
- "name" => request.name
480
- }
556
+ header_params = {}
557
+ if request.name
558
+ header_params["name"] = request.name
559
+ end
560
+
481
561
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
482
562
  metadata[:"x-goog-request-params"] ||= request_params_header
483
563
 
@@ -499,6 +579,8 @@ module Google
499
579
 
500
580
  ##
501
581
  # Creates a new metric descriptor.
582
+ # The creation is executed asynchronously and callers may check the returned
583
+ # operation to track its progress.
502
584
  # User-created metric descriptors define
503
585
  # [custom metrics](https://cloud.google.com/monitoring/custom-metrics).
504
586
  #
@@ -534,6 +616,21 @@ module Google
534
616
  #
535
617
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
536
618
  #
619
+ # @example Basic example
620
+ # require "google/cloud/monitoring/v3"
621
+ #
622
+ # # Create a client object. The client can be reused for multiple calls.
623
+ # client = Google::Cloud::Monitoring::V3::MetricService::Client.new
624
+ #
625
+ # # Create a request. To set request fields, pass in keyword arguments.
626
+ # request = Google::Cloud::Monitoring::V3::CreateMetricDescriptorRequest.new
627
+ #
628
+ # # Call the create_metric_descriptor method.
629
+ # result = client.create_metric_descriptor request
630
+ #
631
+ # # The returned object is of type Google::Api::MetricDescriptor.
632
+ # p result
633
+ #
537
634
  def create_metric_descriptor request, options = nil
538
635
  raise ::ArgumentError, "request must be provided" if request.nil?
539
636
 
@@ -551,9 +648,11 @@ module Google
551
648
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
552
649
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
553
650
 
554
- header_params = {
555
- "name" => request.name
556
- }
651
+ header_params = {}
652
+ if request.name
653
+ header_params["name"] = request.name
654
+ end
655
+
557
656
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
558
657
  metadata[:"x-goog-request-params"] ||= request_params_header
559
658
 
@@ -609,6 +708,21 @@ module Google
609
708
  #
610
709
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
611
710
  #
711
+ # @example Basic example
712
+ # require "google/cloud/monitoring/v3"
713
+ #
714
+ # # Create a client object. The client can be reused for multiple calls.
715
+ # client = Google::Cloud::Monitoring::V3::MetricService::Client.new
716
+ #
717
+ # # Create a request. To set request fields, pass in keyword arguments.
718
+ # request = Google::Cloud::Monitoring::V3::DeleteMetricDescriptorRequest.new
719
+ #
720
+ # # Call the delete_metric_descriptor method.
721
+ # result = client.delete_metric_descriptor request
722
+ #
723
+ # # The returned object is of type Google::Protobuf::Empty.
724
+ # p result
725
+ #
612
726
  def delete_metric_descriptor request, options = nil
613
727
  raise ::ArgumentError, "request must be provided" if request.nil?
614
728
 
@@ -626,9 +740,11 @@ module Google
626
740
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
627
741
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
628
742
 
629
- header_params = {
630
- "name" => request.name
631
- }
743
+ header_params = {}
744
+ if request.name
745
+ header_params["name"] = request.name
746
+ end
747
+
632
748
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
633
749
  metadata[:"x-goog-request-params"] ||= request_params_header
634
750
 
@@ -718,6 +834,27 @@ module Google
718
834
  #
719
835
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
720
836
  #
837
+ # @example Basic example
838
+ # require "google/cloud/monitoring/v3"
839
+ #
840
+ # # Create a client object. The client can be reused for multiple calls.
841
+ # client = Google::Cloud::Monitoring::V3::MetricService::Client.new
842
+ #
843
+ # # Create a request. To set request fields, pass in keyword arguments.
844
+ # request = Google::Cloud::Monitoring::V3::ListTimeSeriesRequest.new
845
+ #
846
+ # # Call the list_time_series method.
847
+ # result = client.list_time_series request
848
+ #
849
+ # # The returned object is of type Gapic::PagedEnumerable. You can
850
+ # # iterate over all elements by calling #each, and the enumerable
851
+ # # will lazily make API calls to fetch subsequent pages. Other
852
+ # # methods are also available for managing paging directly.
853
+ # result.each do |response|
854
+ # # Each element is of type ::Google::Cloud::Monitoring::V3::TimeSeries.
855
+ # p response
856
+ # end
857
+ #
721
858
  def list_time_series request, options = nil
722
859
  raise ::ArgumentError, "request must be provided" if request.nil?
723
860
 
@@ -735,9 +872,11 @@ module Google
735
872
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
736
873
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
737
874
 
738
- header_params = {
739
- "name" => request.name
740
- }
875
+ header_params = {}
876
+ if request.name
877
+ header_params["name"] = request.name
878
+ end
879
+
741
880
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
742
881
  metadata[:"x-goog-request-params"] ||= request_params_header
743
882
 
@@ -801,6 +940,21 @@ module Google
801
940
  #
802
941
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
803
942
  #
943
+ # @example Basic example
944
+ # require "google/cloud/monitoring/v3"
945
+ #
946
+ # # Create a client object. The client can be reused for multiple calls.
947
+ # client = Google::Cloud::Monitoring::V3::MetricService::Client.new
948
+ #
949
+ # # Create a request. To set request fields, pass in keyword arguments.
950
+ # request = Google::Cloud::Monitoring::V3::CreateTimeSeriesRequest.new
951
+ #
952
+ # # Call the create_time_series method.
953
+ # result = client.create_time_series request
954
+ #
955
+ # # The returned object is of type Google::Protobuf::Empty.
956
+ # p result
957
+ #
804
958
  def create_time_series request, options = nil
805
959
  raise ::ArgumentError, "request must be provided" if request.nil?
806
960
 
@@ -818,9 +972,11 @@ module Google
818
972
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
819
973
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
820
974
 
821
- header_params = {
822
- "name" => request.name
823
- }
975
+ header_params = {}
976
+ if request.name
977
+ header_params["name"] = request.name
978
+ end
979
+
824
980
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
825
981
  metadata[:"x-goog-request-params"] ||= request_params_header
826
982
 
@@ -840,6 +996,110 @@ module Google
840
996
  raise ::Google::Cloud::Error.from_error(e)
841
997
  end
842
998
 
999
+ ##
1000
+ # Creates or adds data to one or more service time series. A service time
1001
+ # series is a time series for a metric from a Google Cloud service. The
1002
+ # response is empty if all time series in the request were written. If any
1003
+ # time series could not be written, a corresponding failure message is
1004
+ # included in the error response. This endpoint rejects writes to
1005
+ # user-defined metrics.
1006
+ # This method is only for use by Google Cloud services. Use
1007
+ # {::Google::Cloud::Monitoring::V3::MetricService::Client#create_time_series projects.timeSeries.create}
1008
+ # instead.
1009
+ #
1010
+ # @overload create_service_time_series(request, options = nil)
1011
+ # Pass arguments to `create_service_time_series` via a request object, either of type
1012
+ # {::Google::Cloud::Monitoring::V3::CreateTimeSeriesRequest} or an equivalent Hash.
1013
+ #
1014
+ # @param request [::Google::Cloud::Monitoring::V3::CreateTimeSeriesRequest, ::Hash]
1015
+ # A request object representing the call parameters. Required. To specify no
1016
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1017
+ # @param options [::Gapic::CallOptions, ::Hash]
1018
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1019
+ #
1020
+ # @overload create_service_time_series(name: nil, time_series: nil)
1021
+ # Pass arguments to `create_service_time_series` via keyword arguments. Note that at
1022
+ # least one keyword argument is required. To specify no parameters, or to keep all
1023
+ # the default parameter values, pass an empty Hash as a request object (see above).
1024
+ #
1025
+ # @param name [::String]
1026
+ # Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on
1027
+ # which to execute the request. The format is:
1028
+ #
1029
+ # projects/[PROJECT_ID_OR_NUMBER]
1030
+ # @param time_series [::Array<::Google::Cloud::Monitoring::V3::TimeSeries, ::Hash>]
1031
+ # Required. The new data to be added to a list of time series.
1032
+ # Adds at most one data point to each of several time series. The new data
1033
+ # point must be more recent than any other point in its time series. Each
1034
+ # `TimeSeries` value must fully specify a unique time series by supplying
1035
+ # all label values for the metric and the monitored resource.
1036
+ #
1037
+ # The maximum number of `TimeSeries` objects per `Create` request is 200.
1038
+ #
1039
+ # @yield [response, operation] Access the result along with the RPC operation
1040
+ # @yieldparam response [::Google::Protobuf::Empty]
1041
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1042
+ #
1043
+ # @return [::Google::Protobuf::Empty]
1044
+ #
1045
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1046
+ #
1047
+ # @example Basic example
1048
+ # require "google/cloud/monitoring/v3"
1049
+ #
1050
+ # # Create a client object. The client can be reused for multiple calls.
1051
+ # client = Google::Cloud::Monitoring::V3::MetricService::Client.new
1052
+ #
1053
+ # # Create a request. To set request fields, pass in keyword arguments.
1054
+ # request = Google::Cloud::Monitoring::V3::CreateTimeSeriesRequest.new
1055
+ #
1056
+ # # Call the create_service_time_series method.
1057
+ # result = client.create_service_time_series request
1058
+ #
1059
+ # # The returned object is of type Google::Protobuf::Empty.
1060
+ # p result
1061
+ #
1062
+ def create_service_time_series request, options = nil
1063
+ raise ::ArgumentError, "request must be provided" if request.nil?
1064
+
1065
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::CreateTimeSeriesRequest
1066
+
1067
+ # Converts hash and nil to an options object
1068
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1069
+
1070
+ # Customize the options with defaults
1071
+ metadata = @config.rpcs.create_service_time_series.metadata.to_h
1072
+
1073
+ # Set x-goog-api-client and x-goog-user-project headers
1074
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1075
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1076
+ gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
1077
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1078
+
1079
+ header_params = {}
1080
+ if request.name
1081
+ header_params["name"] = request.name
1082
+ end
1083
+
1084
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1085
+ metadata[:"x-goog-request-params"] ||= request_params_header
1086
+
1087
+ options.apply_defaults timeout: @config.rpcs.create_service_time_series.timeout,
1088
+ metadata: metadata,
1089
+ retry_policy: @config.rpcs.create_service_time_series.retry_policy
1090
+
1091
+ options.apply_defaults timeout: @config.timeout,
1092
+ metadata: @config.metadata,
1093
+ retry_policy: @config.retry_policy
1094
+
1095
+ @metric_service_stub.call_rpc :create_service_time_series, request, options: options do |response, operation|
1096
+ yield response, operation if block_given?
1097
+ return response
1098
+ end
1099
+ rescue ::GRPC::BadStatus => e
1100
+ raise ::Google::Cloud::Error.from_error(e)
1101
+ end
1102
+
843
1103
  ##
844
1104
  # Configuration class for the MetricService API.
845
1105
  #
@@ -1015,6 +1275,11 @@ module Google
1015
1275
  # @return [::Gapic::Config::Method]
1016
1276
  #
1017
1277
  attr_reader :create_time_series
1278
+ ##
1279
+ # RPC-specific configuration for `create_service_time_series`
1280
+ # @return [::Gapic::Config::Method]
1281
+ #
1282
+ attr_reader :create_service_time_series
1018
1283
 
1019
1284
  # @private
1020
1285
  def initialize parent_rpcs = nil
@@ -1034,6 +1299,8 @@ module Google
1034
1299
  @list_time_series = ::Gapic::Config::Method.new list_time_series_config
1035
1300
  create_time_series_config = parent_rpcs.create_time_series if parent_rpcs.respond_to? :create_time_series
1036
1301
  @create_time_series = ::Gapic::Config::Method.new create_time_series_config
1302
+ create_service_time_series_config = parent_rpcs.create_service_time_series if parent_rpcs.respond_to? :create_service_time_series
1303
+ @create_service_time_series = ::Gapic::Config::Method.new create_service_time_series_config
1037
1304
 
1038
1305
  yield self if block_given?
1039
1306
  end