google-cloud-monitoring 0.28.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/README.md +38 -12
  4. data/lib/google/cloud/monitoring.rb +52 -2
  5. data/lib/google/cloud/monitoring/v3.rb +124 -52
  6. data/lib/google/cloud/monitoring/v3/alert_policy_service_client.rb +67 -29
  7. data/lib/google/cloud/monitoring/v3/credentials.rb +43 -0
  8. data/lib/google/cloud/monitoring/v3/doc/google/api/metric.rb +7 -11
  9. data/lib/google/cloud/monitoring/v3/doc/google/api/monitored_resource.rb +27 -3
  10. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb +7 -8
  11. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert_service.rb +135 -0
  12. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/group_service.rb +145 -0
  13. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric.rb +17 -12
  14. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric_service.rb +227 -0
  15. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/notification_service.rb +213 -0
  16. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/uptime.rb +49 -29
  17. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/uptime_service.rb +131 -0
  18. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/any.rb +124 -0
  19. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/empty.rb +28 -0
  20. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/struct.rb +73 -0
  21. data/lib/google/cloud/monitoring/v3/doc/google/rpc/status.rb +83 -0
  22. data/lib/google/cloud/monitoring/v3/doc/overview.rb +26 -1
  23. data/lib/google/cloud/monitoring/v3/group_service_client.rb +78 -35
  24. data/lib/google/cloud/monitoring/v3/metric_service_client.rb +99 -47
  25. data/lib/google/cloud/monitoring/v3/notification_channel_service_client.rb +87 -39
  26. data/lib/google/cloud/monitoring/v3/uptime_check_service_client.rb +90 -47
  27. data/lib/google/monitoring/v3/alert_service_services_pb.rb +1 -1
  28. data/lib/google/monitoring/v3/dropped_labels_pb.rb +19 -0
  29. data/lib/google/monitoring/v3/group_service_services_pb.rb +2 -2
  30. data/lib/google/monitoring/v3/metric_pb.rb +3 -0
  31. data/lib/google/monitoring/v3/metric_service_pb.rb +2 -0
  32. data/lib/google/monitoring/v3/metric_service_services_pb.rb +1 -1
  33. data/lib/google/monitoring/v3/notification_service_services_pb.rb +1 -1
  34. data/lib/google/monitoring/v3/span_context_pb.rb +18 -0
  35. data/lib/google/monitoring/v3/uptime_pb.rb +10 -9
  36. data/lib/google/monitoring/v3/uptime_service_pb.rb +1 -0
  37. data/lib/google/monitoring/v3/uptime_service_services_pb.rb +1 -1
  38. metadata +59 -6
  39. data/lib/google/cloud/monitoring/credentials.rb +0 -33
@@ -25,7 +25,7 @@ require "pathname"
25
25
  require "google/gax"
26
26
 
27
27
  require "google/monitoring/v3/alert_service_pb"
28
- require "google/cloud/monitoring/credentials"
28
+ require "google/cloud/monitoring/v3/credentials"
29
29
 
30
30
  module Google
31
31
  module Cloud
@@ -52,6 +52,9 @@ module Google
52
52
  # The default port of the service.
53
53
  DEFAULT_SERVICE_PORT = 443
54
54
 
55
+ # The default set of gRPC interceptors.
56
+ GRPC_INTERCEPTORS = []
57
+
55
58
  DEFAULT_TIMEOUT = 30
56
59
 
