summaryrefslogtreecommitdiff
path: root/lib/api/environments.rb
diff options
context:
space:
mode:
authorLee Tickett <lee@tickett.net>2019-06-24 12:18:40 +0000
committerKamil TrzciƄski <ayufan@ayufan.eu>2019-06-24 12:18:40 +0000
commitec66f1b5ca20764abe21524792480755b614dbc7 (patch)
tree3ec0bcd669e9d015687effe037c18a3acf389952 /lib/api/environments.rb
parentcf137da316175ed43a980f57e22a81c537a54169 (diff)
downloadgitlab-ce-ec66f1b5ca20764abe21524792480755b614dbc7.tar.gz
Add name & search parameters to project environments API
Diffstat (limited to 'lib/api/environments.rb')
-rw-r--r--lib/api/environments.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/api/environments.rb b/lib/api/environments.rb
index 6cd43923559..ec58b3b7bb9 100644
--- a/lib/api/environments.rb
+++ b/lib/api/environments.rb
@@ -18,11 +18,16 @@ module API
end
params do
use :pagination
+ optional :name, type: String, desc: 'Returns the environment with this name'
+ optional :search, type: String, desc: 'Returns list of environments matching the search criteria'
+ mutually_exclusive :name, :search, message: 'cannot be used together'
end
get ':id/environments' do
authorize! :read_environment, user_project
- present paginate(user_project.environments), with: Entities::Environment, current_user: current_user
+ environments = ::EnvironmentsFinder.new(user_project, current_user, params).find
+
+ present paginate(environments), with: Entities::Environment, current_user: current_user
end
desc 'Creates a new environment' do