Class: MistApi::Inventory

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

Overview

Inventory 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(adopted = SKIP, chassis_mac = SKIP, chassis_serial = SKIP, connected = SKIP, created_time = SKIP, deviceprofile_id = SKIP, hostname = SKIP, hw_rev = SKIP, id = SKIP, jsi = SKIP, mac = SKIP, magic = SKIP, model = SKIP, modified_time = SKIP, name = SKIP, org_id = SKIP, serial = SKIP, site_id = SKIP, sku = SKIP, type = DeviceTypeDefaultApEnum::AP, vc_mac = SKIP) ⇒ Inventory

Returns a new instance of Inventory.



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
185
186
187
188
# File 'lib/mist_api/models/inventory.rb', line 160

def initialize(adopted = SKIP, chassis_mac = SKIP, chassis_serial = SKIP,
               connected = SKIP, created_time = SKIP,
               deviceprofile_id = SKIP, hostname = SKIP, hw_rev = SKIP,
               id = SKIP, jsi = SKIP, mac = SKIP, magic = SKIP,
               model = SKIP, modified_time = SKIP, name = SKIP,
               org_id = SKIP, serial = SKIP, site_id = SKIP, sku = SKIP,
               type = DeviceTypeDefaultApEnum::AP, vc_mac = SKIP)
  @adopted = adopted unless adopted == SKIP
  @chassis_mac = chassis_mac unless chassis_mac == SKIP
  @chassis_serial = chassis_serial unless chassis_serial == SKIP
  @connected = connected unless connected == SKIP
  @created_time = created_time unless created_time == SKIP
  @deviceprofile_id = deviceprofile_id unless deviceprofile_id == SKIP
  @hostname = hostname unless hostname == SKIP
  @hw_rev = hw_rev unless hw_rev == SKIP
  @id = id unless id == SKIP
  @jsi = jsi unless jsi == SKIP
  @mac = mac unless mac == SKIP
  @magic = magic unless magic == SKIP
  @model = model unless model == SKIP
  @modified_time = modified_time unless modified_time == SKIP
  @name = name unless name == SKIP
  @org_id = org_id unless org_id == SKIP
  @serial = serial unless serial == SKIP
  @site_id = site_id unless site_id == SKIP
  @sku = sku unless sku == SKIP
  @type = type unless type == SKIP
  @vc_mac = vc_mac unless vc_mac == SKIP
end

Instance Attribute Details

#adoptedTrueClass | FalseClass

Only if ‘type`==`switch` or `type`==`gateway`, whether the switch/gateway is adopted

Returns:

  • (TrueClass | FalseClass)


15
16
17
# File 'lib/mist_api/models/inventory.rb', line 15

def adopted
  @adopted
end

#chassis_macString

For Virtual Chassis only, the MAC Address of the FPC0

Returns:

  • (String)


19
20
21
# File 'lib/mist_api/models/inventory.rb', line 19

def chassis_mac
  @chassis_mac
end

#chassis_serialString

For Virtual Chassis only, the Serial Number of the FPC0

Returns:

  • (String)


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

def chassis_serial
  @chassis_serial
end

#connectedTrueClass | FalseClass

Whether the device is connected

Returns:

  • (TrueClass | FalseClass)


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

def connected
  @connected
end

#created_timeFloat

When the object has been created, in epoch

Returns:

  • (Float)


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

def created_time
  @created_time
end

#deviceprofile_idString

Deviceprofile id if assigned, null if not assigned

Returns:

  • (String)


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

def deviceprofile_id
  @deviceprofile_id
end

#hostnameString

Hostname reported by the device

Returns:

  • (String)


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

def hostname
  @hostname
end

#hw_revString

Device hardware revision number

Returns:

  • (String)


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

def hw_rev
  @hw_rev
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


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

def id
  @id
end

#jsiTrueClass | FalseClass

Unique ID of the object instance in the Mist Organization

Returns:

  • (TrueClass | FalseClass)


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

def jsi
  @jsi
end

#macString

Device MAC address

Returns:

  • (String)


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

def mac
  @mac
end

#magicString

Device claim code

Returns:

  • (String)


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

def magic
  @magic
end

#modelString

Device model

Returns:

  • (String)


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

def model
  @model
end

#modified_timeFloat

When the object has been modified for the last time, in epoch

Returns:

  • (Float)


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

def modified_time
  @modified_time
end

#nameString

Device name if configured

Returns:

  • (String)


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

def name
  @name
end

#org_idUUID | String

Device name if configured

Returns:

  • (UUID | String)


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

def org_id
  @org_id
end

#serialString

Device serial

Returns:

  • (String)


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

def serial
  @serial
end

#site_idUUID | String

Device serial

Returns:

  • (UUID | String)


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

def site_id
  @site_id
end

#skuString

Device stock keeping unit

Returns:

  • (String)


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

def sku
  @sku
end

#typeDeviceTypeDefaultApEnum

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



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

def type
  @type
end

#vc_macString

If ‘type`==`switch` and device part of a Virtual Chassis, MAC Address of the Virtual Chassis. if `type`==`gateway` and device part of a Cluster, MAC Address of the Cluster

Returns:

  • (String)


97
98
99
# File 'lib/mist_api/models/inventory.rb', line 97

