Selectel DNS v2 for libdns
This package implements the libdns interfaces for Selectel DNS v2 API, allowing you to manage DNS records.
To authorize you need to use Selectel Authorization.
Minimal working example of getting DNS zone records.
package main
import (
"context"
"fmt"
"os"
"github.com/libdns/libdns/selectel"
)
func main() {
provider = selectel.Provider{
User: os.Getenv("SELECTEL_USER"),
Password: os.Getenv("SELECTEL_PASSWORD"),
AccountId: os.Getenv("SELECTEL_ACCOUNT_ID"),
ProjectName: os.Getenv("SELECTEL_PROJECT_NAME"),
ZonesCache: make(map[string]string),
}
zone = os.Getenv("SELECTEL_ZONE")
ctx = context.Background()
records, err := provider.GetRecords(ctx, zone)
if err != nil {
fmt.Printf("Error: %s", err)
return
}
fmt.Println(records)
}
See also: provider_test.go
Always yours @jjazzme