Commit 3ee56f67 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch '346803-set-low-custom-error-budget-thresholds-apis' into 'master'

Set 'Low' Custom Error Budget Thresholds - APIs

See merge request gitlab-org/gitlab!76294
parents 8e6d996b bfbb962b
...@@ -8,6 +8,13 @@ module API ...@@ -8,6 +8,13 @@ module API
before { authenticate! } before { authenticate! }
urgency :low, [
'/projects/:id/merge_requests/:noteable_id/discussions',
'/projects/:id/merge_requests/:noteable_id/discussions/:discussion_id',
'/projects/:id/merge_requests/:noteable_id/discussions/:discussion_id/notes',
'/projects/:id/merge_requests/:noteable_id/discussions/:discussion_id/notes/:note_id'
]
Helpers::DiscussionsHelpers.feature_category_per_noteable_type.each do |noteable_type, feature_category| Helpers::DiscussionsHelpers.feature_category_per_noteable_type.each do |noteable_type, feature_category|
parent_type = noteable_type.parent_class.to_s.underscore parent_type = noteable_type.parent_class.to_s.underscore
noteables_str = noteable_type.to_s.underscore.pluralize noteables_str = noteable_type.to_s.underscore.pluralize
......
...@@ -38,7 +38,7 @@ module API ...@@ -38,7 +38,7 @@ module API
requires :version_id, type: Integer, desc: 'The ID of a merge request diff version' requires :version_id, type: Integer, desc: 'The ID of a merge request diff version'
end end
get ":id/merge_requests/:merge_request_iid/versions/:version_id" do get ":id/merge_requests/:merge_request_iid/versions/:version_id", urgency: :low do
merge_request = find_merge_request_with_access(params[:merge_request_iid]) merge_request = find_merge_request_with_access(params[:merge_request_iid])
present_cached merge_request.merge_request_diffs.find(params[:version_id]), with: Entities::MergeRequestDiffFull, cache_context: nil present_cached merge_request.merge_request_diffs.find(params[:version_id]), with: Entities::MergeRequestDiffFull, cache_context: nil
......
...@@ -134,7 +134,7 @@ module API ...@@ -134,7 +134,7 @@ module API
use :merge_requests_params use :merge_requests_params
use :optional_scope_param use :optional_scope_param
end end
get feature_category: :code_review do get feature_category: :code_review, urgency: :low do
authenticate! unless params[:scope] == 'all' authenticate! unless params[:scope] == 'all'
validate_anonymous_search_access! if params[:search].present? validate_anonymous_search_access! if params[:search].present?
merge_requests = find_merge_requests merge_requests = find_merge_requests
...@@ -155,7 +155,7 @@ module API ...@@ -155,7 +155,7 @@ module API
optional :non_archived, type: Boolean, desc: 'Return merge requests from non archived projects', optional :non_archived, type: Boolean, desc: 'Return merge requests from non archived projects',
default: true default: true
end end
get ":id/merge_requests", feature_category: :code_review do get ":id/merge_requests", feature_category: :code_review, urgency: :low do
validate_anonymous_search_access! if declared_params[:search].present? validate_anonymous_search_access! if declared_params[:search].present?
merge_requests = find_merge_requests(group_id: user_group.id, include_subgroups: true) merge_requests = find_merge_requests(group_id: user_group.id, include_subgroups: true)
...@@ -195,7 +195,7 @@ module API ...@@ -195,7 +195,7 @@ module API
use :merge_requests_params use :merge_requests_params
optional :iids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The IID array of merge requests' optional :iids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The IID array of merge requests'
end end
get ":id/merge_requests", feature_category: :code_review do get ":id/merge_requests", feature_category: :code_review, urgency: :low do
authorize! :read_merge_request, user_project authorize! :read_merge_request, user_project
validate_anonymous_search_access! if declared_params[:search].present? validate_anonymous_search_access! if declared_params[:search].present?
...@@ -222,7 +222,7 @@ module API ...@@ -222,7 +222,7 @@ module API
desc: 'The target project of the merge request defaults to the :id of the project' desc: 'The target project of the merge request defaults to the :id of the project'
use :optional_params use :optional_params
end end
post ":id/merge_requests", feature_category: :code_review do post ":id/merge_requests", feature_category: :code_review, urgency: :low do
Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/20770') Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/20770')
authorize! :create_merge_request_from, user_project authorize! :create_merge_request_from, user_project
...@@ -244,7 +244,7 @@ module API ...@@ -244,7 +244,7 @@ module API
params do params do
requires :merge_request_iid, type: Integer, desc: 'The IID of a merge request' requires :merge_request_iid, type: Integer, desc: 'The IID of a merge request'
end end
delete ":id/merge_requests/:merge_request_iid", feature_category: :code_review do delete ":id/merge_requests/:merge_request_iid", feature_category: :code_review, urgency: :low do
merge_request = find_project_merge_request(params[:merge_request_iid]) merge_request = find_project_merge_request(params[:merge_request_iid])
authorize!(:destroy_merge_request, merge_request) authorize!(:destroy_merge_request, merge_request)
...@@ -263,7 +263,7 @@ module API ...@@ -263,7 +263,7 @@ module API
desc 'Get a single merge request' do desc 'Get a single merge request' do
success Entities::MergeRequest success Entities::MergeRequest
end end
get ':id/merge_requests/:merge_request_iid', feature_category: :code_review do get ':id/merge_requests/:merge_request_iid', feature_category: :code_review, urgency: :low do
merge_request = find_merge_request_with_access(params[:merge_request_iid]) merge_request = find_merge_request_with_access(params[:merge_request_iid])
present merge_request, present merge_request,
...@@ -279,7 +279,7 @@ module API ...@@ -279,7 +279,7 @@ module API
desc 'Get the participants of a merge request' do desc 'Get the participants of a merge request' do
success Entities::UserBasic success Entities::UserBasic
end end
get ':id/merge_requests/:merge_request_iid/participants', feature_category: :code_review do get ':id/merge_requests/:merge_request_iid/participants', feature_category: :code_review, urgency: :low do
merge_request = find_merge_request_with_access(params[:merge_request_iid]) merge_request = find_merge_request_with_access(params[:merge_request_iid])
participants = ::Kaminari.paginate_array(merge_request.participants) participants = ::Kaminari.paginate_array(merge_request.participants)
...@@ -290,7 +290,7 @@ module API ...@@ -290,7 +290,7 @@ module API
desc 'Get the commits of a merge request' do desc 'Get the commits of a merge request' do
success Entities::Commit success Entities::Commit
end end
get ':id/merge_requests/:merge_request_iid/commits', feature_category: :code_review do get ':id/merge_requests/:merge_request_iid/commits', feature_category: :code_review, urgency: :low do
merge_request = find_merge_request_with_access(params[:merge_request_iid]) merge_request = find_merge_request_with_access(params[:merge_request_iid])
commits = commits =
...@@ -371,7 +371,7 @@ module API ...@@ -371,7 +371,7 @@ module API
desc 'Show the merge request changes' do desc 'Show the merge request changes' do
success Entities::MergeRequestChanges success Entities::MergeRequestChanges
end end
get ':id/merge_requests/:merge_request_iid/changes', feature_category: :code_review do get ':id/merge_requests/:merge_request_iid/changes', feature_category: :code_review, urgency: :low do
merge_request = find_merge_request_with_access(params[:merge_request_iid]) merge_request = find_merge_request_with_access(params[:merge_request_iid])
present merge_request, present merge_request,
...@@ -422,7 +422,7 @@ module API ...@@ -422,7 +422,7 @@ module API
use :optional_params use :optional_params
at_least_one_of(*::API::MergeRequests.update_params_at_least_one_of) at_least_one_of(*::API::MergeRequests.update_params_at_least_one_of)
end end
put ':id/merge_requests/:merge_request_iid', feature_category: :code_review do put ':id/merge_requests/:merge_request_iid', feature_category: :code_review, urgency: :low do
Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/20772') Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/20772')
merge_request = find_merge_request_with_access(params.delete(:merge_request_iid), :update_merge_request) merge_request = find_merge_request_with_access(params.delete(:merge_request_iid), :update_merge_request)
...@@ -454,7 +454,7 @@ module API ...@@ -454,7 +454,7 @@ module API
optional :sha, type: String, desc: 'When present, must have the HEAD SHA of the source branch' optional :sha, type: String, desc: 'When present, must have the HEAD SHA of the source branch'
optional :squash, type: Grape::API::Boolean, desc: 'When true, the commits will be squashed into a single commit on merge' optional :squash, type: Grape::API::Boolean, desc: 'When true, the commits will be squashed into a single commit on merge'
end end
put ':id/merge_requests/:merge_request_iid/merge', feature_category: :code_review do put ':id/merge_requests/:merge_request_iid/merge', feature_category: :code_review, urgency: :low do
Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/4796') Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/4796')
merge_request = find_project_merge_request(params[:merge_request_iid]) merge_request = find_project_merge_request(params[:merge_request_iid])
...@@ -524,7 +524,7 @@ module API ...@@ -524,7 +524,7 @@ module API
params do params do
optional :skip_ci, type: Boolean, desc: 'Do not create CI pipeline' optional :skip_ci, type: Boolean, desc: 'Do not create CI pipeline'
end end
put ':id/merge_requests/:merge_request_iid/rebase', feature_category: :code_review do put ':id/merge_requests/:merge_request_iid/rebase', feature_category: :code_review, urgency: :low do
merge_request = find_project_merge_request(params[:merge_request_iid]) merge_request = find_project_merge_request(params[:merge_request_iid])
authorize_push_to_merge_request!(merge_request) authorize_push_to_merge_request!(merge_request)
...@@ -543,7 +543,7 @@ module API ...@@ -543,7 +543,7 @@ module API
params do params do
use :pagination use :pagination
end end
get ':id/merge_requests/:merge_request_iid/closes_issues', feature_category: :code_review do get ':id/merge_requests/:merge_request_iid/closes_issues', feature_category: :code_review, urgency: :low do
merge_request = find_merge_request_with_access(params[:merge_request_iid]) merge_request = find_merge_request_with_access(params[:merge_request_iid])
issues = ::Kaminari.paginate_array(merge_request.visible_closing_issues_for(current_user)) issues = ::Kaminari.paginate_array(merge_request.visible_closing_issues_for(current_user))
issues = paginate(issues) issues = paginate(issues)
......
...@@ -7,6 +7,11 @@ module API ...@@ -7,6 +7,11 @@ module API
before { authenticate! } before { authenticate! }
urgency :low, [
'/projects/:id/merge_requests/:noteable_id/notes',
'/projects/:id/merge_requests/:noteable_id/notes/:note_id'
]
Helpers::NotesHelpers.feature_category_per_noteable_type.each do |noteable_type, feature_category| Helpers::NotesHelpers.feature_category_per_noteable_type.each do |noteable_type, feature_category|
parent_type = noteable_type.parent_class.to_s.underscore parent_type = noteable_type.parent_class.to_s.underscore
noteables_str = noteable_type.to_s.underscore.pluralize noteables_str = noteable_type.to_s.underscore.pluralize
......
...@@ -24,7 +24,7 @@ module API ...@@ -24,7 +24,7 @@ module API
use :pagination use :pagination
end end
get ":id/#{eventables_str}/:eventable_id/resource_label_events", feature_category: feature_category do get ":id/#{eventables_str}/:eventable_id/resource_label_events", feature_category: feature_category, urgency: :low do
eventable = find_noteable(eventable_type, params[:eventable_id]) eventable = find_noteable(eventable_type, params[:eventable_id])
events = eventable.resource_label_events.inc_relations events = eventable.resource_label_events.inc_relations
......
...@@ -26,7 +26,7 @@ module API ...@@ -26,7 +26,7 @@ module API
use :pagination use :pagination
end end
get ":id/#{eventables_str}/:eventable_id/resource_milestone_events", feature_category: feature_category do get ":id/#{eventables_str}/:eventable_id/resource_milestone_events", feature_category: feature_category, urgency: :low do
eventable = find_noteable(eventable_type, params[:eventable_id]) eventable = find_noteable(eventable_type, params[:eventable_id])
events = ResourceMilestoneEventFinder.new(current_user, eventable).execute events = ResourceMilestoneEventFinder.new(current_user, eventable).execute
......
...@@ -25,7 +25,7 @@ module API ...@@ -25,7 +25,7 @@ module API
use :pagination use :pagination
end end
get ":id/#{eventable_name.pluralize}/:eventable_iid/resource_state_events", feature_category: feature_category do get ":id/#{eventable_name.pluralize}/:eventable_iid/resource_state_events", feature_category: feature_category, urgency: :low do
eventable = find_noteable(eventable_class, params[:eventable_iid]) eventable = find_noteable(eventable_class, params[:eventable_iid])
events = ResourceStateEventFinder.new(current_user, eventable).execute events = ResourceStateEventFinder.new(current_user, eventable).execute
......
...@@ -14,7 +14,7 @@ module API ...@@ -14,7 +14,7 @@ module API
requires :id, type: String, desc: 'The suggestion ID' requires :id, type: String, desc: 'The suggestion ID'
optional :commit_message, type: String, desc: "A custom commit message to use instead of the default generated message or the project's default message" optional :commit_message, type: String, desc: "A custom commit message to use instead of the default generated message or the project's default message"
end end
put ':id/apply' do put ':id/apply', urgency: :low do
suggestion = Suggestion.find_by_id(params[:id]) suggestion = Suggestion.find_by_id(params[:id])
if suggestion if suggestion
...@@ -31,7 +31,7 @@ module API ...@@ -31,7 +31,7 @@ module API
requires :ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: "An array of suggestion ID's" requires :ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: "An array of suggestion ID's"
optional :commit_message, type: String, desc: "A custom commit message to use instead of the default generated message or the project's default message" optional :commit_message, type: String, desc: "A custom commit message to use instead of the default generated message or the project's default message"
end end
put 'batch_apply' do put 'batch_apply', urgency: :low do
ids = params[:ids] ids = params[:ids]
suggestions = Suggestion.id_in(ids) suggestions = Suggestion.id_in(ids)
......
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