Class: DatadogAPIClient::V1::DowntimeChild

Inherits:
Object
  • Object
show all
Includes:
BaseGenericModel
Defined in:
lib/datadog_api_client/v1/models/downtime_child.rb,
lib/datadog_api_client/v1/models/downtime_child.rb

Overview

The downtime object definition of the active child for the original parent recurring downtime. This field will only exist on recurring downtimes.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BaseGenericModel

included

Instance Attribute Details

#_endObject

POSIX timestamp to end the downtime. If not provided, the downtime is in effect indefinitely until you cancel it.



41
42
43
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 41

def _end
  @_end
end

#_unparsedObject

whether the object has unparsed attributes



23
24
25
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 23

def _unparsed
  @_unparsed
end

#activeObject

If a scheduled downtime currently exists.



26
27
28
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 26

def active
  @active
end

#additional_propertiesObject

Returns the value of attribute additional_properties.



96
97
98
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 96

def additional_properties
  @additional_properties
end

#canceledObject

If a scheduled downtime is canceled.



29
30
31
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 29

def canceled
  @canceled
end

#creator_idObject

User ID of the downtime creator.



32
33
34
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 32

def creator_id
  @creator_id
end

#disabledObject

If a downtime has been disabled.



35
36
37
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 35

def disabled
  @disabled
end

#downtime_typeObject

0 for a downtime applied on * or all, 1 when the downtime is only scoped to hosts, or 2 when the downtime is scoped to anything but hosts.



38
39
40
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 38

def downtime_type
  @downtime_type
end

#idObject

The downtime ID.



44
45
46
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 44

def id
  @id
end

#messageObject

A message to include with notifications for this downtime. Email notifications can be sent to specific users by using the same @username notation as events.



47
48
49
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 47

def message
  @message
end

#monitor_idObject

A single monitor to which the downtime applies. If not provided, the downtime applies to all monitors.



50
51
52
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 50

def monitor_id
  @monitor_id
end

#monitor_tagsObject

A comma-separated list of monitor tags. For example, tags that are applied directly to monitors, not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies. The resulting downtime applies to monitors that match ALL provided monitor tags. For example, service:postgres AND team:frontend.



53
54
55
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 53

def monitor_tags
  @monitor_tags
end

#mute_first_recovery_notificationObject

If the first recovery notification during a downtime should be muted.



64
65
66
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 64

def mute_first_recovery_notification
  @mute_first_recovery_notification
end

#notify_end_statesObject

States for which notify_end_types sends out notifications for.



67
68
69
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 67

def notify_end_states
  @notify_end_states
end

#notify_end_typesObject

If set, notifies if a monitor is in an alert-worthy state (ALERT, WARNING, or NO DATA) when this downtime expires or is canceled. Applied to monitors that change states during the downtime (such as from OK to ALERT, WARNING, or NO DATA), and to monitors that already have an alert-worthy state when downtime begins.



73
74
75
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 73

def notify_end_types
  @notify_end_types
end

#parent_idObject

ID of the parent Downtime.



56
57
58
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 56

def parent_id
  @parent_id
end

#recurrenceObject

An object defining the recurrence of the downtime.



79
80
81
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 79

def recurrence
  @recurrence
end

#scopeObject

The scope(s) to which the downtime applies and must be in key:value format. For example, host:app2. Provide multiple scopes as a comma-separated list like env:dev,env:prod. The resulting downtime applies to sources that matches ALL provided scopes (env:dev AND env:prod).



61
62
63
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 61

def scope
  @scope
end

#startObject

POSIX timestamp to start the downtime. If not provided, the downtime starts the moment it is created.



64
65
66
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 64

def start
  @start
end

#timezoneObject

The timezone in which to display the downtime's start and end times in Datadog applications.



67
68
69
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 67

def timezone
  @timezone
end

#updater_idObject

ID of the last user that updated the downtime.



70
71
72
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 70

def updater_id
  @updater_id
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



95
96
97
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 95

def self.acceptable_attributes
  attribute_map.values
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



313
314
315
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 313

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

Instance Method Details

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



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
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 343

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when :Array
    # generic array, return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = DatadogAPIClient::V1.const_get(type)
    res = klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
    if res.instance_of? DatadogAPIClient::V1::UnparsedObject
      self._unparsed = true
    end
    res
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 421

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
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



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 320

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


300
301
302
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 300

def eql?(o)
  self == o
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 219

def list_invalid_properties
  invalid_properties = Array.new
  if !@creator_id.nil? && @creator_id > 2147483647
    invalid_properties.push('invalid value for "creator_id", must be smaller than or equal to 2147483647.')
  end

  if !@downtime_type.nil? && @downtime_type > 2147483647
    invalid_properties.push('invalid value for "downtime_type", must be smaller than or equal to 2147483647.')
  end

  if !@updater_id.nil? && @updater_id > 2147483647
    invalid_properties.push('invalid value for "updater_id", must be smaller than or equal to 2147483647.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



397
398
399
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 397

def to_body
  to_hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



391
392
393
# File 'lib/datadog_api_client/v1/models/downtime_child.rb', line 391

def to_s
  to_hash.to_s
end