Skip to content

Commit

Permalink
CBG-4100: Call AuditIDClusterInfoRead event (#7009)
Browse files Browse the repository at this point in the history
* Create base.AuditIDClusterInfoRead event

* Update rest/admin_api.go
  • Loading branch information
bbrks authored Jul 23, 2024
1 parent 9f54f2f commit 56f6f2c
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions rest/admin_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2147,36 +2147,36 @@ type BucketInfo struct {
// information (registry) for each
func (h *handler) handleGetClusterInfo() error {

// If not using persistent config, returns legacy_config:true
if h.server.persistentConfig == false {
clusterInfo := ClusterInfo{
LegacyConfig: true,
}
h.writeJSON(clusterInfo)
return nil
}

clusterInfo := ClusterInfo{
Buckets: make(map[string]BucketInfo),
LegacyConfig: true,
}

bucketNames, err := h.server.GetBucketNames()
if err != nil {
return err
}
if h.server.persistentConfig {

for _, bucketName := range bucketNames {
registry, err := h.server.BootstrapContext.getGatewayRegistry(h.ctx(), bucketName)
bucketNames, err := h.server.GetBucketNames()
if err != nil {
base.InfofCtx(h.ctx(), base.KeyAll, "Unable to retrieve registry for bucket %s during getClusterInfo: %v", base.MD(bucketName), err)
continue
return err
}

bucketInfo := BucketInfo{
Registry: *registry,
clusterInfo = ClusterInfo{
Buckets: make(map[string]BucketInfo, len(bucketNames)),
}

for _, bucketName := range bucketNames {
registry, err := h.server.BootstrapContext.getGatewayRegistry(h.ctx(), bucketName)
if err != nil {
base.InfofCtx(h.ctx(), base.KeyAll, "Unable to retrieve registry for bucket %s during getClusterInfo: %v", base.MD(bucketName), err)
continue
}

bucketInfo := BucketInfo{
Registry: *registry,
}
clusterInfo.Buckets[bucketName] = bucketInfo
}
clusterInfo.Buckets[bucketName] = bucketInfo
}

base.Audit(h.ctx(), base.AuditIDClusterInfoRead, nil)
h.writeJSON(clusterInfo)
return nil
}
Expand Down

0 comments on commit 56f6f2c

Please sign in to comment.