Skip to content

Create new gitlab_subscriptions internal API route

What does this MR do and why?

This MR creates a new internal API for gitlab_subscriptions resource to follow the new internal endpoint path format of: '/internal/gitlab_subscriptions/...'

It copies the existing code from API::GitlabSubscriptions::Subscriptions and its corresponding spec, almost verbatim.

The older endpoint will be deprecated and removed in #473625.

Related to Issue: #463741+

Corresponding MR on CDot: https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/11122+

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  • Start the GDK and CustomersDot.

  • GitLab: Create a new top-level namespace that doesn't have gitlab_subscription

    namespace = Namespace.last
    namespace.gitlab_subscription.destroy
    namespace.id
    => 415

    CustomersDot: make the API request to create a GitLab subscription for that namespace

    # create a new subscription
    Client::GitlabApp.post(Gitlab::Api::Internal::Routes.subscription_path(415), **Gitlab::Api::Internal::Authentication.token, body: {start_date: Date.current, seats: 10, plan_code: 'premium' })
    
    # check that the subscription was created 
    Gitlab::Api::Internal::GitlabSubscription.find_by(gl_namespace_id: 415)
    
    # update the subscription seats to 20
    Client::GitlabApp.put(Gitlab::Api::Internal::Routes.subscription_path(415), **Gitlab::Api::Internal::Authentication.token, body: {seats: 20})
    
    # check that the subscription was updated 
    Gitlab::Api::Internal::GitlabSubscription.find_by(gl_namespace_id: 415)
Edited by Bishwa Hang Rai

Merge request reports

Loading