github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/builtin/providers/heroku/config.go (about)

     1  package heroku
     2  
     3  import (
     4  	"log"
     5  	"net/http"
     6  
     7  	"github.com/cyberdelia/heroku-go/v3"
     8  )
     9  
    10  type Config struct {
    11  	Email  string
    12  	APIKey string
    13  }
    14  
    15  // Client() returns a new Service for accessing Heroku.
    16  //
    17  func (c *Config) Client() (*heroku.Service, error) {
    18  	service := heroku.NewService(&http.Client{
    19  		Transport: &heroku.Transport{
    20  			Username:  c.Email,
    21  			Password:  c.APIKey,
    22  			UserAgent: heroku.DefaultUserAgent,
    23  		},
    24  	})
    25  
    26  	log.Printf("[INFO] Heroku Client configured for user: %s", c.Email)
    27  
    28  	return service, nil
    29  }