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

@@ -40,8 +40,8 @@ func init() {
providers.RegisterDomainServiceProviderType("VULTR", NewProvider, features)
}
// Provider represents the Vultr DNSServiceProvider.
type Provider struct {
// vultrProvider represents the Vultr DNSServiceProvider.
type vultrProvider struct {
client *govultr.Client
token string
}
@@ -63,11 +63,11 @@ func NewProvider(m map[string]string, metadata json.RawMessage) (providers.DNSSe
client.SetUserAgent("dnscontrol")
_, err := client.Account.GetInfo(context.Background())
return &Provider{client, token}, err
return &vultrProvider{client, token}, err
}
// GetZoneRecords gets the records of a zone and returns them in RecordConfig format.
func (api *Provider) GetZoneRecords(domain string) (models.Records, error) {
func (api *vultrProvider) GetZoneRecords(domain string) (models.Records, error) {
records, err := api.client.DNSRecord.List(context.Background(), domain)
if err != nil {
return nil, err
@@ -86,7 +86,7 @@ func (api *Provider) GetZoneRecords(domain string) (models.Records, error) {
}
// GetDomainCorrections gets the corrections for a DomainConfig.
func (api *Provider) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Correction, error) {
func (api *vultrProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Correction, error) {
dc.Punycode()
curRecords, err := api.GetZoneRecords(dc.Name)
@@ -138,12 +138,12 @@ func (api *Provider) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Co
}
// GetNameservers gets the Vultr nameservers for a domain
func (api *Provider) GetNameservers(domain string) ([]*models.Nameserver, error) {
func (api *vultrProvider) GetNameservers(domain string) ([]*models.Nameserver, error) {
return models.ToNameservers(defaultNS)
}
// EnsureDomainExists adds a domain to the Vutr DNS service if it does not exist
func (api *Provider) EnsureDomainExists(domain string) error {
func (api *vultrProvider) EnsureDomainExists(domain string) error {
if ok, err := api.isDomainInAccount(domain); err != nil {
return err
} else if ok {
@@ -154,7 +154,7 @@ func (api *Provider) EnsureDomainExists(domain string) error {
return api.client.DNSDomain.Create(context.Background(), domain, "0.0.0.0")
}
func (api *Provider) isDomainInAccount(domain string) (bool, error) {
func (api *vultrProvider) isDomainInAccount(domain string) (bool, error) {
domains, err := api.client.DNSDomain.List(context.Background())
if err != nil {
return false, err