Commit e23b7062 authored by Stan Hu's avatar Stan Hu

Merge branch 'add-base-api-class' into 'master'

Add base API class

See merge request gitlab-org/gitlab!45039
parents dcc29126 9716bd34
...@@ -335,7 +335,7 @@ Gitlab/Union: ...@@ -335,7 +335,7 @@ Gitlab/Union:
- 'spec/**/*' - 'spec/**/*'
- 'ee/spec/**/*' - 'ee/spec/**/*'
API/GrapeAPIInstance: API/Base:
Enabled: true Enabled: true
Include: Include:
- 'lib/**/api/**/*.rb' - 'lib/**/api/**/*.rb'
......
...@@ -19,7 +19,7 @@ gem 'default_value_for', '~> 3.3.0' ...@@ -19,7 +19,7 @@ gem 'default_value_for', '~> 3.3.0'
gem 'pg', '~> 1.1' gem 'pg', '~> 1.1'
gem 'rugged', '~> 0.28' gem 'rugged', '~> 0.28'
gem 'grape-path-helpers', '~> 1.3' gem 'grape-path-helpers', '~> 1.4'
gem 'faraday', '~> 1.0' gem 'faraday', '~> 1.0'
gem 'marginalia', '~> 1.9.0' gem 'marginalia', '~> 1.9.0'
......
...@@ -495,7 +495,7 @@ GEM ...@@ -495,7 +495,7 @@ GEM
grape-entity (0.7.1) grape-entity (0.7.1)
activesupport (>= 4.0) activesupport (>= 4.0)
multi_json (>= 1.3.2) multi_json (>= 1.3.2)
grape-path-helpers (1.3.0) grape-path-helpers (1.4.0)
activesupport activesupport
grape (~> 1.3) grape (~> 1.3)
rake (~> 12) rake (~> 12)
...@@ -1348,7 +1348,7 @@ DEPENDENCIES ...@@ -1348,7 +1348,7 @@ DEPENDENCIES
gpgme (~> 2.0.19) gpgme (~> 2.0.19)
grape (= 1.4.0) grape (= 1.4.0)
grape-entity (~> 0.7.1) grape-entity (~> 0.7.1)
grape-path-helpers (~> 1.3) grape-path-helpers (~> 1.4)
grape_logging (~> 1.7) grape_logging (~> 1.7)
graphiql-rails (~> 1.4.10) graphiql-rails (~> 1.4.10)
graphql (~> 1.11.4) graphql (~> 1.11.4)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module API module API
module Analytics module Analytics
class CodeReviewAnalytics < Grape::API::Instance class CodeReviewAnalytics < ::API::Base
include PaginationParams include PaginationParams
helpers do helpers do
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module API module API
module Analytics module Analytics
class GroupActivityAnalytics < Grape::API::Instance class GroupActivityAnalytics < ::API::Base
DESCRIPTION_DETAIL = DESCRIPTION_DETAIL =
'This feature is gated by the `:group_activity_analytics`'\ 'This feature is gated by the `:group_activity_analytics`'\
' feature flag, introduced in GitLab 12.9.' ' feature flag, introduced in GitLab 12.9.'
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class AuditEvents < ::Grape::API::Instance class AuditEvents < ::API::Base
include ::API::PaginationParams include ::API::PaginationParams
before do before do
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class Dependencies < Grape::API::Instance class Dependencies < ::API::Base
helpers do helpers do
def dependencies_by(params) def dependencies_by(params)
pipeline = ::Security::ReportFetchService.new(user_project, ::Ci::JobArtifact.dependency_list_reports).pipeline pipeline = ::Security::ReportFetchService.new(user_project, ::Ci::JobArtifact.dependency_list_reports).pipeline
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class DependencyProxy < Grape::API::Instance class DependencyProxy < ::API::Base
helpers ::API::Helpers::PackagesHelpers helpers ::API::Helpers::PackagesHelpers
helpers do helpers do
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class ElasticsearchIndexedNamespaces < Grape::API::Instance class ElasticsearchIndexedNamespaces < ::API::Base
before { authenticated_as_admin! } before { authenticated_as_admin! }
resource :elasticsearch_indexed_namespaces do resource :elasticsearch_indexed_namespaces do
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class EpicIssues < Grape::API::Instance class EpicIssues < ::API::Base
before do before do
authenticate! authenticate!
authorize_epics_feature! authorize_epics_feature!
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class EpicLinks < Grape::API::Instance class EpicLinks < ::API::Base
include ::Gitlab::Utils::StrongMemoize include ::Gitlab::Utils::StrongMemoize
before do before do
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class Epics < Grape::API::Instance class Epics < ::API::Base
include PaginationParams include PaginationParams
before do before do
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'base64' require 'base64'
module API module API
class Geo < Grape::API::Instance class Geo < ::API::Base
resource :geo do resource :geo do
helpers do helpers do
def sanitized_node_status_params def sanitized_node_status_params
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class GeoNodes < Grape::API::Instance class GeoNodes < ::API::Base
include PaginationParams include PaginationParams
include APIGuard include APIGuard
include ::Gitlab::Utils::StrongMemoize include ::Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class GeoReplication < Grape::API::Instance class GeoReplication < ::API::Base
include PaginationParams include PaginationParams
include APIGuard include APIGuard
include ::Gitlab::Utils::StrongMemoize include ::Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class GroupHooks < Grape::API::Instance class GroupHooks < ::API::Base
include ::API::PaginationParams include ::API::PaginationParams
before { authenticate! } before { authenticate! }
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class GroupPushRule < Grape::API::Instance class GroupPushRule < ::API::Base
before { authenticate! } before { authenticate! }
before { check_group_push_rule_access! } before { check_group_push_rule_access! }
before { authorize_change_param(user_group, :commit_committer_check, :reject_unsigned_commits) } before { authorize_change_param(user_group, :commit_committer_check, :reject_unsigned_commits) }
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class Ldap < Grape::API::Instance class Ldap < ::API::Base
# Admin users by default should be able to access these API endpoints. # Admin users by default should be able to access these API endpoints.
# However, non-admin users can access these endpoints if the "Allow group # However, non-admin users can access these endpoints if the "Allow group
# owners to manage LDAP-related group settings" is enabled, and they own a # owners to manage LDAP-related group settings" is enabled, and they own a
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class LdapGroupLinks < Grape::API::Instance class LdapGroupLinks < ::API::Base
before { authenticate! } before { authenticate! }
params do params do
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class License < Grape::API::Instance class License < ::API::Base
before { authenticated_as_admin! } before { authenticated_as_admin! }
resource :license do resource :license do
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class ManagedLicenses < Grape::API::Instance class ManagedLicenses < ::API::Base
include PaginationParams include PaginationParams
before { authenticate! unless route.settings[:skip_authentication] } before { authenticate! unless route.settings[:skip_authentication] }
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class MergeRequestApprovalRules < ::Grape::API class MergeRequestApprovalRules < ::API::Base
before { authenticate_non_get! } before { authenticate_non_get! }
helpers do helpers do
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class MergeTrains < ::Grape::API::Instance class MergeTrains < ::API::Base
include PaginationParams include PaginationParams
before do before do
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class PersonalAccessTokens < Grape::API::Instance class PersonalAccessTokens < ::API::Base
include ::API::PaginationParams include ::API::PaginationParams
desc 'Get all Personal Access Tokens' do desc 'Get all Personal Access Tokens' do
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class ProjectAliases < Grape::API::Instance class ProjectAliases < ::API::Base
include PaginationParams include PaginationParams
before { check_feature_availability } before { check_feature_availability }
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class ProjectApprovalRules < ::Grape::API::Instance class ProjectApprovalRules < ::API::Base
before { authenticate! } before { authenticate! }
helpers ::API::Helpers::ProjectApprovalRulesHelpers helpers ::API::Helpers::ProjectApprovalRulesHelpers
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class ProjectApprovalSettings < ::Grape::API::Instance class ProjectApprovalSettings < ::API::Base
before { authenticate! } before { authenticate! }
helpers ::API::Helpers::ProjectApprovalRulesHelpers helpers ::API::Helpers::ProjectApprovalRulesHelpers
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class ProjectApprovals < ::Grape::API::Instance class ProjectApprovals < ::API::Base
before { authenticate! } before { authenticate! }
before { authorize! :update_approvers, user_project } before { authorize! :update_approvers, user_project }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require_dependency 'declarative_policy' require_dependency 'declarative_policy'
module API module API
class ProjectMirror < Grape::API::Instance class ProjectMirror < ::API::Base
helpers do helpers do
def github_webhook_signature def github_webhook_signature
@github_webhook_signature ||= headers['X-Hub-Signature'] @github_webhook_signature ||= headers['X-Hub-Signature']
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class ProjectPushRule < Grape::API::Instance class ProjectPushRule < ::API::Base
before { authenticate! } before { authenticate! }
before { authorize_admin_project } before { authorize_admin_project }
before { check_project_feature_available!(:push_rules) } before { check_project_feature_available!(:push_rules) }
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class ProtectedEnvironments < Grape::API::Instance class ProtectedEnvironments < ::API::Base
include PaginationParams include PaginationParams
ENVIRONMENT_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(name: API::NO_SLASH_URL_PART_REGEX) ENVIRONMENT_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(name: API::NO_SLASH_URL_PART_REGEX)
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class ResourceIterationEvents < Grape::API::Instance class ResourceIterationEvents < ::API::Base
include PaginationParams include PaginationParams
helpers ::API::Helpers::NotesHelpers helpers ::API::Helpers::NotesHelpers
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class ResourceWeightEvents < Grape::API::Instance class ResourceWeightEvents < ::API::Base
include PaginationParams include PaginationParams
helpers ::API::Helpers::NotesHelpers helpers ::API::Helpers::NotesHelpers
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class Scim < Grape::API::Instance class Scim < ::API::Base
include ::Gitlab::Utils::StrongMemoize include ::Gitlab::Utils::StrongMemoize
prefix 'api/scim' prefix 'api/scim'
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class VisualReviewDiscussions < Grape::API::Instance class VisualReviewDiscussions < ::API::Base
include PaginationParams include PaginationParams
helpers ::API::Helpers::NotesHelpers helpers ::API::Helpers::NotesHelpers
helpers ::RendersNotes helpers ::RendersNotes
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class Vulnerabilities < Grape::API::Instance class Vulnerabilities < ::API::Base
include ::API::Helpers::VulnerabilitiesHooks include ::API::Helpers::VulnerabilitiesHooks
include PaginationParams include PaginationParams
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class VulnerabilityExports < Grape::API::Instance class VulnerabilityExports < ::API::Base
include ::API::Helpers::VulnerabilitiesHooks include ::API::Helpers::VulnerabilitiesHooks
include ::Gitlab::Utils::StrongMemoize include ::Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class VulnerabilityFindings < Grape::API::Instance class VulnerabilityFindings < ::API::Base
include PaginationParams include PaginationParams
include ::Gitlab::Utils::StrongMemoize include ::Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class VulnerabilityIssueLinks < Grape::API::Instance class VulnerabilityIssueLinks < ::API::Base
include ::API::Helpers::VulnerabilitiesHooks include ::API::Helpers::VulnerabilitiesHooks
helpers ::API::Helpers::VulnerabilitiesHelpers helpers ::API::Helpers::VulnerabilitiesHelpers
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module EE module EE
module API module API
class Boards < ::Grape::API::Instance class Boards < ::API::Base
include ::API::PaginationParams include ::API::PaginationParams
include ::API::BoardsResponses include ::API::BoardsResponses
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module EE module EE
module API module API
class GroupBoards < ::Grape::API::Instance class GroupBoards < ::API::Base
include ::API::PaginationParams include ::API::PaginationParams
include ::API::BoardsResponses include ::API::BoardsResponses
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class AccessRequests < Grape::API::Instance class AccessRequests < ::API::Base
include PaginationParams include PaginationParams
before { authenticate! } before { authenticate! }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module API module API
module Admin module Admin
module Ci module Ci
class Variables < Grape::API::Instance class Variables < ::API::Base
include PaginationParams include PaginationParams
before { authenticated_as_admin! } before { authenticated_as_admin! }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module API module API
module Admin module Admin
class InstanceClusters < Grape::API::Instance class InstanceClusters < ::API::Base
include PaginationParams include PaginationParams
before do before do
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module API module API
module Admin module Admin
class Sidekiq < Grape::API::Instance class Sidekiq < ::API::Base
before { authenticated_as_admin! } before { authenticated_as_admin! }
namespace 'admin' do namespace 'admin' do
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class API < Grape::API::Instance class API < ::API::Base
include APIGuard include APIGuard
LOG_FILENAME = Rails.root.join("log", "api_json.log") LOG_FILENAME = Rails.root.join("log", "api_json.log")
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class Appearance < Grape::API::Instance class Appearance < ::API::Base
before { authenticated_as_admin! } before { authenticated_as_admin! }
helpers do helpers do
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module API module API
# External applications API # External applications API
class Applications < Grape::API::Instance class Applications < ::API::Base
before { authenticated_as_admin! } before { authenticated_as_admin! }
resource :applications do resource :applications do
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class Avatar < Grape::API::Instance class Avatar < ::API::Base
resource :avatar do resource :avatar do
desc 'Return avatar url for a user' do desc 'Return avatar url for a user' do
success Entities::Avatar success Entities::Avatar
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class AwardEmoji < Grape::API::Instance class AwardEmoji < ::API::Base
include PaginationParams include PaginationParams
before { authenticate! } before { authenticate! }
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class Badges < Grape::API::Instance class Badges < ::API::Base
include PaginationParams include PaginationParams
before { authenticate_non_get! } before { authenticate_non_get! }
......
# frozen_string_literal: true
module API
class Base < Grape::API::Instance # rubocop:disable API/Base
end
end
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class Boards < Grape::API::Instance class Boards < ::API::Base
include BoardsResponses include BoardsResponses
include PaginationParams include PaginationParams
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'mime/types' require 'mime/types'
module API module API
class Branches < Grape::API::Instance class Branches < ::API::Base
include PaginationParams include PaginationParams
BRANCH_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(branch: API::NO_SLASH_URL_PART_REGEX) BRANCH_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(branch: API::NO_SLASH_URL_PART_REGEX)
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class BroadcastMessages < Grape::API::Instance class BroadcastMessages < ::API::Base
include PaginationParams include PaginationParams
resource :broadcast_messages do resource :broadcast_messages do
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module API module API
module Ci module Ci
class PipelineSchedules < Grape::API::Instance class PipelineSchedules < ::API::Base
include PaginationParams include PaginationParams
before { authenticate! } before { authenticate! }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module API module API
module Ci module Ci
class Pipelines < Grape::API::Instance class Pipelines < ::API::Base
include PaginationParams include PaginationParams
before { authenticate_non_get! } before { authenticate_non_get! }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module API module API
module Ci module Ci
class Runner < Grape::API::Instance class Runner < ::API::Base
helpers ::API::Helpers::Runner helpers ::API::Helpers::Runner
resource :runners do resource :runners do
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module API module API
module Ci module Ci
class Runners < Grape::API::Instance class Runners < ::API::Base
include PaginationParams include PaginationParams
before { authenticate! } before { authenticate! }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'mime/types' require 'mime/types'
module API module API
class CommitStatuses < Grape::API::Instance class CommitStatuses < ::API::Base
params do params do
requires :id, type: String, desc: 'The ID of a project' requires :id, type: String, desc: 'The ID of a project'
end end
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'mime/types' require 'mime/types'
module API module API
class Commits < Grape::API::Instance class Commits < ::API::Base
include PaginationParams include PaginationParams
before do before do
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# PHP composer support (https://getcomposer.org/) # PHP composer support (https://getcomposer.org/)
module API module API
class ComposerPackages < Grape::API::Instance class ComposerPackages < ::API::Base
helpers ::API::Helpers::PackagesManagerClientsHelpers helpers ::API::Helpers::PackagesManagerClientsHelpers
helpers ::API::Helpers::RelatedResourcesHelpers helpers ::API::Helpers::RelatedResourcesHelpers
helpers ::API::Helpers::Packages::BasicAuthHelpers helpers ::API::Helpers::Packages::BasicAuthHelpers
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Conan Instance-Level Package Manager Client API # Conan Instance-Level Package Manager Client API
module API module API
class ConanInstancePackages < Grape::API::Instance class ConanInstancePackages < ::API::Base
namespace 'packages/conan/v1' do namespace 'packages/conan/v1' do
include ConanPackageEndpoints include ConanPackageEndpoints
end end
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Conan Project-Level Package Manager Client API # Conan Project-Level Package Manager Client API
module API module API
class ConanProjectPackages < Grape::API::Instance class ConanProjectPackages < ::API::Base
params do params do
requires :id, type: Integer, desc: 'The ID of a project', regexp: %r{\A[1-9]\d*\z} requires :id, type: Integer, desc: 'The ID of a project', regexp: %r{\A[1-9]\d*\z}
end end
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class ContainerRegistryEvent < Grape::API::Instance class ContainerRegistryEvent < ::API::Base
DOCKER_DISTRIBUTION_EVENTS_V1_JSON = 'application/vnd.docker.distribution.events.v1+json' DOCKER_DISTRIBUTION_EVENTS_V1_JSON = 'application/vnd.docker.distribution.events.v1+json'
before { authenticate_registry_notification! } before { authenticate_registry_notification! }
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class DebianGroupPackages < Grape::API::Instance class DebianGroupPackages < ::API::Base
params do params do
requires :id, type: String, desc: 'The ID of a group' requires :id, type: String, desc: 'The ID of a group'
end end
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class DebianProjectPackages < Grape::API::Instance class DebianProjectPackages < ::API::Base
params do params do
requires :id, type: String, desc: 'The ID of a project' requires :id, type: String, desc: 'The ID of a project'
end end
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class DeployKeys < Grape::API::Instance class DeployKeys < ::API::Base
include PaginationParams include PaginationParams
before { authenticate! } before { authenticate! }
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class DeployTokens < Grape::API::Instance class DeployTokens < ::API::Base
include PaginationParams include PaginationParams
helpers do helpers do
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module API module API
# Deployments RESTful API endpoints # Deployments RESTful API endpoints
class Deployments < Grape::API::Instance class Deployments < ::API::Base
include PaginationParams include PaginationParams
before { authenticate! } before { authenticate! }
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class Discussions < Grape::API::Instance class Discussions < ::API::Base
include PaginationParams include PaginationParams
helpers ::API::Helpers::NotesHelpers helpers ::API::Helpers::NotesHelpers
helpers ::RendersNotes helpers ::RendersNotes
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module API module API
# Environments RESTfull API endpoints # Environments RESTfull API endpoints
class Environments < Grape::API::Instance class Environments < ::API::Base
include PaginationParams include PaginationParams
before { authenticate! } before { authenticate! }
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class ErrorTracking < Grape::API::Instance class ErrorTracking < ::API::Base
before { authenticate! } before { authenticate! }
params do params do
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class Events < Grape::API::Instance class Events < ::API::Base
include PaginationParams include PaginationParams
include APIGuard include APIGuard
helpers ::API::Helpers::EventsHelpers helpers ::API::Helpers::EventsHelpers
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class FeatureFlagScopes < Grape::API::Instance class FeatureFlagScopes < ::API::Base
include PaginationParams include PaginationParams
ENVIRONMENT_SCOPE_ENDPOINT_REQUIREMENTS = FeatureFlags::FEATURE_FLAG_ENDPOINT_REQUIREMENTS ENVIRONMENT_SCOPE_ENDPOINT_REQUIREMENTS = FeatureFlags::FEATURE_FLAG_ENDPOINT_REQUIREMENTS
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class FeatureFlags < Grape::API::Instance class FeatureFlags < ::API::Base
include PaginationParams include PaginationParams
FEATURE_FLAG_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS FEATURE_FLAG_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class FeatureFlagsUserLists < Grape::API::Instance class FeatureFlagsUserLists < ::API::Base
include PaginationParams include PaginationParams
error_formatter :json, -> (message, _backtrace, _options, _env, _original_exception) { error_formatter :json, -> (message, _backtrace, _options, _env, _original_exception) {
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class Features < Grape::API::Instance class Features < ::API::Base
before { authenticated_as_admin! } before { authenticated_as_admin! }
helpers do helpers do
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class Files < Grape::API::Instance class Files < ::API::Base
include APIGuard include APIGuard
FILE_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(file_path: API::NO_SLASH_URL_PART_REGEX) FILE_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(file_path: API::NO_SLASH_URL_PART_REGEX)
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class FreezePeriods < Grape::API::Instance class FreezePeriods < ::API::Base
include PaginationParams include PaginationParams
before { authenticate! } before { authenticate! }
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class GenericPackages < Grape::API::Instance class GenericPackages < ::API::Base
GENERIC_PACKAGES_REQUIREMENTS = { GENERIC_PACKAGES_REQUIREMENTS = {
package_name: API::NO_SLASH_URL_PART_REGEX, package_name: API::NO_SLASH_URL_PART_REGEX,
file_name: API::NO_SLASH_URL_PART_REGEX file_name: API::NO_SLASH_URL_PART_REGEX
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class GoProxy < Grape::API::Instance class GoProxy < ::API::Base
helpers Gitlab::Golang helpers Gitlab::Golang
helpers ::API::Helpers::PackagesHelpers helpers ::API::Helpers::PackagesHelpers
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class GroupBoards < Grape::API::Instance class GroupBoards < ::API::Base
include BoardsResponses include BoardsResponses
include PaginationParams include PaginationParams
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class GroupClusters < Grape::API::Instance class GroupClusters < ::API::Base
include PaginationParams include PaginationParams
before { authenticate! } before { authenticate! }
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class GroupContainerRepositories < Grape::API::Instance class GroupContainerRepositories < ::API::Base
include PaginationParams include PaginationParams
helpers ::API::Helpers::PackagesHelpers helpers ::API::Helpers::PackagesHelpers
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class GroupExport < Grape::API::Instance class GroupExport < ::API::Base
helpers Helpers::RateLimiter helpers Helpers::RateLimiter
before do before do
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class GroupImport < Grape::API::Instance class GroupImport < ::API::Base
helpers Helpers::FileUploadHelpers helpers Helpers::FileUploadHelpers
helpers do helpers do
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class GroupLabels < Grape::API::Instance class GroupLabels < ::API::Base
include PaginationParams include PaginationParams
helpers ::API::Helpers::LabelHelpers helpers ::API::Helpers::LabelHelpers
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class GroupMilestones < Grape::API::Instance class GroupMilestones < ::API::Base
include MilestoneResponses include MilestoneResponses
include PaginationParams include PaginationParams
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class GroupPackages < Grape::API::Instance class GroupPackages < ::API::Base
include PaginationParams include PaginationParams
before do before do
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class GroupVariables < Grape::API::Instance class GroupVariables < ::API::Base
include PaginationParams include PaginationParams
before { authenticate! } before { authenticate! }
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class Groups < Grape::API::Instance class Groups < ::API::Base
include PaginationParams include PaginationParams
include Helpers::CustomAttributes include Helpers::CustomAttributes
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class ImportBitbucketServer < Grape::API::Instance class ImportBitbucketServer < ::API::Base
helpers do helpers do
def client def client
@client ||= BitbucketServer::Client.new(credentials) @client ||= BitbucketServer::Client.new(credentials)
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class ImportGithub < Grape::API::Instance class ImportGithub < ::API::Base
rescue_from Octokit::Unauthorized, with: :provider_unauthorized rescue_from Octokit::Unauthorized, with: :provider_unauthorized
before do before do
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module API module API
# Internal access API # Internal access API
module Internal module Internal
class Base < Grape::API::Instance class Base < ::API::Base
before { authenticate_by_gitlab_shell_token! } before { authenticate_by_gitlab_shell_token! }
before do before do
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module API module API
# Kubernetes Internal API # Kubernetes Internal API
module Internal module Internal
class Kubernetes < Grape::API::Instance class Kubernetes < ::API::Base
before do before do
check_feature_enabled check_feature_enabled
authenticate_gitlab_kas_request! authenticate_gitlab_kas_request!
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module API module API
module Internal module Internal
class Lfs < Grape::API::Instance class Lfs < ::API::Base
use Rack::Sendfile use Rack::Sendfile
before { authenticate_by_gitlab_shell_token! } before { authenticate_by_gitlab_shell_token! }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module API module API
# Pages Internal API # Pages Internal API
module Internal module Internal
class Pages < Grape::API::Instance class Pages < ::API::Base
before do before do
authenticate_gitlab_pages_request! authenticate_gitlab_pages_request!
end end
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class IssueLinks < Grape::API::Instance class IssueLinks < ::API::Base
include PaginationParams include PaginationParams
before { authenticate! } before { authenticate! }
......
# frozen_string_literal: true # frozen_string_literal: true
module API module API
class Issues < Grape::API::Instance class Issues < ::API::Base
include PaginationParams include PaginationParams
helpers Helpers::IssuesHelpers helpers Helpers::IssuesHelpers
helpers Helpers::RateLimiter helpers Helpers::RateLimiter
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment