Class: MistApi::DeviceEvent

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

Overview

DeviceEvent Model.

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(org_id = nil, timestamp = nil, type = nil, ap = SKIP, ap_name = SKIP, apfw = SKIP, audit_id = SKIP, bandwidth = SKIP, channel = SKIP, chassis_mac = SKIP, count = SKIP, device_name = SKIP, device_type = SKIP, ev_type = SKIP, ext_ip = SKIP, mac = SKIP, model = SKIP, node = SKIP, port_id = SKIP, power = SKIP, pre_bandwidth = SKIP, pre_channel = SKIP, pre_power = SKIP, pre_usage = SKIP, reason = SKIP, site_id = SKIP, site_name = SKIP, text = SKIP, usage = SKIP, version = SKIP) ⇒ DeviceEvent

Returns a new instance of DeviceEvent.



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
239
240
241
242
243
244
245
# File 'lib/mist_api/models/device_event.rb', line 206

def initialize(org_id = nil, timestamp = nil, type = nil, ap = SKIP,
               ap_name = SKIP, apfw = SKIP, audit_id = SKIP,
               bandwidth = SKIP, channel = SKIP, chassis_mac = SKIP,
               count = SKIP, device_name = SKIP, device_type = SKIP,
               ev_type = SKIP, ext_ip = SKIP, mac = SKIP, model = SKIP,
               node = SKIP, port_id = SKIP, power = SKIP,
               pre_bandwidth = SKIP, pre_channel = SKIP, pre_power = SKIP,
               pre_usage = SKIP, reason = SKIP, site_id = SKIP,
               site_name = SKIP, text = SKIP, usage = SKIP, version = SKIP)
  @ap = ap unless ap == SKIP
  @ap_name = ap_name unless ap_name == SKIP
  @apfw = apfw unless apfw == SKIP
  @audit_id = audit_id unless audit_id == SKIP
  @bandwidth = bandwidth unless bandwidth == SKIP
  @channel = channel unless channel == SKIP
  @chassis_mac = chassis_mac unless chassis_mac == SKIP
  @count = count unless count == SKIP
  @device_name = device_name unless device_name == SKIP
  @device_type = device_type unless device_type == SKIP
  @ev_type = ev_type unless ev_type == SKIP
  @ext_ip = ext_ip unless ext_ip == SKIP
  @mac = mac unless mac == SKIP
  @model = model unless model == SKIP
  @node = node unless node == SKIP
  @org_id = org_id
  @port_id = port_id unless port_id == SKIP
  @power = power unless power == SKIP
  @pre_bandwidth = pre_bandwidth unless pre_bandwidth == SKIP
  @pre_channel = pre_channel unless pre_channel == SKIP
  @pre_power = pre_power unless pre_power == SKIP
  @pre_usage = pre_usage unless pre_usage == SKIP
  @reason = reason unless reason == SKIP
  @site_id = site_id unless site_id == SKIP
  @site_name = site_name unless site_name == SKIP
  @text = text unless text == SKIP
  @timestamp = timestamp
  @type = type
  @usage = usage unless usage == SKIP
  @version = version unless version == SKIP
end

Instance Attribute Details

#apString

(will be deprecated soon; please use mac instead) ap mac

Returns:

  • (String)


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

def ap
  @ap
end

#ap_nameString

(will be deprecated soon; please use device_name instead) ap name

Returns:

  • (String)


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

def ap_name
  @ap_name
end

#apfwString

(will be deprecated soon; please use device_name instead) ap name

Returns:

  • (String)


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

def apfw
  @apfw
end

#audit_idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


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

def audit_id
  @audit_id
end

#bandwidthInteger

Unique ID of the object instance in the Mist Organization

Returns:

  • (Integer)


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

def bandwidth
  @bandwidth
end

#channelInteger

Unique ID of the object instance in the Mist Organization

Returns:

  • (Integer)


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

def channel
  @channel
end

#chassis_macString

Unique ID of the object instance in the Mist Organization

