cloudfoundry / cloudfoundry/stratos

Tidy up API paths, create OpenAPI spec

Open
#4,532 0 comments 0 reactions 2 assignees View on GitHub

@ikapelyukhin is already working on this.

Since Aug 25, 2020.

Dominant language
TypeScript
Stars
267
Forks
137
Avg merge
5h 14m
Merged PRs (30d)
77

Description

Now that we have API Keys, we should take the time to tidy up the core Stratos API.

We still have references to cnsis instead of endpoints, which should be renamed.

This will impact the frontend code and e2e tests - should be fairly mechanical.

The current backend prefix for requests is /pp/v1/ - I suggest we change that to /api/v1.

Suggest we make available the following APIs using API Keys: (with suggested renames, but feel free to consider alternatives)

  • POST /pp/v1/auth/login/cnsi -> /api/v1/tokens
  • POST /pp/v1/auth/logout/cnsi -> DELETE /api/v1/tokens/ID (note: ID is currently supplied via a header)
  • GET /pp/v1/cnsis -> /api/v1/endpoints
  • GET /pp/v1/cnsis/registered -> /api/v1/endpoints/connected (NOTE: I don't believe we use this any more, so we should check and remove)
  • POST /pp/v1/register/ENDPOINT_TYPE -> /api/v1/endpoints (endpoint type should be in the request, not as a param)
  • POST /pp/v1/endpoint/ID -> POST /api/v1/endpoints/ID
  • POST /pp/v1/unregister -> DELETE /api/v1/endpoints/ID (note: ID is currently supplied via a header)

Note: the endpoint registration routes in main.go (around line 959) currently adds a route for each endpoint type - we should change this to be a single route that checks that the endpoint type is supported and then uses the appropriate plugin to do the work - since in the above, the proposal is a single API fo registering endpoints.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.