57
60
  PAGE_DESCRIPTORS = {
@@ -148,11 +151,18 @@ module Google
148
151
  # or the specified config is missing data points.
149
152
  # @param timeout [Numeric]
150
153
  # The default timeout, in seconds, for calls made through this client.
154
+ # @param metadata [Hash]
155
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
156
+ # @param exception_transformer [Proc]
157
+ # An optional proc that intercepts any exceptions raised during an API call to inject
158
+ # custom error handling.
151
159
  def initialize \
152
160
  credentials: nil,
153
161
  scopes: ALL_SCOPES,
154
162
  client_config: {},
155
163
  timeout: DEFAULT_TIMEOUT,
164
+ metadata: nil,
165
+ exception_transformer: nil,
156
166
  lib_name: nil,
157
167
  lib_version: ""
158
168
  # These require statements are intentionally placed here to initialize
@@ -161,10 +171,10 @@ module Google
161
171
  require "google/gax/grpc"
162
172
  require "google/monitoring/v3/alert_service_services_pb"
163
173
 
164
- credentials ||= Google::Cloud::Monitoring::Credentials.default
174
+ credentials ||= Google::Cloud::Monitoring::V3::Credentials.default
165
175
 
166
176
  if credentials.is_a?(String) || credentials.is_a?(Hash)
167
- updater_proc = Google::Cloud::Monitoring::Credentials.new(credentials).updater_proc
177
+ updater_proc = Google::Cloud::Monitoring::V3::Credentials.new(credentials).updater_proc
168
178
  end
169
179
  if credentials.is_a?(GRPC::Core::Channel)
170
180
  channel = credentials
@@ -188,6 +198,7 @@ module Google
188
198
  google_api_client.freeze
189
199
 
190
200
  headers = { :"x-goog-api-client" => google_api_client }
201
+ headers.merge!(metadata) unless metadata.nil?
191
202
  client_config_file = Pathname.new(__dir__).join(
192
203
  "alert_policy_service_client_config.json"
193
204
  )
@@ -200,13 +211,14 @@ module Google
200
211
  timeout,
201
212
  page_descriptors: PAGE_DESCRIPTORS,
202
213
  errors: Google::Gax::Grpc::API_ERRORS,
203
- kwargs: headers
214
+ metadata: headers
204
215
  )
205
216
  end
206
217
 
207
218
  # Allow overriding the service path/port in subclasses.
208
219
  service_path = self.class::SERVICE_ADDRESS
209
220
  port = self.class::DEFAULT_SERVICE_PORT
221
+ interceptors = self.class::GRPC_INTERCEPTORS
210
222
  @alert_policy_service_stub = Google::Gax::Grpc.create_stub(
211
223
  service_path,
212
224
  port,
@@ -214,28 +226,34 @@ module Google
214
226
  channel: channel,
215
227
  updater_proc: updater_proc,
216
228
  scopes: scopes,
229
+ interceptors: interceptors,
217
230
  &Google::Monitoring::V3::AlertPolicyService::Stub.method(:new)
218
231
  )
219
232
 
220
233
  @list_alert_policies = Google::Gax.create_api_call(
221
234
  @alert_policy_service_stub.method(:list_alert_policies),
222
- defaults["list_alert_policies"]
235
+ defaults["list_alert_policies"],
236
+ exception_transformer: exception_transformer
223
237
  )
224
238
  @get_alert_policy = Google::Gax.create_api_call(
225
239
  @alert_policy_service_stub.method(:get_alert_policy),
226
- defaults["get_alert_policy"]
240
+ defaults["get_alert_policy"],
241
+ exception_transformer: exception_transformer
227
242
  )
228
243
  @create_alert_policy = Google::Gax.create_api_call(
229
244
  @alert_policy_service_stub.method(:create_alert_policy),
230
- defaults["create_alert_policy"]
245
+ defaults["create_alert_policy"],
246
+ exception_transformer: exception_transformer
231
247
  )
232
248
  @delete_alert_policy = Google::Gax.create_api_call(
233
249
  @alert_policy_service_stub.method(:delete_alert_policy),
234
- defaults["delete_alert_policy"]
250
+ defaults["delete_alert_policy"],
251
+ exception_transformer: exception_transformer
235
252
  )
236
253
  @update_alert_policy = Google::Gax.create_api_call(
237
254
  @alert_policy_service_stub.method(:update_alert_policy),
238
- defaults["update_alert_policy"]
255
+ defaults["update_alert_policy"],
256
+ exception_transformer: exception_transformer
239
257
  )
240
258
  end
241
259
 
@@ -275,6 +293,9 @@ module Google
275
293
  # @param options [Google::Gax::CallOptions]
276
294
  # Overrides the default settings for this call, e.g, timeout,
277
295
  # retries, etc.
296
+ # @yield [result, operation] Access the result along with the RPC operation
297
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Monitoring::V3::AlertPolicy>]
298
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
278
299
  # @return [Google::Gax::PagedEnumerable<Google::Monitoring::V3::AlertPolicy>]
279
300
  # An enumerable of Google::Monitoring::V3::AlertPolicy instances.
