Class: MistApi::SuppressedAlarm
- Defined in:
- lib/mist_api/models/suppressed_alarm.rb
Overview
SuppressedAlarm Model.
Instance Attribute Summary collapse
-
#applies ⇒ SuppressedAlarmApplies
If ‘scope`==`site`.
-
#duration ⇒ Float
Duration, in seconds.
-
#scheduled_time ⇒ Integer
Epoch_time in seconds, Default as now, accepted time range is from now to now + 7 days.
-
#scope ⇒ SuppressedAlarmScopeEnum
level of scope.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(applies = SKIP, duration = 3600, scheduled_time = SKIP, scope = SuppressedAlarmScopeEnum::SITE, additional_properties = nil) ⇒ SuppressedAlarm
constructor
A new instance of SuppressedAlarm.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(applies = SKIP, duration = 3600, scheduled_time = SKIP, scope = SuppressedAlarmScopeEnum::SITE, additional_properties = nil) ⇒ SuppressedAlarm
Returns a new instance of SuppressedAlarm.
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/mist_api/models/suppressed_alarm.rb', line 57 def initialize(applies = SKIP, duration = 3600, scheduled_time = SKIP, scope = SuppressedAlarmScopeEnum::SITE, additional_properties = nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @applies = applies unless applies == SKIP @duration = duration unless duration == SKIP @scheduled_time = scheduled_time unless scheduled_time == SKIP @scope = scope unless scope == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#applies ⇒ SuppressedAlarmApplies
If ‘scope`==`site`. Object defines the scope (within the org e.g. whole org, and/or some site_groups, and/or some sites) for which the alarm service has to be suppressed for some `duration`
16 17 18 |
# File 'lib/mist_api/models/suppressed_alarm.rb', line 16 def applies @applies end |
#duration ⇒ Float
Duration, in seconds. Maximum duration is 86400 * 180 (180 days). 0 is to un-suppress alarms
21 22 23 |
# File 'lib/mist_api/models/suppressed_alarm.rb', line 21 def duration @duration end |
#scheduled_time ⇒ Integer
Epoch_time in seconds, Default as now, accepted time range is from now to now + 7 days
26 27 28 |
# File 'lib/mist_api/models/suppressed_alarm.rb', line 26 def scheduled_time @scheduled_time end |
#scope ⇒ SuppressedAlarmScopeEnum
level of scope. enum: ‘org`, `site`
30 31 32 |
# File 'lib/mist_api/models/suppressed_alarm.rb', line 30 def scope @scope end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/mist_api/models/suppressed_alarm.rb', line 71 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. applies = SuppressedAlarmApplies.from_hash(hash['applies']) if hash['applies'] duration = hash['duration'] ||= 3600 scheduled_time = hash.key?('scheduled_time') ? hash['scheduled_time'] : SKIP scope = hash['scope'] ||= SuppressedAlarmScopeEnum::SITE # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. SuppressedAlarm.new(applies, duration, scheduled_time, scope, additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 |
# File 'lib/mist_api/models/suppressed_alarm.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['applies'] = 'applies' @_hash['duration'] = 'duration' @_hash['scheduled_time'] = 'scheduled_time' @_hash['scope'] = 'scope' @_hash end |
.nullables ⇒ Object
An array for nullable fields
53 54 55 |
# File 'lib/mist_api/models/suppressed_alarm.rb', line 53 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
43 44 45 46 47 48 49 50 |
# File 'lib/mist_api/models/suppressed_alarm.rb', line 43 def self.optionals %w[ applies duration scheduled_time scope ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
104 105 106 107 108 109 |
# File 'lib/mist_api/models/suppressed_alarm.rb', line 104 def inspect class_name = self.class.name.split('::').last "<#{class_name} applies: #{@applies.inspect}, duration: #{@duration.inspect},"\ " scheduled_time: #{@scheduled_time.inspect}, scope: #{@scope.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
97 98 99 100 101 |
# File 'lib/mist_api/models/suppressed_alarm.rb', line 97 def to_s class_name = self.class.name.split('::').last "<#{class_name} applies: #{@applies}, duration: #{@duration}, scheduled_time:"\ " #{@scheduled_time}, scope: #{@scope}, additional_properties: #{@additional_properties}>" end |