diff options
author | Toon Claes <toon@gitlab.com> | 2017-02-28 14:55:21 +0100 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2017-02-28 15:34:38 +0100 |
commit | 8c569e21d5224128e28fcc2392dc4777f9b839c2 (patch) | |
tree | f54d755279e81d49a4db6828aa1dfaaa054de1a1 /lib/api/environments.rb | |
parent | 54f6357ba3d7f31bdb0009a041e48c3a6be8e2ff (diff) | |
download | gitlab-ce-8c569e21d5224128e28fcc2392dc4777f9b839c2.tar.gz |
Add environment `/stop` action27142-api-replace-destroy-with-stop-environment
Add endpoint to stop an environment through the API.
Diffstat (limited to 'lib/api/environments.rb')
-rw-r--r-- | lib/api/environments.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/api/environments.rb b/lib/api/environments.rb index dbdf29a9640..ebe8c3a5b2c 100644 --- a/lib/api/environments.rb +++ b/lib/api/environments.rb @@ -81,6 +81,23 @@ module API environment.destroy end + + desc 'Stops an existing environment' do + success Entities::Environment + end + params do + requires :environment_id, type: Integer, desc: 'The environment ID' + end + post ':id/environments/:environment_id/stop' do + authorize! :create_deployment, user_project + + environment = user_project.environments.find(params[:environment_id]) + + environment.stop_with_action!(current_user) + + status 200 + present environment, with: Entities::Environment + end end end end |