Class: ProxyAPI::ForemanDynflow::DynflowProxy
- Inherits:
-
Object
- Object
- ProxyAPI::ForemanDynflow::DynflowProxy
- Defined in:
- app/lib/proxy_api/foreman_dynflow/dynflow_proxy.rb
Defined Under Namespace
Classes: Task
Constant Summary collapse
- PREFIX =
'dynflow'.freeze
Instance Method Summary collapse
-
#cancel_task(proxy_task_id) ⇒ Object
Cancel the command.
-
#initialize(args) ⇒ DynflowProxy
constructor
A new instance of DynflowProxy.
- #launch_tasks(operation, input, options = {}) ⇒ Object
- #operations ⇒ Object
- #status_of_task(proxy_task_id) ⇒ Object
- #task_states(ids) ⇒ Object
- #tasks_count(state) ⇒ Object
-
#trigger_task(action_name, action_input) ⇒ Object
Initiate the command.
Constructor Details
#initialize(args) ⇒ DynflowProxy
Returns a new instance of DynflowProxy.
15 16 17 |
# File 'app/lib/proxy_api/foreman_dynflow/dynflow_proxy.rb', line 15 def initialize(args) @args = args end |
Instance Method Details
#cancel_task(proxy_task_id) ⇒ Object
Cancel the command
26 27 28 |
# File 'app/lib/proxy_api/foreman_dynflow/dynflow_proxy.rb', line 26 def cancel_task(proxy_task_id) MultiJson.load(Task.new(@args).send(:post, '', "#{proxy_task_id}/cancel")) end |
#launch_tasks(operation, input, options = {}) ⇒ Object
47 48 49 50 51 52 53 |
# File 'app/lib/proxy_api/foreman_dynflow/dynflow_proxy.rb', line 47 def launch_tasks(operation, input, = {}) data = { :input => input, :operation => operation, :options => } payload = MultiJson.dump(data) MultiJson.load(Task.new(@args).send(:post, payload, 'launch')) end |
#operations ⇒ Object
43 44 45 |
# File 'app/lib/proxy_api/foreman_dynflow/dynflow_proxy.rb', line 43 def operations MultiJson.load(Task.new(@args).send(:get, 'operations')) end |
#status_of_task(proxy_task_id) ⇒ Object
30 31 32 |
# File 'app/lib/proxy_api/foreman_dynflow/dynflow_proxy.rb', line 30 def status_of_task(proxy_task_id) MultiJson.load(Task.new(@args).send(:get, "#{proxy_task_id}/status")) end |
#task_states(ids) ⇒ Object
38 39 40 41 |
# File 'app/lib/proxy_api/foreman_dynflow/dynflow_proxy.rb', line 38 def task_states(ids) payload = MultiJson.dump(:task_ids => ids) MultiJson.load(Task.new(@args).send(:post, payload, 'status')) end |
#tasks_count(state) ⇒ Object
34 35 36 |
# File 'app/lib/proxy_api/foreman_dynflow/dynflow_proxy.rb', line 34 def tasks_count(state) MultiJson.load(Task.new(@args).send(:get, "count?state=#{state}"))['count'].to_i end |
#trigger_task(action_name, action_input) ⇒ Object
Initiate the command
20 21 22 23 |
# File 'app/lib/proxy_api/foreman_dynflow/dynflow_proxy.rb', line 20 def trigger_task(action_name, action_input) payload = MultiJson.dump(:action_name => action_name, :action_input => action_input) MultiJson.load(Task.new(@args).send(:post, payload)) end |