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

@@ -13,7 +13,7 @@ const apiBase = "https://apis.cscglobal.com/dbs/api/v2"
// Api layer for CSC Global
type api struct {
type cscglobalProvider struct {
key string
token string
notifyEmails []string
@@ -55,7 +55,7 @@ type domainRecord struct {
Nameserver []string `json:"nameservers"`
}
func (c *api) getNameservers(domain string) ([]string, error) {
func (c *cscglobalProvider) getNameservers(domain string) ([]string, error) {
var bodyString, err = c.get("/domains/" + domain)
if err != nil {
return nil, err
@@ -71,7 +71,7 @@ func (c *api) getNameservers(domain string) ([]string, error) {
return ns, nil
}
func (c *api) updateNameservers(ns []string, domain string) error {
func (c *cscglobalProvider) updateNameservers(ns []string, domain string) error {
req := nsModRequest{
Domain: domain,
NameServers: ns,
@@ -103,7 +103,7 @@ func (c *api) updateNameservers(ns []string, domain string) error {
return nil
}
func (c *api) put(endpoint string, requestBody []byte) ([]byte, error) {
func (c *cscglobalProvider) put(endpoint string, requestBody []byte) ([]byte, error) {
client := &http.Client{}
req, _ := http.NewRequest("PUT", apiBase+endpoint, bytes.NewReader(requestBody))
@@ -137,7 +137,7 @@ func (c *api) put(endpoint string, requestBody []byte) ([]byte, error) {
req.Host, req.URL.RequestURI())
}
func (c *api) get(endpoint string) ([]byte, error) {
func (c *cscglobalProvider) get(endpoint string) ([]byte, error) {
client := &http.Client{}
req, _ := http.NewRequest("GET", apiBase+endpoint, nil)

View File

@@ -24,7 +24,7 @@ func init() {
}
func newCscGlobal(m map[string]string) (providers.Registrar, error) {
api := &api{}
api := &cscglobalProvider{}
api.key, api.token = m["api-key"], m["user-token"]
if api.key == "" || api.token == "" {
@@ -39,7 +39,7 @@ func newCscGlobal(m map[string]string) (providers.Registrar, error) {
}
// GetRegistrarCorrections gathers corrections that would being n to match dc.
func (c *api) GetRegistrarCorrections(dc *models.DomainConfig) ([]*models.Correction, error) {
func (c *cscglobalProvider) GetRegistrarCorrections(dc *models.DomainConfig) ([]*models.Correction, error) {
nss, err := c.getNameservers(dc.Name)
if err != nil {
return nil, err