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

INWX: Paginate through Nameserver Records (#2609)

Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
Joachim Schwarm
2023-11-01 18:34:34 +01:00
committed by GitHub
parent 65c47cbfe8
commit bf4118a041
2 changed files with 16 additions and 16 deletions

View File

@@ -395,18 +395,24 @@ func (api *inwxAPI) GetRegistrarCorrections(dc *models.DomainConfig) ([]*models.
// fetchNameserverDomains returns the domains configured in INWX nameservers
func (api *inwxAPI) fetchNameserverDomains() error {
zones := map[string]int{}
request := &goinwx.NameserverListRequest{}
request.PageLimit = 2147483647 // int32 max value, highest number API accepts
info, err := api.client.Nameservers.ListWithParams(request)
if err != nil {
return err
page := 1
for {
request.Page = page
info, err := api.client.Nameservers.ListWithParams(request)
if err != nil {
return err
}
for _, domain := range info.Domains {
zones[domain.Domain] = domain.RoID
}
if len(zones) >= info.Count {
break
}
page++
}
api.domainIndex = map[string]int{}
for _, domain := range info.Domains {
api.domainIndex[domain.Domain] = domain.RoID
}
api.domainIndex = zones
return nil
}