Class: MistApi::SwitchSearch

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

Overview

SwitchSearch 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(clustered = SKIP, evpn_missing_links = SKIP, evpntopo_id = SKIP, ext_ip = SKIP, hostname = SKIP, ip = SKIP, last_config_status = SKIP, last_hostname = SKIP, last_trouble_code = SKIP, last_trouble_timestamp = SKIP, mac = SKIP, managed = SKIP, mist_configured = SKIP, model = SKIP, num_members = SKIP, org_id = SKIP, radius_stats = SKIP, role = SKIP, site_id = SKIP, time_drifted = SKIP, timestamp = SKIP, uptime = SKIP, version = SKIP, additional_properties = nil) ⇒ SwitchSearch

Returns a new instance of SwitchSearch.



180
181
182
183
184
185
186
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
# File 'lib/mist_api/models/switch_search.rb', line 180

def initialize(clustered = SKIP, evpn_missing_links = SKIP,
               evpntopo_id = SKIP, ext_ip = SKIP, hostname = SKIP,
               ip = SKIP, last_config_status = SKIP, last_hostname = SKIP,
               last_trouble_code = SKIP, last_trouble_timestamp = SKIP,
               mac = SKIP, managed = SKIP, mist_configured = SKIP,
               model = SKIP, num_members = SKIP, org_id = SKIP,
               radius_stats = SKIP, role = SKIP, site_id = SKIP,
               time_drifted = SKIP, timestamp = SKIP, uptime = SKIP,
               version = SKIP, additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @clustered = clustered unless clustered == SKIP
  @evpn_missing_links = evpn_missing_links unless evpn_missing_links == SKIP
  @evpntopo_id = evpntopo_id unless evpntopo_id == SKIP
  @ext_ip = ext_ip unless ext_ip == SKIP
  @hostname = hostname unless hostname == SKIP
  @ip = ip unless ip == SKIP
  @last_config_status = last_config_status unless last_config_status == SKIP
  @last_hostname = last_hostname unless last_hostname == SKIP
  @last_trouble_code = last_trouble_code unless last_trouble_code == SKIP
  @last_trouble_timestamp = last_trouble_timestamp unless last_trouble_timestamp == SKIP
  @mac = mac unless mac == SKIP
  @managed = managed unless managed == SKIP
  @mist_configured = mist_configured unless mist_configured == SKIP
  @model = model unless model == SKIP
  @num_members = num_members unless num_members == SKIP
  @org_id = org_id unless org_id == SKIP
  @radius_stats = radius_stats unless radius_stats == SKIP
  @role = role unless role == SKIP
  @site_id = site_id unless site_id == SKIP
  @time_drifted = time_drifted unless time_drifted == SKIP
  @timestamp = timestamp unless timestamp == SKIP
  @type = 'switch'
  @uptime = uptime unless uptime == SKIP
  @version = version unless version == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#clusteredTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def clustered
  @clustered
end

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def evpn_missing_links
  @evpn_missing_links
end

#evpntopo_idString

TODO: Write general description for this method

Returns:

  • (String)


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

def evpntopo_id
  @evpntopo_id
end

#ext_ipString

TODO: Write general description for this method

Returns:

  • (String)


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

def ext_ip
  @ext_ip
end

#hostnameArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def hostname
  @hostname
end

#ipString

TODO: Write general description for this method

Returns:

  • (String)


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

def ip
  @ip
end

#last_config_statusString

TODO: Write general description for this method

Returns:

  • (String)


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

def last_config_status
  @last_config_status
end

#last_hostnameString

TODO: Write general description for this method

Returns:

  • (String)


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

def last_hostname
  @last_hostname
end

#last_trouble_codeString

TODO: Write general description for this method

Returns:

  • (String)


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

def last_trouble_code
  @last_trouble_code
end

#last_trouble_timestampFloat

Epoch (seconds)

Returns:

  • (Float)


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

def last_trouble_timestamp
  @last_trouble_timestamp
end

#macString

Epoch (seconds)

Returns:

  • (String)


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

def mac
  @mac
end

#managedTrueClass | FalseClass

Epoch (seconds)

Returns:

  • (TrueClass | FalseClass)


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

def managed
  @managed
end

#mist_configuredTrueClass | FalseClass

whether the device can be configured by Mist or not. This deprecates ‘managed` (for adopted device) and `disable_auto_config` for claimed device)

Returns:

  • (TrueClass | FalseClass)


64
65
66
# File 'lib/mist_api/models/switch_search.rb', line 64

def mist_configured
  @mist_configured
end

#modelString

whether the device can be configured by Mist or not. This deprecates ‘managed` (for adopted device) and `disable_auto_config` for claimed device)

