Skip to content

Commit

Permalink
Add MiqTask#deliver and execute
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrock committed Feb 23, 2024
1 parent da3fcb0 commit b450ab8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/controllers/api/request_tasks_controller.rb
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions config/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b450ab8

Please sign in to comment.