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
@@ -42,13 +42,12 @@ module Google
42
42
  # See {::Google::Cloud::Monitoring::V3::MetricService::Client::Configuration}
43
43
  # for a description of the configuration fields.
44
44
  #
45
- # ## Example
45
+ # @example
46
46
  #
47
- # To modify the configuration for all MetricService clients:
48
- #
49
- # ::Google::Cloud::Monitoring::V3::MetricService::Client.configure do |config|
50
- # config.timeout = 10.0
51
- # end
47
+ # # Modify the configuration for all MetricService clients
48
+ # ::Google::Cloud::Monitoring::V3::MetricService::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
52
51
  #
53
52
  # @yield [config] Configure the Client client.
54
53
  # @yieldparam config [Client::Configuration]
@@ -68,34 +67,34 @@ module Google
68
67
 
69
68
  default_config.rpcs.list_monitored_resource_descriptors.timeout = 30.0
70
69
  default_config.rpcs.list_monitored_resource_descriptors.retry_policy = {
71
- initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
70
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
72
71
  }
73
72
 
74
73
  default_config.rpcs.get_monitored_resource_descriptor.timeout = 30.0
75
74
  default_config.rpcs.get_monitored_resource_descriptor.retry_policy = {
76
- initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
75
+ initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
77
76
  }
78
77
 
79
78
  default_config.rpcs.list_metric_descriptors.timeout = 30.0
80
79
  default_config.rpcs.list_metric_descriptors.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_metric_descriptor.timeout = 30.0
85
84
  default_config.rpcs.get_metric_descriptor.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_metric_descriptor.timeout = 12.0
90
89
 
91
90
  default_config.rpcs.delete_metric_descriptor.timeout = 30.0
92
91
  default_config.rpcs.delete_metric_descriptor.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
- default_config.rpcs.list_time_series.timeout = 30.0
95
+ default_config.rpcs.list_time_series.timeout = 90.0
97
96
  default_config.rpcs.list_time_series.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.create_time_series.timeout = 12.0
@@ -129,19 +128,15 @@ module Google
129
128
  ##
130
129
  # Create a new MetricService client object.
131
130
  #
132
- # ## Examples
133
- #
134
- # To create a new MetricService client with the default
135
- # configuration:
136
- #
137
- # client = ::Google::Cloud::Monitoring::V3::MetricService::Client.new
131
+ # @example
138
132
  #
139
- # To create a new MetricService client with a custom
140
- # configuration:
133
+ # # Create a client using the default configuration
134
+ # client = ::Google::Cloud::Monitoring::V3::MetricService::Client.new
141
135
  #
142
- # client = ::Google::Cloud::Monitoring::V3::MetricService::Client.new do |config|
143
- # config.timeout = 10.0
144
- # end
136
+ # # Create a client using a custom configuration
137
+ # client = ::Google::Cloud::Monitoring::V3::MetricService::Client.new do |config|
138
+ # config.timeout = 10.0
139
+ # end
145
140
  #
146
141
  # @yield [config] Configure the MetricService client.
147
142
  # @yieldparam config [Client::Configuration]
@@ -161,10 +156,9 @@ module Google
161
156
 
162
157
  # Create credentials
163
158
  credentials = @config.credentials
164
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
159
+ # Use self-signed JWT if the endpoint is unchanged from default,
165
160
  # but only if the default endpoint does not have a region prefix.
166
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
167
- @config.endpoint == Client.configure.endpoint &&
161
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
168
162
  !@config.endpoint.split(".").first.include?("-")
169
163
  credentials ||= Credentials.default scope: @config.scope,
170
164
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -204,7 +198,8 @@ module Google
204
198
  # the default parameter values, pass an empty Hash as a request object (see above).
205
199
  #
206
200
  # @param name [::String]
207
- # Required. The project on which to execute the request. The format is:
201
+ # Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on
202
+ # which to execute the request. The format is:
208
203
  #
209
204
  # projects/[PROJECT_ID_OR_NUMBER]
210
205
  # @param filter [::String]
@@ -229,6 +224,27 @@ module Google
229
224
  #
230
225
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
231
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
+ #
232
248
  def list_monitored_resource_descriptors request, options = nil
233
249
  raise ::ArgumentError, "request must be provided" if request.nil?
234
250
 
@@ -246,16 +262,20 @@ module Google
246
262
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
247
263
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
248
264
 
249
- header_params = {
250
- "name" => request.name
251
- }
265
+ header_params = {}
266
+ if request.name
267
+ header_params["name"] = request.name
268
+ end
269
+
252
270
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
253
271
  metadata[:"x-goog-request-params"] ||= request_params_header
