terraform/builtin/providers/heroku/config.go

30 lines
517 B
Go
Raw Normal View History

2014-07-23 06:03:30 +02:00
package heroku
import (
"log"
"net/http"
2014-07-23 06:03:30 +02:00
"github.com/cyberdelia/heroku-go/v3"
2014-07-23 06:03:30 +02:00
)
type Config struct {
Email string
APIKey string
2014-07-23 06:03:30 +02:00
}
// Client() returns a new Service for accessing Heroku.
2014-07-23 06:03:30 +02:00
//
func (c *Config) Client() (*heroku.Service, error) {
service := heroku.NewService(&http.Client{
Transport: &heroku.Transport{
Username: c.Email,
Password: c.APIKey,
UserAgent: heroku.DefaultUserAgent,
},
})
2014-07-23 06:03:30 +02:00
log.Printf("[INFO] Heroku Client configured for user: %s", c.Email)
return service, nil
2014-07-23 06:03:30 +02:00
}