2020-11-30 09:37:17 +00:00
|
|
|
package models
|
|
|
|
|
|
|
|
func (a *Alert) HasRemediation() bool {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Alert) GetScope() string {
|
|
|
|
if a.Source.Scope == nil {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return *a.Source.Scope
|
|
|
|
}
|
|
|
|
|
2022-06-22 09:29:52 +00:00
|
|
|
func (a *Alert) GetValue() string {
|
|
|
|
if a.Source.Value == nil {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return *a.Source.Value
|
|
|
|
}
|
|
|
|
|
2020-11-30 09:37:17 +00:00
|
|
|
func (a *Alert) GetScenario() string {
|
|
|
|
if a.Scenario == nil {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return *a.Scenario
|
|
|
|
}
|
2021-10-04 15:14:52 +00:00
|
|
|
|
|
|
|
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 ""
|
|
|
|
}
|
|
|
|
|
2022-09-07 08:11:39 +00:00
|
|
|
func (a *Alert) GetMeta(key string) string {
|
|
|
|
for _, meta := range a.Meta {
|
|
|
|
if meta.Key == key {
|
|
|
|
return meta.Value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
2021-10-04 15:14:52 +00:00
|
|
|
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
|
|
|
|
}
|
2022-11-14 08:55:53 +00:00
|
|
|
|
|
|
|
func (s Source) GetAsNumberName() string {
|
|
|
|
ret := ""
|
|
|
|
if s.AsNumber != "0" {
|
|
|
|
ret += s.AsNumber
|
|
|
|
}
|
|
|
|
if s.AsName != "" {
|
|
|
|
ret += " " + s.AsName
|
|
|
|
}
|
|
|
|
return ret
|
|
|
|
}
|