Class: OvirtSDK4::ExternalHostGroupsService

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

Instance Method Summary (collapse)

Instance Method Details

- (ExternalHostGroupService) group_service(id)

Locates the group service.

Parameters:

  • id (String)

    The identifier of the group.

Returns:



7283
7284
7285
# File 'lib/ovirtsdk4/services.rb', line 7283

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

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

Returns:



7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
# File 'lib/ovirtsdk4/services.rb', line 7254

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



7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
# File 'lib/ovirtsdk4/services.rb', line 7294

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

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


7310
7311
7312
# File 'lib/ovirtsdk4/services.rb', line 7310

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