alidns: add support to handle more than 20 domains (#739)
This commit is contained in:
parent
15764a17b6
commit
cb3c4c7937
1 changed files with 20 additions and 4 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue