-
Notifications
You must be signed in to change notification settings - Fork 67
feat: group create, get, list command #1849
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
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
jackdelahunt
left a comment
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.
LGTM
| if err != nil { | ||
| return registrycmdutil.TransformInstanceError(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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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