Skip to content

Commit

Permalink
Google DNS: Fixed a problem where not all zones could be retrieved (#751
Browse files Browse the repository at this point in the history
)
  • Loading branch information
shibayan authored Aug 29, 2024
1 parent a81f9d2 commit 32550b8
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions KeyVault.Acmebot/Providers/GoogleDnsProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,23 @@ public GoogleDnsProvider(GoogleDnsOptions options)

public async Task<IReadOnlyList<DnsZone>> ListZonesAsync()
{
var zones = await _dnsService.ManagedZones.List(_credsParameters.ProjectId).ExecuteAsync();
var zones = new List<ManagedZone>();

return zones.ManagedZones
.Select(x => new DnsZone(this) { Id = x.Name, Name = x.DnsName.TrimEnd('.'), NameServers = x.NameServers.ToArray() })
ManagedZonesListResponse response = null;

do
{
var request = _dnsService.ManagedZones.List(_credsParameters.ProjectId);

request.PageToken = response?.NextPageToken;

response = await request.ExecuteAsync();

zones.AddRange(response.ManagedZones);

} while (!string.IsNullOrEmpty(response.NextPageToken));

return zones.Select(x => new DnsZone(this) { Id = x.Name, Name = x.DnsName.TrimEnd('.'), NameServers = x.NameServers.ToArray() })
.ToArray();
}

Expand Down

0 comments on commit 32550b8

Please sign in to comment.