class Morpheus::JobsInterface

Public Instance Methods

base_path() click to toggle source
# File lib/morpheus/api/jobs_interface.rb, line 5
def base_path
  "/api/jobs"
end
create(payload) click to toggle source
# File lib/morpheus/api/jobs_interface.rb, line 28
def create(payload)
  url = base_path
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  execute(method: :post, url: url, headers: headers, payload: payload.to_json)
end
destroy(id, params={}) click to toggle source
# File lib/morpheus/api/jobs_interface.rb, line 40
def destroy(id, params={})
  url = "#{base_path}/#{id}"
  headers = { :params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  execute(method: :delete, url: url, headers: headers)
end
execute_job(id, payload={}, params={}) click to toggle source
# File lib/morpheus/api/jobs_interface.rb, line 46
def execute_job(id, payload={}, params={})
  url = "#{base_path}/#{id}/execute"
  headers = { params: params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  execute(method: :put, url: url, headers: headers, payload: payload.to_json)
end
get(id, params={}) click to toggle source
# File lib/morpheus/api/jobs_interface.rb, line 15
def get(id, params={})
  url = "#{base_path}/#{id}"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  if params.is_a?(Hash)
    headers[:params].merge!(params)
  elsif params.is_a?(Numeric)
    url = "#{base_path}/#{params}"
  elsif params.is_a?(String)
    headers[:params]['name'] = params
  end
  execute(method: :get, url: url, headers: headers)
end
get_execution(id, params={}) click to toggle source
# File lib/morpheus/api/jobs_interface.rb, line 66
def get_execution(id, params={})
  url = "#{@base_url}/api/job-executions/#{id}"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  execute(method: :get, url: url, headers: headers)
end
get_execution_event(id, event_id, params={}) click to toggle source
# File lib/morpheus/api/jobs_interface.rb, line 72
def get_execution_event(id, event_id, params={})
  url = "#{@base_url}/api/job-executions/#{id}/events/#{event_id}"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  execute(method: :get, url: url, headers: headers)
end
list(params={}) click to toggle source
# File lib/morpheus/api/jobs_interface.rb, line 9
def list(params={})
  url = base_path
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  execute(method: :get, url: url, headers: headers)
end
list_executions(params={}) click to toggle source

def list_job_executions(id, params={})

url = "#{base_path}/#{id}/executions"
headers = { params: params, authorization: "Bearer #{@access_token}" }
execute(method: :get, url: url, headers: headers)

end

# File lib/morpheus/api/jobs_interface.rb, line 60
def list_executions(params={})
  url = "#{@base_url}/api/job-executions"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  execute(method: :get, url: url, headers: headers)
end
options(jobTypeId, params={}) click to toggle source
# File lib/morpheus/api/jobs_interface.rb, line 78
def options(jobTypeId, params={})
  url = "#{@base_url}/api/job-options/#{jobTypeId}"
  headers = { params: params, authorization: "Bearer #{@access_token}" }
  execute(method: :get, url: url, headers: headers)
end
update(id, payload, params={}) click to toggle source
# File lib/morpheus/api/jobs_interface.rb, line 34
def update(id, payload, params={})
  url = "#{base_path}/#{id}"
  headers = { params: params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  execute(method: :put, url: url, headers: headers, payload: payload.to_json)
end