Returns:

  • (String)


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

def model
  @model
end

#num_membersInteger

whether the device can be configured by Mist or not. This deprecates ‘managed` (for adopted device) and `disable_auto_config` for claimed device)

Returns:

  • (Integer)


76
77
78
# File 'lib/mist_api/models/switch_search.rb', line 76

def num_members
  @num_members
end

#org_idUUID | String

whether the device can be configured by Mist or not. This deprecates ‘managed` (for adopted device) and `disable_auto_config` for claimed device)

Returns:

  • (UUID | String)


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

def org_id
  @org_id
end

#radius_statsHash[String, DeviceSearchRadiusStat]

Property key is the RADIUS server IP Address

Returns:



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

def radius_stats
  @radius_stats
end

#roleString

Property key is the RADIUS server IP Address

Returns:

  • (String)


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

def role
  @role
end

#site_idUUID | String

Property key is the RADIUS server IP Address

Returns:

  • (UUID | String)


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

def site_id
  @site_id
end

#time_driftedTrueClass | FalseClass

Property key is the RADIUS server IP Address

Returns:

  • (TrueClass | FalseClass)


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

def time_drifted
  @time_drifted
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


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

def timestamp
  @timestamp
end

#typeString (readonly)

Device Type. enum: ‘switch`

Returns:

  • (String)


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

def type
  @type
end

#uptimeInteger

Device Type. enum: ‘switch`

Returns:

  • (Integer)


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

def uptime
  @uptime
end

#versionString

