Пример #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
}
Пример #3
0
// 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
// 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
}