1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

Rename provider handles to *Provider (#914)

This commit is contained in:
Tom Limoncelli
2020-10-26 09:25:30 -04:00
committed by GitHub
parent 29c7ff3a05
commit ca30c9c34f
43 changed files with 318 additions and 318 deletions

View File

@@ -19,8 +19,8 @@ import (
// NamecheapDefaultNs lists the default nameservers for this provider.
var NamecheapDefaultNs = []string{"dns1.registrar-servers.com", "dns2.registrar-servers.com"}
// namecheapAPI is the handle for this provider.
type namecheapAPI struct {
// namecheapProvider is the handle for this provider.
type namecheapProvider struct {
APIKEY string
APIUser string
client *nc.Client
@@ -55,8 +55,8 @@ func newReg(conf map[string]string) (providers.Registrar, error) {
return newProvider(conf, nil)
}
func newProvider(m map[string]string, metadata json.RawMessage) (*namecheapAPI, error) {
api := &namecheapAPI{}
func newProvider(m map[string]string, metadata json.RawMessage) (*namecheapProvider, error) {
api := &namecheapProvider{}
api.APIUser, api.APIKEY = m["apiuser"], m["apikey"]
if api.APIKEY == "" || api.APIUser == "" {
return nil, fmt.Errorf("missing Namecheap apikey and apiuser")
@@ -107,7 +107,7 @@ func doWithRetry(f func() error) {
}
// GetZoneRecords gets the records of a zone and returns them in RecordConfig format.
func (n *namecheapAPI) GetZoneRecords(domain string) (models.Records, error) {
func (n *namecheapProvider) GetZoneRecords(domain string) (models.Records, error) {
return nil, fmt.Errorf("not implemented")
// This enables the get-zones subcommand.
// Implement this by extracting the code from GetDomainCorrections into
@@ -115,7 +115,7 @@ func (n *namecheapAPI) GetZoneRecords(domain string) (models.Records, error) {
}
// GetDomainCorrections returns the corrections for the domain.
func (n *namecheapAPI) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Correction, error) {
func (n *namecheapProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Correction, error) {
dc.Punycode()
sld, tld := splitDomain(dc.Name)
var records *nc.DomainDNSGetHostsResult
@@ -215,7 +215,7 @@ func (n *namecheapAPI) GetDomainCorrections(dc *models.DomainConfig) ([]*models.
return corrections, nil
}
func (n *namecheapAPI) generateRecords(dc *models.DomainConfig) error {
func (n *namecheapProvider) generateRecords(dc *models.DomainConfig) error {
var recs []nc.DomainDNSHost
@@ -250,13 +250,13 @@ func (n *namecheapAPI) generateRecords(dc *models.DomainConfig) error {
}
// GetNameservers returns the nameservers for a domain.
func (n *namecheapAPI) GetNameservers(domainName string) ([]*models.Nameserver, error) {
func (n *namecheapProvider) GetNameservers(domainName string) ([]*models.Nameserver, error) {
// return default namecheap nameservers
return models.ToNameservers(NamecheapDefaultNs)
}
// GetRegistrarCorrections returns corrections to update nameservers.
func (n *namecheapAPI) GetRegistrarCorrections(dc *models.DomainConfig) ([]*models.Correction, error) {
func (n *namecheapProvider) GetRegistrarCorrections(dc *models.DomainConfig) ([]*models.Correction, error) {
var info *nc.DomainInfo
var err error
doWithRetry(func() error {