Skip to content

feat(service-registry): added artifact owner-get owner-set commands#1745

Merged
rkpattnaik780 merged 3 commits intoredhat-developer:mainfrom
SafarMirek:sr-owner-commands
Sep 21, 2022
Merged

feat(service-registry): added artifact owner-get owner-set commands#1745
rkpattnaik780 merged 3 commits intoredhat-developer:mainfrom
SafarMirek:sr-owner-commands

Conversation

@SafarMirek
Copy link
Contributor

See Apicurio/apicurio-cli#9

Get owner of the artifact

[miroslavsafar@m-bean-ipmi app-services-cli]$ ./rhoas service-registry artifact owner-get --help
Get owner of the artifact

Usage:
  rhoas service-registry artifact owner-get [flags]

Examples:
## Get owner of the artifact with artifact id 'example-name' in group 'example-group'
$ rhoas service-registry artifact owner-get --artifact-id example-name --group example-group


Flags:
      --artifact-id string   ID of the artifact
  -g, --group string         Artifact group (default "default")
      --instance-id string   ID of the Service Registry instance to be used (by default, uses the currently selected instance)

Global Flags:
  -h, --help      Show help for a command
  -v, --verbose   Enable verbose mode

Set owner of the artifact

[miroslavsafar@m-bean-ipmi app-services-cli]$ ./rhoas service-registry artifact owner-set --help
Set owner of the specific artifact

Usage:
  rhoas service-registry artifact owner-set [flags]

Examples:
## Set owner of the artifact with artifact id 'example-name' in group 'example-group' to 'new-owner-name'
$ rhoas service-registry artifact owner-get --artifact-id example-name --group example-group --owner new-owner-name


Flags:
      --artifact-id string   ID of the artifact
  -g, --group string         Artifact group (default "default")
      --instance-id string   ID of the Service Registry instance to be used (by default, uses the currently selected instance)
      --owner string         Name of new owner

Global Flags:
  -h, --help      Show help for a command
  -v, --verbose   Enable verbose mode

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation change
  • Other (please specify)

@rkpattnaik780
Copy link
Contributor

Hi @SafarMirek . I am getting issues trying to run these commands:

NotFoundException: RESTEASY003210: Could not find resource for full path: http://bu98.serviceregistry.rhcloud.com/apis/registry/v2/groups/default/artifacts/tweets-topic-2/owner

Do we need to use some other environment?

@rkpattnaik780
Copy link
Contributor

Also the cli uses the convention: [verb]-[noun], like set-kafka, set-service-registry.
Will it be okay if we change these commands to get-owner and set-owner?

@SafarMirek
Copy link
Contributor Author

Currently, this feature is I think only in staging and in Operate First environment.

You can use cli with Operate First using this login command:

rhoas login --api-gateway https://fleet-manager-mt-apicurio-apicurio-registry.apps.smaug.na.operate-first.cloud --auth-url https://auth.apicur.io/auth/realms/operate-first-apicurio --client-id apicurio-cli

@SafarMirek
Copy link
Contributor Author

Also the cli uses the convention: [verb]-[noun], like set-kafka, set-service-registry. Will it be okay if we change these commands to get-owner and set-owner?

I inspired myself in metadata commands:

Available Commands:
  create       Create new artifact from file or standard input
  delete       Deletes an artifact or all artifacts in a given group
  download     Download artifacts from Service Registry using global identifiers
  export       Export data from Service Registry instance
  get          Get artifact by ID, group, and version
  import       Import data into a Service Registry instance
  list         List artifacts
  metadata-get Get artifact metadata
  metadata-set Update artifact metadata
  state-set    Set artifact state
  update       Update artifact
  versions     Get latest artifact versions by artifact-id and group

@EricWittmann
Copy link
Contributor

LGTM - the names of the commands are consistent with existing metadata and state related commands. So I think unless we wanted to change them all, then owner-set and owner-get seem like the right choices.

@rkpattnaik780
Copy link
Contributor

I inspired myself in metadata commands:
I missed those commands, thanks for the clarifying @SafarMirek .

@SafarMirek SafarMirek marked this pull request as ready for review September 14, 2022 13:26
Copy link
Contributor

@rkpattnaik780 rkpattnaik780 left a comment

Choose a reason for hiding this comment

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

Nice PR @SafarMirek ! :)
Leaving some minor suggestions.
Also a question: do you really feel we should add interactive mode for owner operations?

@SafarMirek
Copy link
Contributor Author

Also a question: do you really feel we should add interactive mode for owner operations?

@rkpattnaik780 Does it have any downside?

@rkpattnaik780
Copy link
Contributor

Also a question: do you really feel we should add interactive mode for owner operations?

@rkpattnaik780 Does it have any downside?

No downsides at all. I personally prefer prompting when users have many flags to input or many options and also when options for one flag are dependent on the values provided for previous flags. I would have liked interactivity more if we could chose the owner and artifact-id, but that could be an overkill. Wdyt?

@SafarMirek
Copy link
Contributor Author

I am not sure there is a way to show all users who can be new owners.

There is a way to let the user choose the artifact-id, but I am not sure it will be good UX because there could be hundreds of artifacts in the registry and in this scenario it would not make sense. Wdyt?

@wtrocki
Copy link
Collaborator

wtrocki commented Sep 21, 2022

I agree with Marek. While it is generally an good idea for this case it might be risky to show so many options (or good UX to have it with so many items)

@rkpattnaik780
Copy link
Contributor

There is a way to let the user choose the artifact-id, but I am not sure it will be good UX because there could be hundreds of artifacts in the registry and in this scenario it would not make sense. Wdyt?

Great points @SafarMirek . I will agree as well, let's keep the interactive mode as it is.

@rkpattnaik780 rkpattnaik780 merged commit 7cf562b into redhat-developer:main Sep 21, 2022
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.

4 participants