Bluecat for libdns
This package implements the libdns interfaces for Bluecat Address Manager, allowing you to manage DNS records.
To use this provider, you need:
- Bluecat Address Manager API endpoint (URL)
- Username
- Password
package main
import (
"context"
"fmt"
"time"
"github.com/libdns/bluecat"
"github.com/libdns/libdns"
)
func main() {
provider := &bluecat.Provider{
ServerURL: "https://bluecat.example.com",
Username: "api_user",
Password: "api_password",
// Optional: limit zone lookups to one DNS view
// ViewName: "view",
}
zone := "example.com."
ctx := context.Background()
// Get existing records
records, err := provider.GetRecords(ctx, zone)
if err != nil {
panic(err)
}
fmt.Printf("Found %d records\n", len(records))
// Append a new A record
newRecords := []libdns.Record{
libdns.Address{
Name: "test",
TTL: 300 * time.Second,
IP: netip.MustParseAddr("192.0.2.1"),
},
}
created, err := provider.AppendRecords(ctx, zone, newRecords)
if err != nil {
panic(err)
}
fmt.Printf("Created %d records\n", len(created))
}- The provider requires Bluecat Address Manager 9.5.0 or later with the RESTful v2 API enabled
- Record names should be relative to the zone (e.g., "www" for "www.example.com" in zone "example.com.")
- Handling of Bluecat's linked records is not properly implemented yet. Networks and existing records to link A records and CNAMEs must already exist.
ConfigurationNameis accepted but not yet applied to zone lookups. If the same zone name exists in more than one configuration (or in more than one view with noViewNameset), lookups fail with an ambiguity error instead of picking one.
- Authentication sessions are automatically managed and tokens are cached for efficiency
- The provider supports A, AAAA, CNAME, TXT, MX, NS, and SRV record types