Class: MistApi::WebhookAlarmEvent

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

Overview

WebhookAlarmEvent 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(id = nil, org_id = nil, site_id = nil, timestamp = nil, type = nil, aps = SKIP, bssids = SKIP, count = SKIP, event_id = SKIP, for_site = SKIP, last_seen = SKIP, node = SKIP, ssids = SKIP, update = SKIP) ⇒ WebhookAlarmEvent

Returns a new instance of WebhookAlarmEvent.



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/mist_api/models/webhook_alarm_event.rb', line 112

def initialize(id = nil, org_id = nil, site_id = nil, timestamp = nil,
               type = nil, aps = SKIP, bssids = SKIP, count = SKIP,
               event_id = SKIP, for_site = SKIP, last_seen = SKIP,
               node = SKIP, ssids = SKIP, update = SKIP)
  @aps = aps unless aps == SKIP
  @bssids = bssids unless bssids == SKIP
  @count = count unless count == SKIP
  @event_id = event_id unless event_id == SKIP
  @for_site = for_site unless for_site == SKIP
  @id = id
  @last_seen = last_seen unless last_seen == SKIP
  @node = node unless node == SKIP
  @org_id = org_id
  @site_id = site_id
  @ssids = ssids unless ssids == SKIP
  @timestamp = timestamp
  @type = type
  @update = update unless update == SKIP
end

Instance Attribute Details

#apsArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def aps
  @aps
end

#bssidsArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def bssids
  @bssids
end

#countInteger

If present, represents number of events of given type occurred in current interval, default=1

Returns:

  • (Integer)


23
24
25
# File 'lib/mist_api/models/webhook_alarm_event.rb', line 23

def count
  @count
end

#event_idUUID | String

Event id

Returns:

  • (UUID | String)


27
28
29
# File 'lib/mist_api/models/webhook_alarm_event.rb', line 27

def event_id
  @event_id
end

#for_siteTrueClass | FalseClass

Event id

Returns:

  • (TrueClass | FalseClass)


31
32
33
# File 'lib/mist_api/models/webhook_alarm_event.rb', line 31

def for_site
  @for_site
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


35
36
37
# File 'lib/mist_api/models/webhook_alarm_event.rb', line 35

def id
  @id
end

#last_seenFloat

Last seen timestamp

Returns:

  • (Float)


39
40
41
# File 'lib/mist_api/models/webhook_alarm_event.rb', line 39

def last_seen
  @last_seen
end

#nodeHaClusterNodeEnum

only for HA. enum: ‘node0`, `node1`

Returns:



43
44
45
# File 'lib/mist_api/models/webhook_alarm_event.rb', line 43

def node
  @node
end

#org_idUUID | String

only for HA. enum: ‘node0`, `node1`

Returns:

  • (UUID | String)


47
48
49
# File 'lib/mist_api/models/webhook_alarm_event.rb', line 47

def org_id
  @org_id
end

#site_idUUID | String

only for HA. enum: ‘node0`, `node1`

Returns:

  • (UUID | String)


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

def site_id
  @site_id
end

#ssidsArray[String]

only for HA. enum: ‘node0`, `node1`

Returns:

  • (Array[String])


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

def ssids
  @ssids
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


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

def timestamp
  @timestamp
end

#typeString

Event type

Returns:

  • (String)


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

def type
  @type
end

#updateTrueClass | FalseClass

If presents, represents that this is an update to event with given id sent earlier. default=false

Returns:

  • (TrueClass | FalseClass)


68
69
70
# File 'lib/mist_api/models/webhook_alarm_event.rb', line 68

def update
  @update
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
167
# File 'lib/mist_api/models/webhook_alarm_event.rb', line 133

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  org_id = hash.key?('org_id') ? hash['org_id'] : nil
  site_id = hash.key?('site_id') ? hash['site_id'] : nil
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  aps = hash.key?('aps') ? hash['aps'] : SKIP
  bssids = hash.key?('bssids') ? hash['bssids'] : SKIP
  count = hash.key?('count') ? hash['count'] : SKIP
  event_id = hash.key?('event_id') ? hash['event_id'] : SKIP
  for_site = hash.key?('for_site') ? hash['for_site'] : SKIP
  last_seen = hash.key?('last_seen') ? hash['last_seen'] : SKIP
  node = hash.key?('node') ? hash['node'] : SKIP
  ssids = hash.key?('ssids') ? hash['ssids'] : SKIP
  update = hash.key?('update') ? hash['update'] : SKIP

  # Create object from extracted values.
  WebhookAlarmEvent.new(id,
                        org_id,
                        site_id,
                        timestamp,
                        type,
                        aps,
                        bssids,
                        count,
                        event_id,
                        for_site,
                        last_seen,
                        node,
                        ssids,
                        update)
end

.namesObject

A mapping from model property names to API property names.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/mist_api/models/webhook_alarm_event.rb', line 71

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['aps'] = 'aps'
  @_hash['bssids'] = 'bssids'
  @_hash['count'] = 'count'
  @_hash['event_id'] = 'event_id'
  @_hash['for_site'] = 'for_site'
  @_hash['id'] = 'id'
  @_hash['last_seen'] = 'last_seen'
  @_hash['node'] = 'node'
  @_hash['org_id'] = 'org_id'
  @_hash['site_id'] = 'site_id'
  @_hash['ssids'] = 'ssids'
  @_hash['timestamp'] = 'timestamp'
  @_hash['type'] = 'type'
  @_hash['update'] = 'update'
  @_hash
end

.nullablesObject

An array for nullable fields



106
107
108
109
110
# File 'lib/mist_api/models/webhook_alarm_event.rb', line 106

def self.nullables
  %w[
    last_seen
  ]
end

.optionalsObject

An array for optional fields



91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/mist_api/models/webhook_alarm_event.rb', line 91

def self.optionals
  %w[
    aps
    bssids
    count
    event_id
    for_site
    last_seen
    node
    ssids
    update
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



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
200
201
# File 'lib/mist_api/models/webhook_alarm_event.rb', line 171

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.id,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.org_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.site_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['id'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['org_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['site_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.



213
214
215
216
217
218
219
220
# File 'lib/mist_api/models/webhook_alarm_event.rb', line 213

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} aps: #{@aps.inspect}, bssids: #{@bssids.inspect}, count: #{@count.inspect},"\
  " event_id: #{@event_id.inspect}, for_site: #{@for_site.inspect}, id: #{@id.inspect},"\
  " last_seen: #{@last_seen.inspect}, node: #{@node.inspect}, org_id: #{@org_id.inspect},"\
  " site_id: #{@site_id.inspect}, ssids: #{@ssids.inspect}, timestamp: #{@timestamp.inspect},"\
  " type: #{@type.inspect}, update: #{@update.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



204
205
206
207
208
209
210
# File 'lib/mist_api/models/webhook_alarm_event.rb', line 204

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} aps: #{@aps}, bssids: #{@bssids}, count: #{@count}, event_id: #{@event_id},"\
  " for_site: #{@for_site}, id: #{@id}, last_seen: #{@last_seen}, node: #{@node}, org_id:"\
  " #{@org_id}, site_id: #{@site_id}, ssids: #{@ssids}, timestamp: #{@timestamp}, type:"\
  " #{@type}, update: #{@update}>"
end