Class: OvirtSDK4::LabelService

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

Instance Method Summary (collapse)

Instance Method Details

- (Label) get(opts = {})

Returns the representation of the object managed by this service.

Parameters:

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

    Additional options.

Returns:



10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
# File 'lib/ovirtsdk4/services.rb', line 10701

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

- (Object) remove(opts = {})

Deletes the object managed by this service.

Parameters:

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the remove should be performed asynchronously.



10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
# File 'lib/ovirtsdk4/services.rb', line 10725

def remove(opts = {})
  query = {}
  value = opts[:async]
  unless value.nil?
    value = Writer.render_boolean(value)
    query['async'] = value
  end
  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)


10746
10747
10748
10749
10750
10751
# File 'lib/ovirtsdk4/services.rb', line 10746

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)


10758
10759
10760
# File 'lib/ovirtsdk4/services.rb', line 10758

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