def vc_mac
  @vc_mac
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
239
240
241
# File 'lib/mist_api/models/inventory.rb', line 191

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  adopted = hash.key?('adopted') ? hash['adopted'] : SKIP
  chassis_mac = hash.key?('chassis_mac') ? hash['chassis_mac'] : SKIP
  chassis_serial =
    hash.key?('chassis_serial') ? hash['chassis_serial'] : SKIP
  connected = hash.key?('connected') ? hash['connected'] : SKIP
  created_time = hash.key?('created_time') ? hash['created_time'] : SKIP
  deviceprofile_id =
    hash.key?('deviceprofile_id') ? hash['deviceprofile_id'] : SKIP
  hostname = hash.key?('hostname') ? hash['hostname'] : SKIP
  hw_rev = hash.key?('hw_rev') ? hash['hw_rev'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  jsi = hash.key?('jsi') ? hash['jsi'] : SKIP
  mac = hash.key?('mac') ? hash['mac'] : SKIP
  magic = hash.key?('magic') ? hash['magic'] : SKIP
  model = hash.key?('model') ? hash['model'] : SKIP
  modified_time = hash.key?('modified_time') ? hash['modified_time'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  serial = hash.key?('serial') ? hash['serial'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  sku = hash.key?('sku') ? hash['sku'] : SKIP
  type = hash['type'] ||= DeviceTypeDefaultApEnum::AP
  vc_mac = hash.key?('vc_mac') ? hash['vc_mac'] : SKIP

  # Create object from extracted values.
  Inventory.new(adopted,
                chassis_mac,
                chassis_serial,
                connected,
                created_time,
                deviceprofile_id,
                hostname,
                hw_rev,
                id,
                jsi,
                mac,
                magic,
                model,
                modified_time,
                name,
                org_id,
                serial,
                site_id,
                sku,
                type,
                vc_mac)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['adopted'] = 'adopted'
  @_hash['chassis_mac'] = 'chassis_mac'
  @_hash['chassis_serial'] = 'chassis_serial'
  @_hash['connected'] = 'connected'
  @_hash['created_time'] = 'created_time'
  @_hash['deviceprofile_id'] = 'deviceprofile_id'
  @_hash['hostname'] = 'hostname'
  @_hash['hw_rev'] = 'hw_rev'
  @_hash['id'] = 'id'
  @_hash['jsi'] = 'jsi'
  @_hash['mac'] = 'mac'
  @_hash['magic'] = 'magic'
  @_hash['model'] = 'model'
  @_hash['modified_time'] = 'modified_time'
  @_hash['name'] = 'name'
  @_hash['org_id'] = 'org_id'
  @_hash['serial'] = 'serial'
  @_hash['site_id'] = 'site_id'
  @_hash['sku'] = 'sku'
  @_hash['type'] = 'type'
  @_hash['vc_mac'] = 'vc_mac'
  @_hash
end

.nullablesObject

An array for nullable fields



154
155
156
157
158
# File 'lib/mist_api/models/inventory.rb', line 154

def self.nullables
  %w[
    deviceprofile_id
  ]
end

.optionalsObject

An array for optional fields



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/mist_api/models/inventory.rb', line 127

def self.optionals
  %w[
    adopted
    chassis_mac
    chassis_serial
    connected
    created_time
    deviceprofile_id
    hostname
    hw_rev
    id
    jsi
    mac
    magic
    model
    modified_time
    name
    org_id
    serial
    site_id
    sku
    type
    vc_mac
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



255
256
257
258
259
260
261
262
263
264
265
# File 'lib/mist_api/models/inventory.rb', line 255

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} adopted: #{@adopted.inspect}, chassis_mac: #{@chassis_mac.inspect},"\
  " chassis_serial: #{@chassis_serial.inspect}, connected: #{@connected.inspect},"\
  " created_time: #{@created_time.inspect}, deviceprofile_id: #{@deviceprofile_id.inspect},"\
  " hostname: #{@hostname.inspect}, hw_rev: #{@hw_rev.inspect}, id: #{@id.inspect}, jsi:"\
  " #{@jsi.inspect}, mac: #{@mac.inspect}, magic: #{@magic.inspect}, model: #{@model.inspect},"\
  " modified_time: #{@modified_time.inspect}, name: #{@name.inspect}, org_id:"\
  " #{@org_id.inspect}, serial: #{@serial.inspect}, site_id: #{@site_id.inspect}, sku:"\
  " #{@sku.inspect}, type: #{@type.inspect}, vc_mac: #{@vc_mac.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



244
245
246
247
248
249
250
251
252
# File 'lib/mist_api/models/inventory.rb', line 244

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} adopted: #{@adopted}, chassis_mac: #{@chassis_mac}, chassis_serial:"\
  " #{@chassis_serial}, connected: #{@connected}, created_time: #{@created_time},"\
  " deviceprofile_id: #{@deviceprofile_id}, hostname: #{@hostname}, hw_rev: #{@hw_rev}, id:"\
  " #{@id}, jsi: #{@jsi}, mac: #{@mac}, magic: #{@magic}, model: #{@model}, modified_time:"\
  " #{@modified_time}, name: #{@name}, org_id: #{@org_id}, serial: #{@serial}, site_id:"\
  " #{@site_id}, sku: #{@sku}, type: #{@type}, vc_mac: #{@vc_mac}>"
end