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<AffinityLabel>, Array<Hash>] :host_labels The values of attribute `host_labels`.
@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 [Float] :priority The value of attribute `priority`.
@option opts [Array<AffinityLabel>, Array<Hash>] :vm_labels The values of attribute `vm_labels`.
@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 30001 def initialize(opts = {}) super(opts) self.cluster = opts[:cluster] self.enforcing = opts[:enforcing] self.host_labels = opts[:host_labels] self.hosts = opts[:hosts] self.hosts_rule = opts[:hosts_rule] self.positive = opts[:positive] self.priority = opts[:priority] self.vm_labels = opts[:vm_labels] 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 30018 def ==(other) super && @cluster == other.cluster && @enforcing == other.enforcing && @host_labels == other.host_labels && @hosts == other.hosts && @hosts_rule == other.hosts_rule && @positive == other.positive && @priority == other.priority && @vm_labels == other.vm_labels && @vms == other.vms && @vms_rule == other.vms_rule end
Returns the value of the `cluster` attribute.
@return [Cluster]
# File lib/ovirtsdk4/types.rb, line 29665 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 29678 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 29690 def comment @comment end
Sets the value of the `comment` attribute.
@param value [String]
# File lib/ovirtsdk4/types.rb, line 29699 def comment=(value) @comment = value end
Returns the value of the `description` attribute.
@return [String]
# File lib/ovirtsdk4/types.rb, line 29708 def description @description end
Sets the value of the `description` attribute.
@param value [String]
# File lib/ovirtsdk4/types.rb, line 29717 def description=(value) @description = value end
Returns the value of the `enforcing` attribute.
@return [Boolean]
# File lib/ovirtsdk4/types.rb, line 29726 def enforcing @enforcing end
Sets the value of the `enforcing` attribute.
@param value [Boolean]
# File lib/ovirtsdk4/types.rb, line 29735 def enforcing=(value) @enforcing = value end
Generates a hash value for this object.
# File lib/ovirtsdk4/types.rb, line 30035 def hash super + @cluster.hash + @enforcing.hash + @host_labels.hash + @hosts.hash + @hosts_rule.hash + @positive.hash + @priority.hash + @vm_labels.hash + @vms.hash + @vms_rule.hash end
Returns the value of the `host_labels` attribute.
@return [Array<AffinityLabel>]
# File lib/ovirtsdk4/types.rb, line 29744 def host_labels @host_labels end
Sets the value of the `host_labels` attribute.
@param list [Array<AffinityLabel>]
# File lib/ovirtsdk4/types.rb, line 29753 def host_labels=(list) if list.class == Array list = List.new(list) list.each_with_index do |value, index| if value.is_a?(Hash) list[index] = AffinityLabel.new(value) end end end @host_labels = list end
Returns the value of the `hosts` attribute.
@return [Array<Host>]
# File lib/ovirtsdk4/types.rb, line 29770 def hosts @hosts end
Sets the value of the `hosts` attribute.
@param list [Array<Host>]
# File lib/ovirtsdk4/types.rb, line 29779 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 29796 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 29809 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 29821 def id @id end
Sets the value of the `id` attribute.
@param value [String]
# File lib/ovirtsdk4/types.rb, line 29830 def id=(value) @id = value end
Returns the value of the `name` attribute.
@return [String]
# File lib/ovirtsdk4/types.rb, line 29839 def name @name end
Sets the value of the `name` attribute.
@param value [String]
# File lib/ovirtsdk4/types.rb, line 29848 def name=(value) @name = value end
Returns the value of the `positive` attribute.
@return [Boolean]
# File lib/ovirtsdk4/types.rb, line 29857 def positive @positive end
Sets the value of the `positive` attribute.
@param value [Boolean]
# File lib/ovirtsdk4/types.rb, line 29866 def positive=(value) @positive = value end
Returns the value of the `priority` attribute.
@return [Float]
# File lib/ovirtsdk4/types.rb, line 29875 def priority @priority end
Sets the value of the `priority` attribute.
@param value [Float]
# File lib/ovirtsdk4/types.rb, line 29884 def priority=(value) @priority = value end
Returns the value of the `vm_labels` attribute.
@return [Array<AffinityLabel>]
# File lib/ovirtsdk4/types.rb, line 29893 def vm_labels @vm_labels end
Sets the value of the `vm_labels` attribute.
@param list [Array<AffinityLabel>]
# File lib/ovirtsdk4/types.rb, line 29902 def vm_labels=(list) if list.class == Array list = List.new(list) list.each_with_index do |value, index| if value.is_a?(Hash) list[index] = AffinityLabel.new(value) end end end @vm_labels = list end
Returns the value of the `vms` attribute.
@return [Array<Vm>]
# File lib/ovirtsdk4/types.rb, line 29919 def vms @vms end
Sets the value of the `vms` attribute.
@param list [Array<Vm>]
# File lib/ovirtsdk4/types.rb, line 29928 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 29945 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 29958 def vms_rule=(value) if value.is_a?(Hash) value = AffinityRule.new(value) end @vms_rule = value end