Device Type. enum: ‘switch`

Returns:

  • (String)


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

def version
  @version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
246
247
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
# File 'lib/mist_api/models/switch_search.rb', line 220

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  clustered = hash.key?('clustered') ? hash['clustered'] : SKIP
  evpn_missing_links =
    hash.key?('evpn_missing_links') ? hash['evpn_missing_links'] : SKIP
  evpntopo_id = hash.key?('evpntopo_id') ? hash['evpntopo_id'] : SKIP
  ext_ip = hash.key?('ext_ip') ? hash['ext_ip'] : SKIP
  hostname = hash.key?('hostname') ? hash['hostname'] : SKIP
  ip = hash.key?('ip') ? hash['ip'] : SKIP
  last_config_status =
    hash.key?('last_config_status') ? hash['last_config_status'] : SKIP
  last_hostname = hash.key?('last_hostname') ? hash['last_hostname'] : SKIP
  last_trouble_code =
    hash.key?('last_trouble_code') ? hash['last_trouble_code'] : SKIP
  last_trouble_timestamp =
    hash.key?('last_trouble_timestamp') ? hash['last_trouble_timestamp'] : SKIP
  mac = hash.key?('mac') ? hash['mac'] : SKIP
  managed = hash.key?('managed') ? hash['managed'] : SKIP
  mist_configured =
    hash.key?('mist_configured') ? hash['mist_configured'] : SKIP
  model = hash.key?('model') ? hash['model'] : SKIP
  num_members = hash.key?('num_members') ? hash['num_members'] : SKIP
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  radius_stats = DeviceSearchRadiusStat.from_hash(hash['radius_stats']) if
    hash['radius_stats']

  radius_stats = SKIP unless hash.key?('radius_stats')
  role = hash.key?('role') ? hash['role'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  time_drifted = hash.key?('time_drifted') ? hash['time_drifted'] : SKIP
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
  uptime = hash.key?('uptime') ? hash['uptime'] : SKIP
  version = hash.key?('version') ? hash['version'] : SKIP

  # 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.
  SwitchSearch.new(clustered,
                   evpn_missing_links,
                   evpntopo_id,
                   ext_ip,
                   hostname,
                   ip,
                   last_config_status,
                   last_hostname,
                   last_trouble_code,
                   last_trouble_timestamp,
                   mac,
                   managed,
                   mist_configured,
                   model,
                   num_members,
                   org_id,
                   radius_stats,
                   role,
                   site_id,
                   time_drifted,
                   timestamp,
                   uptime,
                   version,
                   additional_properties)
end

.namesObject

A mapping from model property names to API property names.



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/mist_api/models/switch_search.rb', line 117

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['clustered'] = 'clustered'
  @_hash['evpn_missing_links'] = 'evpn_missing_links'
  @_hash['evpntopo_id'] = 'evpntopo_id'
  @_hash['ext_ip'] = 'ext_ip'
  @_hash['hostname'] = 'hostname'
  @_hash['ip'] = 'ip'
  @_hash['last_config_status'] = 'last_config_status'
  @_hash['last_hostname'] = 'last_hostname'
  @_hash['last_trouble_code'] = 'last_trouble_code'
  @_hash['last_trouble_timestamp'] = 'last_trouble_timestamp'
  @_hash['mac'] = 'mac'
  @_hash['managed'] = 'managed'
  @_hash['mist_configured'] = 'mist_configured'
  @_hash['model'] = 'model'
  @_hash['num_members'] = 'num_members'
  @_hash['org_id'] = 'org_id'
  @_hash['radius_stats'] = 'radius_stats'
  @_hash['role'] = 'role'
  @_hash['site_id'] = 'site_id'
  @_hash['time_drifted'] = 'time_drifted'
  @_hash['timestamp'] = 'timestamp'
  @_hash['type'] = 'type'
  @_hash['uptime'] = 'uptime'
  @_hash['version'] = 'version'
  @_hash
end

.nullablesObject

An array for nullable fields



176
177
178
# File 'lib/mist_api/models/switch_search.rb', line 176

def self.nullables
  []
end

.optionalsObject

An array for optional fields



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/mist_api/models/switch_search.rb', line 147

def self.optionals
  %w[
    clustered
    evpn_missing_links
    evpntopo_id
    ext_ip
    hostname
    ip
    last_config_status
    last_hostname
    last_trouble_code
    last_trouble_timestamp
    mac
    managed
    mist_configured
    model
    num_members
    org_id
    radius_stats
    role
    site_id
    time_drifted
    timestamp
    uptime
    version
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (SwitchSearch | Hash)

    value against the validation is performed.



292
293
294
295
296
297
298
299
300
301
302
# File 'lib/mist_api/models/switch_search.rb', line 292

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

  return false unless value.instance_of? Hash

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/mist_api/models/switch_search.rb', line 319

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} clustered: #{@clustered.inspect}, evpn_missing_links:"\
  " #{@evpn_missing_links.inspect}, evpntopo_id: #{@evpntopo_id.inspect}, ext_ip:"\
  " #{@ext_ip.inspect}, hostname: #{@hostname.inspect}, ip: #{@ip.inspect},"\
  " last_config_status: #{@last_config_status.inspect}, last_hostname:"\
  " #{@last_hostname.inspect}, last_trouble_code: #{@last_trouble_code.inspect},"\
  " last_trouble_timestamp: #{@last_trouble_timestamp.inspect}, mac: #{@mac.inspect}, managed:"\
  " #{@managed.inspect}, mist_configured: #{@mist_configured.inspect}, model:"\
  " #{@model.inspect}, num_members: #{@num_members.inspect}, org_id: #{@org_id.inspect},"\
  " radius_stats: #{@radius_stats.inspect}, role: #{@role.inspect}, site_id:"\
  " #{@site_id.inspect}, time_drifted: #{@time_drifted.inspect}, timestamp:"\
  " #{@timestamp.inspect}, type: #{@type.inspect}, uptime: #{@uptime.inspect}, version:"\
  " #{@version.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/mist_api/models/switch_search.rb', line 305

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} clustered: #{@clustered}, evpn_missing_links: #{@evpn_missing_links},"\
  " evpntopo_id: #{@evpntopo_id}, ext_ip: #{@ext_ip}, hostname: #{@hostname}, ip: #{@ip},"\
  " last_config_status: #{@last_config_status}, last_hostname: #{@last_hostname},"\
  " last_trouble_code: #{@last_trouble_code}, last_trouble_timestamp:"\
  " #{@last_trouble_timestamp}, mac: #{@mac}, managed: #{@managed}, mist_configured:"\
  " #{@mist_configured}, model: #{@model}, num_members: #{@num_members}, org_id: #{@org_id},"\
  " radius_stats: #{@radius_stats}, role: #{@role}, site_id: #{@site_id}, time_drifted:"\
  " #{@time_drifted}, timestamp: #{@timestamp}, type: #{@type}, uptime: #{@uptime}, version:"\
  " #{@version}, additional_properties: #{@additional_properties}>"
end