40 lines
1.2 KiB
Go
40 lines
1.2 KiB
Go
package integrations
|
|
|
|
import "basic-sensor-receiver/models"
|
|
|
|
type ContactPointMessageType string
|
|
|
|
const (
|
|
ContactPointEventAlertTriggered = "alert_triggered"
|
|
ContactPointEventAlertResolved = "alert_resolved"
|
|
ContactPointEventTest = "test"
|
|
)
|
|
|
|
type ContactPointEvent struct {
|
|
Type ContactPointMessageType
|
|
|
|
AlertTriggeredEvent *ContactPointAlertTriggeredEvent
|
|
AlertResolvedEvent *ContactPointAlertResolvedEvent
|
|
}
|
|
|
|
type ContactPointAlertTriggeredEvent struct {
|
|
Alert *models.AlertItem
|
|
Sensor *models.SensorItem
|
|
SensorValueCondition *models.AlertConditionSensorValue
|
|
SensorLastContactCondition *models.AlertConditionSensorLastContact
|
|
LastValue float64
|
|
}
|
|
|
|
type ContactPointAlertResolvedEvent struct {
|
|
Alert *models.AlertItem
|
|
Sensor *models.SensorItem
|
|
SensorValueCondition *models.AlertConditionSensorValue
|
|
SensorLastContactCondition *models.AlertConditionSensorLastContact
|
|
LastValue float64
|
|
}
|
|
|
|
type ContactPointIntegration interface {
|
|
ProcessEvent(evt *ContactPointEvent, rawConfig string) error
|
|
ValidateConfig(rawConfig string) error
|
|
}
|