Class: OvirtSDK4::NetworkConfiguration

Inherits:
Struct
  • Object
show all
Defined in:
lib/ovirtsdk4/types.rb,
lib/ovirtsdk4/types.rb

Instance Method Summary collapse

Methods included from Type

#dig, #href, #href=

Constructor Details

#initialize(opts = {}) ⇒ NetworkConfiguration

Creates a new instance of the OvirtSDK4::NetworkConfiguration 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):

  • :dns (Dns, Hash)

    The value of attribute dns.

  • :nics (Array<Nic>, Array<Hash>)

    The values of attribute nics.



10533
10534
10535
10536
10537
# File 'lib/ovirtsdk4/types.rb', line 10533

def initialize(opts = {})
  super(opts)
  self.dns = opts[:dns]
  self.nics = opts[:nics]
end

Instance Method Details

#==(other) ⇒ Object

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



10542
10543
10544
10545
10546
# File 'lib/ovirtsdk4/types.rb', line 10542

def ==(other)
  super &&
  @dns == other.dns &&
  @nics == other.nics
end

#dnsDns

Returns the value of the dns attribute.

Returns:



10475
10476
10477
# File 'lib/ovirtsdk4/types.rb', line 10475

def dns
  @dns
end

#dns=(value) ⇒ Object

Sets the value of the dns attribute.

The value parameter can be an instance of Dns 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 (Dns, Hash)


10488
10489
10490
10491
10492
10493
# File 'lib/ovirtsdk4/types.rb', line 10488

def dns=(value)
  if value.is_a?(Hash)
    value = Dns.new(value)
  end
  @dns = value
end

#hashObject

Generates a hash value for this object.



10551
10552
10553
10554
10555
# File 'lib/ovirtsdk4/types.rb', line 10551

def hash
  super +
  @dns.hash +
  @nics.hash
end

#nicsArray<Nic>

Returns the value of the nics attribute.

Returns:



10500
10501
10502
# File 'lib/ovirtsdk4/types.rb', line 10500

def nics
  @nics
end

#nics=(list) ⇒ Object

Sets the value of the nics attribute.

Parameters:

  • list (Array<Nic>)


10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
# File 'lib/ovirtsdk4/types.rb', line 10509

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