diff --git a/providers/dns/alidns/alidns.go b/providers/dns/alidns/alidns.go index 3a8d76e6..e7ea22ef 100644 --- a/providers/dns/alidns/alidns.go +++ b/providers/dns/alidns/alidns.go @@ -136,9 +136,25 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { func (d *DNSProvider) getHostedZone(domain string) (string, string, error) { request := alidns.CreateDescribeDomainsRequest() - zones, err := d.client.DescribeDomains(request) - if err != nil { - return "", "", fmt.Errorf("API call failed: %v", err) + + var domains []alidns.Domain + startPage := 1 + + for { + request.PageNumber = requests.NewInteger(startPage) + + response, err := d.client.DescribeDomains(request) + if err != nil { + return "", "", fmt.Errorf("API call failed: %v", err) + } + + domains = append(domains, response.Domains.Domain...) + + if response.PageNumber >= response.PageSize { + break + } + + startPage++ } authZone, err := dns01.FindZoneByFqdn(dns01.ToFqdn(domain)) @@ -147,7 +163,7 @@ func (d *DNSProvider) getHostedZone(domain string) (string, string, error) { } var hostedZone alidns.Domain - for _, zone := range zones.Domains.Domain { + for _, zone := range domains { if zone.DomainName == dns01.UnFqdn(authZone) { hostedZone = zone }