List of usage examples for com.amazonaws.services.route53.model DelegationSet getNameServers
public java.util.List<String> getNameServers()
A complex type that contains a list of the authoritative name servers for a hosted zone or for a reusable delegation set.
From source file:com.msi.dns53.util.DNS53QueryUtil.java
License:Apache License
public static void marshallDelegationSet(DelegationSet result, XMLNode response) { XMLNode delegationSet = QueryUtil.addNode(response, DNS53Constants.DELEGATIONSET); if (result.getNameServers() != null && result.getNameServers().size() > 0) { XMLNode nameservers = QueryUtil.addNode(delegationSet, DNS53Constants.NAMESERVERS); for (String nameserver : result.getNameServers()) { QueryUtil.addNode(nameservers, DNS53Constants.NAMESERVER, nameserver); }/*from w ww. j a va 2s . c o m*/ } }
From source file:com.oneops.inductor.AbstractOrderExecutor.java
License:Apache License
/** * Gets dns servers// w w w . j a v a 2 s . c o m * * @param awsCredentials AWSCredentials * @param zoneDomainName zoneDomainName * @return dns servers */ private List<String> getAuthoritativeServersWithAwsCreds(AWSCredentials awsCredentials, String zoneDomainName) { if (!zoneDomainName.endsWith(".")) { zoneDomainName += "."; } AmazonRoute53 route53 = new AmazonRoute53Client(awsCredentials); ListHostedZonesResult result = route53.listHostedZones(); List<HostedZone> zones = result.getHostedZones(); List<String> dnsServers = new ArrayList<String>(); for (int i = 0; i < zones.size(); i++) { HostedZone hostedZone = zones.get(i); logger.info("zone: " + hostedZone.getName()); if (hostedZone.getName().equalsIgnoreCase(zoneDomainName)) { logger.info("matched zone"); GetHostedZoneResult zone = route53.getHostedZone( new GetHostedZoneRequest().withId(hostedZone.getId().replace("/hostedzone/", ""))); DelegationSet delegationSet = zone.getDelegationSet(); dnsServers = delegationSet.getNameServers(); break; } } logger.info("dnsServer: " + dnsServers.toString()); return dnsServers; }