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.

Warning: Oracle recommends that you avoid using any confidential information when you supply string values using the API.

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):

  • :display_name (String)

    The value to assign to the #display_name property

  • :compartment_id (String)

    The value to assign to the #compartment_id property

  • :metric_compartment_id (String)

    The value to assign to the #metric_compartment_id property

  • :metric_compartment_id_in_subtree (BOOLEAN)

    The value to assign to the #metric_compartment_id_in_subtree property

  • :namespace (String)

    The value to assign to the #namespace property

  • :query (String)

    The value to assign to the #query property

  • :resolution (String)

    The value to assign to the #resolution property

  • :pending_duration (String)

    The value to assign to the #pending_duration property

  • :severity (String)

    The value to assign to the #severity property

  • :body (String)

    The value to assign to the #body property

  • :destinations (Array<String>)

    The value to assign to the #destinations property

  • :repeat_notification_duration (String)

    The value to assign to the #repeat_notification_duration property

  • :suppression (OCI::Monitoring::Models::Suppression)

    The value to assign to the #suppression property

  • :is_enabled (BOOLEAN)

    The value to assign to the #is_enabled property

  • :freeform_tags (Hash<String, String>)

    The value to assign to the #freeform_tags property

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

    The value to assign to the #defined_tags property



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 232

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.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.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']
end

Instance Attribute Details

#bodyString

The human-readable content of the notification delivered. 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)


117
118
119
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 117

def body
  @body
end

#compartment_idString

The [OCID](docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the alarm.

Returns:

  • (String)


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

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: ‘{"CostCenter": "42"}`

Returns:

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


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

def defined_tags
  @defined_tags
end

#destinationsArray<String>

A list of destinations to which the notifications for this alarm will be delivered. Each destination is represented by an [OCID](docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) related to the supported destination service. For example, a destination using the Notifications service is represented by a topic OCID. Supported destination services: Notifications Service. Limit: One destination per supported destination service.

Returns:

  • (Array<String>)


125
126
127
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 125

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 name is sent as the title for notifications related to this alarm.

Example: ‘High CPU Utilization`

Returns:

  • (String)


20
21
22
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 20

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: ‘"Finance"`

Returns:

  • (Hash<String, String>)


154
155
156
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 154

def freeform_tags
  @freeform_tags
end

#is_enabledBOOLEAN

Whether the alarm is enabled.

Example: ‘true`

Returns:

  • (BOOLEAN)


148
149
150
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 148

def is_enabled
  @is_enabled
end

#metric_compartment_idString

The [OCID](docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the metric being evaluated by the alarm.

Returns:

  • (String)


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

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)


42
43
44
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 42

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)


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

def namespace
  @namespace
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" or vice versa. 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"; likewise, the alarm must persist in not breaching the condition for five minutes before the alarm updates its state to "OK."

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" and the first evaluation that does not breach the alarm updates the state to "OK".

Example: ‘PT5M`

Returns:

  • (String)


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

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: ‘1m`-`60m` (also `1h`). You can optionally specify dimensions and grouping functions. Supported grouping functions: `grouping()`, `groupBy()`. For details about Monitoring Query Language (MQL), see [Monitoring Query Language (MQL) Reference](docs.cloud.oracle.com/iaas/Content/Monitoring/Reference/mql.htm). For available dimensions, review the metric definition for the supported service. See [Supported Services](docs.cloud.oracle.com/iaas/Content/Monitoring/Concepts/monitoringoverview.htm#SupportedServices).

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)


78
79
80
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 78

def query
  @query
end

#repeat_notification_durationString

The frequency at which notifications are re-submitted, 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)


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

def repeat_notification_duration
  @repeat_notification_duration
end

#resolutionString

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

Returns:

  • (String)


83
84
85
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 83

def resolution
  @resolution
end

#severityString

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

Example: ‘CRITICAL`

Returns:

  • (String)


108
109
110
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 108

def severity
  @severity
end

#suppressionOCI::Monitoring::Models::Suppression

The configuration details for suppressing an alarm.



141
142
143
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 141

def suppression
  @suppression
end

Class Method Details

.attribute_mapObject

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



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 163

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',
    'query': :'query',
    'resolution': :'resolution',
    'pending_duration': :'pendingDuration',
    'severity': :'severity',
    'body': :'body',
    'destinations': :'destinations',
    'repeat_notification_duration': :'repeatNotificationDuration',
    'suppression': :'suppression',
    'is_enabled': :'isEnabled',
    'freeform_tags': :'freeformTags',
    'defined_tags': :'definedTags'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 187

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',
    'query': :'String',
    'resolution': :'String',
    'pending_duration': :'String',
    'severity': :'String',
    'body': :'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>>'
    # 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



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 314

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 &&
    query == other.query &&
    resolution == other.resolution &&
    pending_duration == other.pending_duration &&
    severity == other.severity &&
    body == other.body &&
    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
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



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 359

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


339
340
341
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 339

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



348
349
350
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 348

def hash
  [display_name, compartment_id, metric_compartment_id, metric_compartment_id_in_subtree, namespace, query, resolution, pending_duration, severity, body, destinations, repeat_notification_duration, suppression, is_enabled, freeform_tags, defined_tags].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



392
393
394
395
396
397
398
399
400
401
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 392

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



386
387
388
# File 'lib/oci/monitoring/models/update_alarm_details.rb', line 386

def to_s
  to_hash.to_s
end