diff --git a/app/controllers/api/request_tasks_controller.rb b/app/controllers/api/request_tasks_controller.rb index 1fb6414328..e8435e5c7d 100644 --- a/app/controllers/api/request_tasks_controller.rb +++ b/app/controllers/api/request_tasks_controller.rb @@ -1,5 +1,15 @@ 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| + raise BadRequestError, "Resource must be approved. state is #{task.state}" unless task.approved? + + task.execute_queue + end + end end end diff --git a/config/api.yml b/config/api.yml index d9f35c7921..c65629d04e 100644 --- a/config/api.yml +++ b/config/api.yml @@ -3233,6 +3233,8 @@ :post: - :name: cancel :identifier: miq_request_control + - :name: execute + :identifier: miq_request_control :subcollection_actions: :get: - :name: read