diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-09 03:07:57 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-09 03:07:57 +0000 |
commit | 330eac18cef61a4f58b3601265f7b631d2311cd0 (patch) | |
tree | 87eec5d8c441581938ca908ce30199832e118b85 /lib/api/remote_mirrors.rb | |
parent | 3359a5a56337b93cd34b9914b6468395bfb6c514 (diff) | |
download | gitlab-ce-330eac18cef61a4f58b3601265f7b631d2311cd0.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/remote_mirrors.rb')
-rw-r--r-- | lib/api/remote_mirrors.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/api/remote_mirrors.rb b/lib/api/remote_mirrors.rb new file mode 100644 index 00000000000..8a085517ce9 --- /dev/null +++ b/lib/api/remote_mirrors.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module API + class RemoteMirrors < Grape::API + include PaginationParams + + before do + # TODO: Remove flag: https://gitlab.com/gitlab-org/gitlab/issues/38121 + not_found! unless Feature.enabled?(:remote_mirrors_api, user_project) + end + + params do + requires :id, type: String, desc: 'The ID of a project' + end + resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do + desc "List the project's remote mirrors" do + success Entities::RemoteMirror + end + params do + use :pagination + end + get ':id/remote_mirrors' do + unauthorized! unless can?(current_user, :admin_remote_mirror, user_project) + + present paginate(user_project.remote_mirrors), + with: Entities::RemoteMirror + end + end + end +end |