Goflexer is a package used for writing nFlex modules as GoLang plugins
package main
import (
"fmt"
"github.com/ntt-nflex/goflexer"
)
// Test is a test handler
func Test(event goflexer.Event, context goflexer.Context) goflexer.Result {
fmt.Println("This is a log message")
return map[string]interface{}{
"foo": "bar",
}
}
You must create a plugin.go
file with you code. Then build it as a Go plugin and zip it.
$ go get "github.com/ntt-nflex/goflexer"
$ go build -buildmode=plugin plugin.go
$ zip module.zip plugin.so
Create a ~/.flexer.yaml file if you don't already have one
regions:
default:
cmp_api_key: *****
cmp_api_secret: ***********
cmp_url: https://localhost/cmp/basic/api
verify_ssl: false
goflexer --handler TestMethod --event '{"foo": "bar"}'
Once you have the zip file, you can upload it to nFlex. The easiest way to do that is with flexer