Class: OvirtSDK4::Bonding

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 = {}) ⇒ Bonding

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

  • :active_slave (HostNic, Hash)

    The value of attribute active_slave.

  • :ad_partner_mac (Mac, Hash)

    The value of attribute ad_partner_mac.

  • :options (Array<Option>, Array<Hash>)

    The values of attribute options.

  • :slaves (Array<HostNic>, Array<Hash>)

    The values of attribute slaves.



1640
1641
1642
1643
1644
1645
1646
# File 'lib/ovirtsdk4/types.rb', line 1640

def initialize(opts = {})
  super(opts)
  self.active_slave = opts[:active_slave]
  self.ad_partner_mac = opts[:ad_partner_mac]
  self.options = opts[:options]
  self.slaves = opts[:slaves]
end

Instance Method Details

#==(other) ⇒ Object

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



1651
1652
1653
1654
1655
1656
1657
# File 'lib/ovirtsdk4/types.rb', line 1651

def ==(other)
  super &&
  @active_slave == other.active_slave &&
  @ad_partner_mac == other.ad_partner_mac &&
  @options == other.options &&
  @slaves == other.slaves
end

#active_slaveHostNic

Returns the value of the active_slave attribute.

Returns:



1527
1528
1529
# File 'lib/ovirtsdk4/types.rb', line 1527

def active_slave
  @active_slave
end

#active_slave=(value) ⇒ Object

Sets the value of the active_slave attribute.

The value parameter can be an instance of HostNic 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:



1540
1541
1542
1543
1544
1545
# File 'lib/ovirtsdk4/types.rb', line 1540

def active_slave=(value)
  if value.is_a?(Hash)
    value = HostNic.new(value)
  end
  @active_slave = value
end

#ad_partner_macMac

Returns the value of the ad_partner_mac attribute.

Returns:



1552
1553
1554
# File 'lib/ovirtsdk4/types.rb', line 1552

def ad_partner_mac
  @ad_partner_mac
end

#ad_partner_mac=(value) ⇒ Object

Sets the value of the ad_partner_mac attribute.

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


1565
1566
1567
1568
1569
1570
# File 'lib/ovirtsdk4/types.rb', line 1565

def ad_partner_mac=(value)
  if value.is_a?(Hash)
    value = Mac.new(value)
  end
  @ad_partner_mac = value
end

#hashObject

Generates a hash value for this object.



1662
1663
1664
1665
1666
1667
1668
# File 'lib/ovirtsdk4/types.rb', line 1662

def hash
  super +
  @active_slave.hash +
  @ad_partner_mac.hash +
  @options.hash +
  @slaves.hash
end

#optionsArray<Option>

Returns the value of the options attribute.

Returns:



1577
1578
1579
# File 'lib/ovirtsdk4/types.rb', line 1577

def options
  @options
end

#options=(list) ⇒ Object

Sets the value of the options attribute.

Parameters:



1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
# File 'lib/ovirtsdk4/types.rb', line 1586

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

#slavesArray<HostNic>

Returns the value of the slaves attribute.

Returns:



1603
1604
1605
# File 'lib/ovirtsdk4/types.rb', line 1603

def slaves
  @slaves
end

#slaves=(list) ⇒ Object

Sets the value of the slaves attribute.

Parameters:



1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
# File 'lib/ovirtsdk4/types.rb', line 1612

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