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>
2897 2898 2899 |
# File 'lib/ovirtsdk4/services.rb', line 2897 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.
2948 2949 2950 |
# File 'lib/ovirtsdk4/services.rb', line 2948 def list(opts = {}) internal_get(LIST, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 |
# File 'lib/ovirtsdk4/services.rb', line 2970 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.
2959 2960 2961 |
# File 'lib/ovirtsdk4/services.rb', line 2959 def tag_service(id) AssignedTagService.new(self, id) end |