private void doIt(object state) { try { logger.Info("Woke up!"); Options localOptions = opts.Clone(); string myIP = new IPAccessor(localOptions).get().Trim(); logger.Info("Got IP [" + myIP + "]"); logger.Info("Retrieving IP from Route53"); Route53Client client = new DefaultRoute53Client(localOptions.AWSOptions.AWSAccessKey, localOptions.AWSOptions.AWSSecretKey); Route53AIPForHostedZoneAccessor accessor = new Route53AIPForHostedZoneAccessor(client, localOptions.AWSOptions.HostedZoneId, localOptions.GeneralOptions.DomainName); string oldIP = accessor.get().Trim(); logger.Info("Route53 is pointing to " + oldIP); if (oldIP != null && String.Equals(oldIP, myIP)) { logger.Info("Nothing changed. Bye monster."); return; } logger.Info("Updating record at Route53 "); new Route53UpdateARecordForHostedZoneAccessor(client, localOptions.AWSOptions.HostedZoneId, oldIP, myIP, localOptions.GeneralOptions.DomainName).get(); } catch (exception.Route53DDNSException ex) { logger.Error("Got an exception haven't done anything perhaps." + ex); } catch (Exception ex) { logger.Error("Something very bad happened! Bailing out!", ex); //die throw ex; } }
private void doIt(object state) { try { logger.Info("Woke up!"); Options localOptions = opts.Clone(); string myIP = new IPAccessor(localOptions).get().Trim(); logger.Info("Got IP [" + myIP + "]"); logger.Info("Retrieving IP from Route53"); Route53Client client = new DefaultRoute53Client(localOptions.AWSOptions.AWSAccessKey, localOptions.AWSOptions.AWSSecretKey); Route53AIPForHostedZoneAccessor accessor = new Route53AIPForHostedZoneAccessor(client, localOptions.AWSOptions.HostedZoneId, localOptions.GeneralOptions.DomainName); string oldIP = accessor.get().Trim(); logger.Info("Route53 is pointing to " + oldIP); if (oldIP != null && String.Equals(oldIP, myIP)) { logger.Info("Nothing changed. Bye monster."); return; } logger.Info("Updating record at Route53 "); new Route53UpdateARecordForHostedZoneAccessor(client, localOptions.AWSOptions.HostedZoneId, oldIP, myIP, localOptions.GeneralOptions.DomainName).get(); } catch (exception.Route53DDNSException ex ) { logger.Error("Got an exception haven't done anything perhaps." + ex); } catch (Exception ex) { logger.Error("Something very bad happened! Bailing out!", ex); //die throw ex; } }