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>
3458 3459 3460 |
# File 'lib/ovirtsdk4/services.rb', line 3458 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.
3509 3510 3511 |
# File 'lib/ovirtsdk4/services.rb', line 3509 def list(opts = {}) internal_get(LIST, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 |
# File 'lib/ovirtsdk4/services.rb', line 3531 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.
3520 3521 3522 |
# File 'lib/ovirtsdk4/services.rb', line 3520 def tag_service(id) AssignedTagService.new(self, id) end |