diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-14 12:06:30 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-14 12:06:30 +0000 |
commit | d8c06be498acbfc2024c01b6b6b02d120dc499f2 (patch) | |
tree | 9e2e0852c45332d6222898676a2f6f096e600084 /lib/api/group_export.rb | |
parent | 2fa7d2ddf6a7004f89616e43b8279229af831e25 (diff) | |
download | gitlab-ce-d8c06be498acbfc2024c01b6b6b02d120dc499f2.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/group_export.rb')
-rw-r--r-- | lib/api/group_export.rb | 34 |
1 files changed, 34 insertions, 0 deletions
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 |