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.

  • :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.

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

    The values of attribute vms.

  • :vms_rule (AffinityRule, Hash)

    The value of attribute vms_rule.



29325
29326
29327
29328
29329
29330
29331
29332
29333
29334
# File 'lib/ovirtsdk4/types.rb', line 29325

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

Instance Method Details

#==(other) ⇒ Object

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



29339
29340
29341
29342
29343
29344
29345
29346
29347
29348
# File 'lib/ovirtsdk4/types.rb', line 29339

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

#clusterCluster

Returns the value of the cluster attribute.

Returns:



29065
29066
29067
# File 'lib/ovirtsdk4/types.rb', line 29065

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:



29078
29079
29080
29081
29082
29083
# File 'lib/ovirtsdk4/types.rb', line 29078

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)


29090
29091
29092
# File 'lib/ovirtsdk4/types.rb', line 29090

def comment
  @comment
end

#comment=(value) ⇒ Object

Sets the value of the comment attribute.

Parameters:

  • value (String)


29099
29100
29101
# File 'lib/ovirtsdk4/types.rb', line 29099

def comment=(value)
  @comment = value
end

#descriptionString

Returns the value of the description attribute.

Returns:

  • (String)


29108
29109
29110
# File 'lib/ovirtsdk4/types.rb', line 29108

def description
  @description
end

#description=(value) ⇒ Object

Sets the value of the description attribute.

Parameters:

  • value (String)


29117
29118
29119
# File 'lib/ovirtsdk4/types.rb', line 29117

def description=(value)
  @description = value
end

#enforcingBoolean

Returns the value of the enforcing attribute.

Returns:

  • (Boolean)


29126
29127
29128
# File 'lib/ovirtsdk4/types.rb', line 29126

def enforcing
  @enforcing
end

#enforcing=(value) ⇒ Object

Sets the value of the enforcing attribute.

Parameters:

  • value (Boolean)


29135
29136
29137
# File 'lib/ovirtsdk4/types.rb', line 29135

def enforcing=(value)
  @enforcing = value
end

#hashObject

Generates a hash value for this object.



29353
29354
29355
29356
29357
29358
29359
29360
29361
29362
# File 'lib/ovirtsdk4/types.rb', line 29353

def hash
  super +
  @cluster.hash +
  @enforcing.hash +
  @hosts.hash +
  @hosts_rule.hash +
  @positive.hash +
  @vms.hash +
  @vms_rule.hash
end

#hostsArray<Host>

Returns the value of the hosts attribute.

Returns:



29144
29145
29146
# File 'lib/ovirtsdk4/types.rb', line 29144

def hosts
  @hosts
end

#hosts=(list) ⇒ Object

Sets the value of the hosts attribute.

Parameters:

  • list (Array<Host>)


29153
29154
29155
29156
29157
29158
29159
29160
29161
29162
29163
# File 'lib/ovirtsdk4/types.rb', line 29153

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:



29170
29171
29172
# File 'lib/ovirtsdk4/types.rb', line 29170

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:



29183
29184
29185
29186
29187
29188
# File 'lib/ovirtsdk4/types.rb', line 29183

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)


29195
29196
29197
# File 'lib/ovirtsdk4/types.rb', line 29195

def id
  @id
end

#id=(value) ⇒ Object

Sets the value of the id attribute.

Parameters:

  • value (String)


29204
29205
29206
# File 'lib/ovirtsdk4/types.rb', line 29204

def id=(value)
  @id = value
end

#nameString

Returns the value of the name attribute.

Returns:

  • (String)


29213
29214
29215
# File 'lib/ovirtsdk4/types.rb', line 29213

def name
  @name
end

#name=(value) ⇒ Object

Sets the value of the name attribute.

Parameters:

  • value (String)


29222
29223
29224
# File 'lib/ovirtsdk4/types.rb', line 29222

def name=(value)
  @name = value
end

#positiveBoolean

Returns the value of the positive attribute.

Returns:

  • (Boolean)


29231
29232
29233
# File 'lib/ovirtsdk4/types.rb', line 29231

def positive
  @positive
end

#positive=(value) ⇒ Object

Sets the value of the positive attribute.

Parameters:

  • value (Boolean)


29240
29241
29242
# File 'lib/ovirtsdk4/types.rb', line 29240

def positive=(value)
  @positive = value
end

#vmsArray<Vm>

Returns the value of the vms attribute.

Returns:

  • (Array<Vm>)


29249
29250
29251
# File 'lib/ovirtsdk4/types.rb', line 29249

def vms
  @vms
end

#vms=(list) ⇒ Object

Sets the value of the vms attribute.

Parameters:

  • list (Array<Vm>)


29258
29259
29260
29261
29262
29263
29264
29265
29266
29267
29268
# File 'lib/ovirtsdk4/types.rb', line 29258

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:



29275
29276
29277
# File 'lib/ovirtsdk4/types.rb', line 29275

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:



29288
29289
29290
29291
29292
29293
# File 'lib/ovirtsdk4/types.rb', line 29288

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