With a new integration between the Ambassador Edge Stack, the most popular Kubernetes-native API gateway and Signal Sciences WAF,…
Signal Sciences was built with an API-first design from day one, meaning you can get to all of the data and configs through the API. Put another way, we love APIs and we love giving all the knobs and switches to our customers to use Signal Sciences however best fits their needs.
We are excited to release a new way to interact with our API.
(Go Gopher by Renee French is licensed under CC by 3.0)
Consumers of the Signal Sciences API may be familiar with our Python API client. While we’ll continue to support the Python library today, we’re releasing an official Go library for interacting with the Signal Sciences API.
It is really easy to install, just use go get
:
$ go get github.com/signalsciences/go-sigsci
That’s it! Now you are ready to use it. From here, we can use go-sigsci, and instantiate a client:
email := "[sigsci email]"
password := "[sigsci password]"
sc, err := sigsci.NewClient(email, password)
if err != nil {
log.Fatal(err)
}
The NewClient
method handles the authentication for us. Once we have a client, we can call methods on it, for example:
agents, err := sc.ListAgents("testcorp", "www.mysite.com")
if err != nil {
log.Fatal(err)
}
This will give us a list of agents for our site. Let’s put this all together in full example script:
package main
import (
“log”
sigsci “github.com/signalsciences/go-sigsci”
)
func main() {
email :=”[sigsci email]”
password := “[sigsci password]”
sc, err := sigsci.NewClient(email, password)
if err != nil {
log.Fatal(err)
}
agents,err := sc.ListAgents(“testcorp”, “www.mysite.com”)
if err != nil {
log.Fatal(err)
}
log.Println(agents)
}
This is just a taste of what you can do, of course aII of the methods listed in our API documentation are available in the Go library. As we add new functionality, you will see the new endpoints become available. If you are looking for more, the GoDoc documentation also lists all of the available methods and contains useful examples.
We encourage our customers who use Go to try out go-sigsci. We love it and we think you will too. Please feel free to open issues on GitHub or email us at support@signalsciences.com if you have any suggestions, comments, or issues.