Class: VSphereAutomation::VCenter::VcenterVMInfo
- Inherits:
-
Object
- Object
- VSphereAutomation::VCenter::VcenterVMInfo
- Defined in:
- lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb
Instance Attribute Summary collapse
-
#boot ⇒ Object
Returns the value of attribute boot.
-
#boot_devices ⇒ Object
Boot device configuration.
-
#cdroms ⇒ Object
List of CD-ROMs.
-
#cpu ⇒ Object
Returns the value of attribute cpu.
-
#disks ⇒ Object
List of disks.
-
#floppies ⇒ Object
List of floppy drives.
-
#guest_os ⇒ Object
Returns the value of attribute guest_os.
-
#hardware ⇒ Object
Returns the value of attribute hardware.
-
#memory ⇒ Object
Returns the value of attribute memory.
-
#name ⇒ Object
Virtual machine name.
-
#nics ⇒ Object
List of Ethernet adapters.
-
#parallel_ports ⇒ Object
List of parallel ports.
-
#power_state ⇒ Object
Returns the value of attribute power_state.
-
#sata_adapters ⇒ Object
List of SATA adapters.
-
#scsi_adapters ⇒ Object
List of SCSI adapters.
-
#serial_ports ⇒ Object
List of serial ports.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ VcenterVMInfo
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ VcenterVMInfo
Initializes the object
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 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 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 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 102 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if attributes.has_key?(:'guest_OS') self.guest_os = attributes[:'guest_OS'] end if attributes.has_key?(:'name') self.name = attributes[:'name'] end if attributes.has_key?(:'power_state') self.power_state = attributes[:'power_state'] end if attributes.has_key?(:'hardware') self.hardware = attributes[:'hardware'] end if attributes.has_key?(:'boot') self.boot = attributes[:'boot'] end if attributes.has_key?(:'boot_devices') if (value = attributes[:'boot_devices']).is_a?(Array) self.boot_devices = value end end if attributes.has_key?(:'cpu') self.cpu = attributes[:'cpu'] end if attributes.has_key?(:'memory') self.memory = attributes[:'memory'] end if attributes.has_key?(:'disks') if (value = attributes[:'disks']).is_a?(Array) self.disks = value end end if attributes.has_key?(:'nics') if (value = attributes[:'nics']).is_a?(Array) self.nics = value end end if attributes.has_key?(:'cdroms') if (value = attributes[:'cdroms']).is_a?(Array) self.cdroms = value end end if attributes.has_key?(:'floppies') if (value = attributes[:'floppies']).is_a?(Array) self.floppies = value end end if attributes.has_key?(:'parallel_ports') if (value = attributes[:'parallel_ports']).is_a?(Array) self.parallel_ports = value end end if attributes.has_key?(:'serial_ports') if (value = attributes[:'serial_ports']).is_a?(Array) self.serial_ports = value end end if attributes.has_key?(:'sata_adapters') if (value = attributes[:'sata_adapters']).is_a?(Array) self.sata_adapters = value end end if attributes.has_key?(:'scsi_adapters') if (value = attributes[:'scsi_adapters']).is_a?(Array) self.scsi_adapters = value end end end |
Instance Attribute Details
#boot ⇒ Object
Returns the value of attribute boot.
23 24 25 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 23 def boot @boot end |
#boot_devices ⇒ Object
Boot device configuration. If the list has no entries, a server-specific default boot sequence is used.
26 27 28 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 26 def boot_devices @boot_devices end |
#cdroms ⇒ Object
List of CD-ROMs. When clients pass a value of this structure as a parameter, the key in the field map must be an identifier for the resource type: vcenter.vm.hardware.Cdrom. When operations return a value of this structure as a result, the key in the field map will be an identifier for the resource type: vcenter.vm.hardware.Cdrom.
39 40 41 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 39 def cdroms @cdroms end |
#cpu ⇒ Object
Returns the value of attribute cpu.
28 29 30 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 28 def cpu @cpu end |
#disks ⇒ Object
List of disks. When clients pass a value of this structure as a parameter, the key in the field map must be an identifier for the resource type: vcenter.vm.hardware.Disk. When operations return a value of this structure as a result, the key in the field map will be an identifier for the resource type: vcenter.vm.hardware.Disk.
33 34 35 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 33 def disks @disks end |
#floppies ⇒ Object
List of floppy drives. When clients pass a value of this structure as a parameter, the key in the field map must be an identifier for the resource type: vcenter.vm.hardware.Floppy. When operations return a value of this structure as a result, the key in the field map will be an identifier for the resource type: vcenter.vm.hardware.Floppy.
42 43 44 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 42 def floppies @floppies end |
#guest_os ⇒ Object
Returns the value of attribute guest_os.
14 15 16 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 14 def guest_os @guest_os end |
#hardware ⇒ Object
Returns the value of attribute hardware.
21 22 23 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 21 def hardware @hardware end |
#memory ⇒ Object
Returns the value of attribute memory.
30 31 32 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 30 def memory @memory end |
#name ⇒ Object
Virtual machine name.
17 18 19 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 17 def name @name end |
#nics ⇒ Object
List of Ethernet adapters. When clients pass a value of this structure as a parameter, the key in the field map must be an identifier for the resource type: vcenter.vm.hardware.Ethernet. When operations return a value of this structure as a result, the key in the field map will be an identifier for the resource type: vcenter.vm.hardware.Ethernet.
36 37 38 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 36 def nics @nics end |
#parallel_ports ⇒ Object
List of parallel ports. When clients pass a value of this structure as a parameter, the key in the field map must be an identifier for the resource type: vcenter.vm.hardware.ParallelPort. When operations return a value of this structure as a result, the key in the field map will be an identifier for the resource type: vcenter.vm.hardware.ParallelPort.
45 46 47 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 45 def parallel_ports @parallel_ports end |
#power_state ⇒ Object
Returns the value of attribute power_state.
19 20 21 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 19 def power_state @power_state end |
#sata_adapters ⇒ Object
List of SATA adapters. When clients pass a value of this structure as a parameter, the key in the field map must be an identifier for the resource type: vcenter.vm.hardware.SataAdapter. When operations return a value of this structure as a result, the key in the field map will be an identifier for the resource type: vcenter.vm.hardware.SataAdapter.
51 52 53 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 51 def sata_adapters @sata_adapters end |
#scsi_adapters ⇒ Object
List of SCSI adapters. When clients pass a value of this structure as a parameter, the key in the field map must be an identifier for the resource type: vcenter.vm.hardware.ScsiAdapter. When operations return a value of this structure as a result, the key in the field map will be an identifier for the resource type: vcenter.vm.hardware.ScsiAdapter.
54 55 56 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 54 def scsi_adapters @scsi_adapters end |
#serial_ports ⇒ Object
List of serial ports. When clients pass a value of this structure as a parameter, the key in the field map must be an identifier for the resource type: vcenter.vm.hardware.SerialPort. When operations return a value of this structure as a result, the key in the field map will be an identifier for the resource type: vcenter.vm.hardware.SerialPort.
48 49 50 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 48 def serial_ports @serial_ports end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 57 def self.attribute_map { :'guest_os' => :'guest_OS', :'name' => :'name', :'power_state' => :'power_state', :'hardware' => :'hardware', :'boot' => :'boot', :'boot_devices' => :'boot_devices', :'cpu' => :'cpu', :'memory' => :'memory', :'disks' => :'disks', :'nics' => :'nics', :'cdroms' => :'cdroms', :'floppies' => :'floppies', :'parallel_ports' => :'parallel_ports', :'serial_ports' => :'serial_ports', :'sata_adapters' => :'sata_adapters', :'scsi_adapters' => :'scsi_adapters' } end |
.openapi_types ⇒ Object
Attribute type mapping.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 79 def self.openapi_types { :'guest_os' => :'VcenterVmGuestOS', :'name' => :'String', :'power_state' => :'VcenterVmPowerState', :'hardware' => :'VcenterVmHardwareInfo', :'boot' => :'VcenterVmHardwareBootInfo', :'boot_devices' => :'Array<VcenterVmHardwareBootDeviceEntry>', :'cpu' => :'VcenterVmHardwareCpuInfo', :'memory' => :'VcenterVmHardwareMemoryInfo', :'disks' => :'Array<VcenterVMInfoDisks>', :'nics' => :'Array<VcenterVMInfoNics>', :'cdroms' => :'Array<VcenterVMInfoCdroms>', :'floppies' => :'Array<VcenterVMInfoFloppies>', :'parallel_ports' => :'Array<VcenterVMInfoParallelPorts>', :'serial_ports' => :'Array<VcenterVMInfoSerialPorts>', :'sata_adapters' => :'Array<VcenterVMInfoSataAdapters>', :'scsi_adapters' => :'Array<VcenterVMInfoScsiAdapters>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 286 def ==(o) return true if self.equal?(o) self.class == o.class && guest_os == o.guest_os && name == o.name && power_state == o.power_state && hardware == o.hardware && boot == o.boot && boot_devices == o.boot_devices && cpu == o.cpu && memory == o.memory && disks == o.disks && nics == o.nics && cdroms == o.cdroms && floppies == o.floppies && parallel_ports == o.parallel_ports && serial_ports == o.serial_ports && sata_adapters == o.sata_adapters && scsi_adapters == o.scsi_adapters end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 343 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN, :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = VSphereAutomation::VCenter.const_get(type).new temp_model.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
409 410 411 412 413 414 415 416 417 418 419 420 421 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 409 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 322 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
309 310 311 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 309 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
315 316 317 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 315 def hash [guest_os, name, power_state, hardware, boot, boot_devices, cpu, memory, disks, nics, cdroms, floppies, parallel_ports, serial_ports, sata_adapters, scsi_adapters].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 193 def list_invalid_properties invalid_properties = Array.new if @guest_os.nil? invalid_properties.push('invalid value for "guest_os", guest_os cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @power_state.nil? invalid_properties.push('invalid value for "power_state", power_state cannot be nil.') end if @hardware.nil? invalid_properties.push('invalid value for "hardware", hardware cannot be nil.') end if @boot.nil? invalid_properties.push('invalid value for "boot", boot cannot be nil.') end if @boot_devices.nil? invalid_properties.push('invalid value for "boot_devices", boot_devices cannot be nil.') end if @cpu.nil? invalid_properties.push('invalid value for "cpu", cpu cannot be nil.') end if @memory.nil? invalid_properties.push('invalid value for "memory", memory cannot be nil.') end if @disks.nil? invalid_properties.push('invalid value for "disks", disks cannot be nil.') end if @nics.nil? invalid_properties.push('invalid value for "nics", nics cannot be nil.') end if @cdroms.nil? invalid_properties.push('invalid value for "cdroms", cdroms cannot be nil.') end if @floppies.nil? invalid_properties.push('invalid value for "floppies", floppies cannot be nil.') end if @parallel_ports.nil? invalid_properties.push('invalid value for "parallel_ports", parallel_ports cannot be nil.') end if @serial_ports.nil? invalid_properties.push('invalid value for "serial_ports", serial_ports cannot be nil.') end if @sata_adapters.nil? invalid_properties.push('invalid value for "sata_adapters", sata_adapters cannot be nil.') end if @scsi_adapters.nil? invalid_properties.push('invalid value for "scsi_adapters", scsi_adapters cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
389 390 391 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 389 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
395 396 397 398 399 400 401 402 403 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 395 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
383 384 385 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 383 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/vsphere-automation-vcenter/models/vcenter_vm_info.rb', line 264 def valid? return false if @guest_os.nil? return false if @name.nil? return false if @power_state.nil? return false if @hardware.nil? return false if @boot.nil? return false if @boot_devices.nil? return false if @cpu.nil? return false if @memory.nil? return false if @disks.nil? return false if @nics.nil? return false if @cdroms.nil? return false if @floppies.nil? return false if @parallel_ports.nil? return false if @serial_ports.nil? return false if @sata_adapters.nil? return false if @scsi_adapters.nil? true end |