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
APIKey create and list client methods #60
Conversation
Codecov Report
@@ Coverage Diff @@
## main #60 +/- ##
==========================================
- Coverage 50.69% 50.47% -0.22%
==========================================
Files 52 52
Lines 3827 3895 +68
==========================================
+ Hits 1940 1966 +26
- Misses 1638 1666 +28
- Partials 249 263 +14
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
This pull request has been linked to Shortcut Story #10359: APIKey Resource Create/List API. |
pkg/tenant/api/v1/api.go
Outdated
} | ||
|
||
type APIKey struct { | ||
ID int `json:"id,omitempty"` |
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.
I noticed in quarterdeck there's a ClientID
. I thought that the TenantID
would be the equivalent of that here, so didn't include one. However, if you think TenantID
or a ClientID
should be included, let me know.
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.
The ClientID
is like a username and it's a component of the API Key - so it's a little different than the database ID.
The way that the API Key requests work is that you can create an API key with Name and ProjectID and then you'll get back the ClientID and ClientSecret - but this is the only time that the ClientSecret will be visible in the application or to the user (after that it's gone forever). Users can update the name of the API Key, and delete it, but that's it.
We may want to take another pass at this when the quarterdeck API is complete.
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.
I appreciate the explanation. I've added ClientID
and changed KeySecret
to ClientSecret
.
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.
Thanks for updating all of those context.TODO()
elements!
pkg/tenant/api/v1/api.go
Outdated
} | ||
|
||
type APIKey struct { | ||
ID int `json:"id,omitempty"` |
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.
The ClientID
is like a username and it's a component of the API Key - so it's a little different than the database ID.
The way that the API Key requests work is that you can create an API key with Name and ProjectID and then you'll get back the ClientID and ClientSecret - but this is the only time that the ClientSecret will be visible in the application or to the user (after that it's gone forever). Users can update the name of the API Key, and delete it, but that's it.
We may want to take another pass at this when the quarterdeck API is complete.
Scope of changes
Added the following client methods and corresponding tests:
ProjectAPIKeyList
ProjectAPIKeyCreate
APIKeyList
APIKeyCreate
This is a short review that should take a few minutes.
Fixes SC-10359
Type of change
Acceptance criteria
Describe how reviewers can test this change to be sure that it works correctly. Add a checklist if possible.
Author checklist
Reviewer(s) checklist