Class: MistApi::DiscoveredSwitch

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

Overview

DiscoveredSwitch 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, ap_redundancy = SKIP, aps = SKIP, chassis_id = SKIP, for_site = SKIP, mgmt_addr = SKIP, model = SKIP, org_id = SKIP, site_id = SKIP, system_desc = SKIP, system_name = SKIP, timestamp = SKIP, vendor = SKIP, version = SKIP) ⇒ DiscoveredSwitch

Returns a new instance of DiscoveredSwitch.



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

def initialize(adopted = SKIP, ap_redundancy = SKIP, aps = SKIP,
               chassis_id = SKIP, for_site = SKIP, mgmt_addr = SKIP,
               model = SKIP, org_id = SKIP, site_id = SKIP,
               system_desc = SKIP, system_name = SKIP, timestamp = SKIP,
               vendor = SKIP, version = SKIP)
  @adopted = adopted unless adopted == SKIP
  @ap_redundancy = ap_redundancy unless ap_redundancy == SKIP
  @aps = aps unless aps == SKIP
  @chassis_id = chassis_id unless chassis_id == SKIP
  @for_site = for_site unless for_site == SKIP
  @mgmt_addr = mgmt_addr unless mgmt_addr == SKIP
  @model = model unless model == SKIP
  @org_id = org_id unless org_id == SKIP
  @site_id = site_id unless site_id == SKIP
  @system_desc = system_desc unless system_desc == SKIP
  @system_name = system_name unless system_name == SKIP
  @timestamp = timestamp unless timestamp == SKIP
  @vendor = vendor unless vendor == SKIP
  @version = version unless version == SKIP
end

Instance Attribute Details

#adoptedTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def adopted
  @adopted
end

#ap_redundancyApRedundancy

TODO: Write general description for this method

Returns:



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

def ap_redundancy
  @ap_redundancy
end

#apsArray[DiscoveredSwitchAp]

TODO: Write general description for this method

Returns:



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

def aps
  @aps
end

#chassis_idArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def chassis_id
  @chassis_id
end

#for_siteTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def for_site
  @for_site
end

#mgmt_addrString

TODO: Write general description for this method

Returns:

  • (String)


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

def mgmt_addr
  @mgmt_addr
end

#modelString

TODO: Write general description for this method

Returns:

  • (String)


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

def model
  @model
end

#org_idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


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

def org_id
  @org_id
end

#site_idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


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

def site_id
  @site_id
end

#system_descString

TODO: Write general description for this method

Returns:

  • (String)


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

def system_desc
  @system_desc
end

#system_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def system_name
  @system_name
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


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

def timestamp
  @timestamp
end

#vendorString

Epoch (seconds)

Returns:

  • (String)


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

def vendor
  @vendor
end

#versionString

Epoch (seconds)

Returns:

  • (String)


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

def version
  @version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/mist_api/models/discovered_switch.rb', line 135

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  adopted = hash.key?('adopted') ? hash['adopted'] : SKIP
  ap_redundancy = ApRedundancy.from_hash(hash['ap_redundancy']) if hash['ap_redundancy']
  # Parameter is an array, so we need to iterate through it
  aps = nil
  unless hash['aps'].nil?
    aps = []
    hash['aps'].each do |structure|
      aps << (DiscoveredSwitchAp.from_hash(structure) if structure)
    end
  end

  aps = SKIP unless hash.key?('aps')
  chassis_id = hash.key?('chassis_id') ? hash['chassis_id'] : SKIP
  for_site = hash.key?('for_site') ? hash['for_site'] : SKIP
  mgmt_addr = hash.key?('mgmt_addr') ? hash['mgmt_addr'] : SKIP
  model = hash.key?('model') ? hash['model'] : SKIP
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  system_desc = hash.key?('system_desc') ? hash['system_desc'] : SKIP
  system_name = hash.key?('system_name') ? hash['system_name'] : SKIP
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
  vendor = hash.key?('vendor') ? hash['vendor'] : SKIP
  version = hash.key?('version') ? hash['version'] : SKIP

  # Create object from extracted values.
  DiscoveredSwitch.new(adopted,
                       ap_redundancy,
                       aps,
                       chassis_id,
                       for_site,
                       mgmt_addr,
                       model,
                       org_id,
                       site_id,
                       system_desc,
                       system_name,
                       timestamp,
                       vendor,
                       version)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['adopted'] = 'adopted'
  @_hash['ap_redundancy'] = 'ap_redundancy'
  @_hash['aps'] = 'aps'
  @_hash['chassis_id'] = 'chassis_id'
  @_hash['for_site'] = 'for_site'
  @_hash['mgmt_addr'] = 'mgmt_addr'
  @_hash['model'] = 'model'
  @_hash['org_id'] = 'org_id'
  @_hash['site_id'] = 'site_id'
  @_hash['system_desc'] = 'system_desc'
  @_hash['system_name'] = 'system_name'
  @_hash['timestamp'] = 'timestamp'
  @_hash['vendor'] = 'vendor'
  @_hash['version'] = 'version'
  @_hash
end

.nullablesObject

An array for nullable fields



109
110
111
# File 'lib/mist_api/models/discovered_switch.rb', line 109

def self.nullables
  []
end

.optionalsObject

An array for optional fields



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/mist_api/models/discovered_switch.rb', line 89

def self.optionals
  %w[
    adopted
    ap_redundancy
    aps
    chassis_id
    for_site
    mgmt_addr
    model
    org_id
    site_id
    system_desc
    system_name
    timestamp
    vendor
    version
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



191
192
193
194
195
196
197
198
199
# File 'lib/mist_api/models/discovered_switch.rb', line 191

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} adopted: #{@adopted.inspect}, ap_redundancy: #{@ap_redundancy.inspect},"\
  " aps: #{@aps.inspect}, chassis_id: #{@chassis_id.inspect}, for_site: #{@for_site.inspect},"\
  " mgmt_addr: #{@mgmt_addr.inspect}, model: #{@model.inspect}, org_id: #{@org_id.inspect},"\
  " site_id: #{@site_id.inspect}, system_desc: #{@system_desc.inspect}, system_name:"\
  " #{@system_name.inspect}, timestamp: #{@timestamp.inspect}, vendor: #{@vendor.inspect},"\
  " version: #{@version.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



181
182
183
184
185
186
187
188
# File 'lib/mist_api/models/discovered_switch.rb', line 181

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} adopted: #{@adopted}, ap_redundancy: #{@ap_redundancy}, aps: #{@aps},"\
  " chassis_id: #{@chassis_id}, for_site: #{@for_site}, mgmt_addr: #{@mgmt_addr}, model:"\
  " #{@model}, org_id: #{@org_id}, site_id: #{@site_id}, system_desc: #{@system_desc},"\
  " system_name: #{@system_name}, timestamp: #{@timestamp}, vendor: #{@vendor}, version:"\
  " #{@version}>"
end