diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-19 15:57:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-19 15:57:54 +0300 |
commit | 419c53ec62de6e97a517abd5fdd4cbde3a942a34 (patch) | |
tree | 1f43a548b46bca8a5fb8fe0c31cef1883d49c5b6 /lib/api/import_github.rb | |
parent | 1da20d9135b3ad9e75e65b028bffc921aaf8deb7 (diff) |
Add latest changes from gitlab-org/gitlab@16-5-stable-eev16.5.0-rc42
Diffstat (limited to 'lib/api/import_github.rb')
-rw-r--r-- | lib/api/import_github.rb | 35 |
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, |