Module: Rundeck::Client::Execution
- Included in:
- Rundeck::Client
- Defined in:
- lib/rundeck/client/execution.rb
Overview
Defines methods related to executions.
Instance Method Summary collapse
-
#abort_execution(id, options = {}) ⇒ Rundeck::ObjectifiedHash
Abort a running execution.
-
#bulk_delete_executions(ids, options = {}) ⇒ Rundeck::ObjectifiedHash
Bulk delete executions.
-
#delete_execution(id, options = {}) ⇒ nil
Delete an execution.
-
#delete_job_executions(id, options = {}) ⇒ Rundeck::ObjectifiedHash
Delete all executions for a specific job.
-
#execute_job(id, options = {}) ⇒ Rundeck::ObjectifiedHash
(also: #run_job)
Execute a job.
-
#execution(id, options = {}) ⇒ Rundeck::ObjectifiedHash
Get info for an execution.
-
#execution_query(project, options = {}) ⇒ Object
Query for executions based on job or execution details.
-
#execution_state(id, options = {}) ⇒ Rundeck::ObjectifiedHash
Get the state of an execution.
-
#job_executions(id, options = {}) ⇒ Rundeck::ObjectifiedHash
Get executions for a specific job.
-
#running_job_executions(project, options = {}) ⇒ Rundeck::ObjectifiedHash
Get all running job executions.
Instance Method Details
#abort_execution(id, options = {}) ⇒ Rundeck::ObjectifiedHash
This method has optional Rundeck parameters that can be passed to the options parameter. See Rundeck API documentation for more information.
-
query: { param1: ‘value’, param2: ‘value’ }
Abort a running execution
113 114 115 |
# File 'lib/rundeck/client/execution.rb', line 113 def abort_execution(id, = {}) objectify post("/execution/#{id}/abort", )['abort'] end |
#bulk_delete_executions(ids, options = {}) ⇒ Rundeck::ObjectifiedHash
Bulk delete executions
149 150 151 152 153 154 155 156 157 |
# File 'lib/rundeck/client/execution.rb', line 149 def bulk_delete_executions(ids, = {}) unless ids.is_a?(Array) fail Rundeck::Error::InvalidAttributes, '`ids` must be an array of ids' end [:query] = {} if [:query].nil? [:query].merge!(ids: ids.join(',')) objectify post('/executions/delete', )['deleteExecutions'] end |
#delete_execution(id, options = {}) ⇒ nil
Delete an execution
97 98 99 |
# File 'lib/rundeck/client/execution.rb', line 97 def delete_execution(id, = {}) delete("/execution/#{id}", ) end |
#delete_job_executions(id, options = {}) ⇒ Rundeck::ObjectifiedHash
Delete all executions for a specific job
84 85 86 |
# File 'lib/rundeck/client/execution.rb', line 84 def delete_job_executions(id, = {}) objectify delete("/job/#{id}/executions", )['deleteExecutions'] end |
#execute_job(id, options = {}) ⇒ Rundeck::ObjectifiedHash Also known as: run_job
This method has optional Rundeck parameters that can be passed to the options parameter. See Rundeck API documentation for more information.
-
query: { param1: ‘value’, param2: ‘value’ }
Execute a job
21 22 23 24 25 26 27 28 29 |
# File 'lib/rundeck/client/execution.rb', line 21 def execute_job(id, = {}) e = post("/job/#{id}/executions", ) # Temporary fix for https://github.com/dblessing/rundeck-ruby/issues/25 begin objectify e['result']['executions'] rescue objectify e['executions'] end end |
#execution(id, options = {}) ⇒ Rundeck::ObjectifiedHash
Get info for an execution
129 130 131 132 133 134 135 136 137 |
# File 'lib/rundeck/client/execution.rb', line 129 def execution(id, = {}) e = get("/execution/#{id}", ) # Temporary fix for https://github.com/dblessing/rundeck-ruby/issues/25 begin objectify e['result']['executions']['execution'] rescue objectify e['executions']['execution'] end end |
#execution_query(project, options = {}) ⇒ Object
This method maps to an advanced Rundeck endpoint. View the Rundeck API documentation and understand what query parameters are required. Responses may include paging details. Recall this method with the next set of paging values to retrieve more elements.
Query for executions based on job or execution details.
181 182 183 184 185 186 187 188 189 190 |
# File 'lib/rundeck/client/execution.rb', line 181 def execution_query(project, = {}) = (project, ) q = get('/executions', ) # Temporary fix for https://github.com/dblessing/rundeck-ruby/issues/25 begin objectify q['result']['executions'] rescue objectify q['executions'] end end |
#execution_state(id, options = {}) ⇒ Rundeck::ObjectifiedHash
Get the state of an execution
168 169 170 |
# File 'lib/rundeck/client/execution.rb', line 168 def execution_state(id, = {}) objectify get("/execution/#{id}/state", )['result']['executionState'] end |
#job_executions(id, options = {}) ⇒ Rundeck::ObjectifiedHash
This method has optional Rundeck parameters that can be passed to the options parameter. See Rundeck API documentation for more information.
-
query: { param1: ‘value’, param2: ‘value’ }
Get executions for a specific job.
47 48 49 50 |
# File 'lib/rundeck/client/execution.rb', line 47 def job_executions(id, = {}) r = get("/job/#{id}/executions", )['result']['executions'] objectify r end |
#running_job_executions(project, options = {}) ⇒ Rundeck::ObjectifiedHash
This method has required Rundeck parameters that can be passed to the options parameter. See Rundeck API documentation for more information.
-
query: { param1: ‘value’, param2: ‘value’ }
Get all running job executions
66 67 68 69 |
# File 'lib/rundeck/client/execution.rb', line 66 def running_job_executions(project, = {}) = (project, ) objectify get('/executions/running', )['result']['executions'] end |