github.com/quay/claircore@v1.5.28/rhel/internal/common/normalizeseverity.go (about)

     1  package common
     2  
     3  import (
     4  	"strings"
     5  
     6  	"github.com/quay/claircore"
     7  )
     8  
     9  // NormalizeSeverity maps Red Hat severity strings to claircore's normalized
    10  // serverity levels.
    11  func NormalizeSeverity(severity string) claircore.Severity {
    12  	switch strings.ToLower(severity) {
    13  	case "none":
    14  		return claircore.Unknown
    15  	case "low":
    16  		return claircore.Low
    17  	case "moderate":
    18  		return claircore.Medium
    19  	case "important":
    20  		return claircore.High
    21  	case "critical":
    22  		return claircore.Critical
    23  	default:
    24  		return claircore.Unknown
    25  	}
    26  }