Class: MistApi::Alarm

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/alarm.rb

Overview

Additional information per alarm type

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(count = nil, group = nil, id = nil, last_seen = nil, severity = nil, timestamp = nil, type = nil, ack_admin_id = SKIP, ack_admin_name = SKIP, acked = SKIP, acked_time = SKIP, aps = SKIP, bssids = SKIP, gateways = SKIP, hostnames = SKIP, note = SKIP, org_id = SKIP, resolved_time = SKIP, site_id = SKIP, ssids = SKIP, status = SKIP, switches = SKIP) ⇒ Alarm

Returns a new instance of Alarm.



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/mist_api/models/alarm.rb', line 155

def initialize(count = nil, group = nil, id = nil, last_seen = nil,
               severity = nil, timestamp = nil, type = nil,
               ack_admin_id = SKIP, ack_admin_name = SKIP, acked = SKIP,
               acked_time = SKIP, aps = SKIP, bssids = SKIP,
               gateways = SKIP, hostnames = SKIP, note = SKIP,
               org_id = SKIP, resolved_time = SKIP, site_id = SKIP,
               ssids = SKIP, status = SKIP, switches = SKIP)
  @ack_admin_id = ack_admin_id unless ack_admin_id == SKIP
  @ack_admin_name = ack_admin_name unless ack_admin_name == SKIP
  @acked = acked unless acked == SKIP
  @acked_time = acked_time unless acked_time == SKIP
  @aps = aps unless aps == SKIP
  @bssids = bssids unless bssids == SKIP
  @count = count
  @gateways = gateways unless gateways == SKIP
  @group = group
  @hostnames = hostnames unless hostnames == SKIP
  @id = id
  @last_seen = last_seen
  @note = note unless note == SKIP
  @org_id = org_id unless org_id == SKIP
  @resolved_time = resolved_time unless resolved_time == SKIP
  @severity = severity
  @site_id = site_id unless site_id == SKIP
  @ssids = ssids unless ssids == SKIP
  @status = status unless status == SKIP
  @switches = switches unless switches == SKIP
  @timestamp = timestamp
  @type = type
end

Instance Attribute Details

#ack_admin_idUUID | String

UUID of the admin who acked the alarm

Returns:

  • (UUID | String)


14
15
16
# File 'lib/mist_api/models/alarm.rb', line 14

def ack_admin_id
  @ack_admin_id
end

#ack_admin_nameString

Name & Email ID of the admin who acked the alarm

Returns:

  • (String)


18
19
20
# File 'lib/mist_api/models/alarm.rb', line 18

def ack_admin_name
  @ack_admin_name
end

#ackedTrueClass | FalseClass

Whether the alarm is acked or not

Returns:

  • (TrueClass | FalseClass)


22
23
24
# File 'lib/mist_api/models/alarm.rb', line 22

def acked
  @acked
end

#acked_timeInteger

Epoch (seconds) when the alarm was acked

Returns:

  • (Integer)


26
27
28
# File 'lib/mist_api/models/alarm.rb', line 26

def acked_time
  @acked_time
end

#apsArray[String]

additional information: List of MACs of the APs

Returns:

  • (Array[String])


30
31
32
# File 'lib/mist_api/models/alarm.rb', line 30

def aps
  @aps
end

#bssidsArray[String]

List of BSSIDs

Returns:

  • (Array[String])


34
35
36
# File 'lib/mist_api/models/alarm.rb', line 34

def bssids
  @bssids
end

#countInteger

Number of incident within an alarm window

Returns:

  • (Integer)


38
39
40
# File 'lib/mist_api/models/alarm.rb', line 38

def count
  @count
end

#gatewaysArray[String]

additional information: List of MACs of the gateways

Returns:

  • (Array[String])


42
43
44
# File 'lib/mist_api/models/alarm.rb', line 42

def gateways
  @gateways
end

#groupString

Group of the alarm

