Creates a new instance of the {AffinityGroup} 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 [Cluster, Hash] :cluster The value of attribute `cluster`.
@option opts [String] :comment The value of attribute `comment`.
@option opts [String] :description The value of attribute `description`.
@option opts [Boolean] :enforcing The value of attribute `enforcing`.
@option opts [Array<Host>, Array<Hash>] :hosts The values of attribute `hosts`.
@option opts [AffinityRule, Hash] :hosts_rule The value of attribute `hosts_rule`.
@option opts [String] :id The value of attribute `id`.
@option opts [String] :name The value of attribute `name`.
@option opts [Boolean] :positive The value of attribute `positive`.
@option opts [Array<Vm>, Array<Hash>] :vms The values of attribute `vms`.
@option opts [AffinityRule, Hash] :vms_rule The value of attribute `vms_rule`.
# File lib/ovirtsdk4/types.rb, line 27380 def initialize(opts = {}) super(opts) self.cluster = opts[:cluster] self.enforcing = opts[:enforcing] self.hosts = opts[:hosts] self.hosts_rule = opts[:hosts_rule] self.positive = opts[:positive] self.vms = opts[:vms] self.vms_rule = opts[:vms_rule] end
Returns `true` if `self` and `other` have the same attributes and values.
# File lib/ovirtsdk4/types.rb, line 27394 def ==(other) super && @cluster == other.cluster && @enforcing == other.enforcing && @hosts == other.hosts && @hosts_rule == other.hosts_rule && @positive == other.positive && @vms == other.vms && @vms_rule == other.vms_rule end
Returns the value of the `cluster` attribute.
@return [Cluster]
# File lib/ovirtsdk4/types.rb, line 27120 def cluster @cluster end
Sets the value of the `cluster` attribute.
@param value [Cluster, Hash]
The `value` parameter can be an instance of {OvirtSDK4::Cluster} 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 27133 def cluster=(value) if value.is_a?(Hash) value = Cluster.new(value) end @cluster = value end
Returns the value of the `comment` attribute.
@return [String]
# File lib/ovirtsdk4/types.rb, line 27145 def comment @comment end
Sets the value of the `comment` attribute.
@param value [String]
# File lib/ovirtsdk4/types.rb, line 27154 def comment=(value) @comment = value end
Returns the value of the `description` attribute.
@return [String]
# File lib/ovirtsdk4/types.rb, line 27163 def description @description end
Sets the value of the `description` attribute.
@param value [String]
# File lib/ovirtsdk4/types.rb, line 27172 def description=(value) @description = value end
Returns the value of the `enforcing` attribute.
@return [Boolean]
# File lib/ovirtsdk4/types.rb, line 27181 def enforcing @enforcing end
Sets the value of the `enforcing` attribute.
@param value [Boolean]
# File lib/ovirtsdk4/types.rb, line 27190 def enforcing=(value) @enforcing = value end
Generates a hash value for this object.
# File lib/ovirtsdk4/types.rb, line 27408 def hash super + @cluster.hash + @enforcing.hash + @hosts.hash + @hosts_rule.hash + @positive.hash + @vms.hash + @vms_rule.hash end
Returns the value of the `hosts` attribute.
@return [Array<Host>]
# File lib/ovirtsdk4/types.rb, line 27199 def hosts @hosts end
Sets the value of the `hosts` attribute.
@param list [Array<Host>]
# File lib/ovirtsdk4/types.rb, line 27208 def hosts=(list) if list.class == Array list = List.new(list) list.each_with_index do |value, index| if value.is_a?(Hash) list[index] = Host.new(value) end end end @hosts = list end
Returns the value of the `hosts_rule` attribute.
@return [AffinityRule]
# File lib/ovirtsdk4/types.rb, line 27225 def hosts_rule @hosts_rule end
Sets the value of the `hosts_rule` attribute.
@param value [AffinityRule, Hash]
The `value` parameter can be an instance of {OvirtSDK4::AffinityRule} 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 27238 def hosts_rule=(value) if value.is_a?(Hash) value = AffinityRule.new(value) end @hosts_rule = value end
Returns the value of the `id` attribute.
@return [String]
# File lib/ovirtsdk4/types.rb, line 27250 def id @id end
Sets the value of the `id` attribute.
@param value [String]
# File lib/ovirtsdk4/types.rb, line 27259 def id=(value) @id = value end
Returns the value of the `name` attribute.
@return [String]
# File lib/ovirtsdk4/types.rb, line 27268 def name @name end
Sets the value of the `name` attribute.
@param value [String]
# File lib/ovirtsdk4/types.rb, line 27277 def name=(value) @name = value end
Returns the value of the `positive` attribute.
@return [Boolean]
# File lib/ovirtsdk4/types.rb, line 27286 def positive @positive end
Sets the value of the `positive` attribute.
@param value [Boolean]
# File lib/ovirtsdk4/types.rb, line 27295 def positive=(value) @positive = value end
Returns the value of the `vms` attribute.
@return [Array<Vm>]
# File lib/ovirtsdk4/types.rb, line 27304 def vms @vms end
Sets the value of the `vms` attribute.
@param list [Array<Vm>]
# File lib/ovirtsdk4/types.rb, line 27313 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
Returns the value of the `vms_rule` attribute.
@return [AffinityRule]
# File lib/ovirtsdk4/types.rb, line 27330 def vms_rule @vms_rule end
Sets the value of the `vms_rule` attribute.
@param value [AffinityRule, Hash]
The `value` parameter can be an instance of {OvirtSDK4::AffinityRule} 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 27343 def vms_rule=(value) if value.is_a?(Hash) value = AffinityRule.new(value) end @vms_rule = value end