This repository was archived by the owner on May 14, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +16
-3
lines changed Expand file tree Collapse file tree 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"
1010type MyPlugin struct {
1111}
1212
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+
1321func (p MyPlugin ) Setup () {
1422 // implement software setup action
1523}
@@ -22,14 +30,14 @@ func (p MyPlugin) Destroy(project pluginlib.Project) {
2230 // implement project destroy action
2331}
2432
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
2735}
2836
2937// Export plugin to StackHead. Must be named "Plugin"!
3038var Plugin MyPlugin
3139```
3240
3341``` shell
34- go build -buildmode=plugin -o plugin_myplugin .so main.go
42+ go build -buildmode=plugin -o plugin .so main.go
3543```
Original file line number Diff line number Diff line change @@ -29,3 +29,7 @@ func (p MyPlugin) Destroy(project pluginlib.Project) {
2929func (p MyPlugin ) Setup () {
3030 fmt .Println ("Setup..." )
3131}
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 {
88 Setup ()
99 Deploy (project Project )
1010 Destroy (project Project )
11+ TriggerHook (hookName string , project Project )
1112}
1213
1314func LoadPlugin (path string ) (Plugin , * PluginConfig , error ) {
You can’t perform that action at this time.
0 commit comments