github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/mailgun/config.go (about)

     1  package mailgun
     2  
     3  import (
     4  	"log"
     5  
     6  	"github.com/pearkes/mailgun"
     7  )
     8  
     9  type Config struct {
    10  	APIKey string
    11  }
    12  
    13  // Client() returns a new client for accessing mailgun.
    14  //
    15  func (c *Config) Client() (*mailgun.Client, error) {
    16  
    17  	// We don't set a domain right away
    18  	client, err := mailgun.NewClient(c.APIKey)
    19  
    20  	if err != nil {
    21  		return nil, err
    22  	}
    23  
    24  	log.Printf("[INFO] Mailgun Client configured ")
    25  
    26  	return client, nil
    27  }