statping/events.go

65 lines
1.1 KiB
Go
Raw Normal View History

2018-06-14 01:19:00 +00:00
package main
2018-06-19 04:48:25 +00:00
import (
"github.com/fatih/structs"
"github.com/hunterlong/statup/plugin"
"upper.io/db.v3/lib/sqlbuilder"
)
func OnLoad(db sqlbuilder.Database) {
for _, p := range allPlugins {
p.OnLoad(db)
}
}
2018-06-14 01:19:00 +00:00
2018-06-14 06:38:15 +00:00
func OnSuccess(s *Service) {
2018-06-14 01:19:00 +00:00
for _, p := range allPlugins {
2018-06-19 04:48:25 +00:00
p.OnSuccess(structs.Map(s))
2018-06-14 01:19:00 +00:00
}
}
func OnFailure(s *Service) {
for _, p := range allPlugins {
2018-06-19 04:48:25 +00:00
p.OnFailure(structs.Map(s))
}
}
func OnSettingsSaved(c *Core) {
for _, p := range allPlugins {
p.OnSettingsSaved(structs.Map(c))
}
}
func OnNewUser(u *User) {
for _, p := range allPlugins {
p.OnNewUser(structs.Map(u))
}
}
func OnNewService(s *Service) {
for _, p := range allPlugins {
p.OnNewService(structs.Map(s))
}
}
func OnDeletedService(s *Service) {
for _, p := range allPlugins {
p.OnDeletedService(structs.Map(s))
}
}
func OnUpdateService(s *Service) {
for _, p := range allPlugins {
p.OnUpdatedService(structs.Map(s))
2018-06-14 01:19:00 +00:00
}
}
func SelectPlugin(name string) plugin.PluginActions {
for _, p := range allPlugins {
if p.GetInfo().Name == name {
return p
}
}
return plugin.PluginInfo{}
}