2016-08-16 02:45:23 -04:00
|
|
|
module API
|
|
|
|
# Deployments RESTfull API endpoints
|
|
|
|
class Deployments < Grape::API
|
2016-11-21 14:15:46 -05:00
|
|
|
include PaginationParams
|
|
|
|
|
2016-08-16 02:45:23 -04:00
|
|
|
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
|
2016-11-21 14:15:46 -05:00
|
|
|
use :pagination
|
2016-08-16 02:45:23 -04:00
|
|
|
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
|