Skip to content

Commit

Permalink
use map[string][]string for view connections
Browse files Browse the repository at this point in the history
  • Loading branch information
bderrly committed Oct 17, 2023
1 parent c67d431 commit 6840718
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkg/humio/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,8 @@ func (h *ClientConfig) AddView(config *humioapi.Config, req reconcile.Request, h
}

description := ""
connectionMap := getConnectionMap(viewConnections)

err := h.GetHumioClient(config, req).Views().Create(hv.Spec.Name, description, connectionMap)
err := h.GetHumioClient(config, req).Views().Create(hv.Spec.Name, description, getConnectionMap(viewConnections))
return &view, err
}

Expand Down Expand Up @@ -534,10 +533,10 @@ func (h *ClientConfig) DeleteAction(config *humioapi.Config, req reconcile.Reque
return h.GetHumioClient(config, req).Actions().Delete(ha.Spec.ViewName, ha.Spec.Name)
}

func getConnectionMap(viewConnections []humioapi.ViewConnection) map[string]string {
connectionMap := make(map[string]string)
func getConnectionMap(viewConnections []humioapi.ViewConnection) map[string][]string {
connectionMap := make(map[string][]string)
for _, connection := range viewConnections {
connectionMap[connection.RepoName] = connection.Filter
connectionMap[connection.RepoName] = append(connectionMap[connection.RepoName], connection.Filter)
}
return connectionMap
}
Expand Down

0 comments on commit 6840718

Please sign in to comment.