class OvirtSDK4::TemplateService

Constants

EXPORT
GET
REMOVE
UPDATE

Public Instance Methods

cdroms_service() click to toggle source

Returns a reference to the service that manages the CDROMs that are associated with the template.

@return [TemplateCdromsService] A reference to `cdroms` service.

# File lib/ovirtsdk4/services.rb, line 25508
def cdroms_service
  @cdroms_service ||= TemplateCdromsService.new(self, 'cdroms')
end
disk_attachments_service() click to toggle source

Reference to the service that manages a specific disk attachment of the template.

@return [TemplateDiskAttachmentsService] A reference to `disk_attachments` service.

# File lib/ovirtsdk4/services.rb, line 25518
def disk_attachments_service
  @disk_attachments_service ||= TemplateDiskAttachmentsService.new(self, 'diskattachments')
end
export(opts = {}) click to toggle source

Exports a template to the data center export domain.

For example, the operation can be facilitated using the following request:

source

POST /ovirt-engine/api/templates/123/export


With a request body like this:

source,xml

<action>

<storage_domain id="456"/>
<exclusive>true<exclusive/>

</action>


@param opts [Hash] Additional options.

@option opts [Boolean] :exclusive Indicates if the existing templates with the same name should be overwritten.

The export action reports a failed action if a template of the same name exists in the destination domain.
Set this parameter to `true` to change this behavior and overwrite any existing template.

@option opts [StorageDomain] :storage_domain Specifies the destination export storage domain.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (nil) The timeout for this request, in seconds. If no value is explicitly

given then the timeout set globally for the connection will be used.

@option opts [Boolean] :wait (true) If `true` wait for the response.

# File lib/ovirtsdk4/services.rb, line 25381
def export(opts = {})
  internal_action(:export, nil, EXPORT, opts)
end
get(opts = {}) click to toggle source

Returns the information about this template or template version.

@param opts [Hash] Additional options.

@option opts [Boolean] :filter Indicates if the results should be filtered according to the permissions of the user.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (nil) The timeout for this request, in seconds. If no value is explicitly

given then the timeout set globally for the connection will be used.

@option opts [Boolean] :wait (true) If `true` wait for the response.

@return [Template]

# File lib/ovirtsdk4/services.rb, line 25409
def get(opts = {})
  internal_get(GET, opts)
end
graphics_consoles_service() click to toggle source

Returns a reference to the service that manages the graphical consoles that are associated with the template.

@return [TemplateGraphicsConsolesService] A reference to `graphics_consoles` service.

# File lib/ovirtsdk4/services.rb, line 25527
def graphics_consoles_service
  @graphics_consoles_service ||= TemplateGraphicsConsolesService.new(self, 'graphicsconsoles')
end
nics_service() click to toggle source

Returns a reference to the service that manages the NICs that are associated with the template.

@return [TemplateNicsService] A reference to `nics` service.

# File lib/ovirtsdk4/services.rb, line 25536
def nics_service
  @nics_service ||= TemplateNicsService.new(self, 'nics')
end
permissions_service() click to toggle source

Returns a reference to the service that manages the permissions that are associated with the template.

@return [AssignedPermissionsService] A reference to `permissions` service.

# File lib/ovirtsdk4/services.rb, line 25545
def permissions_service
  @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')
end
remove(opts = {}) click to toggle source

Removes a virtual machine template.

source

DELETE /ovirt-engine/api/templates/123


@param opts [Hash] Additional options.

@option opts [Boolean] :async Indicates if the remove should be performed asynchronously. @option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (nil) The timeout for this request, in seconds. If no value is explicitly

given then the timeout set globally for the connection will be used.

@option opts [Boolean] :wait (true) If `true` wait for the response.

# File lib/ovirtsdk4/services.rb, line 25439
def remove(opts = {})
  internal_remove(REMOVE, opts)
end
service(path) click to toggle source

Locates the service corresponding to the given path.

@param path [String] The path of the service.

@return [Service] A reference to the service.

# File lib/ovirtsdk4/services.rb, line 25574
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 disk_attachments_service
  end
  if path.start_with?('diskattachments/')
    return disk_attachments_service.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 permissions_service
  end
  if path.start_with?('permissions/')
    return permissions_service.service(path[12..-1])
  end
  if path == 'tags'
    return tags_service
  end
  if path.start_with?('tags/')
    return tags_service.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() click to toggle source

Returns a reference to the service that manages the tags that are associated with the template.

@return [AssignedTagsService] A reference to `tags` service.

# File lib/ovirtsdk4/services.rb, line 25554
def tags_service
  @tags_service ||= AssignedTagsService.new(self, 'tags')
end
to_s() click to toggle source

Returns an string representation of this service.

@return [String]

# File lib/ovirtsdk4/services.rb, line 25628
def to_s
  "#<#{TemplateService}:#{absolute_path}>"
end
update(template, opts = {}) click to toggle source

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:

source

PUT /ovirt-engine/api/templates/123


With the following request body:

source,xml

<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:

source,xml

<template>

<version>
  <version_name>mytemplate_2</version_name>
</version>

</template>


@param template [Template] The `template` to update. @param opts [Hash] Additional options.

@option opts [Boolean] :async Indicates if the update should be performed asynchronously.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (nil) The timeout for this request, in seconds. If no value is explicitly

given then the timeout set globally for the connection will be used.

@option opts [Boolean] :wait (true) If `true` wait for the response.

@return [Template]

# File lib/ovirtsdk4/services.rb, line 25499
def update(template, opts = {})
  internal_update(template, Template, UPDATE, opts)
end
watchdogs_service() click to toggle source

Returns a reference to the service that manages the watchdogs that are associated with the template.

@return [TemplateWatchdogsService] A reference to `watchdogs` service.

# File lib/ovirtsdk4/services.rb, line 25563
def watchdogs_service
  @watchdogs_service ||= TemplateWatchdogsService.new(self, 'watchdogs')
end