Skip to content

Commit

Permalink
Removes parser filter loop and support for non-binary payloads
Browse files Browse the repository at this point in the history
  • Loading branch information
bomoko committed Feb 11, 2024
1 parent 11681c7 commit 65d0811
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions internal/handler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,6 @@ func (h *Messaging) gatherFactsFromInsightData(incoming *InsightsMessage, resour
return lagoonSourceFactMapCollection, fmt.Errorf("no resource definition labels could be found in payload (i.e. lagoon.sh/project or lagoon.sh/environment)")
}

if insights.InputPayload == Payload && insights.LagoonType == Facts {
for _, p := range incoming.Payload {
lagoonSourceFactMap, err := parserFilterLoopForPayloads(insights, p, h, apiClient, resource)
if err != nil {
return lagoonSourceFactMapCollection, err
}
lagoonSourceFactMapCollection = append(lagoonSourceFactMapCollection, lagoonSourceFactMap)
}
}

if insights.InputPayload == BinaryPayload && insights.LagoonType == Facts {
for _, p := range incoming.BinaryPayload {
lagoonSourceFactMap, err := parserFilterLoopForBinaryPayloads(insights, p, h, apiClient, resource)
Expand Down Expand Up @@ -330,28 +320,6 @@ func parserFilterLoopForBinaryPayloads(insights InsightsData, p string, h *Messa
return lagoonSourceFactMap, nil
}

func parserFilterLoopForPayloads(insights InsightsData, p PayloadInput, h *Messaging, apiClient graphql.Client, resource ResourceDestination) (LagoonSourceFactMap, error) {
lagoonSourceFactMap := LagoonSourceFactMap{}
for _, filter := range parserFilters {
var result []LagoonFact
var source string

json, err := json.Marshal(p)
if err != nil {
slog.Error("Error marshalling data", "error", err.Error())
return lagoonSourceFactMap, err
}

result, source, err = filter(h, insights, fmt.Sprintf("%s", json), apiClient, resource)
if err != nil {
slog.Error("Error Filtering payload", "error", err.Error())
return lagoonSourceFactMap, err
}
lagoonSourceFactMap[source] = result
}
return lagoonSourceFactMap, nil
}

func trivySBOMProcessing(apiClient graphql.Client, trivyServerEndpoint string, resource ResourceDestination, payload string) error {

bom, err := getBOMfromPayload(payload)
Expand Down

0 comments on commit 65d0811

Please sign in to comment.