Class: OvirtSDK4::OperatingSystemsService

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

Instance Method Summary (collapse)

Instance Method Details

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

Returns:



15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
# File 'lib/ovirtsdk4/services.rb', line 15201

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

- (OperatingSystemService) operating_system_service(id)

Locates the operating_system service.

Parameters:

  • id (String)

    The identifier of the operating_system.

Returns:



15230
15231
15232
# File 'lib/ovirtsdk4/services.rb', line 15230

def operating_system_service(id)
  return OperatingSystemService.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.



15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
# File 'lib/ovirtsdk4/services.rb', line 15241

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

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


15257
15258
15259
# File 'lib/ovirtsdk4/services.rb', line 15257

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