280
301
  # See Google::Gax::PagedEnumerable documentation for other
@@ -282,9 +303,9 @@ module Google
282
303
  # object.
283
304
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
284
305
  # @example
285
- # require "google/cloud/monitoring/v3"
306
+ # require "google/cloud/monitoring"
286
307
  #
287
- # alert_policy_service_client = Google::Cloud::Monitoring::V3::AlertPolicy.new
308
+ # alert_policy_service_client = Google::Cloud::Monitoring::AlertPolicy.new(version: :v3)
288
309
  # formatted_name = Google::Cloud::Monitoring::V3::AlertPolicyServiceClient.project_path("[PROJECT]")
289
310
  #
290
311
  # # Iterate over all results.
@@ -305,7 +326,8 @@ module Google
305
326
  filter: nil,
306
327
  order_by: nil,
307
328
  page_size: nil,
308
- options: nil
329
+ options: nil,
330
+ &block
309
331
  req = {
310
332
  name: name,
311
333
  filter: filter,
@@ -313,7 +335,7 @@ module Google
313
335
  page_size: page_size
314
336
  }.delete_if { |_, v| v.nil? }
315
337
  req = Google::Gax::to_proto(req, Google::Monitoring::V3::ListAlertPoliciesRequest)
316
- @list_alert_policies.call(req, options)
338
+ @list_alert_policies.call(req, options, &block)
317
339
  end
318
340
 
319
341
  # Gets a single alerting policy.
@@ -325,23 +347,27 @@ module Google
325
347
  # @param options [Google::Gax::CallOptions]
326
348
  # Overrides the default settings for this call, e.g, timeout,
327
349
  # retries, etc.
350
+ # @yield [result, operation] Access the result along with the RPC operation
351
+ # @yieldparam result [Google::Monitoring::V3::AlertPolicy]
352
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
328
353
  # @return [Google::Monitoring::V3::AlertPolicy]
329
354
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
330
355
  # @example
331
- # require "google/cloud/monitoring/v3"
356
+ # require "google/cloud/monitoring"
332
357
  #
333
- # alert_policy_service_client = Google::Cloud::Monitoring::V3::AlertPolicy.new
358
+ # alert_policy_service_client = Google::Cloud::Monitoring::AlertPolicy.new(version: :v3)
334
359
  # formatted_name = Google::Cloud::Monitoring::V3::AlertPolicyServiceClient.alert_policy_path("[PROJECT]", "[ALERT_POLICY]")
335
360
  # response = alert_policy_service_client.get_alert_policy(formatted_name)
336
361
 
337
362
  def get_alert_policy \
338
363
  name,
339
- options: nil
364
+ options: nil,
365
+ &block
340
366
  req = {
341
367
  name: name
342
368
  }.delete_if { |_, v| v.nil? }
343
369
  req = Google::Gax::to_proto(req, Google::Monitoring::V3::GetAlertPolicyRequest)
344
- @get_alert_policy.call(req, options)
370
+ @get_alert_policy.call(req, options, &block)
345
371
  end
346
372
 
347
373
  # Creates a new alerting policy.
@@ -364,12 +390,15 @@ module Google
364
390
  # @param options [Google::Gax::CallOptions]
365
391
  # Overrides the default settings for this call, e.g, timeout,
366
392
  # retries, etc.
393
+ # @yield [result, operation] Access the result along with the RPC operation
394
+ # @yieldparam result [Google::Monitoring::V3::AlertPolicy]
395
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
367
396
  # @return [Google::Monitoring::V3::AlertPolicy]
368
397
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
369
398
  # @example
370
- # require "google/cloud/monitoring/v3"
399
+ # require "google/cloud/monitoring"
371
400
  #
372
- # alert_policy_service_client = Google::Cloud::Monitoring::V3::AlertPolicy.new
401
+ # alert_policy_service_client = Google::Cloud::Monitoring::AlertPolicy.new(version: :v3)
373
402
  # formatted_name = Google::Cloud::Monitoring::V3::AlertPolicyServiceClient.project_path("[PROJECT]")
374
403
  #
375
404
  # # TODO: Initialize +alert_policy+:
@@ -379,13 +408,14 @@ module Google
379
408
  def create_alert_policy \
380
409
  name,
381
410
  alert_policy,
