List of usage examples for com.amazonaws.services.route53 AmazonRoute53 listHostedZones
ListHostedZonesResult listHostedZones();
From source file:com.oneops.inductor.AbstractOrderExecutor.java
License:Apache License
/** * Gets dns servers//from w w w . j av a2 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; }
From source file:org.ofbiz.tenant.amazonaws.AwsServices.java
License:Apache License
/** * get Amazon Rout53 hosted zones/*from w w w.j ava 2 s .c om*/ * @param ctx * @param context * @return */ public static Map<String, Object> getAmazonRoute53HostedZones(DispatchContext ctx, Map<String, Object> context) { AmazonRoute53 route53 = AwsFactory.getAmazonRoute53(); ListHostedZonesResult hostedZonesResult = route53.listHostedZones(); List<HostedZone> hostedZones = hostedZonesResult.getHostedZones(); Map<String, Object> results = ServiceUtil.returnSuccess(); results.put("hostedZones", hostedZones); return results; }