-
Notifications
You must be signed in to change notification settings - Fork 80
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
CLOUDP-289219: Create CLI commands for manipulating stream processors #3496
base: master
Are you sure you want to change the base?
Conversation
22ef83a
to
e916573
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.
Next time, it might be a little easier to review if we break down the commits into each command or each command into their own PR :)
Dropping comments because I think I have gone through all of the create
command. I haven't looked but I will try not to leave the same comments on the other commands if they have the same issues. I will continue looking at the other commands and try to only leave net new stuff
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.
E2E tests reviewed
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.
Delete and Describe reviewed
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.
Start and Stop reviewed
This PR has gone 30 days without any activity and meets the project’s definition of "stale". This will be auto-closed if there is no new activity over the next 30 days. If the issue is still relevant and active, you can simply comment with a "bump" to keep it open, or add the label "not_stale". Thanks for keeping our repository healthy! |
@auddin431 this is currently mark as stale by our bots, are you still working on this? |
@gssbzn yep im still working on this, was out for a while during holidays and got occupied with other tickets. Will push out requested changes in the next day or two |
e916573
to
c9887a4
Compare
evergreen keep-definitions |
return nil, err | ||
} | ||
|
||
if processor.Name == nil { |
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.
if processor.Name == nil { | |
if len(processor.Name) == 0 { |
you may want to validate empty strings
} | ||
|
||
// atlas streams processor create [--projectId projectId]. | ||
func CreateBuilder() *cobra.Command { |
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.
does this command need a --watch
as in are the changes applied on create or does it take a while to be effective? see
cli.WatchOpts |
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.
Hm, I know cluster creation can be a very lengthy process so I see why it's necessary for the --watch
, but this command takes about 5-10 seconds. Is there a general cutoff as to when --watch
is necessary?
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 guess the main rule would be created vs ready for use, customers that script with CLI or other tools want to know when is ready for use and for that reason we provide --watch
} | ||
|
||
func (opts *DeleteOpts) Run() error { | ||
return opts.Delete(opts.store.DeleteStreamProcessor, opts.ProjectID, opts.Instance) |
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 opts.Delete(opts.store.DeleteStreamProcessor, opts.ProjectID, opts.Instance) | |
return opts.Delete(opts.store.DeleteStreamProcessor, opts.ConfigProjectID(), opts.Instance) |
here and everywhere else you do opts.ProjectID
, project id is layered, it can come from config, env or flag, using th emethod ConfigProjectID()
will make sure to use the correct one other wise you are looking only to the flag values
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.
Looks pretty good
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.
Looks good
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'm finding a bit confusing that some commands don't follow the general output logic of the CLI
if err := createOpts.Run(); err != nil { | ||
t.Fatalf("Run() unexpected error: %v", err) | ||
} |
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.
since using testify
to keep it consistent
if err := createOpts.Run(); err != nil { | |
t.Fatalf("Run() unexpected error: %v", err) | |
} | |
require.NoError(createOpts.Run()) |
opts.Output = jsonOutput | ||
if opts.includeStats { | ||
return opts.Print(r) | ||
} |
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.
why overloading output options with your own option?
opts.Output = jsonOutput | ||
if opts.includeStats { | ||
return opts.Print(*r.Results) | ||
} |
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.
same question? why is this a custom way to output instead of the standard --out|-o
?
return opts.Print(*r.Results) | ||
} | ||
|
||
for _, res := range *r.Results { |
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.
don't use pointers, use getters https://github.com/mongodb/atlas-sdk-go/blob/main/docs/doc_5_best_practices.md#using-getters-instead-of-direct-field-access
for _, res := range *r.Results { | |
for _, res := range r.GetResults() { |
return opts.Print(*r.Results) | ||
} | ||
|
||
for _, res := range *r.Results { |
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.
why are you iterating for the print? why don't you define a template that can handle the envelop object?
Proposed changes
This work adds the noun
processors
to the top level nounstreams
so that stream processors can be interacted with through the CLI. Theprocessors
noun has the following verbs:Jira ticket: CLOUDP-289219
Checklist
make fmt
and formatted my code