Class: OvirtSDK4::AssignedAffinityLabelService

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

Instance Method Summary (collapse)

Instance Method Details

- (AffinityLabel) get(opts = {})

Retrieves details about the attached label.

Parameters:

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

    Additional options.

Returns:



1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
# File 'lib/ovirtsdk4/services.rb', line 1832

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

- (Object) remove(opts = {})

Removes the label from an entity. Does not touch the label itself.

Parameters:

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

    Additional options.



1854
1855
1856
1857
1858
1859
1860
1861
# File 'lib/ovirtsdk4/services.rb', line 1854

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)


1870
1871
1872
1873
1874
1875
# File 'lib/ovirtsdk4/services.rb', line 1870

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)


1882
1883
1884
# File 'lib/ovirtsdk4/services.rb', line 1882

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