Module: Rundeck::Client::Job
- Included in:
- Rundeck::Client
- Defined in:
- lib/rundeck/client/job.rb
Overview
Defines methods related to jobs.
Instance Method Summary collapse
-
#delete_job(id, options = {}) ⇒ Object
Delete a job.
-
#export_jobs(project, format = 'yaml', options = {}) ⇒ String
Export jobs to yaml or xml format.
-
#import_jobs(content, format = 'yaml', options = {}) ⇒ Rundeck::ObjectifiedHash
Import a job or multiple jobs.
-
#job(id, options = {}) ⇒ Rundeck::ObjectifiedHash
Gets a single job by id.
-
#jobs(project, options = {}) ⇒ Array<Rundeck::ObjectifiedHash>
Gets a list of jobs for a specific project.
Instance Method Details
#delete_job(id, options = {}) ⇒ Object
Delete a job
@TODO: What does this return?!
40 41 42 |
# File 'lib/rundeck/client/job.rb', line 40 def delete_job(id, = {}) delete("/job/#{id}", ) end |
#export_jobs(project, format = 'yaml', options = {}) ⇒ String
Export jobs to yaml or xml format
90 91 92 93 94 95 96 97 98 99 |
# File 'lib/rundeck/client/job.rb', line 90 def export_jobs(project, format = 'yaml', = {}) unless format =~ /yaml|xml/ fail Error::InvalidAttributes, 'format must be yaml or xml' end [:query] = {} if [:query].nil? [:query].merge!('project' => project, 'format' => format) [:format] = format get('/jobs/export', ) end |
#import_jobs(content, format = 'yaml', options = {}) ⇒ Rundeck::ObjectifiedHash
Import a job or multiple jobs
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/rundeck/client/job.rb', line 65 def import_jobs(content, format = 'yaml', = {}) unless format =~ /yaml|xml/ fail Error::InvalidAttributes, 'format must be yaml or xml' end [:headers] = {} if [:headers].nil? [:headers].merge!( 'Content-Type' => 'application/x-www-form-urlencoded') [:body] = "xmlBatch=#{content}" [:query] = {} if [:query].nil? [:query]['format'] = format objectify post('/jobs/import', )['result'] end |
#job(id, options = {}) ⇒ Rundeck::ObjectifiedHash
Gets a single job by id
26 27 28 |
# File 'lib/rundeck/client/job.rb', line 26 def job(id, = {}) objectify get("/job/#{id}", )['joblist']['job'] end |
#jobs(project, options = {}) ⇒ Array<Rundeck::ObjectifiedHash>
Gets a list of jobs for a specific project.
14 15 16 |
# File 'lib/rundeck/client/job.rb', line 14 def jobs(project, = {}) objectify get("/project/#{project}/jobs", )['jobs']['job'] end |