-
Notifications
You must be signed in to change notification settings - Fork 72
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
Connector type list #1641
Connector type list #1641
Conversation
05b1d2f
to
baf97d7
Compare
@@ -36,6 +37,8 @@ func NewConnectorsCommand(f *factory.Factory) *cobra.Command { | |||
use.NewUseCommand(f), | |||
start.NewStartCommand(f), | |||
stop.NewStopCommand(f), | |||
connector_type.NewTypeCommand(f), |
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.
Wrong naming format :D
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.
This is due to type
being a reserved word in go. I just went with connector_type instead.
|
||
if err != nil { | ||
switch httpRes.StatusCode { | ||
case http.StatusUnauthorized: |
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.
This is antipattern. We should not use status codes for validation. We should use error codes
.
See kafka create for example
|
||
flags := connectorcmdutil.NewFlagSet(cmd, f) | ||
flags.AddOutput(&opts.outputFormat) | ||
flags.IntVar(&opts.limit, "limit", 150, f.Localizer.MustLocalize("connector.type.list.flag.page.description")) |
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 think we should use build package limits here as in other implementations
flags.AddOutput(&opts.outputFormat) | ||
flags.IntVar(&opts.limit, "limit", 150, f.Localizer.MustLocalize("connector.type.list.flag.page.description")) | ||
flags.StringVar(&opts.search, "search", DefaultSearch, f.Localizer.MustLocalize("connector.type.list.flag.search.description")) | ||
flags.IntVar(&opts.page, "page", 1, f.Localizer.MustLocalize("connector.type.list.flag.page.description")) |
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.
Is pagination starting from 0? :)
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.
afaik 1 is the start and when passing 0 it just gives the same output as 1 anyway
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.
Yes. That is common pattern
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.
Works. Minor stuff reported
Can be fixed on separate PR |
Verification Steps
rhoas connector type list
rhoas connector type list --output=yaml
rhoas connector type list --limit=5
rhoas connector type list --search=Amazon%
rhoas connector type list --limit=15 --page=2
Type of change