-
Notifications
You must be signed in to change notification settings - Fork 351
/
handler.go
37 lines (30 loc) · 934 Bytes
/
handler.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
log "github.com/Sirupsen/logrus"
)
// Handler interface contains the methods that are required
type Handler interface {
Init() error
ObjectCreated(obj interface{})
ObjectDeleted(obj interface{})
ObjectUpdated(objOld, objNew interface{})
}
// TestHandler is a sample implementation of Handler
type TestHandler struct{}
// Init handles any handler initialization
func (t *TestHandler) Init() error {
log.Info("TestHandler.Init")
return nil
}
// ObjectCreated is called when an object is created
func (t *TestHandler) ObjectCreated(obj interface{}) {
log.Info("TestHandler.ObjectCreated")
}
// ObjectDeleted is called when an object is deleted
func (t *TestHandler) ObjectDeleted(obj interface{}) {
log.Info("TestHandler.ObjectDeleted")
}
// ObjectUpdated is called when an object is updated
func (t *TestHandler) ObjectUpdated(objOld, objNew interface{}) {
log.Info("TestHandler.ObjectUpdated")
}