github.com/chalford/terraform@v0.3.7-0.20150113080010-a78c69a8c81f/builtin/providers/cloudflare/config.go (about)

     1  package cloudflare
     2  
     3  import (
     4  	"fmt"
     5  	"log"
     6  
     7  	"github.com/pearkes/cloudflare"
     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.Client, error) {
    17  	client, err := cloudflare.NewClient(c.Email, c.Token)
    18  
    19  	if err != nil {
    20  		return nil, fmt.Errorf("Error setting up client: %s", err)
    21  	}
    22  
    23  	log.Printf("[INFO] CloudFlare Client configured for user: %s", client.Email)
    24  
    25  	return client, nil
    26  }