class OvirtSDK4::Device

Public Class Methods

new(opts = {}) click to toggle source

Creates a new instance of the {Device} class.

@param opts [Hash] 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.

@option opts [String] :comment The value of attribute `comment`.

@option opts [String] :description The value of attribute `description`.

@option opts [String] :id The value of attribute `id`.

@option opts [InstanceType, Hash] :instance_type The value of attribute `instance_type`.

@option opts [String] :name The value of attribute `name`.

@option opts [Template, Hash] :template The value of attribute `template`.

@option opts [Vm, Hash] :vm The value of attribute `vm`.

@option opts [Array<Vm>, Array<Hash>] :vms The values of attribute `vms`.

Calls superclass method OvirtSDK4::Identified.new
# File lib/ovirtsdk4/types.rb, line 31210
def initialize(opts = {})
  super(opts)
  self.instance_type = opts[:instance_type]
  self.template = opts[:template]
  self.vm = opts[:vm]
  self.vms = opts[:vms]
end

Public Instance Methods

==(other) click to toggle source

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

Calls superclass method OvirtSDK4::Identified#==
# File lib/ovirtsdk4/types.rb, line 31221
def ==(other)
  super &&
  @instance_type == other.instance_type &&
  @template == other.template &&
  @vm == other.vm &&
  @vms == other.vms
end
comment() click to toggle source

Returns the value of the `comment` attribute.

@return [String]

# File lib/ovirtsdk4/types.rb, line 31018
def comment
  @comment
end
comment=(value) click to toggle source

Sets the value of the `comment` attribute.

@param value [String]

# File lib/ovirtsdk4/types.rb, line 31027
def comment=(value)
  @comment = value
end
description() click to toggle source

Returns the value of the `description` attribute.

@return [String]

# File lib/ovirtsdk4/types.rb, line 31036
def description
  @description
end
description=(value) click to toggle source

Sets the value of the `description` attribute.

@param value [String]

# File lib/ovirtsdk4/types.rb, line 31045
def description=(value)
  @description = value
end
hash() click to toggle source

Generates a hash value for this object.

Calls superclass method OvirtSDK4::Identified#hash
# File lib/ovirtsdk4/types.rb, line 31232
def hash
  super +
  @instance_type.hash +
  @template.hash +
  @vm.hash +
  @vms.hash
end
id() click to toggle source

Returns the value of the `id` attribute.

@return [String]

# File lib/ovirtsdk4/types.rb, line 31054
def id
  @id
end
id=(value) click to toggle source

Sets the value of the `id` attribute.

@param value [String]

# File lib/ovirtsdk4/types.rb, line 31063
def id=(value)
  @id = value
end
instance_type() click to toggle source

Returns the value of the `instance_type` attribute.

@return [InstanceType]

# File lib/ovirtsdk4/types.rb, line 31072
def instance_type
  @instance_type
end
instance_type=(value) click to toggle source

Sets the value of the `instance_type` attribute.

@param value [InstanceType, Hash]

The `value` parameter can be an instance of {OvirtSDK4::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.

# File lib/ovirtsdk4/types.rb, line 31085
def instance_type=(value)
  if value.is_a?(Hash)
    value = InstanceType.new(value)
  end
  @instance_type = value
end
name() click to toggle source

Returns the value of the `name` attribute.

@return [String]

# File lib/ovirtsdk4/types.rb, line 31097
def name
  @name
end
name=(value) click to toggle source

Sets the value of the `name` attribute.

@param value [String]

# File lib/ovirtsdk4/types.rb, line 31106
def name=(value)
  @name = value
end
template() click to toggle source

Returns the value of the `template` attribute.

@return [Template]

# File lib/ovirtsdk4/types.rb, line 31115
def template
  @template
end
template=(value) click to toggle source

Sets the value of the `template` attribute.

@param value [Template, Hash]

The `value` parameter can be an instance of {OvirtSDK4::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.

# File lib/ovirtsdk4/types.rb, line 31128
def template=(value)
  if value.is_a?(Hash)
    value = Template.new(value)
  end
  @template = value
end
vm() click to toggle source

Returns the value of the `vm` attribute.

@return [Vm]

# File lib/ovirtsdk4/types.rb, line 31140
def vm
  @vm
end
vm=(value) click to toggle source

Sets the value of the `vm` attribute.

@param value [Vm, Hash]

The `value` parameter can be an instance of {OvirtSDK4::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.

# File lib/ovirtsdk4/types.rb, line 31153
def vm=(value)
  if value.is_a?(Hash)
    value = Vm.new(value)
  end
  @vm = value
end
vms() click to toggle source

Returns the value of the `vms` attribute.

@return [Array<Vm>]

# File lib/ovirtsdk4/types.rb, line 31165
def vms
  @vms
end
vms=(list) click to toggle source

Sets the value of the `vms` attribute.

@param list [Array<Vm>]

# File lib/ovirtsdk4/types.rb, line 31174
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