crowdsec/pkg/models/helpers.go
Thibault "bui" Koechlin af4bb350c0
hubtests revamp + cscli explain (#988)
* New hubtest CI for scenarios/parsers from the hub
 * New `cscli explain` command to visualize parsers/scenarios pipeline

Co-authored-by: alteredCoder <kevin@crowdsec.net>
Co-authored-by: Sebastien Blot <sebastien@crowdsec.net>
Co-authored-by: he2ss <hamza.essahely@gmail.com>
Co-authored-by: Cristian Nitescu <cristian@crowdsec.net>
2021-10-04 17:14:52 +02:00

50 lines
711 B
Go

package models
func (a *Alert) HasRemediation() bool {
return true
}
func (a *Alert) GetScope() string {
if a.Source.Scope == nil {
return ""
}
return *a.Source.Scope
}
func (a *Alert) GetScenario() string {
if a.Scenario == nil {
return ""
}
return *a.Scenario
}
func (a *Alert) GetEventsCount() int32 {
if a.EventsCount == nil {
return 0
}
return *a.EventsCount
}
func (e *Event) GetMeta(key string) string {
for _, meta := range e.Meta {
if meta.Key == key {
return meta.Value
}
}
return ""
}
func (s Source) GetValue() string {
if s.Value == nil {
return ""
}
return *s.Value
}
func (s Source) GetScope() string {
if s.Scope == nil {
return ""
}
return *s.Scope
}