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

satellite/console: Added error for adding api key with existing name attempt. #3185

Merged
merged 7 commits into from Oct 10, 2019

Conversation

Barterio
Copy link
Contributor

@Barterio Barterio commented Oct 4, 2019

What:
Added error for adding api key with existing name attempt
Why:

Please describe the tests:

  • Test 1:
  • Test 2:

Please describe the performance impact:

Code Review Checklist (to be filled out by reviewer)

  • Does the PR describe what changes are being made?
  • Does the PR describe why the changes are being made?
  • Does the code follow our style guide?
  • Does the code follow our testing guide?
  • Is the PR appropriately sized? (If it could be broken into smaller PRs it should be)
  • Does the new code have enough tests? (every PR should have tests or justification otherwise. Bug-fix PRs especially)
  • Does the new code have enough documentation that answers "how do I use it?" and "what does it do?"? (both source documentation and higher level, diagrams?)
  • Does any documentation need updating?
  • Do the database access patterns make sense?

@Barterio Barterio requested a review from a team October 4, 2019 14:35
@cla-bot cla-bot bot added the cla-signed label Oct 4, 2019
@ghost ghost requested review from coyle and VinozzZ and removed request for a team October 4, 2019 14:35
@Barterio Barterio added Request Code Review Code review requested Reviewer Can Merge If all checks have passed, non-owner can merge PR labels Oct 7, 2019
@Barterio Barterio requested review from crawter and removed request for coyle October 7, 2019 12:01
@Barterio Barterio added Do Not Merge and removed Request Code Review Code review requested Reviewer Can Merge If all checks have passed, non-owner can merge PR labels Oct 9, 2019
@Barterio Barterio added Request Code Review Code review requested Reviewer Can Merge If all checks have passed, non-owner can merge PR and removed Do Not Merge labels Oct 9, 2019
mniewrzal
mniewrzal previously approved these changes Oct 9, 2019
@@ -779,6 +779,11 @@ func (s *Service) CreateAPIKey(ctx context.Context, projectID uuid.UUID, name st
return nil, nil, ErrUnauthorized.Wrap(err)
}

_, err = s.store.APIKeys().GetByNameAndProjectID(ctx, name, projectID)
if err == nil {
return nil, nil, errs.New("An API Key with this name already exists in this project, please use a different name")
Copy link
Contributor

Choose a reason for hiding this comment

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

error message should start with lowercase

mniewrzal
mniewrzal previously approved these changes Oct 9, 2019
@@ -779,6 +779,11 @@ func (s *Service) CreateAPIKey(ctx context.Context, projectID uuid.UUID, name st
return nil, nil, ErrUnauthorized.Wrap(err)
}

_, err = s.store.APIKeys().GetByNameAndProjectID(ctx, name, projectID)
if err == nil {
return nil, nil, errs.New("an API Key with this name already exists in this project, please use a different name")
Copy link
Contributor

Choose a reason for hiding this comment

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

place err message to constant

mniewrzal
mniewrzal previously approved these changes Oct 10, 2019
@Barterio Barterio merged commit 5f775b9 into master Oct 10, 2019
@Barterio Barterio deleted the ba/api_key_existing_name branch October 10, 2019 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed Request Code Review Code review requested Reviewer Can Merge If all checks have passed, non-owner can merge PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants