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.

Options Hash (opts):

  • :dns (Dns, Hash)

    The value of attribute dns.

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

    The values of attribute nics.



11566
11567
11568
11569
11570
# File 'lib/ovirtsdk4/types.rb', line 11566

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.



11575
11576
11577
11578
11579
# File 'lib/ovirtsdk4/types.rb', line 11575

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

#dnsDns

Returns the value of the dns attribute.



11508
11509
11510
# File 'lib/ovirtsdk4/types.rb', line 11508

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.



11521
11522
11523
11524
11525
11526
# File 'lib/ovirtsdk4/types.rb', line 11521

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

#hashObject

Generates a hash value for this object.



11584
11585
11586
11587
11588
# File 'lib/ovirtsdk4/types.rb', line 11584

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

#nicsArray<Nic>

Returns the value of the nics attribute.



11533
11534
11535
# File 'lib/ovirtsdk4/types.rb', line 11533

def nics
  @nics
end

#nics=(list) ⇒ Object

Sets the value of the nics attribute.



11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
# File 'lib/ovirtsdk4/types.rb', line 11542

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