Class: OvirtSDK4::JobService

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) clear(opts = {})

Executes the clear method.



11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
# File 'lib/ovirtsdk4/services.rb', line 11594

def clear(opts = {})
  action = Action.new(opts)
  writer = XmlWriter.new(nil, true)
  ActionWriter.write_one(action, writer)
  body = writer.string
  writer.close
  request = Request.new({
  :method => :POST,
  :path => "#{@path}/clear",
  :body => body,
  })
  response = @connection.send(request)
  case response.code
  when 200
    action = check_action(response)
  else
    check_fault(response)
  end
end

- (Object) end_(opts = {})

Executes the end_ method.



11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
# File 'lib/ovirtsdk4/services.rb', line 11617

def end_(opts = {})
  action = Action.new(opts)
  writer = XmlWriter.new(nil, true)
  ActionWriter.write_one(action, writer)
  body = writer.string
  writer.close
  request = Request.new({
  :method => :POST,
  :path => "#{@path}/end",
  :body => body,
  })
  response = @connection.send(request)
  case response.code
  when 200
    action = check_action(response)
  else
    check_fault(response)
  end
end

- (Job) get(opts = {})

Returns the representation of the object managed by this service.

Parameters:

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

    Additional options.

Returns:



11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
# File 'lib/ovirtsdk4/services.rb', line 11644

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 JobReader.read_one(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.

Raises:

  • (Error)


11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
# File 'lib/ovirtsdk4/services.rb', line 11676

def service(path)
  if path.nil? || path == ''
    return self
  end
  if path == 'steps'
    return steps_service
  end
  if path.start_with?('steps/')
    return steps_service.service(path[6..-1])
  end
  raise Error.new("The path \"#{path}\" doesn't correspond to any service")
end

- (StepsService) steps_service

Locates the steps service.

Returns:



11665
11666
11667
# File 'lib/ovirtsdk4/services.rb', line 11665

def steps_service
  return StepsService.new(@connection, "#{@path}/steps")
end

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


11694
11695
11696
# File 'lib/ovirtsdk4/services.rb', line 11694

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