github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/builtin/providers/digitalocean/config.go (about) 1 package digitalocean 2 3 import ( 4 "log" 5 6 "github.com/digitalocean/godo" 7 "golang.org/x/oauth2" 8 ) 9 10 type Config struct { 11 Token string 12 } 13 14 // Client() returns a new client for accessing digital ocean. 15 func (c *Config) Client() (*godo.Client, error) { 16 tokenSrc := oauth2.StaticTokenSource(&oauth2.Token{ 17 AccessToken: c.Token, 18 }) 19 20 client := godo.NewClient(oauth2.NewClient(oauth2.NoContext, tokenSrc)) 21 22 log.Printf("[INFO] DigitalOcean Client configured for URL: %s", client.BaseURL.String()) 23 24 return client, nil 25 }