382
- options: nil
411
+ options: nil,
412
+ &block
383
413
  req = {
384
414
  name: name,
385
415
  alert_policy: alert_policy
386
416
  }.delete_if { |_, v| v.nil? }
387
417
  req = Google::Gax::to_proto(req, Google::Monitoring::V3::CreateAlertPolicyRequest)
388
- @create_alert_policy.call(req, options)
418
+ @create_alert_policy.call(req, options, &block)
389
419
  end
390
420
 
391
421
  # Deletes an alerting policy.
@@ -399,22 +429,26 @@ module Google
399
429
  # @param options [Google::Gax::CallOptions]
400
430
  # Overrides the default settings for this call, e.g, timeout,
401
431
  # retries, etc.
432
+ # @yield [result, operation] Access the result along with the RPC operation
433
+ # @yieldparam result []
434
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
402
435
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
403
436
  # @example
404
- # require "google/cloud/monitoring/v3"
437
+ # require "google/cloud/monitoring"
405
438
  #
406
- # alert_policy_service_client = Google::Cloud::Monitoring::V3::AlertPolicy.new
439
+ # alert_policy_service_client = Google::Cloud::Monitoring::AlertPolicy.new(version: :v3)
407
440
  # formatted_name = Google::Cloud::Monitoring::V3::AlertPolicyServiceClient.alert_policy_path("[PROJECT]", "[ALERT_POLICY]")
408
441
  # alert_policy_service_client.delete_alert_policy(formatted_name)
409
442
 
410
443
  def delete_alert_policy \
411
444
  name,
412
- options: nil
445
+ options: nil,
446
+ &block
413
447
  req = {
414
448
  name: name
415
449
  }.delete_if { |_, v| v.nil? }
416
450
  req = Google::Gax::to_proto(req, Google::Monitoring::V3::DeleteAlertPolicyRequest)
417
- @delete_alert_policy.call(req, options)
451
+ @delete_alert_policy.call(req, options, &block)
418
452
  nil
419
453
  end
420
454
 
@@ -457,12 +491,15 @@ module Google
457
491
  # @param options [Google::Gax::CallOptions]
458
492
  # Overrides the default settings for this call, e.g, timeout,
459
493
  # retries, etc.
494
+ # @yield [result, operation] Access the result along with the RPC operation
495
+ # @yieldparam result [Google::Monitoring::V3::AlertPolicy]
496
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
460
497
  # @return [Google::Monitoring::V3::AlertPolicy]
461
498
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
462
499
  # @example
463
- # require "google/cloud/monitoring/v3"
500
+ # require "google/cloud/monitoring"
464
501
  #
465
- # alert_policy_service_client = Google::Cloud::Monitoring::V3::AlertPolicy.new
502
+ # alert_policy_service_client = Google::Cloud::Monitoring::AlertPolicy.new(version: :v3)
466
503
  #
467
504
  # # TODO: Initialize +alert_policy+:
468
505
  # alert_policy = {}
@@ -471,13 +508,14 @@ module Google
471
508
  def update_alert_policy \
472
509
  alert_policy,
473
510
  update_mask: nil,
474
- options: nil
511
+ options: nil,
512
+ &block
475
513
  req = {
476
514
  alert_policy: alert_policy,
477
515
  update_mask: update_mask
478
516
  }.delete_if { |_, v| v.nil? }
479
517
  req = Google::Gax::to_proto(req, Google::Monitoring::V3::UpdateAlertPolicyRequest)
480
- @update_alert_policy.call(req, options)
518
+ @update_alert_policy.call(req, options, &block)
481
519
  end
482
520
  end
483
521
  end
