Class: OvirtSDK4::AffinityGroup

Inherits:
Identified 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 = {}) ⇒ AffinityGroup

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

  • :cluster (Cluster, Hash)

    The value of attribute cluster.

  • :comment (String)

    The value of attribute comment.

  • :description (String)

    The value of attribute description.

  • :enforcing (Boolean)

    The value of attribute enforcing.

  • :host_labels (Array<AffinityLabel>, Array<Hash>)

    The values of attribute host_labels.

  • :hosts (Array<Host>, Array<Hash>)

    The values of attribute hosts.

  • :hosts_rule (AffinityRule, Hash)

    The value of attribute hosts_rule.

  • :id (String)

    The value of attribute id.

  • :name (String)

    The value of attribute name.

  • :positive (Boolean)

    The value of attribute positive.

  • :priority (Float)

    The value of attribute priority.

  • :vm_labels (Array<AffinityLabel>, Array<Hash>)

    The values of attribute vm_labels.

  • :vms (Array<Vm>, Array<Hash>)

    The values of attribute vms.

  • :vms_rule (AffinityRule, Hash)

    The value of attribute vms_rule.


30259
30260
30261
30262
30263
30264
30265
30266
30267
30268
30269
30270
30271
# File 'lib/ovirtsdk4/types.rb', line 30259

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

Instance Method Details

#==(other) ⇒ Object

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


30276
30277
30278
30279
30280
30281
30282
30283
30284
30285
30286
30287
30288
# File 'lib/ovirtsdk4/types.rb', line 30276

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

#clusterCluster

Returns the value of the cluster attribute.

Returns:


29923
29924
29925
# File 'lib/ovirtsdk4/types.rb', line 29923

def cluster
  @cluster
end

#cluster=(value) ⇒ Object

Sets the value of the cluster attribute.

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

Parameters:


29936
29937
29938
29939
29940
29941
# File 'lib/ovirtsdk4/types.rb', line 29936

def cluster=(value)
  if value.is_a?(Hash)
    value = Cluster.new(value)
  end
  @cluster = value
end

#commentString

Returns the value of the comment attribute.

Returns:

  • (String)

29948
29949
29950
# File 'lib/ovirtsdk4/types.rb', line 29948

def comment
  @comment
end

#comment=(value) ⇒ Object

Sets the value of the comment attribute.

Parameters:

  • value (String)

29957
29958
29959
# File 'lib/ovirtsdk4/types.rb', line 29957

def comment=(value)
  @comment = value
end

#descriptionString

Returns the value of the description attribute.

Returns:

  • (String)

29966
29967
29968
# File 'lib/ovirtsdk4/types.rb', line 29966

def description
  @description
end

#description=(value) ⇒ Object

Sets the value of the description attribute.

Parameters:

  • value (String)

29975
29976
29977
# File 'lib/ovirtsdk4/types.rb', line 29975

def description=(value)
  @description = value
end

#enforcingBoolean

Returns the value of the enforcing attribute.

Returns:

  • (Boolean)

29984
29985
29986
# File 'lib/ovirtsdk4/types.rb', line 29984

def enforcing
  @enforcing
end

#enforcing=(value) ⇒ Object

Sets the value of the enforcing attribute.

Parameters:

  • value (Boolean)

29993
29994
29995
# File 'lib/ovirtsdk4/types.rb', line 29993

def enforcing=(value)
  @enforcing = value
end

#hashObject

Generates a hash value for this object.


30293
30294
30295
30296
30297
30298
30299
30300
30301
30302
30303
30304
30305
# File 'lib/ovirtsdk4/types.rb', line 30293

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

#host_labelsArray<AffinityLabel>

Returns the value of the host_labels attribute.

Returns:


30002
30003
30004
# File 'lib/ovirtsdk4/types.rb', line 30002

def host_labels
  @host_labels
end

#host_labels=(list) ⇒ Object

Sets the value of the host_labels attribute.

Parameters:


30011
30012
30013
30014
30015
30016
30017
30018
30019
30020
30021
# File 'lib/ovirtsdk4/types.rb', line 30011

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

#hostsArray<Host>

Returns the value of the hosts attribute.

Returns:


30028
30029
30030
# File 'lib/ovirtsdk4/types.rb', line 30028

