public void CanGetDnsimpleClientFromId() { const int id = 3; var client = BespokeUpdater.GetClient(id); Assert.AreEqual(typeof(Client.Dnsimple.DnsimpleClient), client.GetType()); }
public void CanGetRoute53ClientFromId() { const int id = 2; var client = BespokeUpdater.GetClient(id); Assert.AreEqual(typeof(Route53Client), client.GetType()); }
public void CanGetDnsOMaticClientFromId() { const int id = 1; var client = BespokeUpdater.GetClient(id); Assert.AreEqual(typeof(DynamicDnsUpdater.Client.DnsOMatic.DnsOMaticClient), client.GetType()); }
protected override void OnStart(string[] args) { Thread.Sleep(10000); try { hostnamesToUpdate = Config.HostnamesToUpdate; if (string.IsNullOrEmpty(hostnamesToUpdate)) { throw new ArgumentException("Hostnames To Update were not provided"); } logger.Info(string.Format("DynamicDnsUpdaterClientTypeId: {0}", Config.DynamicDnsUpdaterClientTypeId)); if (Config.DynamicDnsUpdaterClientTypeId == (int)DynamicDnsUpdaterClientType.DnsOMatic) { username = Config.DnsOMaticUsername; password = Config.DnsOMaticPassword; if (string.IsNullOrEmpty(username)) { throw new ArgumentException("Username was not provided"); } if (string.IsNullOrEmpty(password)) { throw new ArgumentException("Password was not provided"); } } updater = new BespokeUpdater(Config.DynamicDnsUpdaterClientTypeId); updater.Client.InitializeLastUpdateIpAddresses(hostnamesToUpdate); timer = new Timer(Update, null, updateStartDelay, updateInterval); } catch (Exception ex) { logger.Error(ex); } }
private static void UpdateHostnames(string ipAddress, bool forceUpdate) { string hostnamesToUpdate = ConfigurationManager.AppSettings["HostNamesToUpdate"]; var updater = new BespokeUpdater(Config.DynamicDnsUpdaterClientTypeId); //We can force the update if we don't initialize the last ip address that was used. //this is useful because of DNS Caching if (!forceUpdate) { updater.Client.InitializeLastUpdateIpAddresses(hostnamesToUpdate); } if (!string.IsNullOrWhiteSpace(ipAddress)) { updater.Client.UpdateHostnames(hostnamesToUpdate, ipAddress); } else { updater.Client.UpdateHostnames(hostnamesToUpdate); } //Console.ReadLine(); }