Class: OvirtSDK4::VmReportedDevicesService

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

Instance Method Summary (collapse)

Instance Method Details

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

Returns:



26202
26203
26204
26205
26206
26207
26208
26209
26210
26211
26212
26213
26214
26215
26216
26217
26218
26219
26220
26221
26222
# File 'lib/ovirtsdk4/services.rb', line 26202

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 ReportedDeviceReader.read_many(reader)
    ensure
      reader.close
    end
  else
    check_fault(response)
  end
end

- (VmReportedDeviceService) reported_device_service(id)

Locates the reported_device service.

Parameters:

  • id (String)

    The identifier of the reported_device.

Returns:



26231
26232
26233
# File 'lib/ovirtsdk4/services.rb', line 26231

def reported_device_service(id)
  return VmReportedDeviceService.new(@connection, "#{@path}/#{id}")
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.



26242
26243
26244
26245
26246
26247
26248
26249
26250
26251
# File 'lib/ovirtsdk4/services.rb', line 26242

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

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


26258
26259
26260
# File 'lib/ovirtsdk4/services.rb', line 26258

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