Class: OvirtSDK4::ClusterLevelsService

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

Instance Method Summary (collapse)

Instance Method Details

- (ClusterLevelService) level_service(id)

Reference to the service that provides information about an specific cluster level.

Parameters:

  • id (String)

    The identifier of the level.

Returns:



4355
4356
4357
# File 'lib/ovirtsdk4/services.rb', line 4355

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

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

Lists the cluster levels supported by the system.

Parameters:

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

    Additional options.

Returns:



4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
# File 'lib/ovirtsdk4/services.rb', line 4331

def list(opts = {})
  query = {}
  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 ClusterLevelReader.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.



4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
# File 'lib/ovirtsdk4/services.rb', line 4366

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

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


4382
4383
4384
# File 'lib/ovirtsdk4/services.rb', line 4382

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