From a727da8551855845b9389442f6ab0b51fa1daa2f Mon Sep 17 00:00:00 2001 From: Luther Monson Date: Wed, 25 Oct 2023 23:58:34 -0700 Subject: [PATCH] still return a cluster if no sys.audit access --- cluster.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cluster.go b/cluster.go index 8fa3f2a..a3da92c 100644 --- a/cluster.go +++ b/cluster.go @@ -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 +} + +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) {