-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add how to define new endpoints in web for api-versioning.md #50743
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,6 +146,37 @@ func (h *Handler) getFoos() (interface{}, error) { | |
} | ||
``` | ||
|
||
#### Defining new endpoints in the web client | ||
All endpoints should be defined in a JS object, similary done [here](https://github.com/gravitational/teleport.e/blob/ebf079267020d59f14353dd3495b4fd783339fa5/web/teleport/src/config.ts#L134). | ||
|
||
This helps us tell apart same paths but with different HTTP verbs. | ||
|
||
Example of a new single endpoint: | ||
|
||
```ts | ||
user: { | ||
create: '/v1/webapi/users', | ||
} | ||
``` | ||
|
||
Example of an endpoint with same paths but with different verbs: | ||
|
||
```ts | ||
user: { | ||
create: '/v1/webapi/users', | ||
update: '/v1/webapi/users', | ||
} | ||
``` | ||
|
||
Example of creating a version N endpoint: | ||
```ts | ||
user: { | ||
// TODO(<your-github-handle>): DELETE IN 18.0 - replaced by /v2/webapi/users | ||
create: '/v1/webapi/users', | ||
createV2: '/v2/webapi/users', | ||
} | ||
Comment on lines
+192
to
+195
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we'd only need the So I think this specific pattern is fine, I just don't think we'll be using it too often There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. got it, i think you wanted me to leave some comment about marking it for deletion only if we need a fallback right? which i did here: https://github.com/gravitational/teleport/pull/50743/files#diff-7852f06643f466fb42c702c6f8bb51f67339dbb53e40629bce1c2a69918d1d0dR188 |
||
``` | ||
|
||
### Removing an endpoint | ||
An endpoint can be removed in a major version n+2, where n is the last major | ||
version where the endpoint was used. | ||
|
@@ -269,4 +300,4 @@ tab was available in clients that _may_ have been communicating with proxies | |
older than the required version. So a check was made to see if that proxy | ||
supported pinned resources, and if it wasn't, made the error known to the user | ||
that "Pinned Resources is supported by proxies version 14.1+" (or something like | ||
that). | ||
that). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.