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.rb35
1 files changed, 3 insertions, 32 deletions
diff --git a/lib/api/import_github.rb b/lib/api/import_github.rb
index ab7ac6624a8..29dfa7c9f29 100644
--- a/lib/api/import_github.rb
+++ b/lib/api/import_github.rb
@@ -10,38 +10,7 @@ module API
rescue_from Octokit::Unauthorized, with: :provider_unauthorized
rescue_from Gitlab::GithubImport::RateLimitError, with: :too_many_requests
- helpers do
- def client
- @client ||= if Feature.enabled?(:remove_legacy_github_client)
- Gitlab::GithubImport::Client.new(params[:personal_access_token], host: params[:github_hostname])
- else
- Gitlab::LegacyGithubImport::Client.new(params[:personal_access_token], **client_options)
- end
- end
-
- def access_params
- {
- github_access_token: params[:personal_access_token],
- additional_access_tokens: params[:additional_access_tokens]
- }
- end
-
- def client_options
- { host: params[:github_hostname] }
- end
-
- def provider
- :github
- end
-
- def provider_unauthorized
- error!("Access denied to your #{Gitlab::ImportSources.title(provider.to_s)} account.", 401)
- end
-
- def too_many_requests
- error!('Too Many Requests', 429)
- end
- end
+ helpers ::API::Helpers::ImportGithubHelpers
desc 'Import a GitHub project' do
detail 'This feature was introduced in GitLab 11.3.4.'
@@ -62,6 +31,8 @@ module API
requires :target_namespace, type: String, allow_blank: false, desc: 'Namespace or group to import repository into'
optional :github_hostname, type: String, desc: 'Custom GitHub enterprise hostname'
optional :optional_stages, type: Hash, desc: 'Optional stages of import to be performed'
+ optional :timeout_strategy, type: String, values: ::ProjectImportData::TIMEOUT_STRATEGIES,
+ desc: 'Strategy for behavior on timeouts'
optional :additional_access_tokens,
type: Array[String],
coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce,