Skip to content

Commit

Permalink
Merge pull request #32 from corneliusweig/w/arbitrary-resource-verbs
Browse files Browse the repository at this point in the history
Allow arbitrary verbs in the resource subcommand
  • Loading branch information
corneliusweig authored Jul 1, 2019
2 parents 6f7f2f5 + b4dd597 commit f3ef529
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/rakkess/client/result/subject.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type SubjectAccess struct {
ResourceName string
// roles holds all rule data concerning this resource and is extracted from Roles and ClusterRoles.
roles map[RoleRef]sets.String
// roles holds all subject access data for this resource and is extracted from RoleBindings and ClusterRoleBindings.
// subjectAccess holds all subject access data for this resource and is extracted from RoleBindings and ClusterRoleBindings.
subjectAccess map[SubjectRef]sets.String
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/rakkess/rakkess.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func Resource(ctx context.Context, opts *options.RakkessOptions) error {
// prints the result as a matrix with verbs in the horizontal and subject names
// in the vertical direction.
func Subject(opts *options.RakkessOptions, resource, resourceName string) error {
if err := validation.Options(opts); err != nil {
if err := validation.OutputFormat(opts.OutputFormat); err != nil {
return err
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/rakkess/validation/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ func Options(opts *options.RakkessOptions) error {
if err := verbs(opts.Verbs); err != nil {
return err
}
return outputFormat(opts.OutputFormat)
return OutputFormat(opts.OutputFormat)
}

func outputFormat(format string) error {
func OutputFormat(format string) error {
for _, o := range constants.ValidOutputFormats {
if o == format {
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/rakkess/validation/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestOutputFormat(t *testing.T) {

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
actual := outputFormat(test.format)
actual := OutputFormat(test.format)
if test.expected != "" {
assert.EqualError(t, actual, test.expected)
} else {
Expand Down

0 comments on commit f3ef529

Please sign in to comment.