feat: group create, get, list command#1849
feat: group create, get, list command#1849SafarMirek wants to merge 1 commit intoredhat-developer:mainfrom
Conversation
| one = 'Group {{.GroupId}} was successfully created' | ||
|
|
||
| [group.cmd.create.input.group-id.message] | ||
| one = 'Name of the group:' |
There was a problem hiding this comment.
In every place besides the prompt we call this the group-id but here we call it the name. Is this meant to be like this?
| if err != nil { | ||
| return registrycmdutil.TransformInstanceError(err) | ||
| } | ||
|
|
There was a problem hiding this comment.
We should return the message saying no groups available if rhoas service-registry group list returns no results.
|
|
||
| flags.StringVarP(&opts.groupId, "group-id", "g", "", opts.f.Localizer.MustLocalize("group.cmd.create.flag.group-id")) | ||
| flags.StringVarP(&opts.description, "description", "d", "", opts.f.Localizer.MustLocalize("group.cmd.create.flag.description")) | ||
| flags.StringToStringVarP(&opts.properties, "properties", "p", map[string]string{}, opts.f.Localizer.MustLocalize("group.cmd.create.flag.properties")) |
There was a problem hiding this comment.
--properties doesn't work as expected.
> ./rhoas service-registry group create --group-id rama-test-104 --properties "balance=100,max:90990" --description "[]" --instance-id 79fb0b01-cc23-4e06-81f4-47004b74211e
{
"createdBy": "rpattnai",
"createdOn": "2023-04-13T05:50:32Z",
"description": "[]",
"id": "rama-test-104",
"modifiedBy": "",
"modifiedOn": "1970-01-01T00:00:00Z",
"properties": {
"balance": "100,max:90990"
}
}
There was a problem hiding this comment.
WIll suggest to check the implementation in connector cluster update command.
| return nil | ||
| } | ||
|
|
||
| func runInteractivePrompt(opts *options, missingFlags []string) (err error) { |
There was a problem hiding this comment.
The interactive mode allows --group-id to be "". Is this expected? Should we add some validations?
| flags := rulecmdutil.NewFlagSet(cmd, f) | ||
|
|
||
| flags.StringVarP(&opts.groupId, "group-id", "g", "", opts.f.Localizer.MustLocalize("group.cmd.create.flag.group-id")) | ||
| flags.StringVarP(&opts.description, "description", "d", "", opts.f.Localizer.MustLocalize("group.cmd.create.flag.description")) |
There was a problem hiding this comment.
We don't currently have shorthand for description and properties currently.
| return dump.Formatted(opts.f.IOStreams.Out, opts.outputFormat, groupMetaData) | ||
| } | ||
|
|
||
| func runInteractivePrompt(opts *options, missingFlags []string) (err error) { |
There was a problem hiding this comment.
We don't have interactive mode for get operations, it will be better to remove it.
| flags := rulecmdutil.NewFlagSet(cmd, f) | ||
|
|
||
| flags.Int32VarP(&opts.page, "page", "", cmdutil.ConvertPageValueToInt32(build.DefaultPageNumber), opts.f.Localizer.MustLocalize("group.cmd.list.flag.page")) | ||
| flags.Int32VarP(&opts.limit, "limit", "", 100, opts.f.Localizer.MustLocalize("group.cmd.list.flag.limit")) |
There was a problem hiding this comment.
Is there any reason of keeoing 100 as limit here?
| @@ -0,0 +1,100 @@ | |||
| [group.cmd.description.short] | |||
| one = 'Manage artifacts groups of Service Registry instance' | |||
There was a problem hiding this comment.
| one = 'Manage artifacts groups of Service Registry instance' | |
| one = 'Manage artifact groups of Service Registry instance' |
|
|
||
| [group.cmd.description.long] | ||
| one = ''' | ||
| Manage artifacts groups of Service Registry instance |
There was a problem hiding this comment.
| Manage artifacts groups of Service Registry instance | |
| Manage the artifact groups of the current Service Registry instance |
|
|
||
| [group.cmd.example] | ||
| one = ''' | ||
| ## List all artifacts groups of the current Service Registry instance |
There was a problem hiding this comment.
| ## List all artifacts groups of the current Service Registry instance | |
| ## List all artifact groups of the current Service Registry instance |
| ## List all artifacts groups of the current Service Registry instance | ||
| $ rhoas service-registry group list | ||
|
|
||
| ## Get artifact group metadata by group-id |
There was a problem hiding this comment.
| ## Get artifact group metadata by group-id | |
| ## Get artifact group metadata by group ID |
|
|
||
| [group.list.cmd.description.long] | ||
| one = ''' | ||
| List artifact groups of a Service Registry instance with their id and description |
There was a problem hiding this comment.
| List artifact groups of a Service Registry instance with their id and description | |
| List artifact groups of a Service Registry instance with their group ID and description |
smccarthy-ie
left a comment
There was a problem hiding this comment.
@SafarMirek Looks good. Left a few minor suggestions for the help text, thanks.
This PR adds group command to service-registry part of cli tool. Group actions were added in service-registry API and this PR adds there features to the CLI.
Verification Steps
rhoas service-registry group listto see list of existing groupsrhoas service-registry group createrhoas service-registry group listto see if group created in 2 is thererhoas service-registry group getto get metadata of the created groupType of change