2015-12-06 19:20:43 +01:00
|
|
|
package powerdns
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2016-01-25 19:50:58 +01:00
|
|
|
"log"
|
2015-12-06 19:20:43 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
ServerUrl string
|
|
|
|
ApiKey string
|
|
|
|
}
|
|
|
|
|
|
|
|
// Client returns a new client for accessing PowerDNS
|
|
|
|
func (c *Config) Client() (*Client, error) {
|
|
|
|
client, err := NewClient(c.ServerUrl, c.ApiKey)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("Error setting up PowerDNS client: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Printf("[INFO] PowerDNS Client configured for server %s", c.ServerUrl)
|
|
|
|
|
|
|
|
return client, nil
|
|
|
|
}
|