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.


30674
30675
30676
30677
30678
30679
30680
30681
30682
30683
30684
30685
30686
# File 'lib/ovirtsdk4/types.rb', line 30674

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.


30691
30692
30693
30694
30695
30696
30697
30698
30699
30700
30701
30702
30703
# File 'lib/ovirtsdk4/types.rb', line 30691

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:


30338
30339
30340
# File 'lib/ovirtsdk4/types.rb', line 30338

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:


30351
30352
30353
30354
30355
30356
# File 'lib/ovirtsdk4/types.rb', line 30351

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)

30363
30364
30365
# File 'lib/ovirtsdk4/types.rb', line 30363

def comment
  @comment
end

#comment=(value) ⇒ Object

Sets the value of the comment attribute.

Parameters:

  • value (String)

30372
30373
30374
# File 'lib/ovirtsdk4/types.rb', line 30372

def comment=(value)
  @comment = value
end

#descriptionString

Returns the value of the description attribute.

Returns:

  • (String)

30381
30382
30383
# File 'lib/ovirtsdk4/types.rb', line 30381

def description
  @description
end

#description=(value) ⇒ Object

Sets the value of the description attribute.

Parameters:

  • value (String)

30390
30391
30392
# File 'lib/ovirtsdk4/types.rb', line 30390

def description=(value)
  @description = value
end

#enforcingBoolean

Returns the value of the enforcing attribute.

Returns:

  • (Boolean)

30399
30400
30401
# File 'lib/ovirtsdk4/types.rb', line 30399

def enforcing
  @enforcing
end

#enforcing=(value) ⇒ Object

Sets the value of the enforcing attribute.

Parameters:

  • value (Boolean)

30408
30409
30410
# File 'lib/ovirtsdk4/types.rb', line 30408

def enforcing=(value)
  @enforcing = value
end

#hashObject

Generates a hash value for this object.


30708
30709
30710
30711
30712
30713
30714
30715
30716
30717
30718
30719
30720
# File 'lib/ovirtsdk4/types.rb', line 30708

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:


30417
30418
30419
# File 'lib/ovirtsdk4/types.rb', line 30417

def host_labels
  @host_labels
end

#host_labels=(list) ⇒ Object

Sets the value of the host_labels attribute.

Parameters:


30426
30427
30428
30429
30430
30431
30432
30433
30434
30435
30436
# File 'lib/ovirtsdk4/types.rb', line 30426

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:


30443
30444
30445
# File 'lib/ovirtsdk4/types.rb', line 30443

def hosts
  @hosts
end

#hosts=(list) ⇒ Object

Sets the value of the hosts attribute.

Parameters:

  • list (Array<Host>)

30452
30453
30454
30455
30456
30457
30458
30459
30460
30461
30462
# File 'lib/ovirtsdk4/types.rb', line 30452

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:


30469
30470
30471
# File 'lib/ovirtsdk4/types.rb', line 30469

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:


30482
30483
30484
30485
30486
30487
# File 'lib/ovirtsdk4/types.rb', line 30482

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)

30494
30495
30496
# File 'lib/ovirtsdk4/types.rb', line 30494

def id
  @id
end

#id=(value) ⇒ Object

Sets the value of the id attribute.

Parameters:

  • value (String)

30503
30504
30505
# File 'lib/ovirtsdk4/types.rb', line 30503

def id=(value)
  @id = value
end

#nameString

Returns the value of the name attribute.

Returns:

  • (String)

30512
30513
30514
# File 'lib/ovirtsdk4/types.rb', line 30512

def name
  @name
end

#name=(value) ⇒ Object

Sets the value of the name attribute.

Parameters:

  • value (String)

30521
30522
30523
# File 'lib/ovirtsdk4/types.rb', line 30521

def name=(value)
  @name = value
end

#positiveBoolean

Returns the value of the positive attribute.

Returns:

  • (Boolean)

30530
30531
30532
# File 'lib/ovirtsdk4/types.rb', line 30530

def positive
  @positive
end

#positive=(value) ⇒ Object

Sets the value of the positive attribute.

Parameters:

  • value (Boolean)

30539
30540
30541
# File 'lib/ovirtsdk4/types.rb', line 30539

def positive=(value)
  @positive = value
end

#priorityFloat

Returns the value of the priority attribute.

Returns:

  • (Float)

30548
30549
30550
# File 'lib/ovirtsdk4/types.rb', line 30548

def priority
  @priority
end

#priority=(value) ⇒ Object

Sets the value of the priority attribute.

Parameters:

  • value (Float)

30557
30558
30559
# File 'lib/ovirtsdk4/types.rb', line 30557

def priority=(value)
  @priority = value
end

#vm_labelsArray<AffinityLabel>

Returns the value of the vm_labels attribute.

Returns:


30566
30567
30568
# File 'lib/ovirtsdk4/types.rb', line 30566

def vm_labels
  @vm_labels
end

#vm_labels=(list) ⇒ Object

Sets the value of the vm_labels attribute.

Parameters:


30575
30576
30577
30578
30579
30580
30581
30582
30583
30584
30585
# File 'lib/ovirtsdk4/types.rb', line 30575

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>)

30592
30593
30594
# File 'lib/ovirtsdk4/types.rb', line 30592

def vms
  @vms
end

#vms=(list) ⇒ Object

Sets the value of the vms attribute.

Parameters:

  • list (Array<Vm>)

30601
30602
30603
30604
30605
30606
30607
30608
30609
30610
30611
# File 'lib/ovirtsdk4/types.rb', line 30601

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:


30618
30619
30620
# File 'lib/ovirtsdk4/types.rb', line 30618

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:


30631
30632
30633
30634
30635
30636
# File 'lib/ovirtsdk4/types.rb', line 30631

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