Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

digna-ionos
Copy link
Contributor

What does this fix or implement?

Checklist

  • PR name added as appropriate (e.g. feat:/fix:/doc:/test:/refactor:)
  • Tests added or updated
  • Documentation updated
  • Sonar Cloud Scan
  • Changelog updated and version incremented (label: upcoming release)
  • Github Issue linked if any
  • Jira task updated

Copy link

sonarcloud bot commented Nov 11, 2024

@avirtopeanu-ionos
Copy link
Contributor

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())
Copy link
Contributor

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 lists 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
Copy link
Contributor

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())
Copy link
Contributor

@avirtopeanu-ionos avirtopeanu-ionos Nov 11, 2024

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,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
},
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

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