Class: MistApi::DiscoveredSwitchMetric

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

Overview

DiscoveredSwitchMetric 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, aps = SKIP, chassis_id = SKIP, hostname = SKIP, mgmt_addr = SKIP, model = SKIP, org_id = SKIP, scope = SKIP, score = SKIP, site_id = SKIP, system_desc = SKIP, system_name = SKIP, timestamp = SKIP, type = SKIP, vendor = SKIP, version = SKIP) ⇒ DiscoveredSwitchMetric

Returns a new instance of DiscoveredSwitchMetric.



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/mist_api/models/discovered_switch_metric.rb', line 125

def initialize(adopted = SKIP, aps = SKIP, chassis_id = SKIP,
               hostname = SKIP, mgmt_addr = SKIP, model = SKIP,
               org_id = SKIP, scope = SKIP, score = SKIP, site_id = SKIP,
               system_desc = SKIP, system_name = SKIP, timestamp = SKIP,
               type = SKIP, vendor = SKIP, version = SKIP)
  @adopted = adopted unless adopted == SKIP
  @aps = aps unless aps == SKIP
  @chassis_id = chassis_id unless chassis_id == SKIP
  @hostname = hostname unless hostname == SKIP
  @mgmt_addr = mgmt_addr unless mgmt_addr == SKIP
  @model = model unless model == SKIP
  @org_id = org_id unless org_id == SKIP
  @scope = scope unless scope == SKIP
  @score = score unless score == 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
  @type = type unless type == 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_metric.rb', line 14

def adopted
  @adopted
end

#apsArray[DiscoveredSwitchMetricAp]

TODO: Write general description for this method

Returns:



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

def aps
  @aps
end

#chassis_idArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def chassis_id
  @chassis_id
end

#hostnameString

TODO: Write general description for this method

Returns:

  • (String)


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

def hostname
  @hostname
end

#mgmt_addrString

TODO: Write general description for this method

Returns:

  • (String)


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

def mgmt_addr
  @mgmt_addr
end

#modelString

TODO: Write general description for this method

Returns:

  • (String)


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

def model
  @model
end

#org_idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


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

def org_id
  @org_id
end

#scopeString

TODO: Write general description for this method

Returns:

  • (String)


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

def scope
  @scope
end

#scoreInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def score
  @score
end

#site_idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


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

def site_id
  @site_id
end

#system_descString

TODO: Write general description for this method

Returns:

  • (String)


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

def system_desc
  @system_desc
end

#system_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def system_name
  @system_name
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


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

def timestamp
  @timestamp
end

#typeString

Epoch (seconds)

Returns:

  • (String)


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

def type
  @type
end

#vendorString

Epoch (seconds)

Returns:

  • (String)


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

def vendor
  @vendor
end

#versionString

Epoch (seconds)

Returns:

  • (String)


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

def version
  @version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/mist_api/models/discovered_switch_metric.rb', line 149

def self.from_hash(hash)
  return nil unless hash

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

  aps = SKIP unless hash.key?('aps')
  chassis_id = hash.key?('chassis_id') ? hash['chassis_id'] : SKIP
  hostname = hash.key?('hostname') ? hash['hostname'] : 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
  scope = hash.key?('scope') ? hash['scope'] : SKIP
  score = hash.key?('score') ? hash['score'] : 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
  type = hash.key?('type') ? hash['type'] : SKIP
  vendor = hash.key?('vendor') ? hash['vendor'] : SKIP
  version = hash.key?('version') ? hash['version'] : SKIP

  # Create object from extracted values.
  DiscoveredSwitchMetric.new(adopted,
                             aps,
                             chassis_id,
                             hostname,
                             mgmt_addr,
                             model,
                             org_id,
                             scope,
                             score,
                             site_id,
                             system_desc,
                             system_name,
                             timestamp,
                             type,
                             vendor,
                             version)
end

.namesObject

A mapping from model property names to API property names.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/mist_api/models/discovered_switch_metric.rb', line 77

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

.nullablesObject

An array for nullable fields



121
122
123
# File 'lib/mist_api/models/discovered_switch_metric.rb', line 121

def self.nullables
  []
end

.optionalsObject

An array for optional fields



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/mist_api/models/discovered_switch_metric.rb', line 99

def self.optionals
  %w[
    adopted
    aps
    chassis_id
    hostname
    mgmt_addr
    model
    org_id
    scope
    score
    site_id
    system_desc
    system_name
    timestamp
    type
    vendor
    version
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



209
210
211
212
213
214
215
216
217
# File 'lib/mist_api/models/discovered_switch_metric.rb', line 209

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

#to_sObject

Provides a human-readable string representation of the object.



199
200
201
202
203
204
205
206
# File 'lib/mist_api/models/discovered_switch_metric.rb', line 199

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