Class: OvirtSDK4::AffinityLabelVmService

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

Instance Method Summary (collapse)

Instance Method Details

- (Vm) get(opts = {})

Retrieves details about a vm that has this label assigned.

Parameters:

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

    Additional options.

Returns:



1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
# File 'lib/ovirtsdk4/services.rb', line 1518

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

- (Object) remove(opts = {})

Remove a label from a vm.

Parameters:

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

    Additional options.



1540
1541
1542
1543
1544
1545
1546
1547
# File 'lib/ovirtsdk4/services.rb', line 1540

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)


1556
1557
1558
1559
1560
1561
# File 'lib/ovirtsdk4/services.rb', line 1556

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)


1568
1569
1570
# File 'lib/ovirtsdk4/services.rb', line 1568

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