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

Detail and delete api key tenant handlers #116

Merged
merged 2 commits into from Jan 25, 2023
Merged

Detail and delete api key tenant handlers #116

merged 2 commits into from Jan 25, 2023

Conversation

pdeziel
Copy link
Contributor

@pdeziel pdeziel commented Jan 24, 2023

Scope of changes

This implements the detail and delete api key tenant handlers. These should be pretty straightforward given the pattern setup in SC-10407.

There was also a slight change to ProjectAPIKeyList which should also be reviewed.

Fixes SC-10411

Type of change

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

Acceptance criteria

The endpoint handlers make sense given the TODOs in the code.

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.

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #10411: Implement APIKey Resource Detail/Delete Handlers.

Modified: key.Modified.Format(time.RFC3339Nano),
ID: key.ID.String(),
ClientID: key.ClientID,
Name: key.Name,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List is only supposed to return some of the fields (see the quarterdeck implementation) so I've updated the handler to reflect that.


// Delete the API key using Quarterdeck
// TODO: Handle error status codes returned by Quarterdeck
if err = s.quarterdeck.APIKeyDelete(ctx, apiKeyID); err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that quarterdeck will actually return 404 if the API key is not in the user's organization (to prevent users deleting keys from other organizations). However, we should probably be handling the different error cases that get returned from Quarterdeck so I've added some TODOs in this file.

return
}

c.JSON(http.StatusNoContent, nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be replaced with c.Status(http.StatusNoContent) or does nil need to be returned here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks for catching this!

Copy link
Contributor

@daniellemaxwell daniellemaxwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for providing comments in the PR! I have one small question, but this is good to go.

@pdeziel pdeziel merged commit 0d112ea into main Jan 25, 2023
@pdeziel pdeziel deleted the sc-10411 branch January 25, 2023 16:29
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