summaryrefslogtreecommitdiff
path: root/lib/api/deploy_tokens.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-11 06:10:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-11 06:10:11 +0000
commit65a1175e466105fca1f40cb5a995fdb100ff334e (patch)
tree562573b4fc7a0cd748d07d6a1720b4b13d36386a /lib/api/deploy_tokens.rb
parent3a52deac114dda8a1ee0da597c148b0dfc5dcf35 (diff)
downloadgitlab-ce-65a1175e466105fca1f40cb5a995fdb100ff334e.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/deploy_tokens.rb')
-rw-r--r--lib/api/deploy_tokens.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/api/deploy_tokens.rb b/lib/api/deploy_tokens.rb
index 1631425ec1b..bc58cf0dd32 100644
--- a/lib/api/deploy_tokens.rb
+++ b/lib/api/deploy_tokens.rb
@@ -23,6 +23,8 @@ module API
use :pagination
end
get 'deploy_tokens' do
+ service_unavailable! unless Feature.enabled?(:deploy_tokens_api, default_enabled: true)
+
authenticated_as_admin!
present paginate(DeployToken.all), with: Entities::DeployToken
@@ -32,6 +34,10 @@ module API
requires :id, type: Integer, desc: 'The ID of a project'
end
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
+ before do
+ service_unavailable! unless Feature.enabled?(:deploy_tokens_api, user_project, default_enabled: true)
+ end
+
params do
use :pagination
end
@@ -71,6 +77,23 @@ module API
requires :id, type: Integer, desc: 'The ID of a group'
end
resource :groups, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
+ before do
+ service_unavailable! unless Feature.enabled?(:deploy_tokens_api, user_group, default_enabled: true)
+ end
+
+ params do
+ use :pagination
+ end
+ desc 'List deploy tokens for a group' do
+ detail 'This feature was introduced in GitLab 12.9'
+ success Entities::DeployToken
+ end
+ get ':id/deploy_tokens' do
+ authorize!(:read_deploy_token, user_group)
+
+ present paginate(user_group.deploy_tokens), with: Entities::DeployToken
+ end
+
desc 'Delete a group deploy token' do
detail 'This feature was introduced in GitLab 12.9'
end