Skip to content

Move UpcomingReconciliation APIs to internal API definition

Josianne Hyson requested to merge jh/auth_for_non_internal_apis into master

What does this MR do and why?

Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/466368+

Move CustomersDot APIs to internal API definition

These APIs are only intended to be consumed by CustomersDot. Make this extra clear by moving them to the Internal API file definition.

There shouldn't otherwise be any behaviour change here, as the path is unchanged.

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 CustomersDot and the GDK.

  1. GitLab: find the ID of a top level namespace
  2. CustomersDot: Start a rails console
  3. CustomersDot: verify the creation
    # update reconciliations
    irb(main):001> Client::GitlabApp.put("/api/v4/internal/upcoming_reconciliations", body: { upcoming_reconciliations: [ { namespace_id: 3488, next_reconciliation_date: 1.week.from_now.to_date, display_alert_from: Date.tomorrow } ]  }, token: Client::GitlabApp::ADMIN_API_TOKEN)
    => 200
  4. Gitlab: verify the reconciliation was created
    irb(main):001:0> GitlabSubscriptions::UpcomingReconciliation.last
    =>
    #<GitlabSubscriptions::UpcomingReconciliation:0x000000015f3ffb50
     id: 4,
     namespace_id: 3488,
     next_reconciliation_date: Fri, 16 Aug 2024,
     display_alert_from: Sat, 10 Aug 2024,
     created_at: Fri, 09 Aug 2024 04:42:03.040454000 UTC +00:00,
     updated_at: Fri, 09 Aug 2024 04:42:03.040454000 UTC +00:00,
     organization_id: 1>
  5. CustomersDot: verify the deletion still works
    # delete reconciliation
    irb(main):001> Client::GitlabApp.delete("/api/v4/internal/upcoming_reconciliations?namespace_id=3488", token: Client::GitlabApp::ADMIN_API_TOKEN)
    => #<HTTParty::Response:0x6687a8 parsed_response=nil, @response=#<Net::HTTPNoContent 204 No Content readbody=true>, @headers={"date"=>["Fri, 09 Aug 2024 04:45:23 GMT"], "cache-control"=>["no-cache"], "content-encoding"=>["gzip"], "vary"=>["Origin"], "content-security-policy"=>["default-src 'none'"], "x-content-type-options"=>["nosniff"], "x-frame-options"=>["SAMEORIGIN"], "x-gitlab-meta"=>["{\"correlation_id\":\"01J4TQ99RJYD6A8PVTSREEC781\",\"version\":\"1\"}"], "x-request-id"=>["01J4TQ99RJYD6A8PVTSREEC781"], "x-runtime"=>["0.081215"]}>
Edited by Josianne Hyson

Merge request reports

Loading