@@ -0,0 +1,43 @@
1
+ # Copyright 2018 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require "googleauth"
16
+
17
+ module Google
18
+ module Cloud
19
+ module Monitoring
20
+ module V3
21
+ class Credentials < Google::Auth::Credentials
22
+ SCOPE = [
23
+ "https://www.googleapis.com/auth/cloud-platform",
24
+ "https://www.googleapis.com/auth/monitoring",
25
+ "https://www.googleapis.com/auth/monitoring.read",
26
+ "https://www.googleapis.com/auth/monitoring.write"
27
+ ].freeze
28
+ PATH_ENV_VARS = %w(MONITORING_CREDENTIALS
29
+ MONITORING_KEYFILE
30
+ GOOGLE_CLOUD_CREDENTIALS
31
+ GOOGLE_CLOUD_KEYFILE
32
+ GCLOUD_KEYFILE)
33
+ JSON_ENV_VARS = %w(MONITORING_CREDENTIALS_JSON
34
+ MONITORING_KEYFILE_JSON
35
+ GOOGLE_CLOUD_CREDENTIALS_JSON
36
+ GOOGLE_CLOUD_KEYFILE_JSON
37
+ GCLOUD_KEYFILE_JSON)
38
+ DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -19,14 +19,7 @@ module Google
19
19
  # existing data unusable.
20
20
  # @!attribute [rw] name
21
21
  # @return [String]
22
- # The resource name of the metric descriptor. Depending on the
23
- # implementation, the name typically includes: (1) the parent resource name
24
- # that defines the scope of the metric type or of its data; and (2) the
25
- # metric's URL-encoded type, which also appears in the +type+ field of this
26
- # descriptor. For example, following is the resource name of a custom
27
- # metric within the GCP project +my-project-id+:
28
- #
29
- # "projects/my-project-id/metricDescriptors/custom.googleapis.com%2Finvoice%2Fpaid%2Famount"
22
+ # The resource name of the metric descriptor.
30
23
  # @!attribute [rw] type
31
24
  # @return [String]
32
25
  # The metric type, including its DNS name prefix. The type is not
@@ -93,8 +86,6 @@ module Google
93
86
  #
94
87
  # **Grammar**
95
88
  #
96
- # The grammar includes the dimensionless unit +1+, such as +1/s+.
97
- #
98
89
  # The grammar also includes these connectors:
99
90
  #
100
91
  # * +/+ division (as an infix operator, e.g. +1/s+).
@@ -104,7 +95,7 @@ module Google
104
95
  #
105
96
  # Expression = Component { "." Component } { "/" Component } ;
106
97
  #
107
- # Component = [ PREFIX ] UNIT [ Annotation ]
98
+ # Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
108
99
  # | Annotation
109
100
  # | "1"
110
101
  # ;
@@ -118,6 +109,9 @@ module Google
118
109
  # +{requests}/s == 1/s+, +By{transmitted}/s == By/s+.
119
110
  # * +NAME+ is a sequence of non-blank printable ASCII characters not
120
111
  # containing '{' or '}'.
112
+ # * +1+ represents dimensionless value 1, such as in +1/s+.
113
+ # * +%+ represents dimensionless value 1/100, and annotates values giving
114
+ # a percentage.
121
115
  # @!attribute [rw] description
122
116
  # @return [String]
123
117
  # A detailed description of the metric, which can be used in documentation.
@@ -125,6 +119,8 @@ module Google
125
119
  # @return [String]
126
120
  # A concise name for the metric, which can be displayed in user interfaces.
127
121
  # Use sentence case without an ending period, for example "Request count".
122
+ # This field is optional but it is recommended to be set for any metrics
123
+ # associated with user-visible concepts, such as Quota.
128
124
  class MetricDescriptor
129
125
  # The kind of measurement. It describes how the data is reported.
130
126
  module MetricKind
@@ -70,12 +70,36 @@ module Google
70
70
  # @return [String]
71
71
  # Required. The monitored resource type. This field must match
72
72
  # the +type+ field of a {Google::Api::MonitoredResourceDescriptor MonitoredResourceDescriptor} object. For
73
- # example, the type of a Cloud SQL database is +"cloudsql_database"+.
73
+ # example, the type of a Compute Engine VM instance is +gce_instance+.
74
74
  # @!attribute [rw] labels
75
75
  # @return [Hash{String => String}]
76
76
  # Required. Values for all of the labels listed in the associated monitored
77
- # resource descriptor. For example, Cloud SQL databases use the labels
78
- # +"database_id"+ and +"zone"+.
77
+ # resource descriptor. For example, Compute Engine VM instances use the
78
+ # labels +"project_id"+, +"instance_id"+, and +"zone"+.
79
79
  class MonitoredResource; end
