示例#1
0
func (d *Driver) getClient() *vultr.Client {
	log.Infof("getting client")
	if d.client == nil {
		d.client = vultr.NewClient(d.APIKey, nil)
	}
	return d.client
}
示例#2
0
func (d *Driver) getClient() *vultr.Client {
	if d.client == nil {
		d.client = vultr.NewClient(d.APIKey, &vultr.Options{MaxRetries: clientMaxRetries})
	}

	return d.client
}
// Client() returns a new client for accessing Vultr.
func (c *Config) Client() (*lib.Client, error) {
	client := lib.NewClient(
		c.ApiKey,
		&lib.Options{
			UserAgent: fmt.Sprintf("vultr-go/%s terraform", lib.Version)})

	log.Printf("[INFO] Vultr Client configured for URL: %s", client.Endpoint)

	return client, nil
}
示例#4
0
文件: vultr.go 项目: Rudloff/platform
// NewDNSProviderCredentials uses the supplied credentials to return a DNSProvider
// instance configured for Vultr.
func NewDNSProviderCredentials(apiKey string) (*DNSProvider, error) {
	if apiKey == "" {
		return nil, fmt.Errorf("Vultr credentials missing")
	}

	c := &DNSProvider{
		client: vultr.NewClient(apiKey, nil),
	}

	return c, nil
}