예제 #1
0
        private async Task <HostedZone> ResolveMatchingZone(DnsRecord request)
        {
            try
            {
                if (!string.IsNullOrEmpty(request.ZoneId))
                {
                    var zone = await _route53Client.GetHostedZoneAsync(new GetHostedZoneRequest { Id = request.ZoneId });

                    return(zone.HostedZone);
                }
                else
                {
                    // invalid or empty zone id, don't attempt to fuzzy match
                    return(null);
                }
            }
            catch (Exception)
            {
                //TODO: return error in result
                return(null);
            }
        }
예제 #2
0
        private async Task <HostedZone> ResolveMatchingZone(DnsRecord request)
        {
            try
            {
                if (!String.IsNullOrEmpty(request.ZoneId))
                {
                    var zone = await _route53Client.GetHostedZoneAsync(new GetHostedZoneRequest { Id = request.ZoneId });

                    return(zone.HostedZone);
                }
                else
                {
                    var zones = await _route53Client.ListHostedZonesAsync();

                    var zone = zones.HostedZones.Where(z => z.Name.Contains(request.TargetDomainName)).FirstOrDefault();
                    return(zone);
                }
            }
            catch (Exception)
            {
                //TODO: return error in result
                return(null);
            }
        }
예제 #3
0
 public Task <GetHostedZoneResponse> GetHostedZoneAsync(string id, CancellationToken cancellationToken = default(CancellationToken))
 => _locker.Lock(() => _client.GetHostedZoneAsync(new GetHostedZoneRequest()
 {
     Id = id
 }, cancellationToken).EnsureSuccessAsync());