-
Notifications
You must be signed in to change notification settings - Fork 5
/
plugin.go
29 lines (24 loc) · 683 Bytes
/
plugin.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
package iopipe
import "context"
// PluginInstantiator is the function that initializes the plugin
type PluginInstantiator func() Plugin
// PluginMeta is meta data about the plugin
type PluginMeta struct {
Name string `json:"name"`
Version string `json:"version"`
Homepage string `json:"homepage"`
Enabled bool `json:"enabled"`
Uploads []string `json:"uploads"`
}
// Plugin is the interface a plugin should implement
type Plugin interface {
Meta() *PluginMeta
Enabled() bool
// Hook methods
PreSetup(*Agent)
PostSetup(*Agent)
PreInvoke(context.Context, interface{})
PostInvoke(context.Context, interface{})
PreReport(*Report)
PostReport(*Report)
}