Skip to content
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

Merged
merged 4 commits into from Nov 18, 2022

Conversation

daniellemaxwell
Copy link
Contributor

@daniellemaxwell daniellemaxwell commented Nov 16, 2022

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

  • new feature
  • bug fix
  • documentation
  • testing
  • technical debt
  • other (describe)

Acceptance criteria

Describe how reviewers can test this change to be sure that it works correctly. Add a checklist if possible.

Author checklist

  • I have manually tested the change and/or added automation in the form of unit tests or integration tests
  • I have updated the dependencies list
  • I have recompiled and included new protocol buffers to reflect changes I made
  • I have added new test fixtures as needed to support added tests
  • Check this box if a reviewer can merge this pull request after approval (leave it unchecked if you want to do it yourself)
  • I have moved the associated Shortcut story to "Ready for Review"

Reviewer(s) checklist

  • Any new user-facing content that has been added for this PR has been QA'ed to ensure correct grammar, spelling, and understandability.

@codecov
Copy link

codecov bot commented Nov 16, 2022

Codecov Report

Merging #60 (e233473) into main (4be32f0) will decrease coverage by 0.21%.
The diff coverage is n/a.

❗ Current head e233473 differs from pull request most recent head 3fde745. Consider uploading reports for the commit 3fde745 to get more accurate results

@@            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     
Flag Coverage Δ
unittests 50.47% <ø> (-0.22%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...om/rotationalio/ensign/pkg/tenant/api/v1/client.go 41.86% <0.00%> (-0.63%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #10359: APIKey Resource Create/List API.

}

type APIKey struct {
ID int `json:"id,omitempty"`
Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@daniellemaxwell daniellemaxwell marked this pull request as ready for review November 17, 2022 21:19
Copy link
Contributor

@bbengfort bbengfort left a 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!

}

type APIKey struct {
ID int `json:"id,omitempty"`
Copy link
Contributor

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.

@daniellemaxwell daniellemaxwell merged commit 424d29d into main Nov 18, 2022
@daniellemaxwell daniellemaxwell deleted the sc-10359/apikey-create-list branch November 18, 2022 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants