diff options
Diffstat (limited to 'lib/api/concerns/packages/debian_distribution_endpoints.rb')
-rw-r--r-- | lib/api/concerns/packages/debian_distribution_endpoints.rb | 80 |
1 files changed, 61 insertions, 19 deletions
diff --git a/lib/api/concerns/packages/debian_distribution_endpoints.rb b/lib/api/concerns/packages/debian_distribution_endpoints.rb index 380966136df..76b996f2301 100644 --- a/lib/api/concerns/packages/debian_distribution_endpoints.rb +++ b/lib/api/concerns/packages/debian_distribution_endpoints.rb @@ -25,21 +25,23 @@ module API namespace 'debian_distributions' do helpers do params :optional_distribution_params do - optional :suite, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Suite' - optional :origin, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Origin' - optional :label, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Label' - optional :version, type: String, regexp: Gitlab::Regex.debian_version_regex, desc: 'The Debian Version' - optional :description, type: String, desc: 'The Debian Description' - optional :valid_time_duration_seconds, type: Integer, desc: 'The duration before the Release file should be considered expired by the client' + optional :suite, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Suite', documentation: { example: 'unstable' } + optional :origin, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Origin', documentation: { example: 'Grep' } + optional :label, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Label', documentation: { example: 'grep.be' } + optional :version, type: String, regexp: Gitlab::Regex.debian_version_regex, desc: 'The Debian Version', documentation: { example: '12' } + optional :description, type: String, desc: 'The Debian Description', documentation: { example: 'My description' } + optional :valid_time_duration_seconds, type: Integer, desc: 'The duration before the Release file should be considered expired by the client', documentation: { example: 604800 } optional :components, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, regexp: Gitlab::Regex.debian_component_regex, - desc: 'The list of Components' + desc: 'The list of Components', + documentation: { example: 'main' } optional :architectures, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, regexp: Gitlab::Regex.debian_architecture_regex, - desc: 'The list of Architectures' + desc: 'The list of Architectures', + documentation: { example: 'amd64' } end end @@ -63,11 +65,18 @@ module API # POST {projects|groups}/:id/debian_distributions desc 'Create a Debian Distribution' do detail 'This feature was introduced in 14.0' - success ::API::Entities::Packages::Debian::Distribution + success code: 201, model: ::API::Entities::Packages::Debian::Distribution + failure [ + { code: 400, message: 'Bad Request' }, + { code: 401, message: 'Unauthorized' }, + { code: 403, message: 'Forbidden' }, + { code: 404, message: 'Not Found' } + ] + tags %w[debian_distribution] end params do - requires :codename, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Codename' + requires :codename, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Codename', documentation: { example: 'unstable' } use :optional_distribution_params end post '/' do @@ -87,12 +96,18 @@ module API # GET {projects|groups}/:id/debian_distributions desc 'Get a list of Debian Distributions' do detail 'This feature was introduced in 14.0' - success ::API::Entities::Packages::Debian::Distribution + success code: 200, model: ::API::Entities::Packages::Debian::Distribution + failure [ + { code: 401, message: 'Unauthorized' }, + { code: 403, message: 'Forbidden' }, + { code: 404, message: 'Not Found' } + ] + tags %w[debian_distribution] end params do use :pagination - optional :codename, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Codename' + optional :codename, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Codename', documentation: { example: 'unstable' } use :optional_distribution_params end get '/' do @@ -107,11 +122,17 @@ module API # GET {projects|groups}/:id/debian_distributions/:codename desc 'Get a Debian Distribution' do detail 'This feature was introduced in 14.0' - success ::API::Entities::Packages::Debian::Distribution + success code: 200, model: ::API::Entities::Packages::Debian::Distribution + failure [ + { code: 401, message: 'Unauthorized' }, + { code: 403, message: 'Forbidden' }, + { code: 404, message: 'Not Found' } + ] + tags %w[debian_distribution] end params do - requires :codename, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Codename' + requires :codename, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Codename', documentation: { example: 'unstable' } end get '/:codename' do authorize_read_package!(project_or_group) @@ -122,11 +143,17 @@ module API # GET {projects|groups}/:id/debian_distributions/:codename/key desc 'Get a Debian Distribution Key' do detail 'This feature was introduced in 14.4' - success ::API::Entities::Packages::Debian::Distribution + success code: 200, model: ::API::Entities::Packages::Debian::Distribution + failure [ + { code: 401, message: 'Unauthorized' }, + { code: 403, message: 'Forbidden' }, + { code: 404, message: 'Not Found' } + ] + tags %w[debian_distribution] end params do - requires :codename, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Codename' + requires :codename, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Codename', documentation: { example: 'unstable' } end get '/:codename/key.asc' do authorize_read_package!(project_or_group) @@ -141,11 +168,18 @@ module API # PUT {projects|groups}/:id/debian_distributions/:codename desc 'Update a Debian Distribution' do detail 'This feature was introduced in 14.0' - success ::API::Entities::Packages::Debian::Distribution + success code: 200, model: ::API::Entities::Packages::Debian::Distribution + failure [ + { code: 400, message: 'Bad Request' }, + { code: 401, message: 'Unauthorized' }, + { code: 403, message: 'Forbidden' }, + { code: 404, message: 'Not Found' } + ] + tags %w[debian_distribution] end params do - requires :codename, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Codename' + requires :codename, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Codename', documentation: { example: 'unstable' } use :optional_distribution_params end put '/:codename' do @@ -165,10 +199,18 @@ module API # DELETE {projects|groups}/:id/debian_distributions/:codename desc 'Delete a Debian Distribution' do detail 'This feature was introduced in 14.0' + success code: 202 + failure [ + { code: 400, message: 'Bad Request' }, + { code: 401, message: 'Unauthorized' }, + { code: 403, message: 'Forbidden' }, + { code: 404, message: 'Not Found' } + ] + tags %w[debian_distribution] end params do - requires :codename, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Codename' + requires :codename, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Codename', documentation: { example: 'unstable' } use :optional_distribution_params end delete '/:codename' do |