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 {
|
2015-07-16 17:40:04 +02:00
|
|
|
APIURL string
|
|
|
|
APIKey string
|
|
|
|
SecretKey string
|
|
|
|
HTTPGETOnly bool
|
|
|
|
Timeout int64
|
2014-12-10 22:20:52 +01:00
|
|
|
}
|
|
|
|
|
2015-07-16 17:40:04 +02:00
|
|
|
// NewClient returns a new CloudStack client.
|
2014-12-10 22:20:52 +01:00
|
|
|
func (c *Config) NewClient() (*cloudstack.CloudStackClient, error) {
|
2015-07-16 17:40:04 +02:00
|
|
|
cs := cloudstack.NewAsyncClient(c.APIURL, c.APIKey, c.SecretKey, false)
|
|
|
|
cs.HTTPGETOnly = c.HTTPGETOnly
|
2015-01-12 15:57:24 +01:00
|
|
|
cs.AsyncTimeout(c.Timeout)
|
2014-12-10 22:20:52 +01:00
|
|
|
return cs, nil
|
|
|
|
}
|