Skip to content

Commit a57c9b1

Browse files
feat(service-registry rule): add base and enable command (#1418)
1 parent f3de237 commit a57c9b1

File tree

29 files changed

+730
-17
lines changed

29 files changed

+730
-17
lines changed

docs/commands/rhoas_service-registry.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ rhoas service-registry list
4242
* [rhoas service-registry describe](rhoas_service-registry_describe.md) - Describe a Service Registry instance
4343
* [rhoas service-registry list](rhoas_service-registry_list.md) - List Service Registry instances
4444
* [rhoas service-registry role](rhoas_service-registry_role.md) - Service Registry role management
45+
* [rhoas service-registry rule](rhoas_service-registry_rule.md) - Manage artifact rules in a Service Registry instance
4546
* [rhoas service-registry use](rhoas_service-registry_use.md) - Use a Service Registry instance
4647

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## rhoas service-registry rule
2+
3+
Manage artifact rules in a Service Registry instance
4+
5+
### Synopsis
6+
7+
Set of commands for managing validity and compatibility rules for an entire Service Registry instance or individual for each artifact.
8+
Service Registry rules govern how artifact content can evolve over time by validating for any artifact updates
9+
10+
Rules can be configured as global rules for entire Service Registry instances or specific artifacts.
11+
12+
13+
### Examples
14+
15+
```
16+
## Enable global compatibility rule for artifacts of the current Service Registry instance
17+
$ rhoas service-registry rule enable --rule-type=compatibility --config=full
18+
19+
## Enable global compatibility rule for artifacts of a specific Service Registry instance
20+
$ rhoas service-registry rule enable --rule-type=compatibility --config=full-transitive --instance-id 8ecff228-1ffe-4cf5-b38b-55223885ee00
21+
22+
## display configuration details of global validity rule for current Service Registry instance
23+
$ rhoas service-registry rule describe --rule-type=validity
24+
25+
```
26+
27+
### Options inherited from parent commands
28+
29+
```
30+
-h, --help Show help for a command
31+
-v, --verbose Enable verbose mode
32+
```
33+
34+
### SEE ALSO
35+
36+
* [rhoas service-registry](rhoas_service-registry.md) - Service Registry commands
37+
* [rhoas service-registry rule enable](rhoas_service-registry_rule_enable.md) - Enable validity and compatibility rules
38+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
## rhoas service-registry rule enable
2+
3+
Enable validity and compatibility rules
4+
5+
### Synopsis
6+
7+
Enable validity and compatibility rules for the selected Service Registry instance or specific artifact
8+
9+
```
10+
rhoas service-registry rule enable [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
## Enable global compatibility rule for artifacts of the current Service Registry instance
17+
$ rhoas service-registry rule enable --rule-type=compatibility --config=full
18+
19+
## Enable global compatibility rule for artifacts of a specific Service Registry instance
20+
$ rhoas service-registry rule enable --rule-type=compatibility --config=full-transitive --instance-id 8ecff228-1ffe-4cf5-b38b-55223885ee00
21+
22+
## Enable validity rule for a specific artifact
23+
$ rhoas service-registry rule enable --rule-type=validity --config=syntax-only --artifact-id=my-artifact
24+
25+
```
26+
27+
### Options
28+
29+
```
30+
--artifact-id string ID of the artifact
31+
--config string Configuration value for a rule
32+
-g, --group string Artifact group (default "default")
33+
--instance-id string ID of the Service Registry instance to be used (by default, uses the currently selected instance)
34+
--rule-type string Rule type determines how the content of an artifact can evolve over time
35+
```
36+
37+
### Options inherited from parent commands
38+
39+
```
40+
-h, --help Show help for a command
41+
-v, --verbose Enable verbose mode
42+
```
43+
44+
### SEE ALSO
45+
46+
* [rhoas service-registry rule](rhoas_service-registry_rule.md) - Manage artifact rules in a Service Registry instance
47+

pkg/cmd/registry/artifact/crud/create/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func NewCreateCommand(f *factory.Factory) *cobra.Command {
106106
cmd.Flags().StringVar(&opts.description, "description", "", opts.localizer.MustLocalize("artifact.common.custom.description"))
107107

108108
cmd.Flags().StringVarP(&opts.artifactType, "type", "t", "", opts.localizer.MustLocalize("artifact.common.type", localize.NewEntry("AllowedTypes", util.GetAllowedArtifactTypeEnumValuesAsString())))
109-
cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("artifact.common.instance.id"))
109+
cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("registry.common.flag.instance.id"))
110110

