github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/builtin/providers/cloudflare/config.go (about) 1 package cloudflare 2 3 import ( 4 "fmt" 5 "log" 6 7 "github.com/cloudflare/cloudflare-go" 8 ) 9 10 type Config struct { 11 Email string 12 Token string 13 } 14 15 // Client() returns a new client for accessing cloudflare. 16 func (c *Config) Client() (*cloudflare.API, error) { 17 client, err := cloudflare.New(c.Token, c.Email) 18 if err != nil { 19 return nil, fmt.Errorf("Error creating new CloudFlare client: %s", err) 20 } 21 log.Printf("[INFO] CloudFlare Client configured for user: %s", c.Email) 22 return client, nil 23 }