Skip to content

CLOUDP-57841: Delete dbusers C/OM #57

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

Merged
merged 5 commits into from
Mar 20, 2020
Merged

CLOUDP-57841: Delete dbusers C/OM #57

merged 5 commits into from
Mar 20, 2020

Conversation

gssbzn
Copy link
Collaborator

@gssbzn gssbzn commented Mar 20, 2020

Proposed changes

Jira ticket: CLOUDP-57841

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code

@gssbzn gssbzn requested a review from andreaangiolillo March 20, 2020 09:35
@@ -58,7 +59,7 @@ func (opts *atlasDBUsersCreateOpts) Run() error {

func (opts *atlasDBUsersCreateOpts) newDatabaseUser() *atlas.DatabaseUser {
return &atlas.DatabaseUser{
DatabaseName: convert.AdminDB,
DatabaseName: opts.authDB,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we missed this in the last PR

@@ -24,7 +25,7 @@ import (

const (
fallbackSuccessMessage = "'%s' deleted\n"
fallbackFailMessage = "'%s' not deleted\n"
fallbackFailMessage = "entry not deleted"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

other fail messages don't interpolate so making the fall back compatible

// that should perform the deletion from the store.
func (opts *deleteOpts) DeleteFromProject(d DeleterFromProject, projectID string) error {
func (opts *deleteOpts) Delete(d interface{}, a ...string) error {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this function can do now all three functions

var err error
fmt.Printf("%#v", d)
switch f := d.(type) {
case func(string) error:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

for some reason I could not use types here so getting rid of them

Comment on lines +112 to +125
func (opts *deleteOpts) SuccessMessage() string {
if opts.successMessage != "" {
return opts.successMessage
}
return fallbackSuccessMessage
}

// FailMessage gets the set fail message or the default value
func (opts *deleteOpts) FailMessage() string {
if opts.failMessage != "" {
return opts.failMessage
}
return fallbackFailMessage
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

making this just getters and leaving the printing out

@@ -0,0 +1,99 @@
package convert
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we were missing tests for this

return nil
var err error
fmt.Printf("%#v", d)
switch f := d.(type) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

wow! 👏 😮

if err := opts.init(); err != nil {
return err
}
opts.entry = args[0]
Copy link
Collaborator

Choose a reason for hiding this comment

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

[qa] Do you think it is better to set the arg inside PreRun or Run?. I am quite sure that we are setting that arg inside Run in other commands. We should decide one place and change all the other commands in accordance with that decision. I honestly think that the preRun would be a better place 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah we definitely need to agree on this, I've moved it around based on need, the prompt makes sense to run on the pre run so we need the entry set before prompting, but some validations don't run before preRun, I know flags don't do it but I can't remember if the number of args validation does, if we can confirm it does then we should move them all to a preRun

Copy link
Collaborator

@andreaangiolillo andreaangiolillo left a comment

Choose a reason for hiding this comment

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

LGTM. I have just a couple of questions.

@gssbzn
Copy link
Collaborator Author

gssbzn commented Mar 20, 2020

@andreaangiolillo RFAL

Copy link
Collaborator

@andreaangiolillo andreaangiolillo left a comment

Choose a reason for hiding this comment

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

LGTM

@gssbzn gssbzn merged commit f3c1934 into master Mar 20, 2020
@gssbzn gssbzn deleted the CLOUDP-57841 branch March 20, 2020 10:28
corryroot pushed a commit to corryroot/mongodb-atlas-cli that referenced this pull request Jun 15, 2023
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.

2 participants