Returns:

  • (String)


46
47
48
# File 'lib/mist_api/models/alarm.rb', line 46

def group
  @group
end

#hostnamesArray[String]

additional information: List of Hostnames of the devices (AP/Switch/Gateway)

Returns:

  • (Array[String])


51
52
53
# File 'lib/mist_api/models/alarm.rb', line 51

def hostnames
  @hostnames
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


55
56
57
# File 'lib/mist_api/models/alarm.rb', line 55

def id
  @id
end

#last_seenFloat

Epoch (seconds) of the last incident/alarm within an alarm window

Returns:

  • (Float)


59
60
61
# File 'lib/mist_api/models/alarm.rb', line 59

def last_seen
  @last_seen
end

#noteString

Text describing the alarm

Returns:

  • (String)


63
64
65
# File 'lib/mist_api/models/alarm.rb', line 63

def note
  @note
end

#org_idUUID | String

Text describing the alarm

Returns:

  • (UUID | String)


67
68
69
# File 'lib/mist_api/models/alarm.rb', line 67

def org_id
  @org_id
end

#resolved_timeInteger

Epoch (seconds) of the resolved_time for the alarm

Returns:

  • (Integer)


71
72
73
# File 'lib/mist_api/models/alarm.rb', line 71

def resolved_time
  @resolved_time
end

#severityString

Severity of the alarm

Returns:

  • (String)


75
76
77
# File 'lib/mist_api/models/alarm.rb', line 75

def severity
  @severity
end

#site_idUUID | String

Severity of the alarm

Returns:

  • (UUID | String)


79
80
81
# File 'lib/mist_api/models/alarm.rb', line 79

def site_id
  @site_id
end

#ssidsArray[String]

List of SSIDs

Returns:

  • (Array[String])


83
84
85
# File 'lib/mist_api/models/alarm.rb', line 83

def ssids
  @ssids
end

#statusAlarmStatusEnum

