public static void main(String[] args) throws IOException { Arguments arguments = new Arguments(); CmdLineParser parser = new CmdLineParser(arguments); try { parser.parseArgument(args); } catch (CmdLineException e) { System.err.println("Usage: java -jar dyndns.jar <arguments>"); parser.printUsage(System.err); System.exit(1); } AmazonRoute53 route53 = new AmazonRoute53Client(new DefaultAWSCredentialsProviderChain()); UpdateDns updateDns = new UpdateDns(route53, arguments.hostedZoneId); updateDns.updateDns(arguments.recordSetName, arguments.force); }
public static void createARecords(AmazonRoute53Client client) { ChangeResourceRecordSetsRequest request = new ChangeResourceRecordSetsRequest(); request.setHostedZoneId("Z6C671E6E1A044F6695AD50EE258D8BAE"); ChangeBatch changeBatch = new ChangeBatch(); Collection<Change> changes = new LinkedList<Change>(); for (int i = 1; i < 151; ++i) { Change change = new Change(); change.setAction(ChangeAction.CREATE); ResourceRecordSet rrs = new ResourceRecordSet(); rrs.setType(RRType.A); rrs.setTTL(900L); rrs.setName("inst-" + i + ".msicluster.momentumsoftware.com"); Collection<ResourceRecord> rr = new LinkedList<ResourceRecord>(); ResourceRecord e = new ResourceRecord(); e.setValue("172.31.253." + i); rr.add(e); rrs.setResourceRecords(rr); change.setResourceRecordSet(rrs); changes.add(change); } changeBatch.setChanges(changes); request.setChangeBatch(changeBatch); client.changeResourceRecordSets(request); }
public static void createCNAMERecords(AmazonRoute53Client client) { ChangeResourceRecordSetsRequest request = new ChangeResourceRecordSetsRequest(); request.setHostedZoneId("Z9366F3515BBA46B2AA8C86B1D6DF0311"); ChangeBatch changeBatch = new ChangeBatch(); Collection<Change> changes = new LinkedList<Change>(); Change change = new Change(); change.setAction(ChangeAction.CREATE); ResourceRecordSet rrs = new ResourceRecordSet(); rrs.setType(RRType.CNAME); rrs.setTTL(900L); rrs.setName("devessex.essex.momentumsoftware.com"); Collection<ResourceRecord> rr = new LinkedList<ResourceRecord>(); ResourceRecord e = new ResourceRecord(); e.setValue("inst-5.essex.momentumsoftware.com"); rr.add(e); rrs.setResourceRecords(rr); change.setResourceRecordSet(rrs); changes.add(change); changeBatch.setChanges(changes); request.setChangeBatch(changeBatch); client.changeResourceRecordSets(request); }
public static void testChangeResourceRecordSets(AmazonRoute53Client client) { ChangeResourceRecordSetsRequest req = new ChangeResourceRecordSetsRequest(); req.setHostedZoneId("Z3HKYAOP6P7EX7"); ChangeBatch batch = new ChangeBatch(); Collection<Change> changes = new LinkedList<Change>(); Change change = new Change(); change.setAction("DELETE"); ResourceRecordSet rrSet = new ResourceRecordSet(); rrSet.setName("www.examplethatshouldntbequeried.com."); rrSet.setType("A"); rrSet.setTTL(300L); rrSet.setWeight(1L); Collection<ResourceRecord> rrs = new LinkedList<ResourceRecord>(); ResourceRecord e = new ResourceRecord(); e.setValue("172.31.255.2"); rrs.add(e); rrSet.setResourceRecords(rrs); rrSet.setSetIdentifier("1"); rrSet.setTTL(300L); change.setResourceRecordSet(rrSet); changes.add(change); batch.setChanges(changes); req.setChangeBatch(batch); client.changeResourceRecordSets(req); }
public static void ListResourceRecordSets(AmazonRoute53Client client) { ListResourceRecordSetsRequest req = new ListResourceRecordSetsRequest(); req.setHostedZoneId("Z6C671E6E1A044F6695AD50EE258D8BAE"); // req.setMaxItems("1"); // req.setStartRecordType("NS"); System.out.println(client.listResourceRecordSets(req)); }
public static void CreateHostedZone(AmazonRoute53Client client) { CreateHostedZoneRequest req = new CreateHostedZoneRequest(); req.setName("iamdanielandthisisjustatest2.com."); req.setCallerReference("testCR5"); HostedZoneConfig config = new HostedZoneConfig(); config.setComment("Just some comment"); req.setHostedZoneConfig(config); CreateHostedZoneResult result = client.createHostedZone(req); System.out.println(result.toString()); }
private Route53Helper(Config config){ this.config = checkNotNull(config); this.amazonRoute53Client = new AmazonRoute53Client( new BasicAWSCredentials(config.getRoute53Key(),config.getRoute53Secret()) ); }
public static AmazonRoute53 getRoute53() { AmazonRoute53 route53 = new AmazonRoute53Client(ConfigProvider.getCredential()); route53.setRegion(ConfigProvider.getDefaultRegion()); return route53; }
public static void GetHostedZone(AmazonRoute53Client client) { GetHostedZoneRequest req = new GetHostedZoneRequest(); req.setId("alrite"); client.getHostedZone(req); }
public static void ListHostedZones(AmazonRoute53Client client) { ListHostedZonesRequest req = new ListHostedZonesRequest(); req.setMaxItems("1"); System.out.println(client.listHostedZones(req).toString()); }
public AmazonRoute53Client getRoute53Client(){ return this.client; }
public void setRoute53Client(AmazonRoute53Client client){ this.client = client; }
private AmazonRoute53 newClient() { final AmazonRoute53 amazonClient = new AmazonRoute53Client(credentials); return amazonClient; }