github.com/recobe182/terraform@v0.8.5-0.20170117231232-49ab22a935b7/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 }