Skip to content

Create internal namespace api

Shreyas Agarwal requested to merge 9771-create-internal-endpoint into master

What does this MR do and why?

The MR introduces two new internal API requests, a GET and PUT, for namespaces. From within the CDot application, we have been requesting the public API for namespaces which requires the token the user requesting the API.

The new internal API gets away from the requirement of having current user and would work with only admin token.

Most the code reference is same of that of the public API and no new query or table was introduced.

How to set up and validate locally

  1. Checkout this branch and run the gdk server
  2. Go to CustomersDot and and open up console bin/rails c
  3. Run the following commands
Client::GitlabApp.get("/api/v4/internal/gitlab_subscriptions/namespaces/1", { token: Client::GitlabApp::ADMIN_API_TOKEN })
=> {"id"=>1,
 "name"=>"Administrator",
 "path"=>"root",
 "kind"=>"user",
 "full_path"=>"root",
 "parent_id"=>nil,
 "avatar_url"=>"https://www.gravatar.com/avatar/258d8dc916db8cea2cafb6c3cd0cb0246efe061421dbd83ec3a350428cabda4f?s=80&d=identicon",
 "web_url"=>"http://127.0.0.1:3000/root",
 "shared_runners_minutes_limit"=>nil,
 "extra_shared_runners_minutes_limit"=>nil,
 "additional_purchased_storage_size"=>0,
 "additional_purchased_storage_ends_on"=>nil,
 "billable_members_count"=>1,
 "seats_in_use"=>1,
 "max_seats_used"=>0,
 "max_seats_used_changed_at"=>nil,
 "end_date"=>nil,
 "plan"=>"free",
 "trial_ends_on"=>nil,
 "trial"=>false}

Related to https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/9771

Edited by Shreyas Agarwal

Merge request reports