summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorAlexis Reigel <alexis.reigel.ext@siemens.com>2018-06-11 13:37:47 +0200
committerAlexis Reigel <alexis.reigel.ext@siemens.com>2018-09-15 21:39:26 +0200
commit4b6619cfd3ca127d728d7277cac3da8ed54b99b0 (patch)
treeb590ee77d626f085443ffd9ea3b08c03078e5448 /lib/api
parent65caacc600bc0a507a313e8be45021512260906e (diff)
downloadgitlab-ce-4b6619cfd3ca127d728d7277cac3da8ed54b99b0.tar.gz
add type param to runners api
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/runners.rb22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/api/runners.rb b/lib/api/runners.rb
index 30abd0b63e9..d24ff8641e1 100644
--- a/lib/api/runners.rb
+++ b/lib/api/runners.rb
@@ -11,10 +11,15 @@ module API
params do
optional :scope, type: String, values: Ci::Runner::AVAILABLE_STATUSES,
desc: 'The scope of specific runners to show'
+ optional :type, type: String, values: Ci::Runner::AVAILABLE_TYPES,
+ desc: 'The type of the runners to show'
use :pagination
end
get do
- runners = filter_runners(current_user.ci_owned_runners, params[:scope], allowed_scopes: Ci::Runner::AVAILABLE_STATUSES)
+ runners = current_user.ci_owned_runners
+ runners = filter_runners(runners, params[:scope], allowed_scopes: Ci::Runner::AVAILABLE_STATUSES)
+ runners = filter_runners(runners, params[:type], allowed_scopes: Ci::Runner::AVAILABLE_TYPES)
+
present paginate(runners), with: Entities::Runner
end
@@ -24,11 +29,17 @@ module API
params do
optional :scope, type: String, values: Ci::Runner::AVAILABLE_SCOPES,
desc: 'The scope of specific runners to show'
+ optional :type, type: String, values: Ci::Runner::AVAILABLE_TYPES,
+ desc: 'The type of the runners to show'
use :pagination
end
get 'all' do
authenticated_as_admin!
- runners = filter_runners(Ci::Runner.all, params[:scope])
+
+ runners = Ci::Runner.all
+ runners = filter_runners(runners, params[:scope])
+ runners = filter_runners(runners, params[:type], allowed_scopes: Ci::Runner::AVAILABLE_TYPES)
+
present paginate(runners), with: Entities::Runner
end
@@ -116,10 +127,15 @@ module API
params do
optional :scope, type: String, values: Ci::Runner::AVAILABLE_SCOPES,
desc: 'The scope of specific runners to show'
+ optional :type, type: String, values: Ci::Runner::AVAILABLE_TYPES,
+ desc: 'The type of the runners to show'
use :pagination
end
get ':id/runners' do
- runners = filter_runners(Ci::Runner.owned_or_instance_wide(user_project.id), params[:scope])
+ runners = Ci::Runner.owned_or_instance_wide(user_project.id)
+ runners = filter_runners(runners, params[:scope])
+ runners = filter_runners(runners, params[:type], allowed_scopes: Ci::Runner::AVAILABLE_TYPES)
+
present paginate(runners), with: Entities::Runner
end