254
272
 
255
273
  options.apply_defaults timeout: @config.rpcs.list_monitored_resource_descriptors.timeout,
256
274
  metadata: metadata,
257
275
  retry_policy: @config.rpcs.list_monitored_resource_descriptors.retry_policy
258
- options.apply_defaults metadata: @config.metadata,
276
+
277
+ options.apply_defaults timeout: @config.timeout,
278
+ metadata: @config.metadata,
259
279
  retry_policy: @config.retry_policy
260
280
 
261
281
  @metric_service_stub.call_rpc :list_monitored_resource_descriptors, request, options: options do |response, operation|
@@ -301,6 +321,21 @@ module Google
301
321
  #
302
322
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
303
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
+ #
304
339
  def get_monitored_resource_descriptor request, options = nil
305
340
  raise ::ArgumentError, "request must be provided" if request.nil?
306
341
 
@@ -318,16 +353,20 @@ module Google
318
353
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
319
354
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
320
355
 
321
- header_params = {
322
- "name" => request.name
323
- }
356
+ header_params = {}
357
+ if request.name
358
+ header_params["name"] = request.name
359
+ end
360
+
324
361
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
325
362
  metadata[:"x-goog-request-params"] ||= request_params_header
326
363
 
327
364
  options.apply_defaults timeout: @config.rpcs.get_monitored_resource_descriptor.timeout,
328
365
  metadata: metadata,
329
366
  retry_policy: @config.rpcs.get_monitored_resource_descriptor.retry_policy
330
- options.apply_defaults metadata: @config.metadata,
367
+
368
+ options.apply_defaults timeout: @config.timeout,
369
+ metadata: @config.metadata,
331
370
  retry_policy: @config.retry_policy
332
371
 
333
372
  @metric_service_stub.call_rpc :get_monitored_resource_descriptor, request, options: options do |response, operation|
@@ -357,7 +396,8 @@ module Google
357
396
  # the default parameter values, pass an empty Hash as a request object (see above).
358
397
  #
359
398
  # @param name [::String]
360
- # Required. The project on which to execute the request. The format is:
399
+ # Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on
400
+ # which to execute the request. The format is:
361
401
  #
362
402
  # projects/[PROJECT_ID_OR_NUMBER]
363
403
  # @param filter [::String]
@@ -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,16 +462,20 @@ 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
 
410
473
  options.apply_defaults timeout: @config.rpcs.list_metric_descriptors.timeout,
411
474
  metadata: metadata,
412
475
  retry_policy: @config.rpcs.list_metric_descriptors.retry_policy
413
- options.apply_defaults metadata: @config.metadata,
476
+
477
+ options.apply_defaults timeout: @config.timeout,
478
+ metadata: @config.metadata,
414
479
  retry_policy: @config.retry_policy
415
480
 
416
481
  @metric_service_stub.call_rpc :list_metric_descriptors, request, options: options do |response, operation|
@@ -456,6 +521,21 @@ module Google
456
521
  #
457
522
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
458
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
+ #
459
539
  def get_metric_descriptor request, options = nil
460
540
  raise ::ArgumentError, "request must be provided" if request.nil?
461
541
 
@@ -473,16 +553,20 @@ module Google
473
553
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
474
554
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
475
555
 
476
- header_params = {
477
- "name" => request.name
478
- }
556
+ header_params = {}
557
+ if request.name
558
+ header_params["name"] = request.name
559
+ end
560
+
479
561
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
480
562
  metadata[:"x-goog-request-params"] ||= request_params_header
481
563
 
482
564
  options.apply_defaults timeout: @config.rpcs.get_metric_descriptor.timeout,
483
565
  metadata: metadata,
484
566
  retry_policy: @config.rpcs.get_metric_descriptor.retry_policy
485
- options.apply_defaults metadata: @config.metadata,
567
+
568
+ options.apply_defaults timeout: @config.timeout,
569
+ metadata: @config.metadata,
486
570
  retry_policy: @config.retry_policy
487
571
 
488
572
  @metric_service_stub.call_rpc :get_metric_descriptor, request, options: options do |response, operation|
@@ -495,6 +579,8 @@ module Google
495
579
 
496
580
  ##
497
581
  # Creates a new metric descriptor.
582
+ # The creation is executed asynchronously and callers may check the returned
583
+ # operation to track its progress.
498
584
  # User-created metric descriptors define
499
585
  # [custom metrics](https://cloud.google.com/monitoring/custom-metrics).
500
586
  #