Returns:

  • (String)


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

def chassis_mac
  @chassis_mac
end

#countInteger

Unique ID of the object instance in the Mist Organization

Returns:

  • (Integer)


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

def count
  @count
end

#device_nameString

Device name

Returns:

  • (String)


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

def device_name
  @device_name
end

#device_typeDeviceTypeEnum

enum: ‘ap`, `gateway`, `switch`

Returns:



50
51
52
# File 'lib/mist_api/models/device_event.rb', line 50

def device_type
  @device_type
end

#ev_typeWebhookDeviceEventsEventEvTypeEnum

(optional) event advisory. enum: ‘notice`, `warn`



54
55
56
# File 'lib/mist_api/models/device_event.rb', line 54

def ev_type
  @ev_type
end

#ext_ipString

(optional) event advisory. enum: ‘notice`, `warn`

Returns:

  • (String)


58
59
60
# File 'lib/mist_api/models/device_event.rb', line 58

def ext_ip
  @ext_ip
end

#macString

Device mac

Returns:

  • (String)


62
63
64
# File 'lib/mist_api/models/device_event.rb', line 62

def mac
  @mac
end

#modelString

Device mac

Returns:

  • (String)


66
67
68
# File 'lib/mist_api/models/device_event.rb', line 66

def model
  @model
end

#nodeString

Device mac

Returns:

  • (String)


70
71
72
# File 'lib/mist_api/models/device_event.rb', line 70

def node
  @node
end

#org_idUUID | String

Device mac

Returns:

  • (UUID | String)


74
75
76
# File 'lib/mist_api/models/device_event.rb', line 74

def org_id
  @org_id
end

#port_idString

Device mac

Returns:

  • (String)


78
79
80
# File 'lib/mist_api/models/device_event.rb', line 78

def port_id
  @port_id
end

#powerInteger

Device mac

Returns:

  • (Integer)


82
83
84
# File 'lib/mist_api/models/device_event.rb', line 82

def power
  @power
end

#pre_bandwidthInteger

Device mac

Returns:

  • (Integer)


86
87
88
# File 'lib/mist_api/models/device_event.rb', line 86

def pre_bandwidth
  @pre_bandwidth
end

#pre_channelInteger

Device mac

Returns:

  • (Integer)


90
91
92
# File 'lib/mist_api/models/device_event.rb', line 90

def pre_channel
  @pre_channel
end

#pre_powerInteger

Device mac

Returns:

  • (Integer)


94
95
96
# File 'lib/mist_api/models/device_event.rb', line 94

def pre_power
  @pre_power
end

#pre_usageInteger

Device mac

Returns:

  • (Integer)


98
99
100
# File 'lib/mist_api/models/device_event.rb', line 98

def pre_usage
  @pre_usage
end

#reasonString

(optional) event reason

Returns:

  • (String)


102
103
104
# File 'lib/mist_api/models/device_event.rb', line 102

def reason
  @reason
end

#site_idUUID | String

(optional) event reason

Returns:

  • (UUID | String)


106
107
108
# File 'lib/mist_api/models/device_event.rb', line 106

def site_id
  @site_id
end

#site_nameString

Site name

Returns:

  • (String)


110
111
112
# File 'lib/mist_api/models/device_event.rb', line 110

def site_name
  @site_name
end

#textString

(optional) event description

Returns:

  • (String)


114
115
116
# File 'lib/mist_api/models/device_event.rb', line 114

def text
  @text
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


118
119
120
# File 'lib/mist_api/models/device_event.rb', line 118

def timestamp
  @timestamp
end

#typeString

Event type

Returns:

  • (String)


122
123
124
# File 'lib/mist_api/models/device_event.rb', line 122

def type
  @type
end

#usageInteger

Event type

Returns:

  • (Integer)


126
127
128
# File 'lib/mist_api/models/device_event.rb', line 126

def usage
  @usage
end

#versionString

Event type

Returns:

  • (String)


130
131
132
# File 'lib/mist_api/models/device_event.rb', line 130

def version
  @version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
306
307
308
309
310
311
312
313
314
# File 'lib/mist_api/models/device_event.rb', line 248

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  org_id = hash.key?('org_id') ? hash['org_id'] : nil
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  ap = hash.key?('ap') ? hash['ap'] : SKIP
  ap_name = hash.key?('ap_name') ? hash['ap_name'] : SKIP
  apfw = hash.key?('apfw') ? hash['apfw'] : SKIP
  audit_id = hash.key?('audit_id') ? hash['audit_id'] : SKIP
  bandwidth = hash.key?('bandwidth') ? hash['bandwidth'] : SKIP
  channel = hash.key?('channel') ? hash['channel'] : SKIP
  chassis_mac = hash.key?('chassis_mac') ? hash['chassis_mac'] : SKIP
  count = hash.key?('count') ? hash['count'] : SKIP
  device_name = hash.key?('device_name') ? hash['device_name'] : SKIP
  device_type = hash.key?('device_type') ? hash['device_type'] : SKIP
  ev_type = hash.key?('ev_type') ? hash['ev_type'] : SKIP
  ext_ip = hash.key?('ext_ip') ? hash['ext_ip'] : SKIP
  mac = hash.key?('mac') ? hash['mac'] : SKIP
  model = hash.key?('model') ? hash['model'] : SKIP
  node = hash.key?('node') ? hash['node'] : SKIP
  port_id = hash.key?('port_id') ? hash['port_id'] : SKIP
  power = hash.key?('power') ? hash['power'] : SKIP
  pre_bandwidth = hash.key?('pre_bandwidth') ? hash['pre_bandwidth'] : SKIP
  pre_channel = hash.key?('pre_channel') ? hash['pre_channel'] : SKIP
  pre_power = hash.key?('pre_power') ? hash['pre_power'] : SKIP
  pre_usage = hash.key?('pre_usage') ? hash['pre_usage'] : SKIP
  reason = hash.key?('reason') ? hash['reason'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  site_name = hash.key?('site_name') ? hash['site_name'] : SKIP
  text = hash.key?('text') ? hash['text'] : SKIP
  usage = hash.key?('usage') ? hash['usage'] : SKIP
  version = hash.key?('version') ? hash['version'] : SKIP

  # Create object from extracted values.
  DeviceEvent.new(org_id,
                  timestamp,
                  type,
                  ap,
                  ap_name,
                  apfw,
                  audit_id,
                  bandwidth,
                  channel,
                  chassis_mac,
                  count,
                  device_name,
                  device_type,
                  ev_type,
                  ext_ip,
                  mac,
                  model,
                  node,
                  port_id,
                  power,
                  pre_bandwidth,
                  pre_channel,
                  pre_power,
                  pre_usage,
                  reason,
                  site_id,
                  site_name,
                  text,
                  usage,
                  version)
end

.namesObject

A mapping from model property names to API property names.



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/mist_api/models/device_event.rb', line 133

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ap'] = 'ap'
  @_hash['ap_name'] = 'ap_name'
  @_hash['apfw'] = 'apfw'
  @_hash['audit_id'] = 'audit_id'
  @_hash['bandwidth'] = 'bandwidth'
  @_hash['channel'] = 'channel'
  @_hash['chassis_mac'] = 'chassis_mac'
  @_hash['count'] = 'count'
  @_hash['device_name'] = 'device_name'
  @_hash['device_type'] = 'device_type'
  @_hash['ev_type'] = 'ev_type'
  @_hash['ext_ip'] = 'ext_ip'
  @_hash['mac'] = 'mac'
  @_hash['model'] = 'model'
  @_hash['node'] = 'node'
  @_hash['org_id'] = 'org_id'
  @_hash['port_id'] = 'port_id'
  @_hash['power'] = 'power'
  @_hash['pre_bandwidth'] = 'pre_bandwidth'
  @_hash['pre_channel'] = 'pre_channel'
  @_hash['pre_power'] = 'pre_power'
  @_hash['pre_usage'] = 'pre_usage'
  @_hash['reason'] = 'reason'
  @_hash['site_id'] = 'site_id'
  @_hash['site_name'] = 'site_name'
  @_hash['text'] = 'text'
  @_hash['timestamp'] = 'timestamp'
  @_hash['type'] = 'type'
  @_hash['usage'] = 'usage'
  @_hash['version'] = 'version'
  @_hash
end

.nullablesObject

An array for nullable fields



202
203
204
# File 'lib/mist_api/models/device_event.rb', line 202

def self.nullables
  []
end

.optionalsObject

An array for optional fields



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/mist_api/models/device_event.rb', line 169

def self.optionals
  %w[
    ap
    ap_name
    apfw
    audit_id
    bandwidth
    channel
    chassis_mac
    count
    device_name
    device_type
    ev_type
    ext_ip
    mac
    model
    node
    port_id
    power
    pre_bandwidth
    pre_channel
    pre_power
    pre_usage
    reason
    site_id
    site_name
    text
    usage
    version
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (DeviceEvent | Hash)

    value against the validation is performed.



318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/mist_api/models/device_event.rb', line 318

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.org_id,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.timestamp,
                              ->(val) { val.instance_of? Float }) and
        APIHelper.valid_type?(value.type,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['org_id'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['timestamp'],
                            ->(val) { val.instance_of? Float }) and
      APIHelper.valid_type?(value['type'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/mist_api/models/device_event.rb', line 356

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} ap: #{@ap.inspect}, ap_name: #{@ap_name.inspect}, apfw: #{@apfw.inspect},"\
  " audit_id: #{@audit_id.inspect}, bandwidth: #{@bandwidth.inspect}, channel:"\
  " #{@channel.inspect}, chassis_mac: #{@chassis_mac.inspect}, count: #{@count.inspect},"\
  " device_name: #{@device_name.inspect}, device_type: #{@device_type.inspect}, ev_type:"\
  " #{@ev_type.inspect}, ext_ip: #{@ext_ip.inspect}, mac: #{@mac.inspect}, model:"\
  " #{@model.inspect}, node: #{@node.inspect}, org_id: #{@org_id.inspect}, port_id:"\
  " #{@port_id.inspect}, power: #{@power.inspect}, pre_bandwidth: #{@pre_bandwidth.inspect},"\
  " pre_channel: #{@pre_channel.inspect}, pre_power: #{@pre_power.inspect}, pre_usage:"\
  " #{@pre_usage.inspect}, reason: #{@reason.inspect}, site_id: #{@site_id.inspect},"\
  " site_name: #{@site_name.inspect}, text: #{@text.inspect}, timestamp:"\
  " #{@timestamp.inspect}, type: #{@type.inspect}, usage: #{@usage.inspect}, version:"\
  " #{@version.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



343
344
345
346
347
348
349
350
351
352
353
# File 'lib/mist_api/models/device_event.rb', line 343

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} ap: #{@ap}, ap_name: #{@ap_name}, apfw: #{@apfw}, audit_id: #{@audit_id},"\
  " bandwidth: #{@bandwidth}, channel: #{@channel}, chassis_mac: #{@chassis_mac}, count:"\
  " #{@count}, device_name: #{@device_name}, device_type: #{@device_type}, ev_type:"\
  " #{@ev_type}, ext_ip: #{@ext_ip}, mac: #{@mac}, model: #{@model}, node: #{@node}, org_id:"\
  " #{@org_id}, port_id: #{@port_id}, power: #{@power}, pre_bandwidth: #{@pre_bandwidth},"\
  " pre_channel: #{@pre_channel}, pre_power: #{@pre_power}, pre_usage: #{@pre_usage}, reason:"\
  " #{@reason}, site_id: #{@site_id}, site_name: #{@site_name}, text: #{@text}, timestamp:"\
  " #{@timestamp}, type: #{@type}, usage: #{@usage}, version: #{@version}>"
end