From 32550b8c3e0b8df90eb25d54f637a73f52b39565 Mon Sep 17 00:00:00 2001 From: Tatsuro Shibamura Date: Thu, 29 Aug 2024 16:59:55 +0900 Subject: [PATCH] Google DNS: Fixed a problem where not all zones could be retrieved (#751) --- .../Providers/GoogleDnsProvider.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/KeyVault.Acmebot/Providers/GoogleDnsProvider.cs b/KeyVault.Acmebot/Providers/GoogleDnsProvider.cs index 5c9e2477..bbcf5c4d 100644 --- a/KeyVault.Acmebot/Providers/GoogleDnsProvider.cs +++ b/KeyVault.Acmebot/Providers/GoogleDnsProvider.cs @@ -35,10 +35,23 @@ public GoogleDnsProvider(GoogleDnsOptions options) public async Task> ListZonesAsync() { - var zones = await _dnsService.ManagedZones.List(_credsParameters.ProjectId).ExecuteAsync(); + var zones = new List(); - 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(); }