mirror of https://github.com/statping/statping
Created Statup Plugins (markdown)
parent
b9f3a86d97
commit
cd20fae309
|
@ -0,0 +1,34 @@
|
|||
Since Statup is built in Go Language we can use the go plugin feature to create dynamic plugins that run on load. Statup has an event anytime anything happens, you can create your own plugins and do any type of function.
|
||||
|
||||
## Plugin Interface
|
||||
```go
|
||||
type PluginActions interface {
|
||||
GetInfo() Info
|
||||
GetForm() string
|
||||
SetInfo(map[string]interface{}) Info
|
||||
Routes() []Routing
|
||||
OnSave(map[string]interface{})
|
||||
OnFailure(map[string]interface{})
|
||||
OnSuccess(map[string]interface{})
|
||||
OnSettingsSaved(map[string]interface{})
|
||||
OnNewUser(map[string]interface{})
|
||||
OnNewService(map[string]interface{})
|
||||
OnUpdatedService(map[string]interface{})
|
||||
OnDeletedService(map[string]interface{})
|
||||
OnInstall(map[string]interface{})
|
||||
OnUninstall(map[string]interface{})
|
||||
OnBeforeRequest(map[string]interface{})
|
||||
OnAfterRequest(map[string]interface{})
|
||||
OnShutdown()
|
||||
OnLoad(sqlbuilder.Database)
|
||||
}
|
||||
```
|
||||
|
||||
## Example of an Event
|
||||
Knowing what happens during an event is important for your plugin. For example, lets have an event that echo something when a service has a Failure status being issued.
|
||||
```go
|
||||
func OnFailure(service map[string]interface{}) {
|
||||
fmt.Println("oh no! an event is failing right now! do something!")
|
||||
fmt.Println(service)
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue