@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode()); hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getCallerReference() == null) ? 0 : getCallerReference().hashCode()); hashCode = prime * hashCode + ((getConfig() == null) ? 0 : getConfig().hashCode()); hashCode = prime * hashCode + ((getResourceRecordSetCount() == null) ? 0 : getResourceRecordSetCount().hashCode()); hashCode = prime * hashCode + ((getLinkedService() == null) ? 0 : getLinkedService().hashCode()); return hashCode; }
private ResourceRecordSet getResourceRecordSet(String domain, HostedZone hostedZone) { ListResourceRecordSetsRequest request = new ListResourceRecordSetsRequest(); request.setMaxItems(String.valueOf(Integer.MAX_VALUE)); request.setHostedZoneId(hostedZone.getId()); ListResourceRecordSetsResult listResourceRecordSetsResult = amazonRoute53Client.listResourceRecordSets(request); for(ResourceRecordSet rrs : listResourceRecordSetsResult.getResourceRecordSets()) { if (rrs.getName().equals(domain)) { return rrs; } } return null; }
String zoneName = dnsName + "."; if(zoneList.size()>0 && zoneName.equals(zoneList.get(0).getName())) log_.info("Zone " + dnsName + " exists as " + zoneList.get(0).getId()); return zoneList.get(0).getId(); ); log_.info("Zone " + dnsName + " created as " + createResult.getHostedZone().getId()); return createResult.getHostedZone().getId();
private HostedZone getHostedZone(String domain) { ListHostedZonesRequest listHostedZoneRequest = new ListHostedZonesRequest(); listHostedZoneRequest.setMaxItems(String.valueOf(Integer.MAX_VALUE)); ListHostedZonesResult listHostedZonesResult = amazonRoute53Client.listHostedZones(listHostedZoneRequest); for(HostedZone hostedZone : listHostedZonesResult.getHostedZones()) { if (domain.endsWith(hostedZone.getName())) { return hostedZone; } } return null; }
private void executeChange(Change change, HostedZone hostedZone) { logger.info("Execute change {} ", change); ChangeResourceRecordSetsRequest changeResourceRecordSetsRequest = new ChangeResourceRecordSetsRequest(); changeResourceRecordSetsRequest.setHostedZoneId(hostedZone.getId()); ChangeBatch changeBatch = new ChangeBatch(); changeBatch.withChanges(change); changeResourceRecordSetsRequest.setChangeBatch(changeBatch); amazonRoute53Client.changeResourceRecordSets(changeResourceRecordSetsRequest); }
private HostedZone getHostedZone(String domain) { ListHostedZonesRequest listHostedZoneRequest = new ListHostedZonesRequest(); listHostedZoneRequest.setMaxItems(String.valueOf(Integer.MAX_VALUE)); ListHostedZonesResult listHostedZonesResult = amazonRoute53Client.listHostedZones(listHostedZoneRequest); for(HostedZone hostedZone : listHostedZonesResult.getHostedZones()) { if (domain.endsWith(hostedZone.getName())) { return hostedZone; } } return null; }
return false; HostedZone other = (HostedZone) obj; if (other.getId() == null ^ this.getId() == null) return false; if (other.getId() != null && other.getId().equals(this.getId()) == false) return false; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getCallerReference() == null ^ this.getCallerReference() == null) return false; if (other.getCallerReference() != null && other.getCallerReference().equals(this.getCallerReference()) == false) return false; if (other.getConfig() == null ^ this.getConfig() == null) return false; if (other.getConfig() != null && other.getConfig().equals(this.getConfig()) == false) return false; if (other.getResourceRecordSetCount() == null ^ this.getResourceRecordSetCount() == null) return false; if (other.getResourceRecordSetCount() != null && other.getResourceRecordSetCount().equals(this.getResourceRecordSetCount()) == false) return false; if (other.getLinkedService() == null ^ this.getLinkedService() == null) return false; if (other.getLinkedService() != null && other.getLinkedService().equals(this.getLinkedService()) == false) return false; return true;
private ResourceRecordSet getResourceRecordSet(String domain, HostedZone hostedZone) { ListResourceRecordSetsRequest request = new ListResourceRecordSetsRequest(); request.setMaxItems(String.valueOf(Integer.MAX_VALUE)); request.setHostedZoneId(hostedZone.getId()); ListResourceRecordSetsResult listResourceRecordSetsResult = amazonRoute53Client.listResourceRecordSets(request); for(ResourceRecordSet rrs : listResourceRecordSetsResult.getResourceRecordSets()) { if (rrs.getName().equals(domain)) { return rrs; } } return null; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getId() != null) sb.append("Id: ").append(getId()).append(","); if (getName() != null) sb.append("Name: ").append(getName()).append(","); if (getCallerReference() != null) sb.append("CallerReference: ").append(getCallerReference()).append(","); if (getConfig() != null) sb.append("Config: ").append(getConfig()).append(","); if (getResourceRecordSetCount() != null) sb.append("ResourceRecordSetCount: ").append(getResourceRecordSetCount()).append(","); if (getLinkedService() != null) sb.append("LinkedService: ").append(getLinkedService()); sb.append("}"); return sb.toString(); }
private void executeChange(Change change, HostedZone hostedZone) { logger.info("Execute change {} ", change); ChangeResourceRecordSetsRequest changeResourceRecordSetsRequest = new ChangeResourceRecordSetsRequest(); changeResourceRecordSetsRequest.setHostedZoneId(hostedZone.getId()); ChangeBatch changeBatch = new ChangeBatch(); changeBatch.withChanges(change); changeResourceRecordSetsRequest.setChangeBatch(changeBatch); amazonRoute53Client.changeResourceRecordSets(changeResourceRecordSetsRequest); }
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); }); } n.set("aws_nameServers", an); return n; }
protected void projectHostedZoneResult(GetHostedZoneResult hostedZoneResult) { HostedZone hz = hostedZoneResult.getHostedZone(); ObjectNode n = toJson(hostedZoneResult); getNeoRxClient().execCypher( "merge (a:AwsRoute53HostedZone {aws_id:{aws_id}}) set a+={props}, a.updateTs=timestamp() return a", "aws_id", n.get("aws_id").asText(), "props", n); ListResourceRecordSetsRequest request = new ListResourceRecordSetsRequest(); request.setHostedZoneId(hz.getId()); ListResourceRecordSetsResult result; long timestamp = System.currentTimeMillis(); do { rateLimit(); result = getClient().listResourceRecordSets(request); request.setStartRecordName(result.getNextRecordName()); for (ResourceRecordSet rs : result.getResourceRecordSets()) { projectResourceRecordSet(hz.getId(), rs, timestamp); } } while (result.isTruncated()); getNeoRxClient().execCypher( "match (z:AwsRoute53HostedZone {aws_id:{aws_id}})--(r:AwsRoute53RecordSet) where r.updateTs<{ts} detach delete r", "ts", timestamp, "aws_id", hz.getId()); getNeoRxClient().execCypher( "match (a:AwsRoute53RecordSet) where not (a)-[:CONTAINS]-(:AwsRoute53HostedZone) detach delete a"); }
@Override protected void doGlobalScan() { ListHostedZonesRequest request = new ListHostedZonesRequest(); ListHostedZonesResult result = new ListHostedZonesResult(); do { rateLimit(); result = getClient().listHostedZones(request); for (HostedZone zone : result.getHostedZones()) { scanHostedZoneById(zone.getId()); } request.setMarker(result.getMarker()); } while (result.isTruncated()); }
createHostedZoneResult = route53.createHostedZone(req); nameServers = createHostedZoneResult.getDelegationSet().getNameServers(); hostedZoneId = createHostedZoneResult.getHostedZone().getId(); getLogger().info("HostedZone {} ({} - {}) is created.", hostedZoneId, hostedZoneName, callerReference); nameServers.forEach(it -> {