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
path: root/lib/api
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-14 15:06:30 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-14 15:06:30 +0300
commitd8c06be498acbfc2024c01b6b6b02d120dc499f2 (patch)
tree9e2e0852c45332d6222898676a2f6f096e600084 /lib/api
parent2fa7d2ddf6a7004f89616e43b8279229af831e25 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/api.rb1
-rw-r--r--lib/api/group_export.rb34
2 files changed, 35 insertions, 0 deletions
diff --git a/lib/api/api.rb b/lib/api/api.rb
index 0062759d993..a2bdb76b834 100644
--- a/lib/api/api.rb
+++ b/lib/api/api.rb
@@ -113,6 +113,7 @@ module API
mount ::API::Files
mount ::API::GroupBoards
mount ::API::GroupClusters
+ mount ::API::GroupExport
mount ::API::GroupLabels
mount ::API::GroupMilestones
mount ::API::Groups
diff --git a/lib/api/group_export.rb b/lib/api/group_export.rb
new file mode 100644
index 00000000000..8025a16e191
--- /dev/null
+++ b/lib/api/group_export.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+module API
+ class GroupExport < Grape::API
+ before do
+ authorize! :admin_group, user_group
+ end
+
+ params do
+ requires :id, type: String, desc: 'The ID of a group'
+ end
+ resource :groups, requirements: { id: %r{[^/]+} } do
+ desc 'Download export' do
+ detail 'This feature was introduced in GitLab 12.5.'
+ end
+ get ':id/export/download' do
+ if user_group.export_file_exists?
+ present_carrierwave_file!(user_group.export_file)
+ else
+ render_api_error!('404 Not found or has expired', 404)
+ end
+ end
+
+ desc 'Start export' do
+ detail 'This feature was introduced in GitLab 12.5.'
+ end
+ post ':id/export' do
+ GroupExportWorker.perform_async(current_user.id, user_group.id, params)
+
+ accepted!
+ end
+ end
+ end
+end