Documentation ¶
Overview ¶
A helper package for Lacework severities
Index ¶
- Constants
- Variables
- func IsValid(s string) bool
- func NewSeverity(s string) severity
- func Normalize(s string) (int, string)
- func NotAsCritical(first, second string) bool
- func ShouldFilter(severity, threshold string) bool
- func SortSlice[S Severity](s []S)
- func SortSliceA[S Severity](s []S)
- type Severity
Constants ¶
View Source
const ( // Unknown severity Unknown severity = iota // Critical severity Critical // High severity High // Medium severity Medium // Low severity Low // Informational severity Info )
Variables ¶
A list of valid Lacework severities (critical, high, medium, low, info)
Functions ¶
func IsValid ¶
Take a string representation of Lacework severity and return whether it properly maps to a valid severity (not unknown)
func Normalize ¶
Normalize takes a string representation of Lacework severity and returns it's normalized integer and string values.
Relation:
- Critical Severity => 1, "Critical"
- High Severity => 2, "High"
- Medium Severity => 3, "Medium"
- Low Severity => 4, "Low"
- Informational Severity => 5, "Info"
- Unknown Severity => 0, "Unknown"
func NotAsCritical ¶
Returns true if the first severity not as critical as the second severity
For instance:
- "info" is not as crtical as "low" (true)
- "medium" is as critical as "medium" (false)
- "high" is more critical than "medium" (false)
- "unknown" is more critical than "medium" (false)
- "medium" is not as critical as "unknown" (true)
func ShouldFilter ¶
Returns true if the threshold is proper and the severity is greater than or equal to the threshold
For instance:
- "medium" severity should be filtered for "high" threshold
- "critical" severity should NOT be filtered for "high" threshold
- "info" severity should NOT be filtered for "info" threshold
- invalid (unknown) severity should NOT be filtered for * threshold
- all severities should NOT be filtered for an invalid (unknown) threshold
func SortSlice ¶
func SortSlice[S Severity](s []S)
Sort a slice of Severity interfaces from critical -> info
func SortSliceA ¶
func SortSliceA[S Severity](s []S)
Sort a slice of Severity interfaces from info -> critical
Types ¶
Click to show internal directories.
Click to hide internal directories.