2014-07-19 02:20:28 +02:00
|
|
|
package digitalocean
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/pearkes/digitalocean"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Config struct {
|
2014-11-17 18:55:45 +01:00
|
|
|
Token string
|
2014-07-19 02:20:28 +02:00
|
|
|
}
|
|
|
|
|
2014-11-17 18:55:45 +01:00
|
|
|
// Client() returns a new client for accessing digital ocean.
|
2014-07-19 02:20:28 +02:00
|
|
|
func (c *Config) Client() (*digitalocean.Client, error) {
|
|
|
|
client, err := digitalocean.NewClient(c.Token)
|
|
|
|
|
|
|
|
log.Printf("[INFO] DigitalOcean Client configured for URL: %s", client.URL)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return client, nil
|
|
|
|
}
|