Class: OvirtSDK4::TemplateService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#cdroms_service ⇒ TemplateCdromsService
Returns a reference to the service that manages the CDROMs that are associated with the template.
-
#disk_attachments_service ⇒ TemplateDiskAttachmentsService
Reference to the service that manages a specific disk attachment of the template.
-
#export(opts = {}) ⇒ Object
Exports a template to the data center export domain.
-
#get(opts = {}) ⇒ Template
Returns the information about this template or template version.
-
#graphics_consoles_service ⇒ TemplateGraphicsConsolesService
Returns a reference to the service that manages the graphical consoles that are associated with the template.
-
#nics_service ⇒ TemplateNicsService
Returns a reference to the service that manages the NICs that are associated with the template.
-
#permissions_service ⇒ AssignedPermissionsService
Returns a reference to the service that manages the permissions that are associated with the template.
-
#remove(opts = {}) ⇒ Object
Removes a virtual machine template.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
-
#tags_service ⇒ AssignedTagsService
Returns a reference to the service that manages the tags that are associated with the template.
-
#update(template, opts = {}) ⇒ Template
Updates the template.
-
#watchdogs_service ⇒ TemplateWatchdogsService
Returns a reference to the service that manages the watchdogs that are associated with the template.
Methods inherited from Service
Instance Method Details
#cdroms_service ⇒ TemplateCdromsService
Returns a reference to the service that manages the CDROMs that are associated with the template.
25707 25708 25709 |
# File 'lib/ovirtsdk4/services.rb', line 25707 def cdroms_service @cdroms_service ||= TemplateCdromsService.new(self, 'cdroms') end |
#disk_attachments_service ⇒ TemplateDiskAttachmentsService
Reference to the service that manages a specific disk attachment of the template.
25717 25718 25719 |
# File 'lib/ovirtsdk4/services.rb', line 25717 def ||= TemplateDiskAttachmentsService.new(self, 'diskattachments') end |
#export(opts = {}) ⇒ Object
Exports a template to the data center export domain.
For example, the operation can be facilitated using the following request:
POST /ovirt-engine/api/templates/123/export
With a request body like this:
<action>
<storage_domain id="456"/>
<exclusive>true<exclusive/>
</action>
25576 25577 25578 |
# File 'lib/ovirtsdk4/services.rb', line 25576 def export(opts = {}) internal_action(:export, nil, EXPORT, opts) end |
#get(opts = {}) ⇒ Template
Returns the information about this template or template version.
25608 25609 25610 |
# File 'lib/ovirtsdk4/services.rb', line 25608 def get(opts = {}) internal_get(GET, opts) end |
#graphics_consoles_service ⇒ TemplateGraphicsConsolesService
Returns a reference to the service that manages the graphical consoles that are associated with the template.
25726 25727 25728 |
# File 'lib/ovirtsdk4/services.rb', line 25726 def graphics_consoles_service @graphics_consoles_service ||= TemplateGraphicsConsolesService.new(self, 'graphicsconsoles') end |
#nics_service ⇒ TemplateNicsService
Returns a reference to the service that manages the NICs that are associated with the template.
25735 25736 25737 |
# File 'lib/ovirtsdk4/services.rb', line 25735 def nics_service @nics_service ||= TemplateNicsService.new(self, 'nics') end |
#permissions_service ⇒ AssignedPermissionsService
Returns a reference to the service that manages the permissions that are associated with the template.
25744 25745 25746 |
# File 'lib/ovirtsdk4/services.rb', line 25744 def ||= AssignedPermissionsService.new(self, 'permissions') end |
#remove(opts = {}) ⇒ Object
Removes a virtual machine template.
DELETE /ovirt-engine/api/templates/123
25638 25639 25640 |
# File 'lib/ovirtsdk4/services.rb', line 25638 def remove(opts = {}) internal_remove(REMOVE, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
25773 25774 25775 25776 25777 25778 25779 25780 25781 25782 25783 25784 25785 25786 25787 25788 25789 25790 25791 25792 25793 25794 25795 25796 25797 25798 25799 25800 25801 25802 25803 25804 25805 25806 25807 25808 25809 25810 25811 25812 25813 25814 25815 25816 25817 25818 25819 25820 |
# File 'lib/ovirtsdk4/services.rb', line 25773 def service(path) if path.nil? || path == '' return self end if path == 'cdroms' return cdroms_service end if path.start_with?('cdroms/') return cdroms_service.service(path[7..-1]) end if path == 'diskattachments' return end if path.start_with?('diskattachments/') return .service(path[16..-1]) end if path == 'graphicsconsoles' return graphics_consoles_service end if path.start_with?('graphicsconsoles/') return graphics_consoles_service.service(path[17..-1]) end if path == 'nics' return nics_service end if path.start_with?('nics/') return nics_service.service(path[5..-1]) end if path == 'permissions' return end if path.start_with?('permissions/') return .service(path[12..-1]) end if path == 'tags' return end if path.start_with?('tags/') return .service(path[5..-1]) end if path == 'watchdogs' return watchdogs_service end if path.start_with?('watchdogs/') return watchdogs_service.service(path[10..-1]) end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end |
#tags_service ⇒ AssignedTagsService
Returns a reference to the service that manages the tags that are associated with the template.
25753 25754 25755 |
# File 'lib/ovirtsdk4/services.rb', line 25753 def ||= AssignedTagsService.new(self, 'tags') end |
#update(template, opts = {}) ⇒ Template
Updates the template.
The name, description, type, memory, cpu, topology, os, high_availability, display,
stateless, usb and timezone elements can be updated after a template has been created.
For example, to update a template to so that it has 1 GiB of memory send a request like this:
PUT /ovirt-engine/api/templates/123
With the following request body:
<template>
<memory>1073741824</memory>
</template>
The version_name name attribute is the only one that can be updated within the version attribute used for
template versions:
<template>
<version>
<version_name>mytemplate_2</version_name>
</version>
</template>
25698 25699 25700 |
# File 'lib/ovirtsdk4/services.rb', line 25698 def update(template, opts = {}) internal_update(template, Template, UPDATE, opts) end |
#watchdogs_service ⇒ TemplateWatchdogsService
Returns a reference to the service that manages the watchdogs that are associated with the template.
25762 25763 25764 |
# File 'lib/ovirtsdk4/services.rb', line 25762 def watchdogs_service @watchdogs_service ||= TemplateWatchdogsService.new(self, 'watchdogs') end |