github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/builtin/providers/dme/config.go (about) 1 package dme 2 3 import ( 4 "fmt" 5 "log" 6 7 "github.com/hashicorp/go-cleanhttp" 8 "github.com/soniah/dnsmadeeasy" 9 ) 10 11 // Config contains DNSMadeEasy provider settings 12 type Config struct { 13 AKey string 14 SKey string 15 UseSandbox bool 16 } 17 18 // Client returns a new client for accessing DNSMadeEasy 19 func (c *Config) Client() (*dnsmadeeasy.Client, error) { 20 client, err := dnsmadeeasy.NewClient(c.AKey, c.SKey) 21 if err != nil { 22 return nil, fmt.Errorf("Error setting up client: %s", err) 23 } 24 25 client.HTTP = cleanhttp.DefaultClient() 26 27 if c.UseSandbox { 28 client.URL = dnsmadeeasy.SandboxURL 29 } 30 31 log.Printf("[INFO] DNSMadeEasy Client configured for AKey: %s", client.AKey) 32 33 return client, nil 34 }