func()

in pkg/gcv/result.go [99:119]


func (r *Result) ToInsights() []*Insight {
	if len(r.ConstraintViolations) == 0 {
		return nil
	}

	insights := make([]*Insight, len(r.ConstraintViolations))
	for idx, cv := range r.ConstraintViolations {
		i := &Insight{
			Description:     cv.Message,
			TargetResources: []string{r.Name},
			InsightSubtype:  cv.name(),
			Content: map[string]interface{}{
				"resource": r.InputResource,
				"metadata": cv.metadata(nil),
			},
			Category: "SECURITY",
		}
		insights[idx] = i
	}
	return insights
}