Beispiel #1
0
// NewDNSProviderCredentials uses the supplied credentials to return a
// DNSProvider instance configured for OVH.
func NewDNSProviderCredentials(apiEndpoint, applicationKey, applicationSecret, consumerKey string) (*DNSProvider, error) {
	if apiEndpoint == "" || applicationKey == "" || applicationSecret == "" || consumerKey == "" {
		return nil, fmt.Errorf("OVH credentials missing")
	}

	ovhClient, _ := ovh.NewClient(
		apiEndpoint,
		applicationKey,
		applicationSecret,
		consumerKey,
	)

	return &DNSProvider{
		client:    ovhClient,
		recordIDs: make(map[string]int),
	}, nil
}
// NewAPI instanciates a Cloud API driver from credentials, for a given endpoint. See github.com/ovh/go-ovh for more informations
func NewAPI(endpoint, applicationKey, applicationSecret, consumerKey string) (api *API, err error) {
	client, err := ovh.NewClient(endpoint, applicationKey, applicationSecret, consumerKey)
	return &API{client}, err
}