Skip to content

Commit

Permalink
Fix transform and sanitize functions to match expected response (#840)
Browse files Browse the repository at this point in the history
  • Loading branch information
SaaldjorMike authored Aug 9, 2024
1 parent c2de1ac commit d26bb10
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 0 additions & 1 deletion controllers/humiofilteralert_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,5 @@ func (r *HumioFilterAlertReconciler) logErrorAndReturn(err error, msg string) er
}

func sanitizeFilterAlert(filterAlert *humioapi.FilterAlert) {
filterAlert.ID = ""
filterAlert.RunAsUserID = ""
}
1 change: 0 additions & 1 deletion controllers/humioscheduledsearch_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,5 @@ func (r *HumioScheduledSearchReconciler) logErrorAndReturn(err error, msg string
}

func sanitizeScheduledSearch(scheduledSearch *humioapi.ScheduledSearch) {
scheduledSearch.ID = ""
scheduledSearch.RunAsUserID = ""
}
4 changes: 4 additions & 0 deletions pkg/humio/filteralert_transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ func FilterAlertTransform(hfa *humiov1alpha1.HumioFilterAlert) (*humioapi.Filter
filterAlert.ID = hfa.ObjectMeta.Annotations[FilterAlertIdentifierAnnotation]
}

if filterAlert.Labels == nil {
filterAlert.Labels = []string{}
}

return filterAlert, nil
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/humio/scheduledsearch_transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ func ScheduledSearchTransform(hss *humiov1alpha1.HumioScheduledSearch) (*humioap
scheduledSearch.ID = hss.ObjectMeta.Annotations[ScheduledSearchIdentifierAnnotation]
}

if scheduledSearch.Labels == nil {
scheduledSearch.Labels = []string{}
}

return scheduledSearch, nil
}

Expand Down

0 comments on commit d26bb10

Please sign in to comment.