diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-21 18:07:57 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-21 18:07:57 +0000 |
commit | c0b718a0dbd99e6c0d30e5bc55bdcf4a12946375 (patch) | |
tree | 8ad3691912d91d8cf7b3931f68a4284ae7b5995c /lib/api | |
parent | 5dc70663c4ff1feb215428ce50673b5b646f9809 (diff) | |
download | gitlab-ce-c0b718a0dbd99e6c0d30e5bc55bdcf4a12946375.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/api.rb | 3 | ||||
-rw-r--r-- | lib/api/ci/secure_files.rb | 37 | ||||
-rw-r--r-- | lib/api/entities/ci/secure_file.rb | 15 |
3 files changed, 39 insertions, 16 deletions
diff --git a/lib/api/api.rb b/lib/api/api.rb index 3c88d2483d2..c62a0a60eab 100644 --- a/lib/api/api.rb +++ b/lib/api/api.rb @@ -186,6 +186,7 @@ module API mount ::API::Ci::ResourceGroups mount ::API::Ci::Runner mount ::API::Ci::Runners + mount ::API::Ci::SecureFiles mount ::API::Ci::Pipelines mount ::API::Ci::PipelineSchedules mount ::API::Ci::Triggers @@ -276,6 +277,8 @@ module API mount ::API::AwardEmoji mount ::API::Boards mount ::API::Ci::JobArtifacts + mount ::API::Ci::Pipelines + mount ::API::Ci::PipelineSchedules mount ::API::Ci::SecureFiles mount ::API::ComposerPackages mount ::API::ConanInstancePackages diff --git a/lib/api/ci/secure_files.rb b/lib/api/ci/secure_files.rb index dd628a3413f..0cc20c967db 100644 --- a/lib/api/ci/secure_files.rb +++ b/lib/api/ci/secure_files.rb @@ -16,11 +16,15 @@ module API default_format :json params do - requires :id, types: [String, Integer], desc: 'The ID or URL-encoded path of the 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 - desc 'List all Secure Files for a Project' + desc 'Get list of secure files in a project' do + success Entities::Ci::SecureFile + tags %w[secure_files] + end params do use :pagination end @@ -30,9 +34,13 @@ module API present paginate(secure_files), with: Entities::Ci::SecureFile end - desc 'Get an individual Secure File' + desc 'Get the details of a specific secure file in a project' do + success Entities::Ci::SecureFile + tags %w[secure_files] + failure [{ code: 404, message: '404 Not found' }] + end params do - requires :id, type: Integer, desc: 'The Secure File ID' + requires :id, type: Integer, desc: 'The ID of a secure file' end route_setting :authentication, basic_auth_personal_access_token: true, job_token_allowed: true @@ -41,7 +49,10 @@ module API present secure_file, with: Entities::Ci::SecureFile end - desc 'Download a Secure File' + desc 'Download secure file' do + failure [{ code: 404, message: '404 Not found' }] + tags %w[secure_files] + end route_setting :authentication, basic_auth_personal_access_token: true, job_token_allowed: true get ':id/secure_files/:secure_file_id/download' do secure_file = user_project.secure_files.find(params[:secure_file_id]) @@ -58,10 +69,15 @@ module API authorize! :admin_secure_files, user_project end - desc 'Upload a Secure File' + desc 'Create a secure file' do + success Entities::Ci::SecureFile + tags %w[secure_files] + failure [{ code: 400, message: '400 Bad Request' }] + end params do - requires :name, type: String, desc: 'The name of the file' - requires :file, types: [Rack::Multipart::UploadedFile, ::API::Validations::Types::WorkhorseFile], desc: 'The secure file to be uploaded', documentation: { type: 'file' } + requires :name, type: String, desc: 'The name of the file being uploaded. The filename must be unique within + the project' + requires :file, types: [Rack::Multipart::UploadedFile, ::API::Validations::Types::WorkhorseFile], desc: 'The secure file being uploaded', documentation: { type: 'file' } end route_setting :authentication, basic_auth_personal_access_token: true, job_token_allowed: true post ':id/secure_files' do @@ -84,7 +100,10 @@ module API end end - desc 'Delete an individual Secure File' + desc 'Remove a secure file' do + tags %w[secure_files] + failure [{ code: 404, message: '404 Not found' }] + end route_setting :authentication, basic_auth_personal_access_token: true, job_token_allowed: true delete ':id/secure_files/:secure_file_id' do secure_file = user_project.secure_files.find(params[:secure_file_id]) diff --git a/lib/api/entities/ci/secure_file.rb b/lib/api/entities/ci/secure_file.rb index d957e4488fd..a234ada6f82 100644 --- a/lib/api/entities/ci/secure_file.rb +++ b/lib/api/entities/ci/secure_file.rb @@ -4,13 +4,14 @@ module API module Entities module Ci class SecureFile < Grape::Entity - expose :id - expose :name - expose :checksum - expose :checksum_algorithm - expose :created_at - expose :expires_at - expose :metadata + expose :id, documentation: { type: 'integer', example: 123 } + expose :name, documentation: { type: 'string', example: 'upload-keystore.jks' } + expose :checksum, +documentation: { type: 'string', example: '16630b189ab34b2e3504f4758e1054d2e478deda510b2b08cc0ef38d12e80aac' } + expose :checksum_algorithm, documentation: { type: 'string', example: 'sha256' } + expose :created_at, documentation: { type: 'dateTime', example: '2022-02-22T22:22:22.222Z' } + expose :expires_at, documentation: { type: 'dateTime', example: '2022-09-21T14:56:00.000Z' } + expose :metadata, documentation: { type: 'Hash', example: { "id" => "75949910542696343243264405377658443914" } } end end end |