This repository was archived by the owner on May 14, 2022. It is now read-only.
File tree 4 files changed +16
-3
lines changed
4 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,14 @@ import "github.com/getstackhead/pluginlib"
10
10
type MyPlugin struct {
11
11
}
12
12
13
+ var PluginConfig = pluginlib.PluginConfig {
14
+ Name : " Test" ,
15
+ Description : " This is an example StackHead Proxy plugin" ,
16
+ Version : " 0.0.0-dev" ,
17
+ Authors : []string {" Your Name" },
18
+ PluginType : pluginlib.PluginType .PROXY ,
19
+ }
20
+
13
21
func (p MyPlugin ) Setup () {
14
22
// implement software setup action
15
23
}
@@ -22,14 +30,14 @@ func (p MyPlugin) Destroy(project pluginlib.Project) {
22
30
// implement project destroy action
23
31
}
24
32
25
- func (p MyPlugin ) HookPreTerraformPlan ( project pluginlib .Project ) {
26
- // pre terraform plan hook (to be implemented)
33
+ func (p MyPlugin ) TriggerHook ( hookName string , project pluginlib .Project ) {
34
+ // triggered by hooks
27
35
}
28
36
29
37
// Export plugin to StackHead. Must be named "Plugin"!
30
38
var Plugin MyPlugin
31
39
```
32
40
33
41
``` shell
34
- go build -buildmode=plugin -o plugin_myplugin .so main.go
42
+ go build -buildmode=plugin -o plugin .so main.go
35
43
```
Original file line number Diff line number Diff line change @@ -29,3 +29,7 @@ func (p MyPlugin) Destroy(project pluginlib.Project) {
29
29
func (p MyPlugin ) Setup () {
30
30
fmt .Println ("Setup..." )
31
31
}
32
+
33
+ func (p MyPlugin ) TriggerHook (hookName string , project pluginlib.Project ) {
34
+ fmt .Println ("Hook " + hookName + " triggered for project " + project .Name + "." )
35
+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ type Plugin interface {
8
8
Setup ()
9
9
Deploy (project Project )
10
10
Destroy (project Project )
11
+ TriggerHook (hookName string , project Project )
11
12
}
12
13
13
14
func LoadPlugin (path string ) (Plugin , * PluginConfig , error ) {
You can’t perform that action at this time.
0 commit comments