Class: API::Base

Inherits:
Grape::API::Instance
  • Object
show all
Includes:
Gitlab::EndpointAttributes
Defined in:
lib/api/base.rb

Overview

rubocop:disable API/Base

Direct Known Subclasses

API, AccessRequests, Admin::BatchedBackgroundMigrations, Admin::BroadcastMessages, Admin::Ci::Variables, Admin::Dictionary, Admin::InstanceClusters, Admin::Migrations, Admin::PlanLimits, Admin::Sidekiq, AlertManagementAlerts, Appearance, Applications, Avatar, AwardEmoji, Badges, Boards, Branches, BulkImports, Ci::JobArtifacts, Ci::Jobs, Ci::PipelineSchedules, Ci::Pipelines, Ci::ResourceGroups, Ci::Runner, Ci::Runners, Ci::SecureFiles, Ci::Triggers, Ci::Variables, Clusters::AgentTokens, Clusters::Agents, CommitStatuses, Commits, ComposerPackages, ConanInstancePackages, ConanProjectPackages, ContainerRegistryEvent, ContainerRepositories, DebianGroupPackages, DebianProjectPackages, DependencyProxy, DeployKeys, DeployTokens, Deployments, Discussions, DraftNotes, Environments, Events, FeatureFlags, FeatureFlagsUserLists, Features, Files, FreezePeriods, GenericPackages, Geo, GoProxy, GroupAvatar, GroupBoards, GroupClusters, GroupContainerRepositories, GroupDebianDistributions, GroupExport, GroupImport, GroupLabels, GroupMilestones, GroupPackages, GroupVariables, Groups, HelmPackages, ImportBitbucketServer, ImportGithub, Integrations, Integrations::JiraConnect::Subscriptions, Integrations::Slack::Events, Integrations::Slack::Interactions, Integrations::Slack::Options, Internal::Base, Internal::ContainerRegistry::Migration, Internal::ErrorTracking, Internal::Kubernetes, Internal::Lfs, Internal::MailRoom, Internal::Pages, Internal::Workhorse, Invitations, IssueLinks, Issues, Keys, Labels, Lint, Markdown, MavenPackages, Members, MergeRequestApprovals, MergeRequestDiffs, MergeRequests, Metadata, Metrics::Dashboard::Annotations, Metrics::UserStarredDashboards, Ml::Mlflow::Entrypoint, Ml::Mlflow::Experiments, Ml::Mlflow::Runs, MlModelPackages, Namespaces, Notes, NotificationSettings, NpmGroupPackages, NpmInstancePackages, NpmProjectPackages, NugetGroupPackages, NugetProjectPackages, PackageFiles, Pages, PagesDomains, PersonalAccessTokens, PersonalAccessTokens::SelfInformation, ProjectClusters, ProjectContainerRepositories, ProjectDebianDistributions, ProjectEvents, ProjectExport, ProjectHooks, ProjectImport, ProjectJobTokenScope, ProjectMilestones, ProjectPackages, ProjectRepositoryStorageMoves, ProjectSnapshots, ProjectSnippets, ProjectStatistics, ProjectTemplates, Projects, ProtectedBranches, ProtectedTags, PypiPackages, Release::Links, Releases, RemoteMirrors, Repositories, ResourceAccessTokens, ResourceLabelEvents, ResourceMilestoneEvents, ResourceStateEvents, RpmProjectPackages, RubygemPackages, Search, Settings, SidekiqMetrics, SnippetRepositoryStorageMoves, Snippets, Statistics, Submodules, Subscriptions, Suggestions, SystemHooks, Tags, Templates, Terraform::Modules::V1::Packages, Terraform::State, Terraform::StateVersion, Todos, Topics, Unleash, UsageData, UsageDataNonSqlMetrics, UsageDataQueries, UserCounts, UserRunners, Users, V3::Github, VsCodeSettingsSync, Wikis, ErrorTracking::ClientKeys, ErrorTracking::ProjectSettings

Constant Summary

Constants included from Gitlab::EndpointAttributes

Gitlab::EndpointAttributes::DEFAULT_URGENCY

Class Method Summary collapse

Class Method Details

.endpoint_id_for_route(route) ⇒ Object



20
21
22
# File 'lib/api/base.rb', line 20

def endpoint_id_for_route(route)
  "#{route.request_method} #{route.origin}"
end

.feature_category_for_app(app) ⇒ Object



8
9
10
# File 'lib/api/base.rb', line 8

def feature_category_for_app(app)
  feature_category_for_action(path_for_app(app))
end

.path_for_app(app) ⇒ Object



16
17
18
# File 'lib/api/base.rb', line 16

def path_for_app(app)
  normalize_path(app.namespace, app.options[:path].first)
end

.route(methods, paths = ['/'], route_options = {}, &block) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/api/base.rb', line 24

def route(methods, paths = ['/'], route_options = {}, &block)
  actions = Array(paths).map { |path| normalize_path(namespace, path) }
  if category = route_options.delete(:feature_category)
    feature_category(category, actions)
  end

  if target = route_options.delete(:urgency)
    urgency(target, actions)
  end

  super
end

.urgency_for_app(app) ⇒ Object



12
13
14
# File 'lib/api/base.rb', line 12

def urgency_for_app(app)
  urgency_for_action(path_for_app(app))
end