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 1 commit
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
26 changes: 22 additions & 4 deletions KeyVault.Acmebot/Providers/GoDaddyProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,31 @@ 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 = string.Empty;
var allActiveDomains = new List<ZoneDomain>();

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

response.EnsureSuccessStatusCode();
marker = string.Empty;

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

allActiveDomains.AddRange(domains);

var domains = await response.Content.ReadAsAsync<ZoneDomain[]>();
if (domains.Length == limit)
{
if (domains.Last().Domain is not null)
{
marker = $"&marker={domains.Last().Domain}";
}
}
} while (marker != string.Empty);
shibayan marked this conversation as resolved.
Show resolved Hide resolved

return domains;
return allActiveDomains;
}

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