diff options
author | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-08-16 08:45:23 +0200 |
---|---|---|
committer | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-08-18 21:10:52 +0200 |
commit | 47d6f286eb565ae582def5a28af2cb450b2ee479 (patch) | |
tree | bff99a661fb7420ac4cc51fb2ee2c38361cf7fe3 /lib/api/deployments.rb | |
parent | fffe5c2b577b39be2254525d4320cf396b7ff58b (diff) | |
download | gitlab-ce-47d6f286eb565ae582def5a28af2cb450b2ee479.tar.gz |
Add deployment endpoints
Diffstat (limited to 'lib/api/deployments.rb')
-rw-r--r-- | lib/api/deployments.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/api/deployments.rb b/lib/api/deployments.rb new file mode 100644 index 00000000000..f782bcaf7e9 --- /dev/null +++ b/lib/api/deployments.rb @@ -0,0 +1,40 @@ +module API + # Deployments RESTfull API endpoints + class Deployments < Grape::API + before { authenticate! } + + params do + requires :id, type: String, desc: 'The project ID' + end + resource :projects do + desc 'Get all deployments of the project' do + detail 'This feature was introduced in GitLab 8.11.' + success Entities::Deployment + end + params do + optional :page, type: Integer, desc: 'Page number of the current request' + optional :per_page, type: Integer, desc: 'Number of items per page' + end + get ':id/deployments' do + authorize! :read_deployment, user_project + + present paginate(user_project.deployments), with: Entities::Deployment + end + + desc 'Gets a specific deployment' do + detail 'This feature was introduced in GitLab 8.11.' + success Entities::Deployment + end + params do + requires :deployment_id, type: Integer, desc: 'The deployment ID' + end + get ':id/deployments/:deployment_id' do + authorize! :read_deployment, user_project + + deployment = user_project.deployments.find(params[:deployment_id]) + + present deployment, with: Entities::Deployment + end + end + end +end |