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

Refactoring diff package interface (#22)

* initial refactoring of diffing

* making cloudflare and others compile

* gandi and gcloud. no idea if gandi works anymore.

* r53

* namedotcom wasn't working.
This commit is contained in:
Craig Peterson
2017-01-11 12:38:07 -07:00
committed by GitHub
parent 1f8b0a11e0
commit 12f006441b
15 changed files with 322 additions and 391 deletions

View File

@@ -7,7 +7,6 @@ import (
"net/http"
"github.com/StackExchange/dnscontrol/models"
"github.com/StackExchange/dnscontrol/providers/diff"
)
const (
@@ -47,10 +46,10 @@ func (c *CloudflareApi) fetchDomainList() error {
}
// get all records for a domain
func (c *CloudflareApi) getRecordsForDomain(id string) ([]diff.Record, error) {
func (c *CloudflareApi) getRecordsForDomain(id string, domain string) ([]*models.RecordConfig, error) {
url := fmt.Sprintf(recordsURL, id)
page := 1
records := []diff.Record{}
records := []*models.RecordConfig{}
for {
reqURL := fmt.Sprintf("%s?page=%d&per_page=100", url, page)
var data recordsResponse
@@ -61,7 +60,7 @@ func (c *CloudflareApi) getRecordsForDomain(id string) ([]diff.Record, error) {
return nil, fmt.Errorf("Error fetching record list cloudflare: %s", stringifyErrors(data.Errors))
}
for _, rec := range data.Result {
records = append(records, rec)
records = append(records, rec.toRecord(domain))
}
ri := data.ResultInfo
if len(data.Result) == 0 || ri.Page*ri.PerPage >= ri.TotalCount {