111111
flagutil.EnableOutputFlagCompletion(cmd)
112112

pkg/cmd/registry/artifact/crud/get/get.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func NewGetCommand(f *factory.Factory) *cobra.Command {
7878

7979
cmd.Flags().StringVar(&opts.artifact, "artifact-id", "", opts.localizer.MustLocalize("artifact.common.id"))
8080
cmd.Flags().StringVarP(&opts.group, "group", "g", util.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group"))
81-
cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("artifact.common.instance.id"))
81+
cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("registry.common.flag.instance.id"))
8282
cmd.Flags().StringVar(&opts.outputFile, "output-file", "", opts.localizer.MustLocalize("artifact.common.message.file.location"))
8383
cmd.Flags().StringVar(&opts.version, "version", "", opts.localizer.MustLocalize("artifact.common.version"))
8484

pkg/cmd/registry/artifact/crud/list/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func NewListCommand(f *factory.Factory) *cobra.Command {
111111
cmd.Flags().StringVar(&opts.description, "description", "", opts.localizer.MustLocalize("artifact.cmd.list.flag.description.description"))
112112
cmd.Flags().StringArrayVar(&opts.properties, "property", []string{}, opts.localizer.MustLocalize("artifact.cmd.list.flag.properties.description"))
113113

114-
cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("artifact.common.instance.id"))
114+
cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("registry.common.flag.instance.id"))
115115
cmd.Flags().StringVarP(&opts.outputFormat, "output", "o", "", opts.localizer.MustLocalize("artifact.common.message.output.format"))
116116

117117
flagutil.EnableOutputFlagCompletion(cmd)

pkg/cmd/registry/artifact/crud/update/update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func NewUpdateCommand(f *factory.Factory) *cobra.Command {
8585

8686
cmd.Flags().StringVar(&opts.artifact, "artifact-id", "", opts.localizer.MustLocalize("artifact.common.id"))
8787
cmd.Flags().StringVarP(&opts.group, "group", "g", util.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group"))
88-
cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("artifact.common.instance.id"))
88+
cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("registry.common.flag.instance.id"))
8989

9090
cmd.Flags().StringVar(&opts.version, "version", "", opts.localizer.MustLocalize("artifact.common.custom.version"))
9191
cmd.Flags().StringVar(&opts.name, "name", "", opts.localizer.MustLocalize("artifact.common.custom.name"))

pkg/cmd/registry/artifact/metadata/get.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func NewGetMetadataCommand(f *factory.Factory) *cobra.Command {
7777

7878
cmd.Flags().StringVar(&opts.artifact, "artifact-id", "", opts.localizer.MustLocalize("artifact.common.id"))
7979
cmd.Flags().StringVarP(&opts.group, "group", "g", util.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group"))
80-
cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("artifact.common.instance.id"))
80+
cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("registry.common.flag.instance.id"))
8181
cmd.Flags().StringVarP(&opts.outputFormat, "output", "o", "", opts.localizer.MustLocalize("artifact.common.message.output.format"))
8282

8383
flagutil.EnableOutputFlagCompletion(cmd)

pkg/cmd/registry/artifact/metadata/set.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func NewSetMetadataCommand(f *factory.Factory) *cobra.Command {
8585

8686
cmd.Flags().StringVar(&opts.artifact, "artifact-id", "", opts.localizer.MustLocalize("artifact.common.id"))
8787
cmd.Flags().StringVarP(&opts.group, "group", "g", util.DefaultArtifactGroup, opts.localizer.MustLocalize("artifact.common.group"))
88-
cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("artifact.common.instance.id"))
88+
cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("registry.common.flag.instance.id"))
8989
cmd.Flags().StringVarP(&opts.outputFormat, "output", "o", "", opts.localizer.MustLocalize("artifact.common.message.output.format"))
9090

9191
cmd.Flags().StringVar(&opts.name, "name", "", opts.localizer.MustLocalize("artifact.common.custom.name"))

pkg/cmd/registry/artifact/migrate/export.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func NewExportCommand(f *factory.Factory) *cobra.Command {
6464
},
6565
}
6666
cmd.Flags().StringVar(&opts.file, "output-file", "", opts.localizer.MustLocalize("artifact.common.file.location"))
67-
cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("artifact.common.instance.id"))
67+
cmd.Flags().StringVar(&opts.registryID, "instance-id", "", opts.localizer.MustLocalize("registry.common.flag.instance.id"))
6868
_ = cmd.MarkFlagRequired("output-file")
6969

7070
return cmd

0 commit comments

Comments
 (0)