List of usage examples for com.amazonaws.services.route53.model GetHostedZoneResult getDelegationSet
public DelegationSet getDelegationSet()
A complex type that lists the Amazon Route 53 name servers for the specified hosted zone.
From source file:com.msi.dns53.server.query.GetHostedZone.java
License:Apache License
@Override public String marshall(MarshallStruct<GetHostedZoneResult> input, HttpServletResponse resp) throws Exception { GetHostedZoneResult result = input.getMainObject(); XMLNode response = new XMLNode(DNS53Constants.GETHOSTEDZONERESPONSE); response.addAttr(DNS53Constants.XMLNS, DNS53Constants.XMLNS_VALUE); DNS53QueryUtil.marshallHostedZone(result.getHostedZone(), response); DNS53QueryUtil.marshallDelegationSet(result.getDelegationSet(), response); return response.toString(); }
From source file:com.oneops.inductor.AbstractOrderExecutor.java
License:Apache License
/** * Gets dns servers//from w w w. j av a2 s.c om * * @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.lendingclub.mercator.aws.Route53Scanner.java
License:Apache License
ObjectNode toJson(GetHostedZoneResult hzResult) { HostedZone hz = hzResult.getHostedZone(); ObjectNode n = mapper.createObjectNode(); n.put("aws_account", getAccountId()); n.put("aws_id", hz.getId()); n.put("aws_name", hz.getName()); n.put("aws_callerReference", hz.getCallerReference()); n.put("aws_resourceRecordSetCount", hz.getResourceRecordSetCount()); n.put("aws_comment", hz.getConfig().getComment()); n.put("aws_privateZone", hz.getConfig().getPrivateZone()); n.put("aws_arn", "arn:aws:route53:::hostedzone/" + hz.getId()); ArrayNode an = mapper.createArrayNode(); if (hzResult.getDelegationSet() != null) { hzResult.getDelegationSet().getNameServers().forEach(ns -> { an.add(ns);/*from ww w . ja v a 2 s . c o m*/ }); } n.set("aws_nameServers", an); return n; }
From source file:org.ofbiz.tenant.amazonaws.AwsServices.java
License:Apache License
/** * get Amazon Rout53 hosted zone/* w ww . j av a 2s . c o m*/ * @param ctx * @param context * @return */ public static Map<String, Object> getAmazonRoute53HostedZone(DispatchContext ctx, Map<String, Object> context) { String hostedZoneId = (String) context.get("hostedZoneId"); AmazonRoute53 route53 = AwsFactory.getAmazonRoute53(); GetHostedZoneRequest request = new GetHostedZoneRequest(hostedZoneId); GetHostedZoneResult hostedZoneResult = route53.getHostedZone(request); HostedZone hostedZone = hostedZoneResult.getHostedZone(); if (UtilValidate.isEmpty(hostedZone)) { return ServiceUtil.returnError("Could not find hosted zone: " + hostedZoneId); } DelegationSet delegationSet = hostedZoneResult.getDelegationSet(); Map<String, Object> results = ServiceUtil.returnSuccess(); results.put("hostedZone", hostedZone); results.put("delegationSet", delegationSet); return results; }