Class: OvirtSDK4::GlusterHooksService

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

Instance Method Summary (collapse)

Instance Method Details

- (GlusterHookService) hook_service(id)

Locates the hook service.

Parameters:

  • id (String)

    The identifier of the hook.

Returns:



8840
8841
8842
# File 'lib/ovirtsdk4/services.rb', line 8840

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

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

Returns:



8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
# File 'lib/ovirtsdk4/services.rb', line 8811

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



8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
# File 'lib/ovirtsdk4/services.rb', line 8851

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

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


8867
8868
8869
# File 'lib/ovirtsdk4/services.rb', line 8867

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