graphicek/server/integrations/integrations.go

40 lines
1.2 KiB
Go
Raw Permalink Normal View History

2024-03-29 09:55:51 +01:00
package integrations
2024-03-29 20:49:08 +01:00
import "basic-sensor-receiver/models"
2024-03-29 09:55:51 +01:00
type ContactPointMessageType string
const (
ContactPointEventAlertTriggered = "alert_triggered"
ContactPointEventAlertResolved = "alert_resolved"
2024-03-29 09:55:51 +01:00
ContactPointEventTest = "test"
)
type ContactPointEvent struct {
Type ContactPointMessageType
AlertTriggeredEvent *ContactPointAlertTriggeredEvent
AlertResolvedEvent *ContactPointAlertResolvedEvent
2024-03-29 09:55:51 +01:00
}
type ContactPointAlertTriggeredEvent struct {
2024-03-29 20:49:08 +01:00
Alert *models.AlertItem
Sensor *models.SensorItem
SensorValueCondition *models.AlertConditionSensorValue
SensorLastContactCondition *models.AlertConditionSensorLastContact
LastValue float64
2024-03-29 09:55:51 +01:00
}
type ContactPointAlertResolvedEvent struct {
Alert *models.AlertItem
Sensor *models.SensorItem
SensorValueCondition *models.AlertConditionSensorValue
SensorLastContactCondition *models.AlertConditionSensorLastContact
LastValue float64
}
2024-03-29 09:55:51 +01:00
type ContactPointIntegration interface {
ProcessEvent(evt *ContactPointEvent, rawConfig string) error
ValidateConfig(rawConfig string) error
}