Class: DatadogAPIClient::V1::Downtime
- Inherits:
-
Object
- Object
- DatadogAPIClient::V1::Downtime
- Includes:
- BaseGenericModel
- Defined in:
- lib/datadog_api_client/v1/models/downtime.rb,
lib/datadog_api_client/v1/models/downtime.rb
Overview
Downtiming gives you greater control over monitor notifications by allowing you to globally exclude scopes from alerting. Downtime settings, which can be scheduled with start and end times, prevent all alerting related to specified Datadog tags.
Instance Attribute Summary collapse
-
#_end ⇒ Object
POSIX timestamp to end the downtime.
-
#_unparsed ⇒ Object
whether the object has unparsed attributes.
-
#active ⇒ Object
If a scheduled downtime currently exists.
-
#active_child ⇒ Object
The downtime object definition of the active child for the original parent recurring downtime.
-
#additional_properties ⇒ Object
Returns the value of attribute additional_properties.
-
#canceled ⇒ Object
If a scheduled downtime is canceled.
-
#creator_id ⇒ Object
readonly
User ID of the downtime creator.
-
#disabled ⇒ Object
If a downtime has been disabled.
-
#downtime_type ⇒ Object
readonly
0
for a downtime applied on*
or all,1
when the downtime is only scoped to hosts, or2
when the downtime is scoped to anything but hosts. -
#id ⇒ Object
The downtime ID.
-
#message ⇒ Object
A message to include with notifications for this downtime.
-
#monitor_id ⇒ Object
A single monitor to which the downtime applies.
-
#monitor_tags ⇒ Object
A comma-separated list of monitor tags.
-
#mute_first_recovery_notification ⇒ Object
If the first recovery notification during a downtime should be muted.
-
#notify_end_states ⇒ Object
States for which
notify_end_types
sends out notifications for. -
#notify_end_types ⇒ Object
If set, notifies if a monitor is in an alert-worthy state (
ALERT
,WARNING
, orNO DATA
) when this downtime expires or is canceled. -
#parent_id ⇒ Object
ID of the parent Downtime.
-
#recurrence ⇒ Object
An object defining the recurrence of the downtime.
-
#scope ⇒ Object
The scope(s) to which the downtime applies and must be in
key:value
format. -
#start ⇒ Object
POSIX timestamp to start the downtime.
-
#timezone ⇒ Object
The timezone in which to display the downtime's start and end times in Datadog applications.
-
#updater_id ⇒ Object
readonly
ID of the last user that updated the downtime.
Class Method Summary collapse
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
Instance Method Summary collapse
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_s ⇒ String
Returns the string representation of the object.
Methods included from BaseGenericModel
Instance Attribute Details
#_end ⇒ Object
POSIX timestamp to end the downtime. If not provided, the downtime is in effect indefinitely until you cancel it.
43 44 45 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 43 def _end @_end end |
#_unparsed ⇒ Object
whether the object has unparsed attributes
23 24 25 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 23 def _unparsed @_unparsed end |
#active ⇒ Object
If a scheduled downtime currently exists.
26 27 28 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 26 def active @active end |
#active_child ⇒ Object
The downtime object definition of the active child for the original parent recurring downtime. This field will only exist on recurring downtimes.
32 33 34 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 32 def active_child @active_child end |
#additional_properties ⇒ Object
Returns the value of attribute additional_properties.
102 103 104 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 102 def additional_properties @additional_properties end |
#canceled ⇒ Object
If a scheduled downtime is canceled.
31 32 33 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 31 def canceled @canceled end |
#creator_id ⇒ Object
User ID of the downtime creator.
34 35 36 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 34 def creator_id @creator_id end |
#disabled ⇒ Object
If a downtime has been disabled.
37 38 39 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 37 def disabled @disabled end |
#downtime_type ⇒ Object
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.
40 41 42 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 40 def downtime_type @downtime_type end |
#id ⇒ Object
The downtime ID.
46 47 48 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 46 def id @id end |
#message ⇒ Object
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.
49 50 51 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 49 def @message end |
#monitor_id ⇒ Object
A single monitor to which the downtime applies. If not provided, the downtime applies to all monitors.
52 53 54 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 52 def monitor_id @monitor_id end |
#monitor_tags ⇒ Object
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
.
55 56 57 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 55 def @monitor_tags end |
#mute_first_recovery_notification ⇒ Object
If the first recovery notification during a downtime should be muted.
70 71 72 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 70 def mute_first_recovery_notification @mute_first_recovery_notification end |
#notify_end_states ⇒ Object
States for which notify_end_types
sends out notifications for.
73 74 75 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 73 def notify_end_states @notify_end_states end |
#notify_end_types ⇒ Object
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.
79 80 81 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 79 def notify_end_types @notify_end_types end |
#parent_id ⇒ Object
ID of the parent Downtime.
58 59 60 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 58 def parent_id @parent_id end |
#recurrence ⇒ Object
An object defining the recurrence of the downtime.
85 86 87 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 85 def recurrence @recurrence end |
#scope ⇒ Object
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
).
63 64 65 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 63 def scope @scope end |
#start ⇒ Object
POSIX timestamp to start the downtime. If not provided, the downtime starts the moment it is created.
66 67 68 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 66 def start @start end |
#timezone ⇒ Object
The timezone in which to display the downtime's start and end times in Datadog applications.
69 70 71 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 69 def timezone @timezone end |
#updater_id ⇒ Object
ID of the last user that updated the downtime.
72 73 74 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 72 def updater_id @updater_id end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
98 99 100 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 98 def self.acceptable_attributes attribute_map.values end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
323 324 325 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 323 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
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 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 353 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
431 432 433 434 435 436 437 438 439 440 441 442 443 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 431 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
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 330 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
310 311 312 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 310 def eql?(o) self == o end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 228 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_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
407 408 409 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 407 def to_body to_hash end |
#to_s ⇒ String
Returns the string representation of the object
401 402 403 |
# File 'lib/datadog_api_client/v1/models/downtime.rb', line 401 def to_s to_hash.to_s end |