def hosts
  @hosts
end

#hosts=(list) ⇒ Object

Sets the value of the hosts attribute.

Parameters:

  • list (Array<Host>)

30037
30038
30039
30040
30041
30042
30043
30044
30045
30046
30047
# File 'lib/ovirtsdk4/types.rb', line 30037

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

#hosts_ruleAffinityRule

Returns the value of the hosts_rule attribute.

Returns:


30054
30055
30056
# File 'lib/ovirtsdk4/types.rb', line 30054

def hosts_rule
  @hosts_rule
end

#hosts_rule=(value) ⇒ Object

Sets the value of the hosts_rule attribute.

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.

Parameters:


30067
30068
30069
30070
30071
30072
# File 'lib/ovirtsdk4/types.rb', line 30067

def hosts_rule=(value)
  if value.is_a?(Hash)
    value = AffinityRule.new(value)
  end
  @hosts_rule = value
end

#idString

Returns the value of the id attribute.

Returns:

  • (String)

30079
30080
30081
# File 'lib/ovirtsdk4/types.rb', line 30079

def id
  @id
end

#id=(value) ⇒ Object

Sets the value of the id attribute.

Parameters:

  • value (String)

30088
30089
30090
# File 'lib/ovirtsdk4/types.rb', line 30088

def id=(value)
  @id = value
end

#nameString

Returns the value of the name attribute.

Returns:

  • (String)

30097
30098
30099
# File 'lib/ovirtsdk4/types.rb', line 30097

def name
  @name
end

#name=(value) ⇒ Object

Sets the value of the name attribute.

Parameters:

  • value (String)

30106
30107
30108
# File 'lib/ovirtsdk4/types.rb', line 30106

def name=(value)
  @name = value
end

#positiveBoolean

Returns the value of the positive attribute.

Returns:

  • (Boolean)

30115
30116
30117
# File 'lib/ovirtsdk4/types.rb', line 30115

def positive
  @positive
end

#positive=(value) ⇒ Object

Sets the value of the positive attribute.

Parameters:

  • value (Boolean)

30124
30125
30126
# File 'lib/ovirtsdk4/types.rb', line 30124

def positive=(value)
  @positive = value
end

#priorityFloat

Returns the value of the priority attribute.

Returns:

  • (Float)

30133
30134
30135
# File 'lib/ovirtsdk4/types.rb', line 30133

def priority
  @priority
end

#priority=(value) ⇒ Object

Sets the value of the priority attribute.

Parameters:

  • value (Float)

30142
30143
30144
# File 'lib/ovirtsdk4/types.rb', line 30142

def priority=(value)
  @priority = value
end

#vm_labelsArray<AffinityLabel>

Returns the value of the vm_labels attribute.

Returns:


30151
30152
30153
# File 'lib/ovirtsdk4/types.rb', line 30151

def vm_labels
  @vm_labels
end

#vm_labels=(list) ⇒ Object

Sets the value of the vm_labels attribute.

Parameters:


30160
30161
30162
30163
30164
30165
30166
30167
30168
30169
30170
# File 'lib/ovirtsdk4/types.rb', line 30160

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

#vmsArray<Vm>

Returns the value of the vms attribute.

Returns:

  • (Array<Vm>)

30177
30178
30179
# File 'lib/ovirtsdk4/types.rb', line 30177

def vms
  @vms
end

#vms=(list) ⇒ Object

Sets the value of the vms attribute.

Parameters:

  • list (Array<Vm>)

30186
30187
30188
30189
30190
30191
30192
30193
30194
30195
30196
# File 'lib/ovirtsdk4/types.rb', line 30186

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

#vms_ruleAffinityRule

Returns the value of the vms_rule attribute.

Returns:


30203
30204
30205
# File 'lib/ovirtsdk4/types.rb', line 30203

def vms_rule
  @vms_rule
end

#vms_rule=(value) ⇒ Object

Sets the value of the vms_rule attribute.

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.

Parameters:


30216
30217
30218
30219
30220
30221
# File 'lib/ovirtsdk4/types.rb', line 30216

def vms_rule=(value)
  if value.is_a?(Hash)
    value = AffinityRule.new(value)
  end
  @vms_rule = value
end