@@ -514,8 +600,9 @@ module Google
514
600
  # the default parameter values, pass an empty Hash as a request object (see above).
515
601
  #
516
602
  # @param name [::String]
517
- # Required. The project on which to execute the request. The format is:
518
- #
603
+ # Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on
604
+ # which to execute the request. The format is:
605
+ # 4
519
606
  # projects/[PROJECT_ID_OR_NUMBER]
520
607
  # @param metric_descriptor [::Google::Api::MetricDescriptor, ::Hash]
521
608
  # Required. The new [custom metric](https://cloud.google.com/monitoring/custom-metrics)
@@ -529,6 +616,21 @@ module Google
529
616
  #
530
617
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
531
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
+ #
532
634
  def create_metric_descriptor request, options = nil
533
635
  raise ::ArgumentError, "request must be provided" if request.nil?
534
636
 
@@ -546,16 +648,20 @@ module Google
546
648
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
547
649
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
548
650
 
549
- header_params = {
550
- "name" => request.name
551
- }
651
+ header_params = {}
652
+ if request.name
653
+ header_params["name"] = request.name
654
+ end
655
+
552
656
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
553
657
  metadata[:"x-goog-request-params"] ||= request_params_header
554
658
 
555
659
  options.apply_defaults timeout: @config.rpcs.create_metric_descriptor.timeout,
556
660
  metadata: metadata,
557
661
  retry_policy: @config.rpcs.create_metric_descriptor.retry_policy
558
- options.apply_defaults metadata: @config.metadata,
662
+
663
+ options.apply_defaults timeout: @config.timeout,
664
+ metadata: @config.metadata,
559
665
  retry_policy: @config.retry_policy
560
666
 
561
667
  @metric_service_stub.call_rpc :create_metric_descriptor, request, options: options do |response, operation|
@@ -602,6 +708,21 @@ module Google
602
708
  #
603
709
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
604
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
+ #
605
726
  def delete_metric_descriptor request, options = nil
606
727
  raise ::ArgumentError, "request must be provided" if request.nil?
607
728
 
@@ -619,16 +740,20 @@ module Google
619
740
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
620
741
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
621
742
 
622
- header_params = {
623
- "name" => request.name
624
- }
743
+ header_params = {}
744
+ if request.name
745
+ header_params["name"] = request.name
746
+ end
747
+
625
748
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
626
749
  metadata[:"x-goog-request-params"] ||= request_params_header
627
750
 
628
751
  options.apply_defaults timeout: @config.rpcs.delete_metric_descriptor.timeout,
629
752
  metadata: metadata,
630
753
  retry_policy: @config.rpcs.delete_metric_descriptor.retry_policy
631
- options.apply_defaults metadata: @config.metadata,
754
+
755
+ options.apply_defaults timeout: @config.timeout,
756
+ metadata: @config.metadata,
632
757
  retry_policy: @config.retry_policy
633
758
 
634
759
  @metric_service_stub.call_rpc :delete_metric_descriptor, request, options: options do |response, operation|
@@ -658,8 +783,8 @@ module Google
658
783
  # the default parameter values, pass an empty Hash as a request object (see above).
659
784
  #
660
785
  # @param name [::String]
661
- # Required. The project, organization or folder on which to execute the request. The
662
- # format is:
786
+ # Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name),
787
+ # organization or folder on which to execute the request. The format is:
663
788
  #
664
789
  # projects/[PROJECT_ID_OR_NUMBER]
665
790
  # organizations/[ORGANIZATION_ID]
@@ -709,6 +834,27 @@ module Google
709
834
  #
710
835
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
711
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
+ #
712
858
  def list_time_series request, options = nil
713
859
  raise ::ArgumentError, "request must be provided" if request.nil?
714
860
 
@@ -726,16 +872,20 @@ module Google
726
872
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
727
873
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
728
874
 
729
- header_params = {
730
- "name" => request.name
731
- }
875
+ header_params = {}
876
+ if request.name
877
+ header_params["name"] = request.name
878
+ end
879
+
732
880
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
733
881
  metadata[:"x-goog-request-params"] ||= request_params_header
734
882
 
735
883
  options.apply_defaults timeout: @config.rpcs.list_time_series.timeout,
736
884
  metadata: metadata,
737
885
  retry_policy: @config.rpcs.list_time_series.retry_policy
738
- options.apply_defaults metadata: @config.metadata,
886
+
887
+ options.apply_defaults timeout: @config.timeout,
888
+ metadata: @config.metadata,
739
889
  retry_policy: @config.retry_policy
740
890
 
