app/models/foreman_tasks/task.rb in foreman-tasks-2.0.3 vs app/models/foreman_tasks/task.rb in foreman-tasks-3.0.0
- old
+ new
@@ -68,9 +68,20 @@
joins(:locks).where(:"foreman_tasks_locks.resource_id" => resource.id,
:"foreman_tasks_locks.resource_type" => resource.class.name)
end)
scope :for_action_types, (->(action_types) { where('foreman_tasks_tasks.label IN (?)', Array(action_types)) })
+ apipie :class, "A class representing #{model_name.human} object" do
+ name 'Task'
+ refs 'Task'
+ sections only: %w[all additional]
+ property :main_action, object_of: 'Dynflow::Action', desc: 'Returns the main action of the task, e.g. Actions::RemoteExecution::RunHostJob'
+ property :label, String, desc: 'Returns the label of the task'
+ property :state, String, desc: 'Returns state of the task execution, e.g. "stopped"'
+ property :result, String, desc: 'Returns result of the task execution, e.g. "success"'
+ property :started_at, ActiveSupport::TimeWithZone, desc: 'Returns date with time the task started at'
+ property :ended_at, ActiveSupport::TimeWithZone, desc: 'Returns date with time the task ended at'
+ end
class Jail < Safemode::Jail
allow :started_at, :ended_at, :result, :state, :label, :main_action
end
def input