diff --git a/KeyVault.Acmebot/Options/AcmebotOptions.cs b/KeyVault.Acmebot/Options/AcmebotOptions.cs index 0283ef73..1431658d 100644 --- a/KeyVault.Acmebot/Options/AcmebotOptions.cs +++ b/KeyVault.Acmebot/Options/AcmebotOptions.cs @@ -35,7 +35,7 @@ public class AcmebotOptions public DnsMadeEasyOptions DnsMadeEasy { get; set; } - public GandDnsOptions Gandi { get; set; } + public GandiOptions Gandi { get; set; } public GoDaddyOptions GoDaddy { get; set; } diff --git a/KeyVault.Acmebot/Options/GandDnsOptions.cs b/KeyVault.Acmebot/Options/GandiOptions.cs similarity index 75% rename from KeyVault.Acmebot/Options/GandDnsOptions.cs rename to KeyVault.Acmebot/Options/GandiOptions.cs index 01eb7d71..4946c980 100644 --- a/KeyVault.Acmebot/Options/GandDnsOptions.cs +++ b/KeyVault.Acmebot/Options/GandiOptions.cs @@ -1,6 +1,6 @@ namespace KeyVault.Acmebot.Options { - public class GandDnsOptions + public class GandiOptions { public string ApiKey { get; set; } } diff --git a/KeyVault.Acmebot/Providers/AzureDnsProvider.cs b/KeyVault.Acmebot/Providers/AzureDnsProvider.cs index 5684e4c5..f9eb088c 100644 --- a/KeyVault.Acmebot/Providers/AzureDnsProvider.cs +++ b/KeyVault.Acmebot/Providers/AzureDnsProvider.cs @@ -41,7 +41,7 @@ public async Task> ListZonesAsync() return zones; } - public async Task CreateTxtRecordAsync(DnsZone zone, string relativeRecordName, IEnumerable values) + public Task CreateTxtRecordAsync(DnsZone zone, string relativeRecordName, IEnumerable values) { var resourceGroup = ExtractResourceGroup(zone.Id); @@ -56,14 +56,14 @@ public async Task CreateTxtRecordAsync(DnsZone zone, string relativeRecordName, recordSet.TxtRecords.Add(new TxtRecord { Value = { value } }); } - await _dnsManagementClient.RecordSets.CreateOrUpdateAsync(resourceGroup, zone.Name, relativeRecordName, RecordType.TXT, recordSet); + return _dnsManagementClient.RecordSets.CreateOrUpdateAsync(resourceGroup, zone.Name, relativeRecordName, RecordType.TXT, recordSet); } - public async Task DeleteTxtRecordAsync(DnsZone zone, string relativeRecordName) + public Task DeleteTxtRecordAsync(DnsZone zone, string relativeRecordName) { var resourceGroup = ExtractResourceGroup(zone.Id); - await _dnsManagementClient.RecordSets.DeleteAsync(resourceGroup, zone.Name, relativeRecordName, RecordType.TXT); + return _dnsManagementClient.RecordSets.DeleteAsync(resourceGroup, zone.Name, relativeRecordName, RecordType.TXT); } private static string ExtractResourceGroup(string resourceId) diff --git a/KeyVault.Acmebot/Providers/GandiDnsProvider.cs b/KeyVault.Acmebot/Providers/GandiProvider.cs similarity index 79% rename from KeyVault.Acmebot/Providers/GandiDnsProvider.cs rename to KeyVault.Acmebot/Providers/GandiProvider.cs index 78c1f172..3da9581f 100644 --- a/KeyVault.Acmebot/Providers/GandiDnsProvider.cs +++ b/KeyVault.Acmebot/Providers/GandiProvider.cs @@ -13,14 +13,14 @@ namespace KeyVault.Acmebot.Providers { - public class GandiDnsProvider : IDnsProvider + public class GandiProvider : IDnsProvider { - public GandiDnsProvider(GandDnsOptions options) + public GandiProvider(GandiOptions options) { - _client = new GandiDnsClient(options.ApiKey); + _client = new GandiClient(options.ApiKey); } - private readonly GandiDnsClient _client; + private readonly GandiClient _client; public int PropagationSeconds => 300; @@ -28,27 +28,25 @@ public async Task> ListZonesAsync() { var zones = await _client.ListZonesAsync(); - /** - * Do NOT include the PrimaryNameServer element from the DnsZone list for now, - * the return value from Gandi when returning zones is not the expected value when doing the intersect at the Dns01Precondition method - **/ + // Do NOT include the PrimaryNameServer element from the DnsZone list for now, + // the return value from Gandi when returning zones is not the expected value when doing the intersect at the Dns01Precondition method return zones.Select(x => new DnsZone { Id = x.Uuid, Name = x.Name }).ToArray(); } - public async Task CreateTxtRecordAsync(DnsZone zone, string relativeRecordName, IEnumerable values) + public Task CreateTxtRecordAsync(DnsZone zone, string relativeRecordName, IEnumerable values) { - await _client.AddRecordAsync(zone.Name, relativeRecordName, values); + return _client.AddRecordAsync(zone.Name, relativeRecordName, values); } - public async Task DeleteTxtRecordAsync(DnsZone zone, string relativeRecordName) + public Task DeleteTxtRecordAsync(DnsZone zone, string relativeRecordName) { - await _client.DeleteRecordAsync(zone.Name, relativeRecordName); + return _client.DeleteRecordAsync(zone.Name, relativeRecordName); } - private class GandiDnsClient + private class GandiClient { - public GandiDnsClient(string apiKey) + public GandiClient(string apiKey) { if (apiKey is null) { diff --git a/KeyVault.Acmebot/Providers/GoDaddyProvider.cs b/KeyVault.Acmebot/Providers/GoDaddyProvider.cs index 92697094..a94ecbf1 100644 --- a/KeyVault.Acmebot/Providers/GoDaddyProvider.cs +++ b/KeyVault.Acmebot/Providers/GoDaddyProvider.cs @@ -31,7 +31,7 @@ public async Task> ListZonesAsync() return zones.Select(x => new DnsZone { Id = x.DomainId, Name = x.Domain, NameServers = x.NameServers }).ToArray(); } - public async Task CreateTxtRecordAsync(DnsZone zone, string relativeRecordName, IEnumerable values) + public Task CreateTxtRecordAsync(DnsZone zone, string relativeRecordName, IEnumerable values) { var entries = new List(); @@ -46,12 +46,12 @@ public async Task CreateTxtRecordAsync(DnsZone zone, string relativeRecordName, }); } - await _client.AddRecordAsync(zone.Name, entries); + return _client.AddRecordAsync(zone.Name, entries); } - public async Task DeleteTxtRecordAsync(DnsZone zone, string relativeRecordName) + public Task DeleteTxtRecordAsync(DnsZone zone, string relativeRecordName) { - await _client.DeleteRecordAsync(zone.Name, "TXT", relativeRecordName); + return _client.DeleteRecordAsync(zone.Name, "TXT", relativeRecordName); } private class GoDaddyClient diff --git a/KeyVault.Acmebot/Providers/GoogleDnsProvider.cs b/KeyVault.Acmebot/Providers/GoogleDnsProvider.cs index 01bf1395..6dbafd26 100644 --- a/KeyVault.Acmebot/Providers/GoogleDnsProvider.cs +++ b/KeyVault.Acmebot/Providers/GoogleDnsProvider.cs @@ -40,7 +40,7 @@ public async Task> ListZonesAsync() .ToArray(); } - public async Task CreateTxtRecordAsync(DnsZone zone, string relativeRecordName, IEnumerable values) + public Task CreateTxtRecordAsync(DnsZone zone, string relativeRecordName, IEnumerable values) { var recordName = $"{relativeRecordName}.{zone.Name}."; @@ -58,7 +58,7 @@ public async Task CreateTxtRecordAsync(DnsZone zone, string relativeRecordName, } }; - await _dnsService.Changes.Create(change, _credsParameters.ProjectId, zone.Id).ExecuteAsync(); + return _dnsService.Changes.Create(change, _credsParameters.ProjectId, zone.Id).ExecuteAsync(); } public async Task DeleteTxtRecordAsync(DnsZone zone, string relativeRecordName) diff --git a/KeyVault.Acmebot/Providers/Route53Provider.cs b/KeyVault.Acmebot/Providers/Route53Provider.cs index 4b6dae94..81f32a3e 100644 --- a/KeyVault.Acmebot/Providers/Route53Provider.cs +++ b/KeyVault.Acmebot/Providers/Route53Provider.cs @@ -31,7 +31,7 @@ public async Task> ListZonesAsync() return zones.HostedZones.Select(x => new DnsZone { Id = x.Id, Name = x.Name.TrimEnd('.') }).ToArray(); } - public async Task CreateTxtRecordAsync(DnsZone zone, string relativeRecordName, IEnumerable values) + public Task CreateTxtRecordAsync(DnsZone zone, string relativeRecordName, IEnumerable values) { var recordName = $"{relativeRecordName}.{zone.Name}."; @@ -49,7 +49,7 @@ public async Task CreateTxtRecordAsync(DnsZone zone, string relativeRecordName, var request = new ChangeResourceRecordSetsRequest(zone.Id, new ChangeBatch(new List { change })); - await _amazonRoute53Client.ChangeResourceRecordSetsAsync(request); + return _amazonRoute53Client.ChangeResourceRecordSetsAsync(request); } public async Task DeleteTxtRecordAsync(DnsZone zone, string relativeRecordName) diff --git a/KeyVault.Acmebot/Startup.cs b/KeyVault.Acmebot/Startup.cs index abc472b9..2616b507 100644 --- a/KeyVault.Acmebot/Startup.cs +++ b/KeyVault.Acmebot/Startup.cs @@ -94,7 +94,7 @@ public override void Configure(IFunctionsHostBuilder builder) if (options.Gandi != null) { - return new GandiDnsProvider(options.Gandi); + return new GandiProvider(options.Gandi); } if (options.GoDaddy != null)