Class: OvirtSDK4::AffinityLabelHostService

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

Instance Method Summary (collapse)

Instance Method Details

- (Host) get(opts = {})

Retrieves details about a host that has this label assigned.

Parameters:

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

    Additional options.

Returns:



1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
# File 'lib/ovirtsdk4/services.rb', line 1325

def get(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 HostReader.read_one(reader)
    ensure
      reader.close
    end
  else
    check_fault(response)
  end
end

- (Object) remove(opts = {})

Remove a label from a host.

Parameters:

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

    Additional options.



1347
1348
1349
1350
1351
1352
1353
1354
# File 'lib/ovirtsdk4/services.rb', line 1347

def remove(opts = {})
  query = {}
  request = Request.new(:method => :DELETE, :path => @path, :query => query)
  response = @connection.send(request)
  unless response.code == 200
    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.

Raises:

  • (Error)


1363
1364
1365
1366
1367
1368
# File 'lib/ovirtsdk4/services.rb', line 1363

def service(path)
  if path.nil? || path == ''
    return self
  end
  raise Error.new("The path \"#{path}\" doesn't correspond to any service")
end

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


1375
1376
1377
# File 'lib/ovirtsdk4/services.rb', line 1375

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