enum: ‘open`, `resolved`

Returns:



87
88
89
# File 'lib/mist_api/models/alarm.rb', line 87

def status
  @status
end

#switchesArray[String]

additional information: List of MACs of the switches

Returns:

  • (Array[String])


91
92
93
# File 'lib/mist_api/models/alarm.rb', line 91

def switches
  @switches
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


95
96
97
# File 'lib/mist_api/models/alarm.rb', line 95

def timestamp
  @timestamp
end

#typeString

Key-name of the alarm type

Returns:

  • (String)


99
100
101
# File 'lib/mist_api/models/alarm.rb', line 99

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/mist_api/models/alarm.rb', line 187

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  count = hash.key?('count') ? hash['count'] : nil
  group = hash.key?('group') ? hash['group'] : nil
  id = hash.key?('id') ? hash['id'] : nil
  last_seen = hash.key?('last_seen') ? hash['last_seen'] : nil
  severity = hash.key?('severity') ? hash['severity'] : nil
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  ack_admin_id = hash.key?('ack_admin_id') ? hash['ack_admin_id'] : SKIP
  ack_admin_name =
    hash.key?('ack_admin_name') ? hash['ack_admin_name'] : SKIP
  acked = hash.key?('acked') ? hash['acked'] : SKIP
  acked_time = hash.key?('acked_time') ? hash['acked_time'] : SKIP
  aps = hash.key?('aps') ? hash['aps'] : SKIP
  bssids = hash.key?('bssids') ? hash['bssids'] : SKIP
  gateways = hash.key?('gateways') ? hash['gateways'] : SKIP
  hostnames = hash.key?('hostnames') ? hash['hostnames'] : SKIP
  note = hash.key?('note') ? hash['note'] : SKIP
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  resolved_time = hash.key?('resolved_time') ? hash['resolved_time'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  ssids = hash.key?('ssids') ? hash['ssids'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  switches = hash.key?('switches') ? hash['switches'] : SKIP

  # Create object from extracted values.
  Alarm.new(count,
            group,
            id,
            last_seen,
            severity,
            timestamp,
            type,
            ack_admin_id,
            ack_admin_name,
            acked,
            acked_time,
            aps,
            bssids,
            gateways,
            hostnames,
            note,
            org_id,
            resolved_time,
            site_id,
            ssids,
            status,
            switches)
end

.namesObject

A mapping from model property names to API property names.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/mist_api/models/alarm.rb', line 102

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ack_admin_id'] = 'ack_admin_id'
  @_hash['ack_admin_name'] = 'ack_admin_name'
  @_hash['acked'] = 'acked'
  @_hash['acked_time'] = 'acked_time'
  @_hash['aps'] = 'aps'
  @_hash['bssids'] = 'bssids'
  @_hash['count'] = 'count'
  @_hash['gateways'] = 'gateways'
  @_hash['group'] = 'group'
  @_hash['hostnames'] = 'hostnames'
  @_hash['id'] = 'id'
  @_hash['last_seen'] = 'last_seen'
  @_hash['note'] = 'note'
  @_hash['org_id'] = 'org_id'
  @_hash['resolved_time'] = 'resolved_time'
  @_hash['severity'] = 'severity'
  @_hash['site_id'] = 'site_id'
  @_hash['ssids'] = 'ssids'
  @_hash['status'] = 'status'
  @_hash['switches'] = 'switches'
  @_hash['timestamp'] = 'timestamp'
  @_hash['type'] = 'type'
  @_hash
end

.nullablesObject

An array for nullable fields



151
152
153
# File 'lib/mist_api/models/alarm.rb', line 151

def self.nullables
  []
end

.optionalsObject

An array for optional fields



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/mist_api/models/alarm.rb', line 130

def self.optionals
  %w[
    ack_admin_id
    ack_admin_name
    acked
    acked_time
    aps
    bssids
    gateways
    hostnames
    note
    org_id
    resolved_time
    site_id
    ssids
    status
    switches
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



252
253
254
255
256
257
258
259
260
261
262
263
# File 'lib/mist_api/models/alarm.rb', line 252

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} ack_admin_id: #{@ack_admin_id.inspect}, ack_admin_name:"\
  " #{@ack_admin_name.inspect}, acked: #{@acked.inspect}, acked_time: #{@acked_time.inspect},"\
  " aps: #{@aps.inspect}, bssids: #{@bssids.inspect}, count: #{@count.inspect}, gateways:"\
  " #{@gateways.inspect}, group: #{@group.inspect}, hostnames: #{@hostnames.inspect}, id:"\
  " #{@id.inspect}, last_seen: #{@last_seen.inspect}, note: #{@note.inspect}, org_id:"\
  " #{@org_id.inspect}, resolved_time: #{@resolved_time.inspect}, severity:"\
  " #{@severity.inspect}, site_id: #{@site_id.inspect}, ssids: #{@ssids.inspect}, status:"\
  " #{@status.inspect}, switches: #{@switches.inspect}, timestamp: #{@timestamp.inspect},"\
  " type: #{@type.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



241
242
243
244
245
246
247
248
249
# File 'lib/mist_api/models/alarm.rb', line 241

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} ack_admin_id: #{@ack_admin_id}, ack_admin_name: #{@ack_admin_name}, acked:"\
  " #{@acked}, acked_time: #{@acked_time}, aps: #{@aps}, bssids: #{@bssids}, count: #{@count},"\
  " gateways: #{@gateways}, group: #{@group}, hostnames: #{@hostnames}, id: #{@id}, last_seen:"\
  " #{@last_seen}, note: #{@note}, org_id: #{@org_id}, resolved_time: #{@resolved_time},"\
  " severity: #{@severity}, site_id: #{@site_id}, ssids: #{@ssids}, status: #{@status},"\
  " switches: #{@switches}, timestamp: #{@timestamp}, type: #{@type}>"
end