Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance GoDaddyProvider.ListZonesAsync method to use marker argument … #582

Merged
merged 3 commits into from
May 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions KeyVault.Acmebot/Providers/GoDaddyProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,29 @@ public GoDaddyClient(string apiKey, string apiSecret)

public async Task<IReadOnlyList<ZoneDomain>> ListZonesAsync()
{
var response = await _httpClient.GetAsync("v1/domains?statuses=ACTIVE&includes=nameServers");
var limit = 100;
var marker = "";
var allActiveDomains = new List<ZoneDomain>();

response.EnsureSuccessStatusCode();
while (true)
{
var response = await _httpClient.GetAsync($"v1/domains?statuses=ACTIVE&includes=nameServers&limit={limit}{marker}");

response.EnsureSuccessStatusCode();

var domains = await response.Content.ReadAsAsync<ZoneDomain[]>();
var domains = await response.Content.ReadAsAsync<ZoneDomain[]>();

if (domains.Length == 0)
{
break;
}

allActiveDomains.AddRange(domains);

marker = $"&marker={domains[^1].Domain}";
}

return domains;
return allActiveDomains;
}

public async Task DeleteRecordAsync(string domain, string type, string name)
Expand Down