A Go client library for the Wallarm API. Used by the Terraform provider for Wallarm.
- Rules — create, read, update, delete rules (hints) with paginated bulk fetch
- IP lists — manage allowlist, denylist, and graylist entries (subnets, countries, datacenters, proxy types)
- Integrations — email, Slack, Splunk, PagerDuty, OpsGenie, Datadog, and more
- Triggers — threshold-based alerting and reaction rules
- Applications — create and manage application pools
- Nodes — filtering node lifecycle management
- Tenants — multi-tenant account management
- Users — user CRUD and role management
- Actions — rule scope management (action conditions)
- Hits — fetch detected hits for false positive analysis
- Attacks — fetch detected attacks, hit details, and raw hit payloads
- Activity log — audit-log access with object-type filtering
- Security issues — detected vulnerabilities and attack-surface issues grouped by type and severity
- API specs — API specification management
- Credential stuffing — credential stuffing detection configs
- Global mode — filtration mode (monitoring/blocking) management
-
Automatic retry — transient errors are retried automatically:
Status Delay Max retries 423 (Rules locked) 5s fixed 12 5xx (Server error) 10s fixed 12 429 (Rate limit) Exponential backoff 12 -
Gzip compression — requests include
Accept-Encoding: gzipfor reduced response sizes -
Structured errors —
APIErrortype withStatusCodeandBodyfields, compatible witherrors.As() -
Configurable — custom HTTP client, base URL, retry policy, user agent, and headers via functional options
go get github.com/wallarm/wallarm-gopackage main
import (
"log"
"net/http"
"os"
wallarm "github.com/wallarm/wallarm-go"
)
func main() {
host := os.Getenv("WALLARM_API_HOST")
if host == "" {
host = "https://api.wallarm.com"
}
token := os.Getenv("WALLARM_API_TOKEN")
if token == "" {
log.Fatal("WALLARM_API_TOKEN is required")
}
headers := http.Header{}
headers.Set("X-WallarmAPI-Token", token)
// Create client with token auth, retry policy, and custom base URL.
api, err := wallarm.New(
wallarm.UsingBaseURL(host),
wallarm.Headers(headers),
wallarm.UsingRetryPolicy(12, 1, 30),
)
if err != nil {
log.Fatal(err)
}
// Fetch user details
user, err := api.UserDetails()
if err != nil {
log.Fatal(err)
}
log.Printf("Authenticated as client %d", user.Body.ClientID)
// Read all rules for a client
resp, err := api.HintRead(&wallarm.HintRead{
Limit: 500,
OrderBy: "updated_at",
Filter: &wallarm.HintFilter{Clientid: []int{user.Body.ClientID}},
})
if err != nil {
log.Fatal(err)
}
log.Printf("Found %d rules", len(*resp.Body))
}API errors are returned as *wallarm.APIError with status code and response body:
import "errors"
var apiErr *wallarm.APIError
if errors.As(err, &apiErr) {
log.Printf("API error %d: %s", apiErr.StatusCode, apiErr.Body)
}