Add API for creating limit exclusions

What does this MR do and why?

Adds an admin-only API endpoint for creating Namespaces::Storage::LimitExclusions records relating to a Namespace

  • POST /namespaces/:id/storage/limit_exclusion - create a new exclusion

Eventually we'll also add DELETE and GET endpoints (!116531 (merged), !116532 (merged) - separate MRs to keep the diff easier to review)

This endpoint will be used by an admin-only frontend UI as part of https://gitlab.com/groups/gitlab-org/-/epics/9173

Docs preview: https://gitlab.com/gitlab-org/gitlab/-/blob/dbbd9ada6492d2410784549cda1bba32bc9ed6d0/doc/development/internal_api/index.md#storage-limit-exclusions

Testing

Replace :id and :your-pat (for an admin user) in the below cURL accordingly:

curl --request POST \
  --url http://gdk.test:3000/api/v4/namespaces/:id/storage/limit_exclusion \
  --header 'Content-Type: application/json' \
  --header 'PRIVATE-TOKEN: :your-pat' \
  --data '{
	"reason": "testing an exclusion"
}'

Refs https://gitlab.com/gitlab-org/gitlab/-/issues/385740

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vijay Hawoldar

Merge request reports

Loading