github.com/mohanarpit/terraform@v0.6.16-0.20160909104007-291f29853544/builtin/providers/dnsimple/config.go (about)

     1  package dnsimple
     2  
     3  import (
     4  	"fmt"
     5  	"log"
     6  
     7  	"github.com/pearkes/dnsimple"
     8  )
     9  
    10  type Config struct {
    11  	Email string
    12  	Token string
    13  }
    14  
    15  // Client() returns a new client for accessing dnsimple.
    16  func (c *Config) Client() (*dnsimple.Client, error) {
    17  	client, err := dnsimple.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] DNSimple Client configured for user: %s", client.Email)
    24  
    25  	return client, nil
    26  }