Class: OCI::Monitoring::Models::UpdateAlarmDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/monitoring/models/update_alarm_details.rb

Overview

The configuration details for updating an alarm.

Constant Summary collapse

MESSAGE_FORMAT_ENUM =
[
  MESSAGE_FORMAT_RAW = 'RAW'.freeze,
  MESSAGE_FORMAT_PRETTY_JSON = 'PRETTY_JSON'.freeze,
  MESSAGE_FORMAT_ONS_OPTIMIZED = 'ONS_OPTIMIZED'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ UpdateAlarmDetails

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 307

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.display_name = attributes[:'displayName'] if attributes[:'displayName']

  raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')

  self.display_name = attributes[:'display_name'] if attributes[:'display_name']

  self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']

  raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')

  self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']

  self.metric_compartment_id = attributes[:'metricCompartmentId'] if attributes[:'metricCompartmentId']

  raise 'You cannot provide both :metricCompartmentId and :metric_compartment_id' if attributes.key?(:'metricCompartmentId') && attributes.key?(:'metric_compartment_id')

  self.metric_compartment_id = attributes[:'metric_compartment_id'] if attributes[:'metric_compartment_id']

  self.metric_compartment_id_in_subtree = attributes[:'metricCompartmentIdInSubtree'] unless attributes[:'metricCompartmentIdInSubtree'].nil?

  raise 'You cannot provide both :metricCompartmentIdInSubtree and :metric_compartment_id_in_subtree' if attributes.key?(:'metricCompartmentIdInSubtree') && attributes.key?(:'metric_compartment_id_in_subtree')

  self.metric_compartment_id_in_subtree = attributes[:'metric_compartment_id_in_subtree'] unless attributes[:'metric_compartment_id_in_subtree'].nil?

  self.namespace = attributes[:'namespace'] if attributes[:'namespace']

  self.resource_group = attributes[:'resourceGroup'] if attributes[:'resourceGroup']

  raise 'You cannot provide both :resourceGroup and :resource_group' if attributes.key?(:'resourceGroup') && attributes.key?(:'resource_group')

  self.resource_group = attributes[:'resource_group'] if attributes[:'resource_group']

  self.query = attributes[:'query'] if attributes[:'query']

  self.resolution = attributes[:'resolution'] if attributes[:'resolution']

  self.pending_duration = attributes[:'pendingDuration'] if attributes[:'pendingDuration']

  raise 'You cannot provide both :pendingDuration and :pending_duration' if attributes.key?(:'pendingDuration') && attributes.key?(:'pending_duration')

  self.pending_duration = attributes[:'pending_duration'] if attributes[:'pending_duration']

  self.severity = attributes[:'severity'] if attributes[:'severity']

  self.body = attributes[:'body'] if attributes[:'body']

  self.is_notifications_per_metric_dimension_enabled = attributes[:'isNotificationsPerMetricDimensionEnabled'] unless attributes[:'isNotificationsPerMetricDimensionEnabled'].nil?
  self.is_notifications_per_metric_dimension_enabled = false if is_notifications_per_metric_dimension_enabled.nil? && !attributes.key?(:'isNotificationsPerMetricDimensionEnabled') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :isNotificationsPerMetricDimensionEnabled and :is_notifications_per_metric_dimension_enabled' if attributes.key?(:'isNotificationsPerMetricDimensionEnabled') && attributes.key?(:'is_notifications_per_metric_dimension_enabled')

  self.is_notifications_per_metric_dimension_enabled = attributes[:'is_notifications_per_metric_dimension_enabled'] unless attributes[:'is_notifications_per_metric_dimension_enabled'].nil?
  self.is_notifications_per_metric_dimension_enabled = false if is_notifications_per_metric_dimension_enabled.nil? && !attributes.key?(:'isNotificationsPerMetricDimensionEnabled') && !attributes.key?(:'is_notifications_per_metric_dimension_enabled') # rubocop:disable Style/StringLiterals

  self.message_format = attributes[:'messageFormat'] if attributes[:'messageFormat']

  raise 'You cannot provide both :messageFormat and :message_format' if attributes.key?(:'messageFormat') && attributes.key?(:'message_format')

  self.message_format = attributes[:'message_format'] if attributes[:'message_format']

  self.destinations = attributes[:'destinations'] if attributes[:'destinations']

  self.repeat_notification_duration = attributes[:'repeatNotificationDuration'] if attributes[:'repeatNotificationDuration']

  raise 'You cannot provide both :repeatNotificationDuration and :repeat_notification_duration' if attributes.key?(:'repeatNotificationDuration') && attributes.key?(:'repeat_notification_duration')

  self.repeat_notification_duration = attributes[:'repeat_notification_duration'] if attributes[:'repeat_notification_duration']

  self.suppression = attributes[:'suppression'] if attributes[:'suppression']

  self.is_enabled = attributes[:'isEnabled'] unless attributes[:'isEnabled'].nil?

  raise 'You cannot provide both :isEnabled and :is_enabled' if attributes.key?(:'isEnabled') && attributes.key?(:'is_enabled')

  self.is_enabled = attributes[:'is_enabled'] unless attributes[:'is_enabled'].nil?

  self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']

  raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags')

  self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags']

  self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']

  raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags')

  self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags']

  self.overrides = attributes[:'overrides'] if attributes[:'overrides']

  self.rule_name = attributes[:'ruleName'] if attributes[:'ruleName']

  raise 'You cannot provide both :ruleName and :rule_name' if attributes.key?(:'ruleName') && attributes.key?(:'rule_name')

  self.rule_name = attributes[:'rule_name'] if attributes[:'rule_name']

  self.notification_version = attributes[:'notificationVersion'] if attributes[:'notificationVersion']

  raise 'You cannot provide both :notificationVersion and :notification_version' if attributes.key?(:'notificationVersion') && attributes.key?(:'notification_version')

  self.notification_version = attributes[:'notification_version'] if attributes[:'notification_version']
end

Instance Attribute Details

#bodyString

The human-readable content of the delivered alarm notification. Oracle recommends providing guidance to operators for resolving the alarm condition. Consider adding links to standard runbook practices. Avoid entering confidential information.

Example: High CPU usage alert. Follow runbook instructions for resolution.

Returns:

  • (String)


137
138
139
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 137

def body
  @body
end

#compartment_idString

The OCID of the compartment containing the alarm.

Returns:

  • (String)


31
32
33
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 31

def compartment_id
  @compartment_id
end

#defined_tagsHash<String, Hash<String, Object>>

Usage of predefined tag keys. These predefined keys are scoped to namespaces. Example: {\"Operations\": {\"CostCenter\": \"42\"}}

Returns:

  • (Hash<String, Hash<String, Object>>)


195
196
197
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 195

def defined_tags
  @defined_tags
end

#destinationsArray<String>

A list of destinations for alarm notifications. Each destination is represented by the OCID of a related resource, such as a NotificationTopic. Supported destination services: Notifications, Streaming. Limit: One destination per supported destination service.

Returns:

  • (Array<String>)


160
161
162
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 160

def destinations
  @destinations
end

#display_nameString

A user-friendly name for the alarm. It does not have to be unique, and it's changeable. Avoid entering confidential information.

This value determines the title of each alarm notification.

Example: High CPU Utilization

Returns:

  • (String)


26
27
28
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 26

def display_name
  @display_name
end

#freeform_tagsHash<String, String>

Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {\"Department\": \"Finance\"}

Returns:

  • (Hash<String, String>)


189
190
191
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 189

def freeform_tags
  @freeform_tags
end

#is_enabledBOOLEAN

Whether the alarm is enabled.

Example: true

Returns:

  • (BOOLEAN)


183
184
185
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 183

def is_enabled
  @is_enabled
end

#is_notifications_per_metric_dimension_enabledBOOLEAN

When set to true, splits alarm notifications per metric stream. When set to false, groups alarm notifications across metric streams.

Returns:

  • (BOOLEAN)


143
144
145
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 143

def is_notifications_per_metric_dimension_enabled
  @is_notifications_per_metric_dimension_enabled
end

#message_formatString

The format to use for alarm notifications. The formats are: * RAW - Raw JSON blob. Default value. When the destinations attribute specifies Streaming, all alarm notifications use this format. * PRETTY_JSON: JSON with new lines and indents. Available when the destinations attribute specifies Notifications only. * ONS_OPTIMIZED: Simplified, user-friendly layout. Available when the destinations attribute specifies Notifications only. Applies to Email subscription types only.

Returns:

  • (String)


151
152
153
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 151

def message_format
  @message_format
end

#metric_compartment_idString

The OCID of the compartment containing the metric being evaluated by the alarm.

Returns:

  • (String)


37
38
39
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 37

def metric_compartment_id
  @metric_compartment_id
end

#metric_compartment_id_in_subtreeBOOLEAN

When true, the alarm evaluates metrics from all compartments and subcompartments. The parameter can only be set to true when metricCompartmentId is the tenancy OCID (the tenancy is the root compartment). A true value requires the user to have tenancy-level permissions. If this requirement is not met, then the call is rejected. When false, the alarm evaluates metrics from only the compartment specified in metricCompartmentId. Default is false.

Example: true

Returns:

  • (BOOLEAN)


48
49
50
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 48

def metric_compartment_id_in_subtree
  @metric_compartment_id_in_subtree
end

#namespaceString

The source service or application emitting the metric that is evaluated by the alarm.

Example: oci_computeagent

Returns:

  • (String)


55
56
57
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 55

def namespace
  @namespace
end

#notification_versionString

The version of the alarm notification to be delivered. Allowed value: 1.X The value must start with a number (up to four digits), followed by a period and an uppercase X.

Returns:

  • (String)


217
218
219
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 217

def notification_version
  @notification_version
end

#overridesArray<OCI::Monitoring::Models::AlarmOverride>

A set of overrides that control evaluations of the alarm.

Each override can specify values for query, severity, body, and pending duration. When an alarm contains overrides, the Monitoring service evaluates each override in order, beginning with the first override in the array (index position 0), and then evaluates the alarm's base values (ruleName value of BASE).



204
205
206
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 204

def overrides
  @overrides
end

#pending_durationString

The period of time that the condition defined in the alarm must persist before the alarm state changes from "OK" to "FIRING". For example, a value of 5 minutes means that the alarm must persist in breaching the condition for five minutes before the alarm updates its state to "FIRING".

The duration is specified as a string in ISO 8601 format (PT10M for ten minutes or PT1H for one hour). Minimum: PT1M. Maximum: PT1H. Default: PT1M.

Under the default value of PT1M, the first evaluation that breaches the alarm updates the state to "FIRING".

The alarm updates its status to "OK" when the breaching condition has been clear for the most recent minute.

Example: PT5M

Returns:

  • (String)


121
122
123
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 121

def pending_duration
  @pending_duration
end

#queryString

The Monitoring Query Language (MQL) expression to evaluate for the alarm. The Alarms feature of the Monitoring service interprets results for each returned time series as Boolean values, where zero represents false and a non-zero value represents true. A true value means that the trigger rule condition has been met. The query must specify a metric, statistic, interval, and trigger rule (threshold or absence). Supported values for interval depend on the specified time range. More interval values are supported for smaller time ranges. You can optionally specify dimensions and grouping functions. Supported grouping functions: grouping(), groupBy(). For information about writing MQL expressions, see Editing the MQL Expression for a Query. For details about MQL, see Monitoring Query Language (MQL) Reference. For available dimensions, review the metric definition for the supported service. See Supported Services.

Example of threshold alarm:


CpuUtilization[1m]{availabilityDomain=\"cumS:PHX-AD-1\"}.groupBy(availabilityDomain).percentile(0.9) > 85

Example of absence alarm:


CpuUtilization[1m]{availabilityDomain=\"cumS:PHX-AD-1\"}.absent()

Returns:

  • (String)


97
98
99
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 97

def query
  @query
end

#repeat_notification_durationString

The frequency for re-submitting alarm notifications, if the alarm keeps firing without interruption. Format defined by ISO 8601. For example, PT4H indicates four hours. Minimum: PT1M. Maximum: P30D.

Default value: null (notifications are not re-submitted).

Example: PT2H

Returns:

  • (String)


171
172
173
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 171

def repeat_notification_duration
  @repeat_notification_duration
end

#resolutionString

The time between calculated aggregation windows for the alarm. Supported value: 1m

Returns:

  • (String)


102
103
104
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 102

def resolution
  @resolution
end

#resource_groupString

Resource group that you want to match. A null value returns only metric data that has no resource groups. The alarm retrieves metric data associated with the specified resource group only. Only one resource group can be applied per metric. A valid resourceGroup value starts with an alphabetical character and includes only alphanumeric characters, periods (.), underscores (_), hyphens (-), and dollar signs ($). Avoid entering confidential information.

Example: frontend-fleet

Returns:

  • (String)


64
65
66
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 64

def resource_group
  @resource_group
end

#rule_nameString

Identifier of the alarm's base values for alarm evaluation, for use when the alarm contains overrides. A valid ruleName value starts with an alphabetic character and includes only alphanumeric characters, underscores and square brackets. Minimum number of characters: 3. Default value is BASE. For information about alarm overrides, see alarm_override.

Returns:

  • (String)


211
212
213
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 211

def rule_name
  @rule_name
end

#severityString

The perceived severity of the alarm with regard to the affected system.

Example: CRITICAL

Returns:

  • (String)


128
129
130
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 128

def severity
  @severity
end

#suppressionOCI::Monitoring::Models::Suppression

The configuration details for suppressing an alarm.



176
177
178
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 176

def suppression
  @suppression
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 220

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'display_name': :'displayName',
    'compartment_id': :'compartmentId',
    'metric_compartment_id': :'metricCompartmentId',
    'metric_compartment_id_in_subtree': :'metricCompartmentIdInSubtree',
    'namespace': :'namespace',
    'resource_group': :'resourceGroup',
    'query': :'query',
    'resolution': :'resolution',
    'pending_duration': :'pendingDuration',
    'severity': :'severity',
    'body': :'body',
    'is_notifications_per_metric_dimension_enabled': :'isNotificationsPerMetricDimensionEnabled',
    'message_format': :'messageFormat',
    'destinations': :'destinations',
    'repeat_notification_duration': :'repeatNotificationDuration',
    'suppression': :'suppression',
    'is_enabled': :'isEnabled',
    'freeform_tags': :'freeformTags',
    'defined_tags': :'definedTags',
    'overrides': :'overrides',
    'rule_name': :'ruleName',
    'notification_version': :'notificationVersion'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 250

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'display_name': :'String',
    'compartment_id': :'String',
    'metric_compartment_id': :'String',
    'metric_compartment_id_in_subtree': :'BOOLEAN',
    'namespace': :'String',
    'resource_group': :'String',
    'query': :'String',
    'resolution': :'String',
    'pending_duration': :'String',
    'severity': :'String',
    'body': :'String',
    'is_notifications_per_metric_dimension_enabled': :'BOOLEAN',
    'message_format': :'String',
    'destinations': :'Array<String>',
    'repeat_notification_duration': :'String',
    'suppression': :'OCI::Monitoring::Models::Suppression',
    'is_enabled': :'BOOLEAN',
    'freeform_tags': :'Hash<String, String>',
    'defined_tags': :'Hash<String, Hash<String, Object>>',
    'overrides': :'Array<OCI::Monitoring::Models::AlarmOverride>',
    'rule_name': :'String',
    'notification_version': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 431

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    display_name == other.display_name &&
    compartment_id == other.compartment_id &&
    metric_compartment_id == other.metric_compartment_id &&
    metric_compartment_id_in_subtree == other.metric_compartment_id_in_subtree &&
    namespace == other.namespace &&
    resource_group == other.resource_group &&
    query == other.query &&
    resolution == other.resolution &&
    pending_duration == other.pending_duration &&
    severity == other.severity &&
    body == other.body &&
    is_notifications_per_metric_dimension_enabled == other.is_notifications_per_metric_dimension_enabled &&
    message_format == other.message_format &&
    destinations == other.destinations &&
    repeat_notification_duration == other.repeat_notification_duration &&
    suppression == other.suppression &&
    is_enabled == other.is_enabled &&
    freeform_tags == other.freeform_tags &&
    defined_tags == other.defined_tags &&
    overrides == other.overrides &&
    rule_name == other.rule_name &&
    notification_version == other.notification_version
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 482

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


462
463
464
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 462

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



471
472
473
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 471

def hash
  [display_name, compartment_id, metric_compartment_id, metric_compartment_id_in_subtree, namespace, resource_group, query, resolution, pending_duration, severity, body, is_notifications_per_metric_dimension_enabled, message_format, destinations, repeat_notification_duration, suppression, is_enabled, freeform_tags, defined_tags, overrides, rule_name, notification_version].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



515
516
517
518
519
520
521
522
523
524
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 515

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



509
510
511
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 509

def to_s
  to_hash.to_s
end