80
+
81
+ # Auxiliary metadata for a {Google::Api::MonitoredResource MonitoredResource} object.
82
+ # {Google::Api::MonitoredResource MonitoredResource} objects contain the minimum set of information to
83
+ # uniquely identify a monitored resource instance. There is some other useful
84
+ # auxiliary metadata. Google Stackdriver Monitoring & Logging uses an ingestion
85
+ # pipeline to extract metadata for cloud resources of all types , and stores
86
+ # the metadata in this message.
87
+ # @!attribute [rw] system_labels
88
+ # @return [Google::Protobuf::Struct]
89
+ # Output only. Values for predefined system metadata labels.
90
+ # System labels are a kind of metadata extracted by Google Stackdriver.
91
+ # Stackdriver determines what system labels are useful and how to obtain
92
+ # their values. Some examples: "machine_image", "vpc", "subnet_id",
93
+ # "security_group", "name", etc.
94
+ # System label values can be only strings, Boolean values, or a list of
95
+ # strings. For example:
96
+ #
97
+ # { "name": "my-test-instance",
98
+ # "security_group": ["a", "b", "c"],
99
+ # "spot_instance": false }
100
+ # @!attribute [rw] user_labels
101
+ # @return [Hash{String => String}]
102
+ # Output only. A map of user-defined metadata labels.
103
+ class MonitoredResourceMetadata; end
80
104
  end
81
105
  end
@@ -235,15 +235,14 @@ module Google
235
235
  # @return [Google::Protobuf::Duration]
236
236
  # The amount of time that a time series must violate the
237
237
  # threshold to be considered failing. Currently, only values
238
- # that are a multiple of a minute--e.g. 60, 120, or 300
238
+ # that are a multiple of a minute--e.g., 0, 60, 120, or 300
239
239
  # seconds--are supported. If an invalid value is given, an
240
- # error will be returned. The +Duration.nanos+ field is
241
- # ignored. When choosing a duration, it is useful to keep in mind the
242
- # frequency of the underlying time series data (which may also be
243
- # affected by any alignments specified in the +aggregation+ field);
244
- # a good duration is long enough so that a single outlier does not
245
- # generate spurious alerts, but short enough that unhealthy states
246
- # are detected and alerted on quickly.
240
+ # error will be returned. When choosing a duration, it is useful to
241
+ # keep in mind the frequency of the underlying time series data
242
+ # (which may also be affected by any alignments specified in the
243
+ # +aggregations+ field); a good duration is long enough so that a single
244
+ # outlier does not generate spurious alerts, but short enough that
245
+ # unhealthy states are detected and alerted on quickly.
247
246
  # @!attribute [rw] trigger
248
247
  # @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
249
248
  # The number/percent of time series for which the comparison must hold
