Class: OvirtSDK4::DomainsService

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

Instance Method Summary (collapse)

Instance Method Details

- (DomainService) domain_service(id)

Locates the domain service.

Parameters:

  • id (String)

    The identifier of the domain.

Returns:



6518
6519
6520
# File 'lib/ovirtsdk4/services.rb', line 6518

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

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

Returns:



6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
# File 'lib/ovirtsdk4/services.rb', line 6489

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



6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
# File 'lib/ovirtsdk4/services.rb', line 6529

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

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


6545
6546
6547
# File 'lib/ovirtsdk4/services.rb', line 6545

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