Class: OvirtSDK4::HostHooksService

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

Instance Method Summary (collapse)

Instance Method Details

- (HostHookService) hook_service(id)

Locates the hook service.

Parameters:

  • id (String)

    The identifier of the hook.

Returns:



9749
9750
9751
# File 'lib/ovirtsdk4/services.rb', line 9749

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

- (Array<Hook>) 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:



9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
# File 'lib/ovirtsdk4/services.rb', line 9720

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



9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
# File 'lib/ovirtsdk4/services.rb', line 9760

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)


9776
9777
9778
# File 'lib/ovirtsdk4/services.rb', line 9776

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