2017-01-18 15:43:09 +01:00
|
|
|
package profitbricks
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/profitbricks/profitbricks-sdk-go"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
Username string
|
|
|
|
Password string
|
2017-02-02 14:26:14 +01:00
|
|
|
Endpoint string
|
2017-01-18 15:43:09 +01:00
|
|
|
Retries int
|
|
|
|
}
|
|
|
|
|
|
|
|
// Client() returns a new client for accessing digital ocean.
|
|
|
|
func (c *Config) Client() (*Config, error) {
|
|
|
|
profitbricks.SetAuth(c.Username, c.Password)
|
|
|
|
profitbricks.SetDepth("5")
|
2017-02-02 14:26:14 +01:00
|
|
|
if len(c.Endpoint) > 0 {
|
|
|
|
profitbricks.SetEndpoint(c.Endpoint)
|
|
|
|
}
|
2017-01-18 15:43:09 +01:00
|
|
|
return c, nil
|
|
|
|
}
|