Class: OvirtSDK4::AffinityGroupVmLabelsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#add(label, opts = {}) ⇒ AffinityLabel
Adds a virtual machine label to the affinity group.
-
#label_service(id) ⇒ AffinityGroupVmLabelService
Access the service that manages the virtual machine label assignment to this affinity group.
-
#list(opts = {}) ⇒ Array<AffinityLabel>
List all virtual machine labels assigned to this affinity group.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
Methods inherited from Service
Instance Method Details
#add(label, opts = {}) ⇒ AffinityLabel
Adds a virtual machine label to the affinity group.
For example, to add the label 789
to the affinity group 456
of cluster 123
,
send a request like this:
POST /ovirt-engine/api/clusters/123/affinitygroups/456/vmlabels
With the following body:
<affinity_label id="789"/>
1506 1507 1508 |
# File 'lib/ovirtsdk4/services.rb', line 1506 def add(label, opts = {}) internal_add(label, AffinityLabel, ADD, opts) end |
#label_service(id) ⇒ AffinityGroupVmLabelService
Access the service that manages the virtual machine label assignment to this affinity group.
1552 1553 1554 |
# File 'lib/ovirtsdk4/services.rb', line 1552 def label_service(id) AffinityGroupVmLabelService.new(self, id) end |
#list(opts = {}) ⇒ Array<AffinityLabel>
List all virtual machine labels assigned to this affinity group.
The order of the returned labels isn’t guaranteed.
1541 1542 1543 |
# File 'lib/ovirtsdk4/services.rb', line 1541 def list(opts = {}) internal_get(LIST, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 |
# File 'lib/ovirtsdk4/services.rb', line 1563 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return label_service(path) end return label_service(path[0..(index - 1)]).service(path[(index + 1)..-1]) end |