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