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
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/import_github.rb')
-rw-r--r--lib/api/import_github.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/api/import_github.rb b/lib/api/import_github.rb
index 46ca8e4c428..493cc038f46 100644
--- a/lib/api/import_github.rb
+++ b/lib/api/import_github.rb
@@ -43,6 +43,7 @@ module API
optional :new_name, type: String, desc: 'New repo name'
requires :target_namespace, type: String, desc: 'Namespace to import repo into'
optional :github_hostname, type: String, desc: 'Custom GitHub enterprise hostname'
+ optional :optional_stages, type: Hash, desc: 'Optional stages of import to be performed'
end
post 'import/github' do
result = Import::GithubService.new(client, current_user, params).execute(access_params, provider)
@@ -54,5 +55,20 @@ module API
{ errors: result[:message] }
end
end
+
+ params do
+ requires :project_id, type: Integer, desc: 'ID of importing project to be canceled'
+ end
+ post 'import/github/cancel' do
+ project = Project.imported_from(provider.to_s).find(params[:project_id])
+ result = Import::Github::CancelProjectImportService.new(project, current_user).execute
+
+ if result[:status] == :success
+ status :ok
+ present ProjectSerializer.new.represent(project, serializer: :import)
+ else
+ render_api_error!(result[:message], result[:http_status])
+ end
+ end
end
end