class Delphix::Job

Public Class Methods

list() click to toggle source

class methods

# File lib/delphix/job.rb, line 52
def self.list
  jobs = Delphix::BaseArray.new
  result = Delphix.get('/resources/json/delphix/job')['result']
  result.each do |job|
    jobs << Delphix::Job.new(job['reference'],job)
  end
  jobs
end
new(reference, details=nil) click to toggle source
Calls superclass method Delphix::Base::new
# File lib/delphix/job.rb, line 5
def initialize(reference, details=nil)
  super(reference, details)
end

Public Instance Methods

base_endpoint() click to toggle source
# File lib/delphix/job.rb, line 46
def base_endpoint
  '/resources/json/delphix/job'
end
cancel!() click to toggle source
# File lib/delphix/job.rb, line 22
def cancel!
  Delphix.post("#{base_endpoint}/#{reference}/cancel")['result']
end
resume!() click to toggle source
# File lib/delphix/job.rb, line 30
def resume!
  Delphix.post("#{base_endpoint}/#{reference}/resume")['result']
end
state() click to toggle source

specific operations

# File lib/delphix/job.rb, line 13
def state
  @details['jobState'] # RUNNING, SUSPENDED, CANCELED, COMPLETED, FAILED
end
state?() click to toggle source
# File lib/delphix/job.rb, line 17
def state?
  refresh_details
  state
end
suspend!() click to toggle source
# File lib/delphix/job.rb, line 26
def suspend!
  Delphix.post("#{base_endpoint}/#{reference}/suspend")['result']
end
to_s() click to toggle source

inherited operations

# File lib/delphix/job.rb, line 42
def to_s
  "#{self.class.name}[#{@details['actionType']}, #{reference}, #{@details['jobState']}]"
end
wait_for_completion() click to toggle source
# File lib/delphix/job.rb, line 34
def wait_for_completion
  begin
    sleep 1
  end while state? == 'RUNNING'
end