Class: OvirtSDK4::TemplateCdromsService

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

Instance Method Summary (collapse)

Instance Method Details

- (TemplateCdromService) cdrom_service(id)

Locates the cdrom service.

Parameters:

  • id (String)

    The identifier of the cdrom.

Returns:



21820
21821
21822
# File 'lib/ovirtsdk4/services.rb', line 21820

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

- (Array<Cdrom>) 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 CDROMs to return. If not specified all the CDROMs are returned.

Returns:



21791
21792
21793
21794
21795
21796
21797
21798
21799
21800
21801
21802
21803
21804
21805
21806
21807
21808
21809
21810
21811
# File 'lib/ovirtsdk4/services.rb', line 21791

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 CdromReader.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.



21831
21832
21833
21834
21835
21836
21837
21838
21839
21840
# File 'lib/ovirtsdk4/services.rb', line 21831

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

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


21847
21848
21849
# File 'lib/ovirtsdk4/services.rb', line 21847

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