Class: OvirtSDK4::AssignedTagsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#add(tag, opts = {}) ⇒ Tag
Assign tag to specific entity in the system.
-
#list(opts = {}) ⇒ Array<Tag>
List all tags assigned to the specific entity.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
-
#tag_service(id) ⇒ AssignedTagService
Reference to the service that manages assignment of specific tag.
Methods inherited from Service
Instance Method Details
#add(tag, opts = {}) ⇒ Tag
Assign tag to specific entity in the system.
For example to assign tag mytag
to virtual machine with the id 123
send a request like this:
POST /ovirt-engine/api/vms/123/tags
With a request body like this:
<tag>
<name>mytag</name>
</tag>
3476 3477 3478 |
# File 'lib/ovirtsdk4/services.rb', line 3476 def add(tag, opts = {}) internal_add(tag, Tag, ADD, opts) end |
#list(opts = {}) ⇒ Array<Tag>
List all tags assigned to the specific entity.
For example to list all the tags of the virtual machine with id 123
send a request like this:
GET /ovirt-engine/api/vms/123/tags
<tags>
<tag href="/ovirt-engine/api/tags/222" id="222">
<name>mytag</name>
<description>mytag</description>
<vm href="/ovirt-engine/api/vms/123" id="123"/>
</tag>
</tags>
The order of the returned tags isn’t guaranteed.
3527 3528 3529 |
# File 'lib/ovirtsdk4/services.rb', line 3527 def list(opts = {}) internal_get(LIST, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 |
# File 'lib/ovirtsdk4/services.rb', line 3549 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return tag_service(path) end return tag_service(path[0..(index - 1)]).service(path[(index + 1)..-1]) end |
#tag_service(id) ⇒ AssignedTagService
Reference to the service that manages assignment of specific tag.
3538 3539 3540 |
# File 'lib/ovirtsdk4/services.rb', line 3538 def tag_service(id) AssignedTagService.new(self, id) end |