@@ -0,0 +1,135 @@
1
+ # Copyright 2018 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Monitoring
17
+ module V3
18
+ # The protocol for the +CreateAlertPolicy+ request.
19
+ # @!attribute [rw] name
20
+ # @return [String]
21
+ # The project in which to create the alerting policy. The format is
22
+ # +projects/[PROJECT_ID]+.
23
+ #
24
+ # Note that this field names the parent container in which the alerting
25
+ # policy will be written, not the name of the created policy. The alerting
26
+ # policy that is returned will have a name that contains a normalized
27
+ # representation of this name as a prefix but adds a suffix of the form
28
+ # +/alertPolicies/[POLICY_ID]+, identifying the policy in the container.
29
+ # @!attribute [rw] alert_policy
30
+ # @return [Google::Monitoring::V3::AlertPolicy]
31
+ # The requested alerting policy. You should omit the +name+ field in this
32
+ # policy. The name will be returned in the new policy, including
33
+ # a new [ALERT_POLICY_ID] value.
34
+ class CreateAlertPolicyRequest; end
35
+
36
+ # The protocol for the +GetAlertPolicy+ request.
37
+ # @!attribute [rw] name
38
+ # @return [String]
39
+ # The alerting policy to retrieve. The format is
40
+ #
41
+ # projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
42
+ class GetAlertPolicyRequest; end
43
+
44
+ # The protocol for the +ListAlertPolicies+ request.
45
+ # @!attribute [rw] name
46
+ # @return [String]
47
+ # The project whose alert policies are to be listed. The format is
48
+ #
49
+ # projects/[PROJECT_ID]
50
+ #
51
+ # Note that this field names the parent container in which the alerting
52
+ # policies to be listed are stored. To retrieve a single alerting policy
53
+ # by name, use the
54
+ # {Google::Monitoring::V3::AlertPolicyService::GetAlertPolicy GetAlertPolicy}
55
+ # operation, instead.
56
+ # @!attribute [rw] filter
57
+ # @return [String]
58
+ # If provided, this field specifies the criteria that must be met by
59
+ # alert policies to be included in the response.
60
+ #
61
+ # For more details, see [sorting and
62
+ # filtering](/monitoring/api/v3/sorting-and-filtering).
63
+ # @!attribute [rw] order_by
64
+ # @return [String]
65
+ # A comma-separated list of fields by which to sort the result. Supports
66
+ # the same set of field references as the +filter+ field. Entries can be
67
+ # prefixed with a minus sign to sort by the field in descending order.
68
+ #
69
+ # For more details, see [sorting and
70
+ # filtering](/monitoring/api/v3/sorting-and-filtering).
71
+ # @!attribute [rw] page_size
72
+ # @return [Integer]
73
+ # The maximum number of results to return in a single response.
74
+ # @!attribute [rw] page_token
75
+ # @return [String]
76
+ # If this field is not empty then it must contain the +nextPageToken+ value
77
+ # returned by a previous call to this method. Using this field causes the
78
+ # method to return more results from the previous method call.
79
+ class ListAlertPoliciesRequest; end
80
+
81
+ # The protocol for the +ListAlertPolicies+ response.
82
+ # @!attribute [rw] alert_policies
83
+ # @return [Array<Google::Monitoring::V3::AlertPolicy>]
84
+ # The returned alert policies.
85
+ # @!attribute [rw] next_page_token
86
+ # @return [String]
87
+ # If there might be more results than were returned, then this field is set
88
+ # to a non-empty value. To see the additional results,
89
+ # use that value as +pageToken+ in the next call to this method.
90
+ class ListAlertPoliciesResponse; end
91
+
92
+ # The protocol for the +UpdateAlertPolicy+ request.
93
+ # @!attribute [rw] update_mask
94
+ # @return [Google::Protobuf::FieldMask]
95
+ # Optional. A list of alerting policy field names. If this field is not
96
+ # empty, each listed field in the existing alerting policy is set to the
97
+ # value of the corresponding field in the supplied policy (+alert_policy+),
98
+ # or to the field's default value if the field is not in the supplied
99
+ # alerting policy. Fields not listed retain their previous value.
100
+ #
101
+ # Examples of valid field masks include +display_name+, +documentation+,
102
+ # +documentation.content+, +documentation.mime_type+, +user_labels+,
103
+ # +user_label.nameofkey+, +enabled+, +conditions+, +combiner+, etc.
104
+ #
105
+ # If this field is empty, then the supplied alerting policy replaces the
106
+ # existing policy. It is the same as deleting the existing policy and
107
+ # adding the supplied policy, except for the following:
108
+ #
109
+ # * The new policy will have the same +[ALERT_POLICY_ID]+ as the former
110
+ # policy. This gives you continuity with the former policy in your
111
+ # notifications and incidents.
112
+ # * Conditions in the new policy will keep their former +[CONDITION_ID]+ if
113
+ # the supplied condition includes the +name+ field with that
114
+ # +[CONDITION_ID]+. If the supplied condition omits the +name+ field,
115
+ # then a new +[CONDITION_ID]+ is created.
116
+ # @!attribute [rw] alert_policy
117
+ # @return [Google::Monitoring::V3::AlertPolicy]
118
+ # Required. The updated alerting policy or the updated values for the
119
+ # fields listed in +update_mask+.
120
+ # If +update_mask+ is not empty, any fields in this policy that are
121
+ # not in +update_mask+ are ignored.
122
+ class UpdateAlertPolicyRequest; end
123
+
124
+ # The protocol for the +DeleteAlertPolicy+ request.
125
+ # @!attribute [rw] name
126
+ # @return [String]
127
+ # The alerting policy to delete. The format is:
128
+ #
129
+ # projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
130
+ #
131
+ # For more information, see {Google::Monitoring::V3::AlertPolicy AlertPolicy}.
132
+ class DeleteAlertPolicyRequest; end
133
+ end
134
+ end
135
+ end