2018-09-29 18:34:47 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-05-14 08:33:31 -04:00
|
|
|
module API
|
2020-10-14 20:08:42 -04:00
|
|
|
class API < ::API::Base
|
2014-12-19 09:15:29 -05:00
|
|
|
include APIGuard
|
2022-10-14 05:09:13 -04:00
|
|
|
include Helpers::OpenApi
|
2017-01-30 12:41:56 -05:00
|
|
|
|
2017-09-07 01:41:15 -04:00
|
|
|
LOG_FILENAME = Rails.root.join("log", "api_json.log")
|
|
|
|
|
2019-05-05 06:19:14 -04:00
|
|
|
NO_SLASH_URL_PART_REGEX = %r{[^/]+}.freeze
|
2018-11-08 07:18:17 -05:00
|
|
|
NAMESPACE_OR_PROJECT_REQUIREMENTS = { id: NO_SLASH_URL_PART_REGEX }.freeze
|
|
|
|
COMMIT_ENDPOINT_REQUIREMENTS = NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(sha: NO_SLASH_URL_PART_REGEX).freeze
|
2019-01-31 05:13:23 -05:00
|
|
|
USER_REQUIREMENTS = { user_id: NO_SLASH_URL_PART_REGEX }.freeze
|
2019-07-12 15:13:28 -04:00
|
|
|
LOG_FILTERS = ::Rails.application.config.filter_parameters + [/^output$/]
|
2021-10-13 20:12:08 -04:00
|
|
|
LOG_FORMATTER = Gitlab::GrapeLogging::Formatters::LogrageWithTimestamp.new
|
2022-10-21 02:09:25 -04:00
|
|
|
LOGGER = Logger.new(LOG_FILENAME)
|
2017-09-23 09:21:32 -04:00
|
|
|
|
2018-05-18 02:48:59 -04:00
|
|
|
insert_before Grape::Middleware::Error,
|
|
|
|
GrapeLogging::Middleware::RequestLogger,
|
2022-10-21 02:09:25 -04:00
|
|
|
logger: LOGGER,
|
2021-10-13 20:12:08 -04:00
|
|
|
formatter: LOG_FORMATTER,
|
2018-05-18 02:48:59 -04:00
|
|
|
include: [
|
2022-10-21 02:09:25 -04:00
|
|
|
Gitlab::GrapeLogging::Loggers::FilterParameters.new(LOG_FILTERS),
|
2019-08-20 14:12:28 -04:00
|
|
|
Gitlab::GrapeLogging::Loggers::ClientEnvLogger.new,
|
2018-09-03 13:03:32 -04:00
|
|
|
Gitlab::GrapeLogging::Loggers::RouteLogger.new,
|
2018-05-26 00:00:26 -04:00
|
|
|
Gitlab::GrapeLogging::Loggers::UserLogger.new,
|
2022-07-20 20:08:45 -04:00
|
|
|
Gitlab::GrapeLogging::Loggers::TokenLogger.new,
|
2019-11-11 10:06:42 -05:00
|
|
|
Gitlab::GrapeLogging::Loggers::ExceptionLogger.new,
|
2018-09-04 13:14:22 -04:00
|
|
|
Gitlab::GrapeLogging::Loggers::QueueDurationLogger.new,
|
2018-12-05 15:54:40 -05:00
|
|
|
Gitlab::GrapeLogging::Loggers::PerfLogger.new,
|
2020-05-15 14:07:52 -04:00
|
|
|
Gitlab::GrapeLogging::Loggers::CorrelationIdLogger.new,
|
2020-10-26 17:08:22 -04:00
|
|
|
Gitlab::GrapeLogging::Loggers::ContextLogger.new,
|
2021-10-19 08:12:07 -04:00
|
|
|
Gitlab::GrapeLogging::Loggers::ContentLogger.new,
|
2022-07-18 05:08:30 -04:00
|
|
|
Gitlab::GrapeLogging::Loggers::UrgencyLogger.new,
|
|
|
|
Gitlab::GrapeLogging::Loggers::ResponseLogger.new
|
2018-05-18 02:48:59 -04:00
|
|
|
]
|
2017-09-07 01:41:15 -04:00
|
|
|
|
2017-06-20 03:40:24 -04:00
|
|
|
allow_access_with_scope :api
|
2021-02-02 13:09:42 -05:00
|
|
|
allow_access_with_scope :read_api, if: -> (request) { request.get? || request.head? }
|
2017-07-25 05:35:45 -04:00
|
|
|
prefix :api
|
2017-06-20 03:40:24 -04:00
|
|
|
|
2017-01-30 12:41:56 -05:00
|
|
|
version 'v3', using: :path do
|
2018-05-15 09:39:33 -04:00
|
|
|
route :any, '*path' do
|
|
|
|
error!('API V3 is no longer supported. Use API V4 instead.', 410)
|
|
|
|
end
|
2017-01-30 12:41:56 -05:00
|
|
|
end
|
2012-07-04 03:48:00 -04:00
|
|
|
|
2018-05-15 09:39:33 -04:00
|
|
|
version 'v4', using: :path
|
|
|
|
|
2017-11-01 05:25:49 -04:00
|
|
|
before do
|
|
|
|
header['X-Frame-Options'] = 'SAMEORIGIN'
|
|
|
|
header['X-Content-Type-Options'] = 'nosniff'
|
2022-08-01 08:12:10 -04:00
|
|
|
|
|
|
|
if Rails.application.config.content_security_policy && !Rails.application.config.content_security_policy_report_only
|
|
|
|
policy = ActionDispatch::ContentSecurityPolicy.new { |p| p.default_src :none }
|
|
|
|
end
|
|
|
|
|
|
|
|
request.env[ActionDispatch::ContentSecurityPolicy::Request::POLICY] = policy
|
2017-11-01 05:25:49 -04:00
|
|
|
end
|
2017-05-03 22:05:38 -04:00
|
|
|
|
2020-01-03 10:08:33 -05:00
|
|
|
before do
|
2020-06-29 17:09:07 -04:00
|
|
|
coerce_nil_params_to_array!
|
|
|
|
|
2021-10-13 20:12:08 -04:00
|
|
|
api_endpoint = request.env[Grape::Env::API_ENDPOINT]
|
2020-10-26 14:08:27 -04:00
|
|
|
feature_category = api_endpoint.options[:for].try(:feature_category_for_app, api_endpoint).to_s
|
|
|
|
|
2021-10-13 20:12:08 -04:00
|
|
|
# remote_ip is added here and the ContextLogger so that the
|
|
|
|
# client_id field is set correctly, as the user object does not
|
|
|
|
# survive between multiple context pushes.
|
2020-01-03 10:08:33 -05:00
|
|
|
Gitlab::ApplicationContext.push(
|
2020-03-06 13:08:08 -05:00
|
|
|
user: -> { @current_user },
|
2020-01-03 10:08:33 -05:00
|
|
|
project: -> { @project },
|
2020-01-23 10:08:46 -05:00
|
|
|
namespace: -> { @group },
|
2021-03-11 19:09:18 -05:00
|
|
|
runner: -> { @current_runner || @runner },
|
2021-01-05 16:10:22 -05:00
|
|
|
remote_ip: request.ip,
|
2021-10-13 20:12:08 -04:00
|
|
|
caller_id: api_endpoint.endpoint_id,
|
2020-10-26 14:08:27 -04:00
|
|
|
feature_category: feature_category
|
2020-01-03 10:08:33 -05:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2020-08-18 14:10:10 -04:00
|
|
|
before do
|
|
|
|
set_peek_enabled_for_current_request
|
|
|
|
end
|
|
|
|
|
2021-02-14 04:09:06 -05:00
|
|
|
after do
|
|
|
|
Gitlab::UsageDataCounters::VSCodeExtensionActivityUniqueCounter.track_api_request_when_trackable(user_agent: request&.user_agent, user: @current_user)
|
|
|
|
end
|
|
|
|
|
2022-02-01 16:12:02 -05:00
|
|
|
after do
|
|
|
|
Gitlab::UsageDataCounters::JetBrainsPluginActivityUniqueCounter.track_api_request_when_trackable(user_agent: request&.user_agent, user: @current_user)
|
|
|
|
end
|
|
|
|
|
2022-03-31 02:08:34 -04:00
|
|
|
after do
|
|
|
|
Gitlab::UsageDataCounters::GitLabCliActivityUniqueCounter.track_api_request_when_trackable(user_agent: request&.user_agent, user: @current_user)
|
|
|
|
end
|
|
|
|
|
2017-08-02 12:20:31 -04:00
|
|
|
# The locale is set to the current user's locale when `current_user` is loaded
|
2017-05-25 11:22:45 -04:00
|
|
|
after { Gitlab::I18n.use_default_locale }
|
2016-11-22 04:04:23 -05:00
|
|
|
|
2016-06-23 11:14:31 -04:00
|
|
|
rescue_from Gitlab::Access::AccessDeniedError do
|
|
|
|
rack_response({ 'message' => '403 Forbidden' }.to_json, 403)
|
|
|
|
end
|
|
|
|
|
2012-07-05 11:12:09 -04:00
|
|
|
rescue_from ActiveRecord::RecordNotFound do
|
2015-02-02 23:36:54 -05:00
|
|
|
rack_response({ 'message' => '404 Not found' }.to_json, 404)
|
2012-07-05 11:12:09 -04:00
|
|
|
end
|
|
|
|
|
2019-06-21 12:56:47 -04:00
|
|
|
rescue_from(
|
|
|
|
::ActiveRecord::StaleObjectError,
|
|
|
|
::Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError
|
|
|
|
) do
|
2018-11-23 11:25:11 -05:00
|
|
|
rack_response({ 'message' => '409 Conflict: Resource lock' }.to_json, 409)
|
|
|
|
end
|
|
|
|
|
2018-04-03 12:47:33 -04:00
|
|
|
rescue_from UploadedFile::InvalidPathError do |e|
|
|
|
|
rack_response({ 'message' => e.message }.to_json, 400)
|
|
|
|
end
|
|
|
|
|
|
|
|
rescue_from ObjectStorage::RemoteStoreError do |e|
|
|
|
|
rack_response({ 'message' => e.message }.to_json, 500)
|
|
|
|
end
|
|
|
|
|
2016-08-02 17:56:27 -04:00
|
|
|
# Retain 405 error rather than a 500 error for Grape 0.15.0+.
|
2017-01-04 12:24:39 -05:00
|
|
|
# https://github.com/ruby-grape/grape/blob/a3a28f5b5dfbb2797442e006dbffd750b27f2a76/UPGRADING.md#changes-to-method-not-allowed-routes
|
|
|
|
rescue_from Grape::Exceptions::MethodNotAllowed do |e|
|
|
|
|
error! e.message, e.status, e.headers
|
|
|
|
end
|
|
|
|
|
2016-08-02 17:56:27 -04:00
|
|
|
rescue_from Grape::Exceptions::Base do |e|
|
|
|
|
error! e.message, e.status, e.headers
|
2016-07-29 06:14:36 -04:00
|
|
|
end
|
|
|
|
|
2017-02-17 06:52:27 -05:00
|
|
|
rescue_from Gitlab::Auth::TooManyIps do |e|
|
2017-02-17 08:44:57 -05:00
|
|
|
rack_response({ 'message' => '403 Forbidden' }.to_json, 403)
|
2017-02-17 06:52:27 -05:00
|
|
|
end
|
|
|
|
|
2013-02-01 04:42:02 -05:00
|
|
|
rescue_from :all do |exception|
|
2016-08-18 20:06:33 -04:00
|
|
|
handle_api_exception(exception)
|
2013-01-29 12:20:59 -05:00
|
|
|
end
|
|
|
|
|
2020-04-30 17:09:47 -04:00
|
|
|
# This is a specific exception raised by `rack-timeout` gem when Puma
|
|
|
|
# requests surpass its timeout. Given it inherits from Exception, we
|
|
|
|
# should rescue it separately. For more info, see:
|
2022-06-06 14:09:02 -04:00
|
|
|
# - https://github.com/zombocom/rack-timeout/blob/master/doc/exceptions.md
|
2020-04-30 17:09:47 -04:00
|
|
|
# - https://github.com/ruby-grape/grape#exception-handling
|
|
|
|
rescue_from Rack::Timeout::RequestTimeoutException do |exception|
|
|
|
|
handle_api_exception(exception)
|
|
|
|
end
|
|
|
|
|
2021-10-12 23:12:30 -04:00
|
|
|
rescue_from RateLimitedService::RateLimitedError do |exception|
|
|
|
|
exception.log_request(context.request, context.current_user)
|
|
|
|
rack_response({ 'message' => { 'error' => exception.message } }.to_json, 429, exception.headers)
|
|
|
|
end
|
|
|
|
|
2012-06-27 07:32:56 -04:00
|
|
|
format :json
|
2020-07-16 17:10:05 -04:00
|
|
|
formatter :json, Gitlab::Json::GrapeFormatter
|
2021-01-20 07:11:06 -05:00
|
|
|
content_type :json, 'application/json'
|
2020-10-23 05:08:41 -04:00
|
|
|
|
2016-04-15 11:35:40 -04:00
|
|
|
# Ensure the namespace is right, otherwise we might load Grape::API::Helpers
|
|
|
|
helpers ::API::Helpers
|
2017-05-04 08:11:15 -04:00
|
|
|
helpers ::API::Helpers::CommonHelpers
|
2020-08-18 14:10:10 -04:00
|
|
|
helpers ::API::Helpers::PerformanceBarHelpers
|
2021-10-12 23:12:30 -04:00
|
|
|
helpers ::API::Helpers::RateLimiter
|
2016-04-15 11:35:40 -04:00
|
|
|
|
2020-02-10 10:08:54 -05:00
|
|
|
namespace do
|
|
|
|
after do
|
2020-04-07 17:09:46 -04:00
|
|
|
::Users::ActivityService.new(@current_user).execute
|
2020-02-10 10:08:54 -05:00
|
|
|
end
|
|
|
|
|
2022-10-14 05:09:13 -04:00
|
|
|
# Mount endpoints to include in the OpenAPI V2 documentation here
|
|
|
|
namespace do
|
2022-11-02 05:10:53 -04:00
|
|
|
# Keep in alphabetical order
|
2022-10-21 11:11:29 -04:00
|
|
|
mount ::API::AccessRequests
|
2022-10-27 20:11:00 -04:00
|
|
|
mount ::API::Appearance
|
2022-11-01 20:11:19 -04:00
|
|
|
mount ::API::BulkImports
|
2022-11-01 17:09:16 -04:00
|
|
|
mount ::API::Ci::Runner
|
2022-11-02 23:10:45 -04:00
|
|
|
mount ::API::Ci::Runners
|
2022-10-31 17:11:07 -04:00
|
|
|
mount ::API::Clusters::Agents
|
|
|
|
mount ::API::Clusters::AgentTokens
|
2022-10-28 17:10:45 -04:00
|
|
|
mount ::API::DeployKeys
|
2022-10-31 14:09:25 -04:00
|
|
|
mount ::API::DeployTokens
|
2022-10-27 11:09:49 -04:00
|
|
|
mount ::API::Deployments
|
2022-11-01 08:10:18 -04:00
|
|
|
mount ::API::Environments
|
|
|
|
mount ::API::FeatureFlagsUserLists
|
2022-11-03 11:11:31 -04:00
|
|
|
mount ::API::FeatureFlags
|
2022-10-31 11:11:37 -04:00
|
|
|
mount ::API::Features
|
2022-10-31 14:09:25 -04:00
|
|
|
mount ::API::FreezePeriods
|
2022-11-03 11:11:31 -04:00
|
|
|
mount ::API::Keys
|
2022-11-02 05:10:53 -04:00
|
|
|
mount ::API::Metadata
|
2022-11-03 11:11:31 -04:00
|
|
|
mount ::API::MergeRequestDiffs
|
2022-11-03 14:11:17 -04:00
|
|
|
mount ::API::ProjectHooks
|
2022-10-27 11:09:49 -04:00
|
|
|
mount ::API::ProjectRepositoryStorageMoves
|
2022-11-03 11:11:31 -04:00
|
|
|
mount ::API::Releases
|
2022-10-28 17:10:45 -04:00
|
|
|
mount ::API::Release::Links
|
2022-11-02 05:10:53 -04:00
|
|
|
mount ::API::ResourceAccessTokens
|
2022-11-03 14:11:17 -04:00
|
|
|
mount ::API::ProjectSnapshots
|
2022-11-02 17:09:03 -04:00
|
|
|
mount ::API::ProtectedTags
|
2022-11-02 11:11:07 -04:00
|
|
|
mount ::API::ProtectedBranches
|
2022-11-03 14:11:17 -04:00
|
|
|
mount ::API::SnippetRepositoryStorageMoves
|
2022-10-28 14:10:48 -04:00
|
|
|
mount ::API::Statistics
|
2022-11-03 08:11:20 -04:00
|
|
|
mount ::API::Submodules
|
2022-11-02 05:10:53 -04:00
|
|
|
mount ::API::Suggestions
|
2022-11-01 17:09:16 -04:00
|
|
|
mount ::API::Tags
|
2022-11-02 05:10:53 -04:00
|
|
|
mount ::API::UserCounts
|
2022-10-14 05:09:13 -04:00
|
|
|
|
|
|
|
add_open_api_documentation!
|
|
|
|
end
|
|
|
|
|
2020-02-10 10:08:54 -05:00
|
|
|
# Keep in alphabetical order
|
2022-08-18 14:10:07 -04:00
|
|
|
mount ::API::Admin::BatchedBackgroundMigrations
|
2020-05-13 17:08:55 -04:00
|
|
|
mount ::API::Admin::Ci::Variables
|
2020-07-16 20:09:37 -04:00
|
|
|
mount ::API::Admin::InstanceClusters
|
2021-03-03 01:11:13 -05:00
|
|
|
mount ::API::Admin::PlanLimits
|
2020-03-03 10:08:08 -05:00
|
|
|
mount ::API::Admin::Sidekiq
|
2022-04-14 11:08:59 -04:00
|
|
|
mount ::API::AlertManagementAlerts
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::Applications
|
|
|
|
mount ::API::Avatar
|
|
|
|
mount ::API::AwardEmoji
|
|
|
|
mount ::API::Badges
|
|
|
|
mount ::API::Boards
|
|
|
|
mount ::API::Branches
|
|
|
|
mount ::API::BroadcastMessages
|
2021-07-20 17:09:52 -04:00
|
|
|
mount ::API::Ci::JobArtifacts
|
|
|
|
mount ::API::Ci::Jobs
|
2020-07-10 20:09:17 -04:00
|
|
|
mount ::API::Ci::PipelineSchedules
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::Ci::Pipelines
|
2021-09-20 20:09:28 -04:00
|
|
|
mount ::API::Ci::ResourceGroups
|
2022-01-26 04:14:20 -05:00
|
|
|
mount ::API::Ci::SecureFiles
|
2021-07-20 17:09:52 -04:00
|
|
|
mount ::API::Ci::Triggers
|
|
|
|
mount ::API::Ci::Variables
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::CommitStatuses
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::Commits
|
|
|
|
mount ::API::ComposerPackages
|
|
|
|
mount ::API::ConanInstancePackages
|
|
|
|
mount ::API::ConanProjectPackages
|
2020-03-30 05:07:58 -04:00
|
|
|
mount ::API::ContainerRegistryEvent
|
2020-10-30 08:08:44 -04:00
|
|
|
mount ::API::ContainerRepositories
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::DebianGroupPackages
|
|
|
|
mount ::API::DebianProjectPackages
|
2020-11-13 16:09:31 -05:00
|
|
|
mount ::API::DependencyProxy
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::Discussions
|
2021-09-27 17:09:27 -04:00
|
|
|
mount ::API::ErrorTracking::ClientKeys
|
|
|
|
mount ::API::ErrorTracking::Collector
|
|
|
|
mount ::API::ErrorTracking::ProjectSettings
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::Events
|
|
|
|
mount ::API::Files
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::GenericPackages
|
2021-06-17 14:10:22 -04:00
|
|
|
mount ::API::Geo
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::GoProxy
|
2021-06-09 11:10:05 -04:00
|
|
|
mount ::API::GroupAvatar
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::GroupBoards
|
|
|
|
mount ::API::GroupClusters
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::GroupContainerRepositories
|
|
|
|
mount ::API::GroupDebianDistributions
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::GroupExport
|
2020-02-11 04:08:39 -05:00
|
|
|
mount ::API::GroupImport
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::GroupLabels
|
|
|
|
mount ::API::GroupMilestones
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::GroupPackages
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::GroupVariables
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::Groups
|
|
|
|
mount ::API::HelmPackages
|
2020-07-06 14:09:13 -04:00
|
|
|
mount ::API::ImportBitbucketServer
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::ImportGithub
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::Integrations
|
2022-05-13 11:07:43 -04:00
|
|
|
mount ::API::Integrations::JiraConnect::Subscriptions
|
2020-11-04 19:09:16 -05:00
|
|
|
mount ::API::Invitations
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::IssueLinks
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::Issues
|
|
|
|
mount ::API::Labels
|
|
|
|
mount ::API::Lint
|
|
|
|
mount ::API::Markdown
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::MavenPackages
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::Members
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::MergeRequestApprovals
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::MergeRequests
|
2020-04-14 14:09:54 -04:00
|
|
|
mount ::API::Metrics::Dashboard::Annotations
|
2020-05-13 14:08:47 -04:00
|
|
|
mount ::API::Metrics::UserStarredDashboards
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::Namespaces
|
|
|
|
mount ::API::Notes
|
|
|
|
mount ::API::NotificationSettings
|
2020-11-11 07:09:06 -05:00
|
|
|
mount ::API::NpmInstancePackages
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::NpmProjectPackages
|
|
|
|
mount ::API::NugetGroupPackages
|
|
|
|
mount ::API::NugetProjectPackages
|
|
|
|
mount ::API::PackageFiles
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::Pages
|
|
|
|
mount ::API::PagesDomains
|
2022-09-20 11:13:52 -04:00
|
|
|
mount ::API::PersonalAccessTokens::SelfInformation
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::PersonalAccessTokens
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::ProjectClusters
|
|
|
|
mount ::API::ProjectContainerRepositories
|
2021-06-14 14:10:28 -04:00
|
|
|
mount ::API::ProjectDebianDistributions
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::ProjectEvents
|
|
|
|
mount ::API::ProjectExport
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::ProjectImport
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::ProjectMilestones
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::ProjectPackages
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::ProjectSnippets
|
|
|
|
mount ::API::ProjectStatistics
|
|
|
|
mount ::API::ProjectTemplates
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::Projects
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::ProtectedTags
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::PypiPackages
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::RemoteMirrors
|
|
|
|
mount ::API::Repositories
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::ResourceLabelEvents
|
|
|
|
mount ::API::ResourceMilestoneEvents
|
|
|
|
mount ::API::ResourceStateEvents
|
2022-08-29 14:09:53 -04:00
|
|
|
mount ::API::RpmProjectPackages
|
2021-02-10 10:11:19 -05:00
|
|
|
mount ::API::RubygemPackages
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::Search
|
|
|
|
mount ::API::Settings
|
|
|
|
mount ::API::SidekiqMetrics
|
|
|
|
mount ::API::Snippets
|
|
|
|
mount ::API::Subscriptions
|
|
|
|
mount ::API::SystemHooks
|
|
|
|
mount ::API::Tags
|
|
|
|
mount ::API::Templates
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::Terraform::Modules::V1::Packages
|
|
|
|
mount ::API::Terraform::State
|
|
|
|
mount ::API::Terraform::StateVersion
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::Todos
|
2021-11-12 04:10:03 -05:00
|
|
|
mount ::API::Topics
|
2020-09-30 08:09:53 -04:00
|
|
|
mount ::API::Unleash
|
2020-09-10 08:08:54 -04:00
|
|
|
mount ::API::UsageData
|
2021-04-06 02:09:00 -04:00
|
|
|
mount ::API::UsageDataNonSqlMetrics
|
2022-04-20 11:10:23 -04:00
|
|
|
mount ::API::UsageDataQueries
|
2020-02-10 10:08:54 -05:00
|
|
|
mount ::API::Users
|
|
|
|
mount ::API::Wikis
|
2022-09-06 14:10:28 -04:00
|
|
|
mount ::API::Ml::Mlflow
|
2020-02-10 10:08:54 -05:00
|
|
|
end
|
|
|
|
|
2019-09-03 18:07:49 -04:00
|
|
|
mount ::API::Internal::Base
|
2020-10-01 08:10:14 -04:00
|
|
|
mount ::API::Internal::Lfs
|
2019-09-06 00:06:25 -04:00
|
|
|
mount ::API::Internal::Pages
|
2020-07-20 05:09:22 -04:00
|
|
|
mount ::API::Internal::Kubernetes
|
2022-07-14 14:08:36 -04:00
|
|
|
mount ::API::Internal::ErrorTracking
|
2022-01-06 01:10:35 -05:00
|
|
|
mount ::API::Internal::MailRoom
|
2022-02-01 19:18:16 -05:00
|
|
|
mount ::API::Internal::ContainerRegistry::Migration
|
2022-06-01 23:08:40 -04:00
|
|
|
mount ::API::Internal::Workhorse
|
2016-10-07 09:39:57 -04:00
|
|
|
|
2020-09-01 08:11:01 -04:00
|
|
|
version 'v3', using: :path do
|
|
|
|
# Although the following endpoints are kept behind V3 namespace,
|
|
|
|
# they're not deprecated neither should be removed when V3 get
|
|
|
|
# removed. They're needed as a layer to integrate with Jira
|
|
|
|
# Development Panel.
|
|
|
|
namespace '/', requirements: ::API::V3::Github::ENDPOINT_REQUIREMENTS do
|
|
|
|
mount ::API::V3::Github
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-04-05 08:10:23 -04:00
|
|
|
route :any, '*path', feature_category: :not_owned do # rubocop:todo Gitlab/AvoidFeatureCategoryNotOwned
|
2016-10-07 13:18:02 -04:00
|
|
|
error!('404 Not Found', 404)
|
2016-10-07 09:39:57 -04:00
|
|
|
end
|
2012-06-27 07:32:56 -04:00
|
|
|
end
|
2012-06-27 05:26:16 -04:00
|
|
|
end
|
2019-09-13 09:26:31 -04:00
|
|
|
|
2021-05-11 17:10:21 -04:00
|
|
|
API::API.prepend_mod
|