summaryrefslogtreecommitdiff
path: root/lib/api/deploy_tokens.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/deploy_tokens.rb')
-rw-r--r--lib/api/deploy_tokens.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/api/deploy_tokens.rb b/lib/api/deploy_tokens.rb
index cb1ee7df496..2b1c485785b 100644
--- a/lib/api/deploy_tokens.rb
+++ b/lib/api/deploy_tokens.rb
@@ -71,6 +71,24 @@ module API
present deploy_token, with: Entities::DeployTokenWithToken
end
+
+ desc 'Delete a project deploy token' do
+ detail 'This feature was introduced in GitLab 12.9'
+ end
+ params do
+ requires :token_id, type: Integer, desc: 'The deploy token ID'
+ end
+ delete ':id/deploy_tokens/:token_id' do
+ authorize!(:destroy_deploy_token, user_project)
+
+ deploy_token = user_project.project_deploy_tokens
+ .find_by_deploy_token_id(params[:token_id])
+
+ not_found!('Deploy Token') unless deploy_token
+
+ deploy_token.destroy
+ no_content!
+ end
end
params do