-
Notifications
You must be signed in to change notification settings - Fork 5
Conversation
refactor the cli of the smtp-service to have a structure more similar to the default cobra generated file structure. along with this, other changes have been made: - output a secret on the 'refresh' command - allow the secret name to be overridden on 'create' and 'refresh' - change the default output secret name to 'redhat-rhmi-smtp' - change the debug flow to be a single 'debug' boolean flag verification: - for each subcommand: 'create', 'get', 'refresh', 'delete', 'version', do the following steps - run the command, ensure it succeeds - run 'create' and 'refresh' with the 'secret-name' flag set to a different string and ensure the output secret name is overridden - run any command with the 'debug' flag set to 'true' and ensure that debug and info logs are shown and they're output to stderr
from bf3f9ec the 'refresh' subcommand will now return smtpdetails rather than a string with a new api key. this change in interface resulted in tests failing. this change updates the tests to not expect a string to be returned and to expect a smtpdetails struct instead. verification: - run 'make test/unit' - ensure all tests complete successfully
1d680ea
to
c2e5ad4
Compare
@dimitraz @austinmartinh Mind taking a look? This is a minor refactor of the CLI to give it some more structure and to ensure the secret name can be overridden in |
pkg/sendgrid/sendgridapi.go
Outdated
} | ||
} | ||
if foundUser == nil { | ||
return nil, &NotExistError{Message: fmt.Sprintf("uaer with username %s not found in sendgrid subuser list", username)} |
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.
return nil, &NotExistError{Message: fmt.Sprintf("uaer with username %s not found in sendgrid subuser list", username)} | |
return nil, &NotExistError{Message: fmt.Sprintf("user with username %s not found in sendgrid subuser list", username)} |
cmd/cli/version.go
Outdated
// Here you will define your flags and configuration settings. | ||
|
||
// Cobra supports Persistent Flags which will work for this command | ||
// and all subcommands, e.g.: | ||
// versionCmd.PersistentFlags().String("foo", "", "A help for foo") | ||
|
||
// Cobra supports local flags which will only run when this command | ||
// is called directly, e.g.: | ||
// versionCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") |
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.
// Here you will define your flags and configuration settings. | |
// Cobra supports Persistent Flags which will work for this command | |
// and all subcommands, e.g.: | |
// versionCmd.PersistentFlags().String("foo", "", "A help for foo") | |
// Cobra supports local flags which will only run when this command | |
// is called directly, e.g.: | |
// versionCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") |
Should this comment block be removed?
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.
Verified with minor suggestions
remove comments generated by the cobra cli tool, these include: - license headers - flag example comments license headers can be added to all files if needed in a later commit.
result of 'make vendor/fix'
c2e5ad4
to
332648c
Compare
@austinmartinh I think I hit all those comments, mind taking one more look? |
pkg/sendgrid/sendgridapi.go
Outdated
@@ -173,7 +173,7 @@ func (c *BackendAPIClient) ListSubUsers(query map[string]string) ([]*SubUser, er | |||
query = map[string]string{} | |||
} | |||
listReq := c.restClient.BuildRequest(APIRouteSubUsers, rest.Get) | |||
listReq.QueryParams = query | |||
//listReq.QueryParams = query |
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'll delete this
remove commented code for query handling in sendgridapi.go that is no longer used.
332648c
to
e5afbea
Compare
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.
lgtm 👍
just reviewed it, happy to give it another verify if you want?
refactor the cli of the smtp-service to have a structure more
similar to the default cobra generated file structure.
along with this, other changes have been made:
verification:
'version', do the following steps
different string and ensure the output secret name is overridden
that debug and info logs are shown and they're output to stderr