A Golang API client for interacting with Lacework APIs.
Download the library into your $GOPATH
:
$ go get github.com/lacework/go-sdk/api
Import the library into your tool:
import "github.com/lacework/go-sdk/api"
To interact with Lacework's API you need to have:
- A Lacework account
- Either API access keys or token for authentication
Create a new Lacework client that will automatically generate a new access token
from the provided set of API keys, then hit the /api/v2/AlertChannels
endpoint
to list all available alert channels in your account:
package main
import (
"fmt"
"log"
"github.com/lacework/go-sdk/api"
)
func main() {
lacework, err := api.NewClient("account",
api.WithTokenFromKeys("KEY", "SECRET"),
)
if err != nil {
log.Fatal(err)
}
alertChannels, err := lacework.V2.AlertChannels.List()
if err != nil {
log.Fatal(err)
}
for _, channel := range alertChannels.Data {
fmt.Printf("Alert channel: %s\n", channel.Name)
}
// Output:
//
// Alert channel: DEFAULT EMAIL
}
Look at the _examples/ folder for more examples.