1
|
module ForemanPipeline
|
2
|
class Api::JenkinsRequestsController < Katello::Api::V2::ApiController
|
3
|
respond_to :json
|
4
|
|
5
|
include Api::Rendering
|
6
|
|
7
|
before_filter :find_job
|
8
|
|
9
|
api :GET, "/organizations/:organization_id/jenkins_requests/list"
|
10
|
param :organization_id, :number, :desc => N_("Organization identifier"), :required => true
|
11
|
param :job_id, :number, :desc => N_("Job identifier")
|
12
|
param :filter, String, :desc => N_("All jenkins projects with name matching this string will be retrieved")
|
13
|
def list
|
14
|
fail "filter string not given" if params[:filter].blank?
|
15
|
task = async_task(::Actions::ForemanPipeline::Jenkins::List, :job_id => params[:job_id], :filter => params[:filter])
|
16
|
respond_for_async(:resource => task)
|
17
|
end
|
18
|
|
19
|
private
|
20
|
|
21
|
def find_job
|
22
|
@job = Job.find_by_id(params[:job_id])
|
23
|
fail ::Katello::HttpErrors::NotFound, "Could not find job with id #{params[:job_id]}" if @job.nil?
|
24
|
@job
|
25
|
end
|
26
|
|
27
|
end
|
28
|
end
|