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); }
public ChangeBatch unmarshall(StaxUnmarshallerContext context) throws Exception { ChangeBatch changeBatch = new ChangeBatch(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return changeBatch; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Comment", targetDepth)) { changeBatch.setComment(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Changes", targetDepth)) { changeBatch.withChanges(new ArrayList<Change>()); continue; } if (context.testExpression("Changes/Change", targetDepth)) { changeBatch.withChanges(ChangeStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return changeBatch; } } } }
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); }
.withHostedZoneId(zoneId) .withChangeBatch(new ChangeBatch() .withChanges(new Change() .withAction(ChangeAction.UPSERT) .withResourceRecordSet(resourceRecordSet)
@TaskAction public void changeResourceRecordSets() { // to enable conventionMappings feature String hostedZoneId = getHostedZoneId(); String rrsName = getRrsName(); String resourceRecord = getResourceRecord(); AmazonRoute53PluginExtension ext = getProject().getExtensions().getByType(AmazonRoute53PluginExtension.class); AmazonRoute53 route53 = ext.getClient(); route53.changeResourceRecordSets(new ChangeResourceRecordSetsRequest() .withHostedZoneId(hostedZoneId) .withChangeBatch(new ChangeBatch() .withChanges(new Change(ChangeAction.CREATE, new ResourceRecordSet(rrsName, RRType.CNAME) .withResourceRecords(new ResourceRecord(resourceRecord)))))); getLogger().info("change {} requested", hostedZoneId); } }