741
891
  @metric_service_stub.call_rpc :list_time_series, request, options: options do |response, operation|
@@ -769,7 +919,8 @@ module Google
769
919
  # the default parameter values, pass an empty Hash as a request object (see above).
770
920
  #
771
921
  # @param name [::String]
772
- # Required. The project on which to execute the request. The format is:
922
+ # Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on
923
+ # which to execute the request. The format is:
773
924
  #
774
925
  # projects/[PROJECT_ID_OR_NUMBER]
775
926
  # @param time_series [::Array<::Google::Cloud::Monitoring::V3::TimeSeries, ::Hash>]
@@ -789,6 +940,21 @@ module Google
789
940
  #
790
941
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
791
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
+ #
792
958
  def create_time_series request, options = nil
793
959
  raise ::ArgumentError, "request must be provided" if request.nil?
794
960
 
@@ -806,16 +972,20 @@ module Google
806
972
  gapic_version: ::Google::Cloud::Monitoring::V3::VERSION
807
973
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
808
974
 
809
- header_params = {
810
- "name" => request.name
811
- }
975
+ header_params = {}
976
+ if request.name
977
+ header_params["name"] = request.name
978
+ end
979
+
812
980
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
813
981
  metadata[:"x-goog-request-params"] ||= request_params_header
814
982
 
815
983
  options.apply_defaults timeout: @config.rpcs.create_time_series.timeout,
816
984
  metadata: metadata,
817
985
  retry_policy: @config.rpcs.create_time_series.retry_policy
818
- options.apply_defaults metadata: @config.metadata,
986
+
987
+ options.apply_defaults timeout: @config.timeout,
988
+ metadata: @config.metadata,
819
989
  retry_policy: @config.retry_policy
820
990
 
821
991
  @metric_service_stub.call_rpc :create_time_series, request, options: options do |response, operation|
@@ -826,6 +996,110 @@ module Google
826
996
  raise ::Google::Cloud::Error.from_error(e)
827
997
  end
828
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
+
829
1103
  ##
830
1104
  # Configuration class for the MetricService API.
831
1105
  #
@@ -839,22 +1113,21 @@ module Google
839
1113
  # Configuration can be applied globally to all clients, or to a single client
840
1114
  # on construction.
841
1115
  #
842
- # # Examples
843
- #
844
- # To modify the global config, setting the timeout for list_monitored_resource_descriptors
845
- # to 20 seconds, and all remaining timeouts to 10 seconds:
1116
+ # @example
846
1117
  #
847
- # ::Google::Cloud::Monitoring::V3::MetricService::Client.configure do |config|
848
- # config.timeout = 10.0
849
- # config.rpcs.list_monitored_resource_descriptors.timeout = 20.0
850
- # end
1118
+ # # Modify the global config, setting the timeout for
1119
+ # # list_monitored_resource_descriptors to 20 seconds,
1120
+ # # and all remaining timeouts to 10 seconds.
1121
+ # ::Google::Cloud::Monitoring::V3::MetricService::Client.configure do |config|
1122
+ # config.timeout = 10.0
1123
+ # config.rpcs.list_monitored_resource_descriptors.timeout = 20.0
1124
+ # end
851
1125
  #
852
- # To apply the above configuration only to a new client:
853
- #
854
- # client = ::Google::Cloud::Monitoring::V3::MetricService::Client.new do |config|
855
- # config.timeout = 10.0
856
- # config.rpcs.list_monitored_resource_descriptors.timeout = 20.0
857
- # end
1126
+ # # Apply the above configuration only to a new client.
1127
+ # client = ::Google::Cloud::Monitoring::V3::MetricService::Client.new do |config|
1128
+ # config.timeout = 10.0
1129
+ # config.rpcs.list_monitored_resource_descriptors.timeout = 20.0
1130
+ # end
858
1131
  #
859
1132
  # @!attribute [rw] endpoint
860
1133
  # The hostname or hostname:port of the service endpoint.
@@ -1002,6 +1275,11 @@ module Google
1002
1275
  # @return [::Gapic::Config::Method]
1003
1276
  #
1004
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
1005
1283
 
1006
1284
  # @private
1007
1285
  def initialize parent_rpcs = nil
@@ -1021,6 +1299,8 @@ module Google
1021
1299
  @list_time_series = ::Gapic::Config::Method.new list_time_series_config
1022
1300
  create_time_series_config = parent_rpcs.create_time_series if parent_rpcs.respond_to? :create_time_series
1023
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
1024
1304
 
1025
1305
  yield self if block_given?
1026
1306
  end