diff --git a/docs/commands/rhoas_service-registry_rule.md b/docs/commands/rhoas_service-registry_rule.md index 5affbbcbd..aaeb598a9 100644 --- a/docs/commands/rhoas_service-registry_rule.md +++ b/docs/commands/rhoas_service-registry_rule.md @@ -35,6 +35,8 @@ $ rhoas service-registry rule describe --rule-type=validity * [rhoas service-registry](rhoas_service-registry.md) - Service Registry commands * [rhoas service-registry rule describe](rhoas_service-registry_rule_describe.md) - Display configuration of a rule +* [rhoas service-registry rule disable](rhoas_service-registry_rule_disable.md) - Disable validity and compatibility rules * [rhoas service-registry rule enable](rhoas_service-registry_rule_enable.md) - Enable validity and compatibility rules * [rhoas service-registry rule list](rhoas_service-registry_rule_list.md) - List validity and compatibility rules +* [rhoas service-registry rule update](rhoas_service-registry_rule_update.md) - Update configuration of rules diff --git a/docs/commands/rhoas_service-registry_rule_disable.md b/docs/commands/rhoas_service-registry_rule_disable.md new file mode 100644 index 000000000..7b8e84fc5 --- /dev/null +++ b/docs/commands/rhoas_service-registry_rule_disable.md @@ -0,0 +1,47 @@ +## rhoas service-registry rule disable + +Disable validity and compatibility rules + +### Synopsis + +Disable validity and compatibility rules for the specified Service Registry instance or artifact + +``` +rhoas service-registry rule disable [flags] +``` + +### Examples + +``` +## Disable global compatibility rule for artifacts of the current Service Registry instance +$ rhoas service-registry rule disable --rule-type=compatibility + +## Disable global compatibility rule for artifacts of a specific Service Registry instance +$ rhoas service-registry rule disable --rule-type=compatibility --instance-id 8ecff228-1ffe-4cf5-b38b-55223885ee00 + +## Disable validity rule for a specific artifact +$ rhoas service-registry rule disable --rule-type=validity --artifact-id=my-artifact + +``` + +### Options + +``` + --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) + --rule-type string Rule type determines how the content of an artifact can evolve over time + -y, --yes Disable rule(s) without prompt +``` + +### Options inherited from parent commands + +``` + -h, --help Show help for a command + -v, --verbose Enable verbose mode +``` + +### SEE ALSO + +* [rhoas service-registry rule](rhoas_service-registry_rule.md) - Manage artifact rules in a Service Registry instance + diff --git a/docs/commands/rhoas_service-registry_rule_update.md b/docs/commands/rhoas_service-registry_rule_update.md new file mode 100644 index 000000000..7f183a116 --- /dev/null +++ b/docs/commands/rhoas_service-registry_rule_update.md @@ -0,0 +1,47 @@ +## rhoas service-registry rule update + +Update configuration of rules + +### Synopsis + +Update configuration of validity and compatibility rules for the specified Service Registry instance or artifact + +``` +rhoas service-registry rule update [flags] +``` + +### Examples + +``` +## Update global compatibility rule for artifacts of the current Service Registry instance +$ rhoas service-registry rule update --rule-type=compatibility --config=full + +## Update global compatibility rule for artifacts of a specific Service Registry instance +$ rhoas service-registry rule update --rule-type=compatibility --config=full --instance-id 8ecff228-1ffe-4cf5-b38b-55223885ee00 + +## Update validity rule for a specific artifact +$ rhoas service-registry rule update --rule-type=validity --config=full --artifact-id=my-artifact + +``` + +### Options + +``` + --artifact-id string ID of the artifact + --config string Configuration value for a rule + -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) + --rule-type string Rule type determines how the content of an artifact can evolve over time +``` + +### Options inherited from parent commands + +``` + -h, --help Show help for a command + -v, --verbose Enable verbose mode +``` + +### SEE ALSO + +* [rhoas service-registry rule](rhoas_service-registry_rule.md) - Manage artifact rules in a Service Registry instance + diff --git a/pkg/cmd/registry/artifact/crud/create/create.go b/pkg/cmd/registry/artifact/crud/create/create.go index 002ef603e..cdf789456 100644 --- a/pkg/cmd/registry/artifact/crud/create/create.go +++ b/pkg/cmd/registry/artifact/crud/create/create.go @@ -99,7 +99,7 @@ func NewCreateCommand(f *factory.Factory) *cobra.Command { cmd.Flags().StringVar(&opts.file, "file", "", opts.localizer.MustLocalize("artifact.common.file.location")) cmd.Flags().StringVar(&opts.artifact, "artifact-id", "", opts.localizer.MustLocalize("artifact.common.id")) - cmd.Flags().StringVarP(&opts.group, "group", "g", util.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) + cmd.Flags().StringVarP(&opts.group, "group", "g", registrycmdutil.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) cmd.Flags().StringVar(&opts.version, "version", "", opts.localizer.MustLocalize("artifact.common.custom.version")) cmd.Flags().StringVar(&opts.name, "name", "", opts.localizer.MustLocalize("artifact.common.custom.name")) @@ -133,9 +133,8 @@ func runCreate(opts *options) error { return err } - if opts.group == util.DefaultArtifactGroup { - opts.Logger.Info(opts.localizer.MustLocalize("artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", util.DefaultArtifactGroup))) - opts.group = util.DefaultArtifactGroup + if opts.group == registrycmdutil.DefaultArtifactGroup { + opts.Logger.Info(opts.localizer.MustLocalize("registry.artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", registrycmdutil.DefaultArtifactGroup))) } var specifiedFile *os.File diff --git a/pkg/cmd/registry/artifact/crud/delete/delete.go b/pkg/cmd/registry/artifact/crud/delete/delete.go index 4911c0dea..4cb6c8ede 100644 --- a/pkg/cmd/registry/artifact/crud/delete/delete.go +++ b/pkg/cmd/registry/artifact/crud/delete/delete.go @@ -5,7 +5,6 @@ import ( "errors" "github.com/AlecAivazis/survey/v2" - "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/artifact/util" "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/registrycmdutil" "github.com/redhat-developer/app-services-cli/pkg/core/cmdutil/flagutil" "github.com/redhat-developer/app-services-cli/pkg/core/config" @@ -74,7 +73,7 @@ func NewDeleteCommand(f *factory.Factory) *cobra.Command { cmd.Flags().BoolVarP(&opts.force, "yes", "y", false, opts.localizer.MustLocalize("artifact.common.delete.without.prompt")) cmd.Flags().StringVar(&opts.artifact, "artifact-id", "", opts.localizer.MustLocalize("artifact.common.id")) - cmd.Flags().StringVarP(&opts.group, "group", "g", util.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) + cmd.Flags().StringVarP(&opts.group, "group", "g", registrycmdutil.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("artifact.common.registryIdToUse")) flagutil.EnableOutputFlagCompletion(cmd) @@ -92,9 +91,8 @@ func runDelete(opts *options) error { return err } - if opts.group == util.DefaultArtifactGroup { - opts.Logger.Info(opts.localizer.MustLocalize("artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", util.DefaultArtifactGroup))) - opts.group = util.DefaultArtifactGroup + if opts.group == registrycmdutil.DefaultArtifactGroup { + opts.Logger.Info(opts.localizer.MustLocalize("registry.artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", registrycmdutil.DefaultArtifactGroup))) } if opts.artifact == "" { diff --git a/pkg/cmd/registry/artifact/crud/get/get.go b/pkg/cmd/registry/artifact/crud/get/get.go index 04ca8379f..2ff1719f4 100644 --- a/pkg/cmd/registry/artifact/crud/get/get.go +++ b/pkg/cmd/registry/artifact/crud/get/get.go @@ -6,7 +6,6 @@ import ( "io/ioutil" "os" - "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/artifact/util" "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/registrycmdutil" "github.com/redhat-developer/app-services-cli/pkg/core/cmdutil/flagutil" "github.com/redhat-developer/app-services-cli/pkg/core/config" @@ -77,7 +76,7 @@ func NewGetCommand(f *factory.Factory) *cobra.Command { } cmd.Flags().StringVar(&opts.artifact, "artifact-id", "", opts.localizer.MustLocalize("artifact.common.id")) - cmd.Flags().StringVarP(&opts.group, "group", "g", util.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) + cmd.Flags().StringVarP(&opts.group, "group", "g", registrycmdutil.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("registry.common.flag.instance.id")) cmd.Flags().StringVar(&opts.outputFile, "output-file", "", opts.localizer.MustLocalize("artifact.common.message.file.location")) cmd.Flags().StringVar(&opts.version, "version", "", opts.localizer.MustLocalize("artifact.common.version")) @@ -98,9 +97,8 @@ func runGet(opts *options) error { return err } - if opts.group == util.DefaultArtifactGroup { - opts.Logger.Info(opts.localizer.MustLocalize("artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", util.DefaultArtifactGroup))) - opts.group = util.DefaultArtifactGroup + if opts.group == registrycmdutil.DefaultArtifactGroup { + opts.Logger.Info(opts.localizer.MustLocalize("registry.artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", registrycmdutil.DefaultArtifactGroup))) } var dataFile *os.File diff --git a/pkg/cmd/registry/artifact/crud/list/list.go b/pkg/cmd/registry/artifact/crud/list/list.go index 2cc3b57a5..2e8d8fd2c 100644 --- a/pkg/cmd/registry/artifact/crud/list/list.go +++ b/pkg/cmd/registry/artifact/crud/list/list.go @@ -3,7 +3,6 @@ package list import ( "context" - "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/artifact/util" "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/registrycmdutil" "github.com/redhat-developer/app-services-cli/pkg/core/cmdutil/flagutil" @@ -102,7 +101,7 @@ func NewListCommand(f *factory.Factory) *cobra.Command { }, } - cmd.Flags().StringVarP(&opts.group, "group", "g", util.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) + cmd.Flags().StringVarP(&opts.group, "group", "g", registrycmdutil.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) cmd.Flags().Int32VarP(&opts.page, "page", "", 1, opts.localizer.MustLocalize("artifact.common.page.number")) cmd.Flags().Int32VarP(&opts.limit, "limit", "", 100, opts.localizer.MustLocalize("artifact.common.page.limit")) @@ -120,9 +119,8 @@ func NewListCommand(f *factory.Factory) *cobra.Command { } func runList(opts *options) error { - if opts.group == util.DefaultArtifactGroup { - opts.Logger.Info(opts.localizer.MustLocalize("artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", util.DefaultArtifactGroup))) - opts.group = util.DefaultArtifactGroup + if opts.group == registrycmdutil.DefaultArtifactGroup { + opts.Logger.Info(opts.localizer.MustLocalize("registry.artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", registrycmdutil.DefaultArtifactGroup))) } conn, err := opts.Connection(connection.DefaultConfigRequireMasAuth) diff --git a/pkg/cmd/registry/artifact/crud/update/update.go b/pkg/cmd/registry/artifact/crud/update/update.go index 983db5c70..1abc9c363 100644 --- a/pkg/cmd/registry/artifact/crud/update/update.go +++ b/pkg/cmd/registry/artifact/crud/update/update.go @@ -5,6 +5,7 @@ import ( "os" "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/artifact/util" + "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/registrycmdutil" "github.com/redhat-developer/app-services-cli/pkg/core/cmdutil/flagutil" "github.com/redhat-developer/app-services-cli/pkg/core/config" "github.com/redhat-developer/app-services-cli/pkg/core/ioutil/iostreams" @@ -84,7 +85,7 @@ func NewUpdateCommand(f *factory.Factory) *cobra.Command { cmd.Flags().StringVarP(&opts.file, "file", "f", "", opts.localizer.MustLocalize("artifact.common.file.location")) cmd.Flags().StringVar(&opts.artifact, "artifact-id", "", opts.localizer.MustLocalize("artifact.common.id")) - cmd.Flags().StringVarP(&opts.group, "group", "g", util.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) + cmd.Flags().StringVarP(&opts.group, "group", "g", registrycmdutil.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("registry.common.flag.instance.id")) cmd.Flags().StringVar(&opts.version, "version", "", opts.localizer.MustLocalize("artifact.common.custom.version")) @@ -107,9 +108,8 @@ func runUpdate(opts *options) error { return err } - if opts.group == util.DefaultArtifactGroup { - opts.Logger.Info(opts.localizer.MustLocalize("artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", util.DefaultArtifactGroup))) - opts.group = util.DefaultArtifactGroup + if opts.group == registrycmdutil.DefaultArtifactGroup { + opts.Logger.Info(opts.localizer.MustLocalize("registry.artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", registrycmdutil.DefaultArtifactGroup))) } var specifiedFile *os.File diff --git a/pkg/cmd/registry/artifact/download/download.go b/pkg/cmd/registry/artifact/download/download.go index 3fa2e39ae..c133c6ce4 100644 --- a/pkg/cmd/registry/artifact/download/download.go +++ b/pkg/cmd/registry/artifact/download/download.go @@ -6,7 +6,6 @@ import ( "io/ioutil" "os" - "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/artifact/util" "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/registrycmdutil" "github.com/redhat-developer/app-services-cli/pkg/core/cmdutil/flagutil" "github.com/redhat-developer/app-services-cli/pkg/core/config" @@ -77,7 +76,7 @@ func NewDownloadCommand(f *factory.Factory) *cobra.Command { }, } - cmd.Flags().StringVarP(&opts.group, "group", "g", util.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) + cmd.Flags().StringVarP(&opts.group, "group", "g", registrycmdutil.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) cmd.Flags().StringVar(&opts.hash, "hash", "", opts.localizer.MustLocalize("artifact.common.sha")) cmd.Flags().Int64VarP(&opts.globalId, "global-id", "", unusedFlagIdValue, opts.localizer.MustLocalize("artifact.common.global.id")) cmd.Flags().Int64VarP(&opts.contentId, "content-id", "", unusedFlagIdValue, opts.localizer.MustLocalize("artifact.common.content.id")) @@ -101,9 +100,8 @@ func runGet(opts *options) error { return err } - if opts.group == util.DefaultArtifactGroup { - opts.Logger.Info(opts.localizer.MustLocalize("artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", util.DefaultArtifactGroup))) - opts.group = util.DefaultArtifactGroup + if opts.group == registrycmdutil.DefaultArtifactGroup { + opts.Logger.Info(opts.localizer.MustLocalize("registry.artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", registrycmdutil.DefaultArtifactGroup))) } opts.Logger.Info(opts.localizer.MustLocalize("artifact.common.message.fetching.artifact")) diff --git a/pkg/cmd/registry/artifact/metadata/get.go b/pkg/cmd/registry/artifact/metadata/get.go index db0410130..e6113b1ce 100644 --- a/pkg/cmd/registry/artifact/metadata/get.go +++ b/pkg/cmd/registry/artifact/metadata/get.go @@ -76,7 +76,7 @@ func NewGetMetadataCommand(f *factory.Factory) *cobra.Command { } cmd.Flags().StringVar(&opts.artifact, "artifact-id", "", opts.localizer.MustLocalize("artifact.common.id")) - cmd.Flags().StringVarP(&opts.group, "group", "g", util.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) + cmd.Flags().StringVarP(&opts.group, "group", "g", registrycmdutil.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("registry.common.flag.instance.id")) cmd.Flags().StringVarP(&opts.outputFormat, "output", "o", "", opts.localizer.MustLocalize("artifact.common.message.output.format")) @@ -101,9 +101,8 @@ func runGet(opts *GetOptions) error { return err } - if opts.group == util.DefaultArtifactGroup { - opts.Logger.Info(opts.localizer.MustLocalize("artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", util.DefaultArtifactGroup))) - opts.group = util.DefaultArtifactGroup + if opts.group == registrycmdutil.DefaultArtifactGroup { + opts.Logger.Info(opts.localizer.MustLocalize("registry.artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", registrycmdutil.DefaultArtifactGroup))) } opts.Logger.Info(opts.localizer.MustLocalize("artifact.common.message.artifact.metadata.fetching")) diff --git a/pkg/cmd/registry/artifact/metadata/set.go b/pkg/cmd/registry/artifact/metadata/set.go index 3f66478e9..84f3a3beb 100644 --- a/pkg/cmd/registry/artifact/metadata/set.go +++ b/pkg/cmd/registry/artifact/metadata/set.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" - "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/artifact/util" "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/registrycmdutil" "github.com/redhat-developer/app-services-cli/pkg/core/cmdutil/flagutil" "github.com/redhat-developer/app-services-cli/pkg/core/config" @@ -84,7 +83,7 @@ func NewSetMetadataCommand(f *factory.Factory) *cobra.Command { } cmd.Flags().StringVar(&opts.artifact, "artifact-id", "", opts.localizer.MustLocalize("artifact.common.id")) - cmd.Flags().StringVarP(&opts.group, "group", "g", util.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) + cmd.Flags().StringVarP(&opts.group, "group", "g", registrycmdutil.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("registry.common.flag.instance.id")) cmd.Flags().StringVarP(&opts.outputFormat, "output", "o", "", opts.localizer.MustLocalize("artifact.common.message.output.format")) @@ -107,9 +106,8 @@ func runSet(opts *SetOptions) error { return err } - if opts.group == util.DefaultArtifactGroup { - opts.Logger.Info(opts.localizer.MustLocalize("artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", util.DefaultArtifactGroup))) - opts.group = util.DefaultArtifactGroup + if opts.group == registrycmdutil.DefaultArtifactGroup { + opts.Logger.Info(opts.localizer.MustLocalize("registry.artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", registrycmdutil.DefaultArtifactGroup))) } opts.Logger.Info(opts.localizer.MustLocalize("artifact.common.message.artifact.metadata.fetching")) diff --git a/pkg/cmd/registry/artifact/state/state.go b/pkg/cmd/registry/artifact/state/state.go index 8b4c9df4b..e6f194020 100644 --- a/pkg/cmd/registry/artifact/state/state.go +++ b/pkg/cmd/registry/artifact/state/state.go @@ -78,7 +78,7 @@ func NewSetStateCommand(f *factory.Factory) *cobra.Command { } cmd.Flags().StringVar(&opts.artifact, "artifact-id", "", opts.localizer.MustLocalize("artifact.common.id")) - cmd.Flags().StringVarP(&opts.group, "group", "g", util.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) + cmd.Flags().StringVarP(&opts.group, "group", "g", registrycmdutil.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("registry.common.flag.instance.id")) cmd.Flags().StringVar(&opts.state, "state", "", opts.localizer.MustLocalize("artifact.flag.state.description")) @@ -99,9 +99,8 @@ func runSet(opts *options) error { return err } - if opts.group == util.DefaultArtifactGroup { - opts.Logger.Info(opts.localizer.MustLocalize("artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", util.DefaultArtifactGroup))) - opts.group = util.DefaultArtifactGroup + if opts.group == registrycmdutil.DefaultArtifactGroup { + opts.Logger.Info(opts.localizer.MustLocalize("registry.artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", registrycmdutil.DefaultArtifactGroup))) } updateState, err := registryinstanceclient.NewArtifactStateFromValue(opts.state) diff --git a/pkg/cmd/registry/artifact/util/constants.go b/pkg/cmd/registry/artifact/util/constants.go index 1df650bba..69c509754 100644 --- a/pkg/cmd/registry/artifact/util/constants.go +++ b/pkg/cmd/registry/artifact/util/constants.go @@ -4,8 +4,6 @@ import ( "strings" ) -const DefaultArtifactGroup = "default" - var AllowedArtifactTypeEnumValues = []string{ "AVRO", "PROTOBUF", diff --git a/pkg/cmd/registry/artifact/util/util.go b/pkg/cmd/registry/artifact/util/util.go index d0f83ca16..862385002 100644 --- a/pkg/cmd/registry/artifact/util/util.go +++ b/pkg/cmd/registry/artifact/util/util.go @@ -3,6 +3,7 @@ package util import ( "fmt" + "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/registrycmdutil" registryinstanceclient "github.com/redhat-developer/app-services-sdk-go/registryinstance/apiv1internal/client" registrymgmtclient "github.com/redhat-developer/app-services-sdk-go/registrymgmt/apiv1/client" ) @@ -13,7 +14,7 @@ func GetArtifactURL(registry *registrymgmtclient.Registry, metadata *registryins group := metadata.GetGroupId() if group == "" { - group = DefaultArtifactGroup + group = registrycmdutil.DefaultArtifactGroup } homeURL, ok := registry.GetBrowserUrlOk() diff --git a/pkg/cmd/registry/artifact/versions/versions.go b/pkg/cmd/registry/artifact/versions/versions.go index 4c3dd93d7..eaed51d83 100644 --- a/pkg/cmd/registry/artifact/versions/versions.go +++ b/pkg/cmd/registry/artifact/versions/versions.go @@ -3,7 +3,6 @@ package versions import ( "context" - "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/artifact/util" "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/registrycmdutil" "github.com/redhat-developer/app-services-cli/pkg/core/cmdutil/flagutil" "github.com/redhat-developer/app-services-cli/pkg/core/config" @@ -74,7 +73,7 @@ func NewVersionsCommand(f *factory.Factory) *cobra.Command { } cmd.Flags().StringVar(&opts.artifact, "artifact-id", "", opts.localizer.MustLocalize("artifact.common.id")) - cmd.Flags().StringVarP(&opts.group, "group", "g", util.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) + cmd.Flags().StringVarP(&opts.group, "group", "g", registrycmdutil.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group")) cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("registry.common.flag.instance.id")) cmd.Flags().StringVarP(&opts.outputFormat, "output", "o", "", opts.localizer.MustLocalize("artifact.common.message.output.format")) @@ -94,9 +93,8 @@ func runGet(opts *options) error { return err } - if opts.group == util.DefaultArtifactGroup { - opts.Logger.Info(opts.localizer.MustLocalize("artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", util.DefaultArtifactGroup))) - opts.group = util.DefaultArtifactGroup + if opts.group == registrycmdutil.DefaultArtifactGroup { + opts.Logger.Info(opts.localizer.MustLocalize("registry.artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", registrycmdutil.DefaultArtifactGroup))) } opts.Logger.Info(opts.localizer.MustLocalize("artifact.common.message.artifact.versions.fetching")) diff --git a/pkg/cmd/registry/registrycmdutil/constants.go b/pkg/cmd/registry/registrycmdutil/constants.go new file mode 100644 index 000000000..971babb1e --- /dev/null +++ b/pkg/cmd/registry/registrycmdutil/constants.go @@ -0,0 +1,3 @@ +package registrycmdutil + +const DefaultArtifactGroup = "default" diff --git a/pkg/cmd/registry/rule/describe/describe.go b/pkg/cmd/registry/rule/describe/describe.go index 231d588ac..cd5f7d987 100644 --- a/pkg/cmd/registry/rule/describe/describe.go +++ b/pkg/cmd/registry/rule/describe/describe.go @@ -137,6 +137,10 @@ func runDescribe(opts *options) error { s.Stop() } else { + if opts.group == registrycmdutil.DefaultArtifactGroup { + opts.Logger.Info(opts.localizer.MustLocalize("registry.artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", registrycmdutil.DefaultArtifactGroup))) + } + request := dataAPI.ArtifactsApi.GetLatestArtifact(opts.Context, opts.group, opts.artifactID) _, httpRes, err = request.Execute() if httpRes != nil { diff --git a/pkg/cmd/registry/rule/disable/disable.go b/pkg/cmd/registry/rule/disable/disable.go new file mode 100644 index 000000000..3ff5d7911 --- /dev/null +++ b/pkg/cmd/registry/rule/disable/disable.go @@ -0,0 +1,225 @@ +package disable + +import ( + "context" + "net/http" + + "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/registrycmdutil" + "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/rule/rulecmdutil" + "github.com/redhat-developer/app-services-cli/pkg/core/config" + "github.com/redhat-developer/app-services-cli/pkg/core/ioutil/icon" + "github.com/redhat-developer/app-services-cli/pkg/core/ioutil/iostreams" + "github.com/redhat-developer/app-services-cli/pkg/core/ioutil/spinner" + "github.com/redhat-developer/app-services-cli/pkg/core/localize" + "github.com/redhat-developer/app-services-cli/pkg/core/logging" + "github.com/redhat-developer/app-services-cli/pkg/shared/connection" + "github.com/redhat-developer/app-services-cli/pkg/shared/factory" + "github.com/spf13/cobra" + + registryinstanceclient "github.com/redhat-developer/app-services-sdk-go/registryinstance/apiv1internal/client" +) + +type options struct { + IO *iostreams.IOStreams + Config config.IConfig + Connection factory.ConnectionFunc + Logger logging.Logger + localizer localize.Localizer + Context context.Context + + ruleType string + + registryID string + artifactID string + group string +} + +// NewDisableCommand creates a new command for disabling rule +func NewDisableCommand(f *factory.Factory) *cobra.Command { + + opts := &options{ + IO: f.IOStreams, + Config: f.Config, + Connection: f.Connection, + Logger: f.Logger, + localizer: f.Localizer, + Context: f.Context, + } + + cmd := &cobra.Command{ + Use: "disable", + Short: f.Localizer.MustLocalize("registry.rule.disable.cmd.description.short"), + Long: f.Localizer.MustLocalize("registry.rule.disable.cmd.description.long"), + Example: f.Localizer.MustLocalize("registry.rule.disable.cmd.example"), + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, _ []string) (err error) { + + validator := rulecmdutil.Validator{ + Localizer: opts.localizer, + } + + cfg, err := opts.Config.Load() + if err != nil { + return err + } + + if err = validator.ValidateRuleType(opts.ruleType); err != nil && opts.ruleType != "" { + return err + } + + instanceID, ok := cfg.GetServiceRegistryIdOk() + if !ok { + return opts.localizer.MustLocalizeError("artifact.cmd.common.error.noServiceRegistrySelected") + } + + opts.registryID = instanceID + + return runDisable(opts) + }, + } + + flags := rulecmdutil.NewFlagSet(cmd, f) + + flags.AddRegistryInstance(&opts.registryID) + + flags.AddArtifactID(&opts.artifactID) + flags.AddGroup(&opts.group) + flags.AddRuleType(&opts.ruleType) + + return cmd +} + +func runDisable(opts *options) error { + + var httpRes *http.Response + var newErr error + + conn, err := opts.Connection(connection.DefaultConfigRequireMasAuth) + if err != nil { + return err + } + + dataAPI, _, err := conn.API().ServiceRegistryInstance(opts.registryID) + if err != nil { + return err + } + + if opts.artifactID == "" { + + httpRes, newErr = disableGlobalRule(opts, dataAPI) + if httpRes != nil { + defer httpRes.Body.Close() + } + + } else { + + if opts.group == registrycmdutil.DefaultArtifactGroup { + opts.Logger.Info(opts.localizer.MustLocalize("registry.artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", registrycmdutil.DefaultArtifactGroup))) + } + + request := dataAPI.ArtifactsApi.GetLatestArtifact(opts.Context, opts.group, opts.artifactID) + _, httpRes, err = request.Execute() + if httpRes != nil { + defer httpRes.Body.Close() + } + + if err != nil { + return registrycmdutil.TransformInstanceError(err) + } + + httpRes, newErr = disableArtifactRule(opts, dataAPI) + if httpRes != nil { + defer httpRes.Body.Close() + } + + } + + if newErr != nil { + if httpRes == nil { + return registrycmdutil.TransformInstanceError(newErr) + } + + ruleErr := &rulecmdutil.RuleErrHandler{ + Localizer: opts.localizer, + } + + switch httpRes.StatusCode { + case http.StatusNotFound: + return ruleErr.RuleNotEnabled(opts.ruleType) + default: + return registrycmdutil.TransformInstanceError(newErr) + } + } + + opts.Logger.Info(icon.SuccessPrefix(), opts.localizer.MustLocalize("registry.rule.disable.log.info.success")) + + return nil + +} + +func disableGlobalRule(opts *options, dataAPI *registryinstanceclient.APIClient) (httpRes *http.Response, err error) { + + if opts.ruleType != "" { + + s := spinner.New(opts.IO.ErrOut, opts.localizer) + s.SetLocalizedSuffix("registry.rule.disable.log.info.disabling.globalRule", localize.NewEntry("RuleType", opts.ruleType)) + s.Start() + + req := dataAPI.AdminApi.DeleteGlobalRule(opts.Context, *rulecmdutil.GetMappedRuleType(opts.ruleType)) + + httpRes, err = req.Execute() + + s.Stop() + } else { + + s := spinner.New(opts.IO.ErrOut, opts.localizer) + s.SetLocalizedSuffix("registry.rule.disable.log.info.disabling.globalRules", localize.NewEntry("RuleType", opts.ruleType)) + s.Start() + + req := dataAPI.AdminApi.DeleteAllGlobalRules(opts.Context) + + httpRes, err = req.Execute() + + s.Stop() + } + + return httpRes, err +} + +func disableArtifactRule(opts *options, dataAPI *registryinstanceclient.APIClient) (httpRes *http.Response, err error) { + if opts.ruleType != "" { + + s := spinner.New(opts.IO.ErrOut, opts.localizer) + s.SetLocalizedSuffix( + "registry.rule.disable.log.info.disabling.artifactRule", + localize.NewEntry("RuleType", opts.ruleType), + localize.NewEntry("ArtifactID", opts.artifactID), + ) + s.Start() + + req := dataAPI.ArtifactRulesApi.DeleteArtifactRule(opts.Context, opts.group, opts.artifactID, string(*rulecmdutil.GetMappedRuleType(opts.ruleType))) + + httpRes, err = req.Execute() + if httpRes != nil { + defer httpRes.Body.Close() + } + + s.Stop() + } else { + + s := spinner.New(opts.IO.ErrOut, opts.localizer) + s.SetLocalizedSuffix("registry.rule.disable.log.info.disabling.artifactRules", localize.NewEntry("ArtifactID", opts.artifactID)) + s.Start() + + req := dataAPI.ArtifactRulesApi.DeleteArtifactRules(opts.Context, opts.group, opts.artifactID) + + httpRes, err = req.Execute() + if httpRes != nil { + defer httpRes.Body.Close() + } + + s.Stop() + } + + return httpRes, err +} diff --git a/pkg/cmd/registry/rule/enable/enable.go b/pkg/cmd/registry/rule/enable/enable.go index 1808da46e..c39a50e18 100644 --- a/pkg/cmd/registry/rule/enable/enable.go +++ b/pkg/cmd/registry/rule/enable/enable.go @@ -19,8 +19,6 @@ import ( "github.com/redhat-developer/app-services-cli/pkg/shared/factory" "github.com/spf13/cobra" - artifactutil "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/artifact/util" - registryinstanceclient "github.com/redhat-developer/app-services-sdk-go/registryinstance/apiv1internal/client" ) @@ -171,6 +169,10 @@ func runEnable(opts *options) error { s.Stop() } else { + if opts.group == registrycmdutil.DefaultArtifactGroup { + opts.Logger.Info(opts.localizer.MustLocalize("registry.artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", registrycmdutil.DefaultArtifactGroup))) + } + s := spinner.New(opts.IO.ErrOut, opts.localizer) s.SetLocalizedSuffix( "registry.rule.enable.log.info.enabling.artifactRules", @@ -256,7 +258,7 @@ func runInteractivePrompt(opts *options) (err error) { groupPrompt := &survey.Input{ Message: opts.localizer.MustLocalize("registry.rule.enable.input.group.message"), Help: opts.localizer.MustLocalize("registry.rule.enable.input.group.help"), - Default: artifactutil.DefaultArtifactGroup, + Default: registrycmdutil.DefaultArtifactGroup, } err = survey.AskOne(groupPrompt, &opts.group) diff --git a/pkg/cmd/registry/rule/list/list.go b/pkg/cmd/registry/rule/list/list.go index 72ba37640..9db355c4d 100644 --- a/pkg/cmd/registry/rule/list/list.go +++ b/pkg/cmd/registry/rule/list/list.go @@ -133,6 +133,10 @@ func runList(opts *options) error { s.Stop() } else { + if opts.group == registrycmdutil.DefaultArtifactGroup { + opts.Logger.Info(opts.localizer.MustLocalize("registry.artifact.common.message.no.group", localize.NewEntry("DefaultArtifactGroup", registrycmdutil.DefaultArtifactGroup))) + } + s := spinner.New(opts.IO.ErrOut, opts.localizer) s.SetLocalizedSuffix("registry.rule.list.log.info.fetching.artifactRules") s.Start() diff --git a/pkg/cmd/registry/rule/rule.go b/pkg/cmd/registry/rule/rule.go index fc002492a..89e267d7f 100644 --- a/pkg/cmd/registry/rule/rule.go +++ b/pkg/cmd/registry/rule/rule.go @@ -2,8 +2,10 @@ package rule import ( "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/rule/describe" + "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/rule/disable" "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/rule/enable" "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/rule/list" + "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/rule/update" "github.com/redhat-developer/app-services-cli/pkg/shared/factory" "github.com/spf13/cobra" ) @@ -22,6 +24,8 @@ func NewRuleCommand(f *factory.Factory) *cobra.Command { enable.NewEnableCommand(f), list.NewListCommand(f), describe.NewDescribeCommand(f), + update.NewUpdateCommand(f), + disable.NewDisableCommand(f), ) return cmd diff --git a/pkg/cmd/registry/rule/rulecmdutil/flagset.go b/pkg/cmd/registry/rule/rulecmdutil/flagset.go index 332cee05e..347b3d488 100644 --- a/pkg/cmd/registry/rule/rulecmdutil/flagset.go +++ b/pkg/cmd/registry/rule/rulecmdutil/flagset.go @@ -1,7 +1,6 @@ package rulecmdutil import ( - artifactutil "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/artifact/util" "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/registrycmdutil" "github.com/redhat-developer/app-services-cli/pkg/core/cmdutil/flagutil" "github.com/redhat-developer/app-services-cli/pkg/shared/factory" @@ -44,7 +43,7 @@ func (fs *flagSet) AddGroup(artifactID *string) { artifactID, flagName, "g", - artifactutil.DefaultArtifactGroup, + registrycmdutil.DefaultArtifactGroup, fs.factory.Localizer.MustLocalize("artifact.common.group"), ) diff --git a/pkg/cmd/registry/rule/update/update.go b/pkg/cmd/registry/rule/update/update.go new file mode 100644 index 000000000..cb69b3fca --- /dev/null +++ b/pkg/cmd/registry/rule/update/update.go @@ -0,0 +1,224 @@ +package update + +import ( + "context" + "net/http" + + "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/registrycmdutil" + "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/rule/rulecmdutil" + "github.com/redhat-developer/app-services-cli/pkg/core/cmdutil" + "github.com/redhat-developer/app-services-cli/pkg/core/config" + "github.com/redhat-developer/app-services-cli/pkg/core/ioutil/icon" + "github.com/redhat-developer/app-services-cli/pkg/core/ioutil/iostreams" + "github.com/redhat-developer/app-services-cli/pkg/core/ioutil/spinner" + "github.com/redhat-developer/app-services-cli/pkg/core/localize" + "github.com/redhat-developer/app-services-cli/pkg/core/logging" + "github.com/redhat-developer/app-services-cli/pkg/shared/connection" + "github.com/redhat-developer/app-services-cli/pkg/shared/factory" + "github.com/spf13/cobra" + + registryinstanceclient "github.com/redhat-developer/app-services-sdk-go/registryinstance/apiv1internal/client" +) + +type options struct { + IO *iostreams.IOStreams + Config config.IConfig + Connection factory.ConnectionFunc + Logger logging.Logger + localizer localize.Localizer + Context context.Context + + ruleType string + config string + registryID string + + artifactID string + group string +} + +// NewUpdateCommand creates a new command for updating rule +func NewUpdateCommand(f *factory.Factory) *cobra.Command { + + opts := &options{ + IO: f.IOStreams, + Config: f.Config, + Connection: f.Connection, + Logger: f.Logger, + localizer: f.Localizer, + Context: f.Context, + } + + cmd := &cobra.Command{ + Use: "update", + Short: f.Localizer.MustLocalize("registry.rule.update.cmd.description.short"), + Long: f.Localizer.MustLocalize("registry.rule.update.cmd.description.long"), + Example: f.Localizer.MustLocalize("registry.rule.update.cmd.example"), + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, _ []string) (err error) { + + validator := rulecmdutil.Validator{ + Localizer: opts.localizer, + } + + cfg, err := opts.Config.Load() + if err != nil { + return err + } + + err = validator.ValidateRuleType(opts.ruleType) + if err != nil { + return err + } + + isValid, configs := validator.IsValidRuleConfig(opts.ruleType, opts.config) + if !isValid { + return opts.localizer.MustLocalizeError("registry.rule.common.error.invalidRuleConfig", + localize.NewEntry("RuleType", opts.ruleType), + localize.NewEntry("Config", opts.config), + localize.NewEntry("ValidConfigList", cmdutil.StringSliceToListStringWithQuotes(configs)), + ) + } + + instanceID, ok := cfg.GetServiceRegistryIdOk() + if !ok { + return opts.localizer.MustLocalizeError("artifact.cmd.common.error.noServiceRegistrySelected") + } + + opts.registryID = instanceID + + return runUpdate(opts) + }, + } + + flags := rulecmdutil.NewFlagSet(cmd, f) + + flags.AddRegistryInstance(&opts.registryID) + + flags.AddArtifactID(&opts.artifactID) + flags.AddGroup(&opts.group) + + _ = flags.AddConfig(&opts.config).Required() + _ = flags.AddRuleType(&opts.ruleType).Required() + + return cmd +} + +func runUpdate(opts *options) error { + + var httpRes *http.Response + var newErr error + + conn, err := opts.Connection(connection.DefaultConfigRequireMasAuth) + if err != nil { + return err + } + + dataAPI, _, err := conn.API().ServiceRegistryInstance(opts.registryID) + if err != nil { + return err + } + + if opts.artifactID == "" { + + httpRes, newErr = updateGlobalRule(opts, dataAPI) + if httpRes != nil { + defer httpRes.Body.Close() + } + } else { + + request := dataAPI.ArtifactsApi.GetLatestArtifact(opts.Context, opts.group, opts.artifactID) + _, httpRes, err = request.Execute() + if httpRes != nil { + defer httpRes.Body.Close() + } + + if err != nil { + return registrycmdutil.TransformInstanceError(err) + } + + httpRes, newErr = updateArtifactRule(opts, dataAPI) + if httpRes != nil { + defer httpRes.Body.Close() + } + } + + ruleErr := &rulecmdutil.RuleErrHandler{ + Localizer: opts.localizer, + } + + if newErr != nil { + if httpRes == nil { + return registrycmdutil.TransformInstanceError(newErr) + } + + switch httpRes.StatusCode { + case http.StatusNotFound: + return ruleErr.RuleNotEnabled(opts.ruleType) + case http.StatusConflict: + return ruleErr.ConflictError(opts.ruleType) + default: + return registrycmdutil.TransformInstanceError(newErr) + } + } + + opts.Logger.Info(icon.SuccessPrefix(), opts.localizer.MustLocalize("registry.rule.update.log.info.ruleUpdated")) + + return nil + +} + +func updateGlobalRule(opts *options, dataAPI *registryinstanceclient.APIClient) (httpRes *http.Response, err error) { + + s := spinner.New(opts.IO.ErrOut, opts.localizer) + s.SetLocalizedSuffix( + "registry.rule.update.log.info.updating.globalRule", + localize.NewEntry("RuleType", opts.ruleType), + localize.NewEntry("Configuration", opts.config), + ) + s.Start() + + req := dataAPI.AdminApi.UpdateGlobalRuleConfig(opts.Context, *rulecmdutil.GetMappedRuleType(opts.ruleType)) + + rule := registryinstanceclient.Rule{ + Config: rulecmdutil.GetMappedConfigValue(opts.config), + Type: rulecmdutil.GetMappedRuleType(opts.ruleType), + } + + req = req.Rule2(rule) + + _, httpRes, err = req.Execute() + + s.Stop() + + return httpRes, err +} + +func updateArtifactRule(opts *options, dataAPI *registryinstanceclient.APIClient) (httpRes *http.Response, err error) { + + s := spinner.New(opts.IO.ErrOut, opts.localizer) + s.SetLocalizedSuffix( + "registry.rule.update.log.info.updating.artifactRule", + localize.NewEntry("RuleType", opts.ruleType), + localize.NewEntry("Configuration", opts.config), + localize.NewEntry("ArtifactID", opts.artifactID), + ) + s.Start() + + req := dataAPI.ArtifactRulesApi.UpdateArtifactRuleConfig(opts.Context, opts.group, opts.artifactID, string(*rulecmdutil.GetMappedRuleType(opts.ruleType))) + + rule := registryinstanceclient.Rule{ + Config: rulecmdutil.GetMappedConfigValue(opts.config), + Type: rulecmdutil.GetMappedRuleType(opts.ruleType), + } + + req = req.Rule2(rule) + + _, httpRes, err = req.Execute() + if httpRes != nil { + defer httpRes.Body.Close() + } + + s.Stop() + + return httpRes, err +} diff --git a/pkg/core/localize/locales/en/cmd/artifact.en.toml b/pkg/core/localize/locales/en/cmd/artifact.en.toml index 28c44ea2b..88fa5783c 100644 --- a/pkg/core/localize/locales/en/cmd/artifact.en.toml +++ b/pkg/core/localize/locales/en/cmd/artifact.en.toml @@ -97,9 +97,6 @@ one = 'Page number' [artifact.common.page.limit] one = 'Page limit' -[artifact.common.message.no.group] -one = 'Using {{.DefaultArtifactGroup}} artifacts group.' - [artifact.common.message.opening.file] one = 'Opening file: {{.FileName}}' diff --git a/pkg/core/localize/locales/en/cmd/registry_crud.en.toml b/pkg/core/localize/locales/en/cmd/registry_crud.en.toml index 2d78b9353..2f627d40f 100644 --- a/pkg/core/localize/locales/en/cmd/registry_crud.en.toml +++ b/pkg/core/localize/locales/en/cmd/registry_crud.en.toml @@ -237,4 +237,7 @@ one = 'Name of the Service Registry instance to view' one = 'Name of the Service Registry instance to delete' [registry.common.flag.instance.id] -one = 'ID of the Service Registry instance to be used (by default, uses the currently selected instance)' \ No newline at end of file +one = 'ID of the Service Registry instance to be used (by default, uses the currently selected instance)' + +[registry.artifact.common.message.no.group] +one = 'Using {{.DefaultArtifactGroup}} artifacts group.' \ No newline at end of file diff --git a/pkg/core/localize/locales/en/cmd/rule.en.toml b/pkg/core/localize/locales/en/cmd/rule.en.toml index a01e123b6..31c27a764 100644 --- a/pkg/core/localize/locales/en/cmd/rule.en.toml +++ b/pkg/core/localize/locales/en/cmd/rule.en.toml @@ -149,4 +149,65 @@ $ rhoas service-registry rule describe --rule-type=compatibility --artifact-id=m one='Fetching global {{.Type}} rule for artifacts in the Service Registry instance' [registry.rule.describe.log.info.fetching.artifactRule] -one = 'Fetching {{.Type}} rule for the artifact' \ No newline at end of file +one = 'Fetching {{.Type}} rule for the artifact' + +[registry.rule.disable.cmd.description.short] +one='Disable validity and compatibility rules' + +[registry.rule.disable.cmd.description.long] +one='Disable validity and compatibility rules for the specified Service Registry instance or artifact' + +[registry.rule.disable.cmd.example] +one=''' +## Disable global compatibility rule for artifacts of the current Service Registry instance +$ rhoas service-registry rule disable --rule-type=compatibility + +## Disable global compatibility rule for artifacts of a specific Service Registry instance +$ rhoas service-registry rule disable --rule-type=compatibility --instance-id 8ecff228-1ffe-4cf5-b38b-55223885ee00 + +## Disable validity rule for a specific artifact +$ rhoas service-registry rule disable --rule-type=validity --artifact-id=my-artifact +''' + +[registry.rule.disable.log.info.disabling.globalRule] +one='Disabling global "{{.RuleType}}" rule for artifacts of Service Registry instance' + +[registry.rule.disable.log.info.disabling.globalRules] +one='Disabling all global rules for artifacts of Service Registry instance' + +[registry.rule.disable.log.info.disabling.artifactRule] +one='Disabling "{{.RuleType}}" rule for artifact with ID "{{.ArtifactID}}"' + +[registry.rule.disable.log.info.disabling.artifactRules] +one='Disabling all rules for artifact with ID "{{.ArtifactID}}"' + +[registry.rule.disable.log.info.success] +one='Successfully disabled' + + +[registry.rule.update.cmd.description.short] +one='Update configuration of rules' + +[registry.rule.update.cmd.description.long] +one='Update configuration of validity and compatibility rules for the specified Service Registry instance or artifact' + +[registry.rule.update.cmd.example] +one=''' +## Update global compatibility rule for artifacts of the current Service Registry instance +$ rhoas service-registry rule update --rule-type=compatibility --config=full + +## Update global compatibility rule for artifacts of a specific Service Registry instance +$ rhoas service-registry rule update --rule-type=compatibility --config=full --instance-id 8ecff228-1ffe-4cf5-b38b-55223885ee00 + +## Update validity rule for a specific artifact +$ rhoas service-registry rule update --rule-type=validity --config=full --artifact-id=my-artifact +''' + +[registry.rule.update.log.info.updating.globalRule] +one='Updating global "{{.RuleType}}" rule for artifacts of Service Registry instance with configuration "{{.Configuration}}"' + +[registry.rule.update.log.info.updating.artifactRule] +one='Updating "{{.RuleType}}" rule for artifact with ID "{{.ArtifactID}}" with configuration "{{.Configuration}}"' + +[registry.rule.update.log.info.ruleUpdated] +one='Rule successfully updated' \ No newline at end of file