Class: OvirtSDK4::StorageDomainTemplatesService

Inherits:
Service
  • Object
show all
Defined in:
lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb

Instance Method Summary (collapse)

Instance Method Details

- (Array<Template>) list(opts = {})

Returns the representation of the object managed by this service.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :max (Integer)

    Sets the maximum number of templates to return. If not specified all the templates are returned.

Returns:



19603
19604
19605
19606
19607
19608
19609
19610
19611
19612
19613
19614
19615
19616
19617
19618
19619
19620
19621
19622
19623
# File 'lib/ovirtsdk4/services.rb', line 19603

def list(opts = {})
  query = {}
  value = opts[:max]
  unless value.nil?
    value = Writer.render_integer(value)
    query['max'] = value
  end
  request = Request.new(:method => :GET, :path => @path, :query => query)
  response = @connection.send(request)
  case response.code
  when 200
    begin
      reader = XmlReader.new(response.body)
      return TemplateReader.read_many(reader)
    ensure
      reader.close
    end
  else
    check_fault(response)
  end
end

- (Service) service(path)

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.



19643
19644
19645
19646
19647
19648
19649
19650
19651
19652
# File 'lib/ovirtsdk4/services.rb', line 19643

def service(path)
  if path.nil? || path == ''
    return self
  end
  index = path.index('/')
  if index.nil?
    return template_service(path)
  end
  return template_service(path[0..(index - 1)]).service(path[(index +1)..-1])
end

- (StorageDomainTemplateService) template_service(id)

Locates the template service.

Parameters:

  • id (String)

    The identifier of the template.

Returns:



19632
19633
19634
# File 'lib/ovirtsdk4/services.rb', line 19632

def template_service(id)
  return StorageDomainTemplateService.new(@connection, "#{@path}/#{id}")
end

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


19659
19660
19661
# File 'lib/ovirtsdk4/services.rb', line 19659

def to_s
  return "#<#{StorageDomainTemplatesService}:#{@path}>"
end