Class: OvirtSDK4::SnapshotCdromsService

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

Instance Method Summary (collapse)

Instance Method Details

- (SnapshotCdromService) cdrom_service(id)

Locates the cdrom service.

Parameters:

  • id (String)

    The identifier of the cdrom.

Returns:



17481
17482
17483
# File 'lib/ovirtsdk4/services.rb', line 17481

def cdrom_service(id)
  return SnapshotCdromService.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:



17452
17453
17454
17455
17456
17457
17458
17459
17460
17461
17462
17463
17464
17465
17466
17467
17468
17469
17470
17471
17472
# File 'lib/ovirtsdk4/services.rb', line 17452

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.



17492
17493
17494
17495
17496
17497
17498
17499
17500
17501
# File 'lib/ovirtsdk4/services.rb', line 17492

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)


17508
17509
17510
# File 'lib/ovirtsdk4/services.rb', line 17508

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