Class: OvirtSDK4::Device

Inherits:
Identified show all
Defined in:
lib/ovirtsdk4/types.rb,
lib/ovirtsdk4/types.rb

Direct Known Subclasses

Cdrom, Disk, Floppy, GlusterBrickAdvancedDetails, Nic, Watchdog

Instance Method Summary collapse

Methods included from Type

#dig, #href, #href=

Constructor Details

#initialize(opts = {}) ⇒ Device

Creates a new instance of the OvirtSDK4::Device class.

Parameters:

  • opts (Hash) (defaults to: {})

    A hash containing the attributes of the object. The keys of the hash should be symbols corresponding to the names of the attributes. The values of the hash should be the values of the attributes.

Options Hash (opts):

  • :comment (String)

    The value of attribute comment.

  • :description (String)

    The value of attribute description.

  • :id (String)

    The value of attribute id.

  • :instance_type (InstanceType, Hash)

    The value of attribute instance_type.

  • :name (String)

    The value of attribute name.

  • :template (Template, Hash)

    The value of attribute template.

  • :vm (Vm, Hash)

    The value of attribute vm.

  • :vms (Array<Vm>, Array<Hash>)

    The values of attribute vms.


34480
34481
34482
34483
34484
34485
34486
# File 'lib/ovirtsdk4/types.rb', line 34480

def initialize(opts = {})
  super(opts)
  self.instance_type = opts[:instance_type]
  self.template = opts[:template]
  self.vm = opts[:vm]
  self.vms = opts[:vms]
end

Instance Method Details

#==(other) ⇒ Object

Returns true if self and other have the same attributes and values.


34491
34492
34493
34494
34495
34496
34497
# File 'lib/ovirtsdk4/types.rb', line 34491

def ==(other)
  super &&
  @instance_type == other.instance_type &&
  @template == other.template &&
  @vm == other.vm &&
  @vms == other.vms
end

#commentString

Returns the value of the comment attribute.

Returns:

  • (String)

34288
34289
34290
# File 'lib/ovirtsdk4/types.rb', line 34288

def comment
  @comment
end

#comment=(value) ⇒ Object

Sets the value of the comment attribute.

Parameters:

  • value (String)

34297
34298
34299
# File 'lib/ovirtsdk4/types.rb', line 34297

def comment=(value)
  @comment = value
end

#descriptionString

Returns the value of the description attribute.

Returns:

  • (String)

34306
34307
34308
# File 'lib/ovirtsdk4/types.rb', line 34306

def description
  @description
end

#description=(value) ⇒ Object

Sets the value of the description attribute.

Parameters:

  • value (String)

34315
34316
34317
# File 'lib/ovirtsdk4/types.rb', line 34315

def description=(value)
  @description = value
end

#hashObject

Generates a hash value for this object.


34502
34503
34504
34505
34506
34507
34508
# File 'lib/ovirtsdk4/types.rb', line 34502

def hash
  super +
  @instance_type.hash +
  @template.hash +
  @vm.hash +
  @vms.hash
end

#idString

Returns the value of the id attribute.

Returns:

  • (String)

34324
34325
34326
# File 'lib/ovirtsdk4/types.rb', line 34324

def id
  @id
end

#id=(value) ⇒ Object

Sets the value of the id attribute.

Parameters:

  • value (String)

34333
34334
34335
# File 'lib/ovirtsdk4/types.rb', line 34333

def id=(value)
  @id = value
end

#instance_typeInstanceType

Returns the value of the instance_type attribute.

Returns:


34342
34343
34344
# File 'lib/ovirtsdk4/types.rb', line 34342

def instance_type
  @instance_type
end

#instance_type=(value) ⇒ Object

Sets the value of the instance_type attribute.

The value parameter can be an instance of InstanceType or a hash. If it is a hash then a new instance will be created passing the hash as the opts parameter to the constructor.

Parameters:


34355
34356
34357
34358
34359
34360
# File 'lib/ovirtsdk4/types.rb', line 34355

def instance_type=(value)
  if value.is_a?(Hash)
    value = InstanceType.new(value)
  end
  @instance_type = value
end

#nameString

Returns the value of the name attribute.

Returns:

  • (String)

34367
34368
34369
# File 'lib/ovirtsdk4/types.rb', line 34367

def name
  @name
end

#name=(value) ⇒ Object

Sets the value of the name attribute.

Parameters:

  • value (String)

34376
34377
34378
# File 'lib/ovirtsdk4/types.rb', line 34376

def name=(value)
  @name = value
end

#templateTemplate

Returns the value of the template attribute.

Returns:


34385
34386
34387
# File 'lib/ovirtsdk4/types.rb', line 34385

def template
  @template
end

#template=(value) ⇒ Object

Sets the value of the template attribute.

The value parameter can be an instance of Template or a hash. If it is a hash then a new instance will be created passing the hash as the opts parameter to the constructor.

Parameters:


34398
34399
34400
34401
34402
34403
# File 'lib/ovirtsdk4/types.rb', line 34398

def template=(value)
  if value.is_a?(Hash)
    value = Template.new(value)
  end
  @template = value
end

#vmVm

Returns the value of the vm attribute.

Returns:


34410
34411
34412
# File 'lib/ovirtsdk4/types.rb', line 34410

def vm
  @vm
end

#vm=(value) ⇒ Object

Sets the value of the vm attribute.

The value parameter can be an instance of Vm or a hash. If it is a hash then a new instance will be created passing the hash as the opts parameter to the constructor.

Parameters:

  • value (Vm, Hash)

34423
34424
34425
34426
34427
34428
# File 'lib/ovirtsdk4/types.rb', line 34423

def vm=(value)
  if value.is_a?(Hash)
    value = Vm.new(value)
  end
  @vm = value
end

#vmsArray<Vm>

Returns the value of the vms attribute.

Returns:

  • (Array<Vm>)

34435
34436
34437
# File 'lib/ovirtsdk4/types.rb', line 34435

def vms
  @vms
end

#vms=(list) ⇒ Object

Sets the value of the vms attribute.

Parameters:

  • list (Array<Vm>)

34444
34445
34446
34447
34448
34449
34450
34451
34452
34453
34454
# File 'lib/ovirtsdk4/types.rb', line 34444

def vms=(list)
  if list.class == Array
    list = List.new(list)
    list.each_with_index do |value, index|
      if value.is_a?(Hash)
        list[index] = Vm.new(value)
      end
    end
  end
  @vms = list
end