-
Notifications
You must be signed in to change notification settings - Fork 6
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
add kafka cluster resource operations #465
base: master
Are you sure you want to change the base?
Conversation
Quality Gate passedIssues Measures |
nice work 👍 let's add some bats tests for this |
return []string{"AVAILABLE", "BUSY", "DEPLOYING", "UPDATING", "FAILED_UPDATING", "FAILED", "DESTROYING"}, cobra.ShellCompDirectiveNoFileComp | ||
}) | ||
|
||
cmd.AddStringFlag(constants.FlagLocation, "", "", "The datacenter location", core.RequiredFlagOption()) |
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 I want to list clusters across all locations, I have to make multiple list
s with multiple locations, right?
cmd.AddStringFlag(constants.FlagFilterName, "", "", "Filter used to fetch only the records that contain specified name.") | ||
cmd.AddSetFlag(constants.FlagFilterState, "", "", []string{"AVAILABLE", "BUSY", "DEPLOYING", "UPDATING", "FAILED_UPDATING", "FAILED", "DESTROYING"}, "Filter used to fetch only the records that contain specified state.") | ||
_ = cmd.Command.RegisterFlagCompletionFunc(constants.FlagFilterState, func(c *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { | ||
return []string{"AVAILABLE", "BUSY", "DEPLOYING", "UPDATING", "FAILED_UPDATING", "FAILED", "DESTROYING"}, cobra.ShellCompDirectiveNoFileComp |
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.
You don't need to add completions for Set
type flags, they're added automatically
return []string{"XS", "S", "M", "L", "XL"}, cobra.ShellCompDirectiveNoFileComp | ||
}) | ||
|
||
cmd.AddStringFlag(constants.FlagLocation, "", "", "The location of the kafka cluster", core.RequiredFlagOption()) |
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.
Could we add this as a persistent flag on the kafka
command? instead of having it on each command
Also, some users can't use completions due to the nature of their environment so we should add the possible values to the helptext of the flag
slices.Collect(maps.Keys(locationToURL))
Short: "The sub-commands of 'ionosctl kafka cluster' allow you to manage kafka clusters", | ||
Aliases: []string{"cl"}, | ||
TraverseChildren: true, | ||
}, |
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.
}, | |
PersistentPreRun: func(cmd *cobra.Command, args []string) { | |
location, _ := cmd.Flags().GetString(constants.FlagLocation) | |
changeLocation(client.Must().KafkaClient, location) | |
}, |
after moving Lcation as a PersistentFlag on this command
What does this fix or implement?
Checklist
feat:
/fix:
/doc:
/test:
/refactor:
)