2014-12-10 22:20:52 +01:00
|
|
|
package cloudstack
|
|
|
|
|
|
|
|
import "github.com/xanzy/go-cloudstack/cloudstack"
|
|
|
|
|
|
|
|
// Config is the configuration structure used to instantiate a
|
|
|
|
// new CloudStack client.
|
|
|
|
type Config struct {
|
|
|
|
ApiURL string
|
|
|
|
ApiKey string
|
|
|
|
SecretKey string
|
2015-01-12 15:57:24 +01:00
|
|
|
Timeout int64
|
2014-12-10 22:20:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Client() returns a new CloudStack client.
|
|
|
|
func (c *Config) NewClient() (*cloudstack.CloudStackClient, error) {
|
|
|
|
cs := cloudstack.NewAsyncClient(c.ApiURL, c.ApiKey, c.SecretKey, false)
|
2015-01-12 15:57:24 +01:00
|
|
|
cs.AsyncTimeout(c.Timeout)
|
2014-12-10 22:20:52 +01:00
|
|
|
return cs, nil
|
|
|
|
}
|