Add action type *dynamic_action_plan

This commit is contained in:
arberkatellari
2025-05-26 19:26:09 +02:00
committed by Dan Christian Bogos
parent ccdf3ef1f1
commit 33a47f663c
8 changed files with 307 additions and 187 deletions

View File

@@ -367,8 +367,14 @@ func (t *TPTiming) IsActiveAt(tm time.Time) bool {
return true
}
// Returns true if string can be split in 3 sperated by ":" signs. "00:00:00"
// Returns true if string can be split in 3 sperated by ":" signs. "00:00:00", or if
// its parsable to a duration
func IsTimeFormated(t string) bool {
if strings.HasPrefix(t, PlusChar) {
if _, err := time.ParseDuration(strings.TrimPrefix(t, PlusChar)); err != nil {
return false
}
}
return len(strings.Split(t, ":")) == 3
}

View File

@@ -199,6 +199,7 @@ const (
FilterValStart = "("
FilterValEnd = ")"
PlusChar = "+"
MinusChar = "-"
JSON = "json"
JSONCaps = "JSON"
GOBCaps = "GOB"
@@ -1183,6 +1184,7 @@ const (
MetaDynamicThreshold = "*dynamic_threshold"
MetaDynamicStats = "*dynamic_stats"
MetaDynamicAttribute = "*dynamic_attribute"
MetaDynamicActionPlan = "*dynamic_action_plan"
ActionID = "ActionID"
ActionType = "ActionType"
ActionValue = "ActionValue"