Module: Idcf::Ilb::ClientExtensions::Job
- Included in:
- Idcf::Ilb::Client
- Defined in:
- lib/idcf/ilb/client_extensions/job.rb
Overview
SDK APIs for job resource
Instance Method Summary collapse
-
#check_job(id, headers = {}, callback_and_args = [], specify_res_id = true) ⇒ Response
Check job result Get a resource data.
-
#get_job(id, headers = {}) ⇒ Response
Get a job.
-
#jobs(headers = {}) ⇒ Array<Resources::Job>
Get an array of existing job objects.
-
#list_jobs(attributes = {}, headers = {}) ⇒ Response
Get list of existing jobs.
Instance Method Details
#check_job(id, headers = {}, callback_and_args = [], specify_res_id = true) ⇒ Response
Check job result Get a resource data
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/idcf/ilb/client_extensions/job.rb', line 34 def check_job(id, headers = {}, callback_and_args = [], specify_res_id = true) flag = success?(id, headers) return if "DELETE" == @res.body["method"] if flag == true if specify_res_id == true res_id = @res.body["resource_id"] callback_and_args << res_id end callback_and_args.empty? ? true : __send__(*callback_and_args, headers) else raise( ApiError, "JOB Timeout." ) end end |
#get_job(id, headers = {}) ⇒ Response
Get a job
25 26 27 |
# File 'lib/idcf/ilb/client_extensions/job.rb', line 25 def get_job(id, headers = {}) get!("jobs/#{id}", {}, headers) end |
#jobs(headers = {}) ⇒ Array<Resources::Job>
Get an array of existing job objects.
55 56 57 58 59 |
# File 'lib/idcf/ilb/client_extensions/job.rb', line 55 def jobs(headers = {}) list_jobs({}, headers).resources.map do |job| Resources::Job.new(self, job) end end |
#list_jobs(attributes = {}, headers = {}) ⇒ Response
Get list of existing jobs
15 16 17 18 |
# File 'lib/idcf/ilb/client_extensions/job.rb', line 15 def list_jobs(attributes = {}, headers = {}) Validators::Job.validate_attributes!(attributes, :list) get!("jobs", attributes, headers) end |