alrm/alarm/alarm.go

21 lines
393 B
Go
Raw Normal View History

package alarm
import (
2021-01-24 13:59:53 -09:00
"fmt"
2021-02-03 05:59:31 -09:00
"git.binarythought.com/cdramey/alrm/alarm/email"
)
type Alarm interface {
Parse(string) (bool, error)
Alarm(string, string, string, error) error
}
func NewAlarm(name string, typename string) (Alarm, error) {
switch typename {
case "email":
2021-01-24 13:32:39 -09:00
return email.NewAlarmEmail(name), nil
default:
return nil, fmt.Errorf("unknown alarm name \"%s\"", name)
}
}