Leaseweb provider for libdns
This package implements the libdns interfaces for Leaseweb, allowing you to manage DNS records.
Generate an API Key via the Leaseweb customer portal; under Administration -> API Key.
Place API Key in the configuration as APIKey
.
Run:
docker run --rm -it -v "$PWD":/usr/local/go/src/leaseweb -w /usr/local/go/src/leaseweb golang:1.16
which will drop you in an interactive bash prompt where go
and friends are available.
For example you can build the code with go build
.
package main
import (
"context"
"fmt"
"github.com/libdns/leaseweb"
)
func main() {
provider := leaseweb.Provider{APIKey: "<LEASEWEB API KEY>"}
records, err := provider.GetRecords(context.TODO(), "example.com")
if err != nil {
fmt.Println(err.Error())
}
for _, record := range records {
fmt.Printf("%s %v %s %s\n", record.Name, record.TTL.Seconds(), record.Type, record.Value)
}
}