diff --git a/app/controllers/api/request_tasks_controller.rb b/app/controllers/api/request_tasks_controller.rb index 1fb6414328..5da8f6b874 100644 --- a/app/controllers/api/request_tasks_controller.rb +++ b/app/controllers/api/request_tasks_controller.rb @@ -1,5 +1,22 @@ module Api class RequestTasksController < BaseController include Api::Mixins::ResourceCancel + + # execute queues the work. + # this is typically called from within the workflow + def execute_resource(type, id, _data) + api_resource(type, id, "Executing") do |task| + task.execute_queue + end + end + + # for a workflow/automate task, this kicks off the workflow + # that workflow will call execute directly + # for other types of request tasks, this queues deliver + def deliver_resource(type, id, _data) + api_resource(type, id, "Delivering") do |task| + task.deliver_queue + end + end end end diff --git a/config/api.yml b/config/api.yml index d9f35c7921..459084be55 100644 --- a/config/api.yml +++ b/config/api.yml @@ -3233,6 +3233,10 @@ :post: - :name: cancel :identifier: miq_request_control + - :name: deliver + :identifier: miq_request_control + - :name: execute + :identifier: miq_request_control :subcollection_actions: :get: - :name: read