Skip to content

Commit

Permalink
still return a cluster if no sys.audit access
Browse files Browse the repository at this point in the history
  • Loading branch information
luthermonson committed Oct 26, 2023
1 parent 6c8706e commit a727da8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@ func (c *Client) Cluster(ctx context.Context) (*Cluster, error) {
cluster := &Cluster{
client: c,
}
return cluster, c.Get(ctx, "/cluster/status", cluster)

// requires (/, Sys.Audit), do not error out if no access to still get the cluster
if err := cluster.Status(ctx); !IsNotAuthorized(err) {
return cluster, err
}

return cluster, nil

Check warning on line 20 in cluster.go

View check run for this annotation

Codecov / codecov/patch

cluster.go#L20

Added line #L20 was not covered by tests
}

func (cl *Cluster) Status(ctx context.Context) error {
return cl.client.Get(ctx, "/cluster/status", cl)
}

func (cl *Cluster) NextID(ctx context.Context) (int, error) {
Expand Down

0 comments on commit a727da8

Please sign in to comment.