Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/deploy_tokens.rb')
-rw-r--r--lib/api/deploy_tokens.rb100
1 files changed, 77 insertions, 23 deletions
diff --git a/lib/api/deploy_tokens.rb b/lib/api/deploy_tokens.rb
index 3955e29621f..975a65af285 100644
--- a/lib/api/deploy_tokens.rb
+++ b/lib/api/deploy_tokens.rb
@@ -4,6 +4,8 @@ module API
class DeployTokens < ::API::Base
include PaginationParams
+ deploy_tokens_tags = %w[deploy_tokens]
+
feature_category :continuous_delivery
urgency :low
@@ -25,9 +27,15 @@ module API
end
end
- desc 'Return all deploy tokens' do
- detail 'This feature was introduced in GitLab 12.9.'
+ desc 'List all deploy tokens' do
+ detail 'Get a list of all deploy tokens across the GitLab instance. This endpoint requires administrator access. This feature was introduced in GitLab 12.9.'
success Entities::DeployToken
+ failure [
+ { code: 401, message: 'Unauthorized' },
+ { code: 403, message: 'Forbidden' }
+ ]
+ is_array true
+ tags deploy_tokens_tags
end
params do
use :pagination
@@ -46,16 +54,23 @@ module API
end
params do
- requires :id, type: String, desc: 'The ID of a project'
+ requires :id, types: [String, Integer], desc: 'The ID or URL-encoded path of the project owned by the authenticated user'
end
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
params do
use :pagination
use :filter_params
end
- desc 'List deploy tokens for a project' do
- detail 'This feature was introduced in GitLab 12.9'
+ desc 'List project deploy tokens' do
+ detail "Get a list of a project's deploy tokens. This feature was introduced in GitLab 12.9."
success Entities::DeployToken
+ failure [
+ { code: 401, message: 'Unauthorized' },
+ { code: 403, message: 'Forbidden' },
+ { code: 404, message: 'Not found' }
+ ]
+ is_array true
+ tags deploy_tokens_tags
end
get ':id/deploy_tokens' do
authorize!(:read_deploy_token, user_project)
@@ -75,13 +90,19 @@ module API
type: Array[String],
coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce,
values: ::DeployToken::AVAILABLE_SCOPES.map(&:to_s),
- desc: 'Indicates the deploy token scopes. Must be at least one of "read_repository", "read_registry", "write_registry", "read_package_registry", or "write_package_registry".'
- optional :expires_at, type: DateTime, desc: 'Expiration date for the deploy token. Does not expire if no value is provided.'
+ desc: 'Indicates the deploy token scopes. Must be at least one of `read_repository`, `read_registry`, `write_registry`, `read_package_registry`, or `write_package_registry`.'
+ optional :expires_at, type: DateTime, desc: 'Expiration date for the deploy token. Does not expire if no value is provided. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`).'
optional :username, type: String, desc: 'Username for deploy token. Default is `gitlab+deploy-token-{n}`'
end
desc 'Create a project deploy token' do
- detail 'This feature was introduced in GitLab 12.9'
+ detail 'Creates a new deploy token for a project. This feature was introduced in GitLab 12.9.'
success Entities::DeployTokenWithToken
+ failure [
+ { code: 400, message: 'Bad request' },
+ { code: 401, message: 'Unauthorized' },
+ { code: 404, message: 'Not found' }
+ ]
+ tags deploy_tokens_tags
end
post ':id/deploy_tokens' do
authorize!(:create_deploy_token, user_project)
@@ -98,11 +119,16 @@ module API
end
desc 'Get a project deploy token' do
- detail 'This feature was introduced in GitLab 14.9'
+ detail "Get a single project's deploy token by ID. This feature was introduced in GitLab 14.9."
success Entities::DeployToken
+ failure [
+ { code: 401, message: 'Unauthorized' },
+ { code: 404, message: 'Not found' }
+ ]
+ tags deploy_tokens_tags
end
params do
- requires :token_id, type: Integer, desc: 'The deploy token ID'
+ requires :token_id, type: Integer, desc: 'The ID of the deploy token'
end
get ':id/deploy_tokens/:token_id' do
authorize!(:read_deploy_token, user_project)
@@ -113,10 +139,15 @@ module API
end
desc 'Delete a project deploy token' do
- detail 'This feature was introduced in GitLab 12.9'
+ detail 'This feature was introduced in GitLab 12.9.'
+ failure [
+ { code: 401, message: 'Unauthorized' },
+ { code: 404, message: 'Not found' }
+ ]
+ tags deploy_tokens_tags
end
params do
- requires :token_id, type: Integer, desc: 'The deploy token ID'
+ requires :token_id, type: Integer, desc: 'The ID of the deploy token'
end
delete ':id/deploy_tokens/:token_id' do
authorize!(:destroy_deploy_token, user_project)
@@ -130,16 +161,23 @@ module API
end
params do
- requires :id, type: String, desc: 'The ID of a group'
+ requires :id, types: [Integer, String], desc: 'The ID or URL-encoded path of the group owned by the authenticated user'
end
resource :groups, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
params do
use :pagination
use :filter_params
end
- desc 'List deploy tokens for a group' do
- detail 'This feature was introduced in GitLab 12.9'
+ desc 'List group deploy tokens' do
+ detail "Get a list of a group's deploy tokens. This feature was introduced in GitLab 12.9."
success Entities::DeployToken
+ failure [
+ { code: 401, message: 'Unauthorized' },
+ { code: 403, message: 'Forbidden' },
+ { code: 404, message: 'Not found' }
+ ]
+ is_array true
+ tags deploy_tokens_tags
end
get ':id/deploy_tokens' do
authorize!(:read_deploy_token, user_group)
@@ -154,18 +192,24 @@ module API
end
params do
- requires :name, type: String, desc: 'The name of the deploy token'
+ requires :name, type: String, desc: "New deploy token's name"
requires :scopes,
type: Array[String],
coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce,
values: ::DeployToken::AVAILABLE_SCOPES.map(&:to_s),
- desc: 'Indicates the deploy token scopes. Must be at least one of "read_repository", "read_registry", "write_registry", "read_package_registry", or "write_package_registry".'
- optional :expires_at, type: DateTime, desc: 'Expiration date for the deploy token. Does not expire if no value is provided.'
+ desc: 'Indicates the deploy token scopes. Must be at least one of `read_repository`, `read_registry`, `write_registry`, `read_package_registry`, or `write_package_registry`'
+ optional :expires_at, type: DateTime, desc: 'Expiration date for the deploy token. Does not expire if no value is provided. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`)'
optional :username, type: String, desc: 'Username for deploy token. Default is `gitlab+deploy-token-{n}`'
end
desc 'Create a group deploy token' do
- detail 'This feature was introduced in GitLab 12.9'
+ detail 'Creates a new deploy token for a group. This feature was introduced in GitLab 12.9.'
success Entities::DeployTokenWithToken
+ failure [
+ { code: 400, message: 'Bad request' },
+ { code: 401, message: 'Unauthorized' },
+ { code: 404, message: 'Not found' }
+ ]
+ tags deploy_tokens_tags
end
post ':id/deploy_tokens' do
authorize!(:create_deploy_token, user_group)
@@ -182,11 +226,16 @@ module API
end
desc 'Get a group deploy token' do
- detail 'This feature was introduced in GitLab 14.9'
+ detail "Get a single group's deploy token by ID. This feature was introduced in GitLab 14.9. "
success Entities::DeployToken
+ failure [
+ { code: 401, message: 'Unauthorized' },
+ { code: 404, message: 'Not found' }
+ ]
+ tags deploy_tokens_tags
end
params do
- requires :token_id, type: Integer, desc: 'The deploy token ID'
+ requires :token_id, type: Integer, desc: 'The ID of the deploy token'
end
get ':id/deploy_tokens/:token_id' do
authorize!(:read_deploy_token, user_group)
@@ -197,10 +246,15 @@ module API
end
desc 'Delete a group deploy token' do
- detail 'This feature was introduced in GitLab 12.9'
+ detail 'Removes a deploy token from the group. This feature was introduced in GitLab 12.9.'
+ failure [
+ { code: 401, message: 'Unauthorized' },
+ { code: 404, message: 'Not found' }
+ ]
+ tags deploy_tokens_tags
end
params do
- requires :token_id, type: Integer, desc: 'The deploy token ID'
+ requires :token_id, type: Integer, desc: 'The ID of the deploy token'
end
delete ':id/deploy_tokens/:token_id' do
authorize!(:destroy_deploy_token, user_group)