List of usage examples for com.amazonaws.services.route53.model RRType A
RRType A
To view the source code for com.amazonaws.services.route53.model RRType A.
Click Source Link
From source file:br.com.ingenieux.mojo.beanstalk.cmd.dns.BindDomainsCommand.java
License:Apache License
protected void assignDomain(BindDomainsContext ctx, String record, String zoneId) { ChangeBatch changeBatch = new ChangeBatch(); changeBatch.setComment(format("Updated for env %s", ctx.getCurEnv().getCNAME())); /**//from www.j ava2 s . co m * Look for Existing Resource Record Sets */ { ResourceRecordSet resourceRecordSet = null; ListResourceRecordSetsResult listResourceRecordSets = r53 .listResourceRecordSets(new ListResourceRecordSetsRequest(zoneId)); for (ResourceRecordSet rrs : listResourceRecordSets.getResourceRecordSets()) { if (!rrs.getName().equals(record)) { continue; } boolean matchesTypes = "A".equals(rrs.getType()) || "CNAME".equals(rrs.getType()); if (!matchesTypes) { continue; } if (isInfoEnabled()) { info("Excluding resourceRecordSet %s for domain %s", rrs, record); } changeBatch.getChanges().add(new Change(ChangeAction.DELETE, rrs)); } } /** * Then Add Ours */ ResourceRecordSet resourceRecordSet = new ResourceRecordSet(); resourceRecordSet.setName(record); resourceRecordSet.setType(RRType.A); if (ctx.singleInstance) { final String address = ctx.getCurEnv().getEndpointURL(); ResourceRecord resourceRecord = new ResourceRecord(address); resourceRecordSet.setTTL(60L); resourceRecordSet.setResourceRecords(asList(resourceRecord)); if (isInfoEnabled()) { info("Adding resourceRecordSet %s for domain %s mapped to %s", resourceRecordSet, record, address); } } else { AliasTarget aliasTarget = new AliasTarget(); aliasTarget.setHostedZoneId(ctx.getElbHostedZoneId()); aliasTarget.setDNSName(ctx.getCurEnv().getEndpointURL()); resourceRecordSet.setAliasTarget(aliasTarget); if (isInfoEnabled()) { info("Adding resourceRecordSet %s for domain %s mapped to %s", resourceRecordSet, record, aliasTarget.getDNSName()); } } changeBatch.getChanges().add(new Change(ChangeAction.CREATE, resourceRecordSet)); if (isInfoEnabled()) { info("Changes to be sent: %s", changeBatch.getChanges()); } ChangeResourceRecordSetsRequest req = new ChangeResourceRecordSetsRequest(zoneId, changeBatch); r53.changeResourceRecordSets(req); }
From source file:com.deploymentio.ec2namer.helpers.DnsRegistrar.java
License:Apache License
protected Change createName(NamerRequest req, LambdaContext context, String name) { Instance instance = instanceLookup.lookup(context, req.getInstanceId()); boolean isVpc = req.isAlwaysUsePublicName() ? false : !StringUtils.isEmpty(instance.getVpcId()); RRType recordType = isVpc ? RRType.A : RRType.CNAME; ResourceRecordSet set = new ResourceRecordSet(req.createFqdn(name) + ".", recordType); set.withTTL(60l);/*from w w w. j a va 2 s. c o m*/ set.withResourceRecords( new ResourceRecord(isVpc ? instance.getPrivateIpAddress() : instance.getPublicDnsName())); return new Change(ChangeAction.UPSERT, set); }
From source file:net.za.slyfox.dyn53.route53.Route53Updater.java
License:Apache License
/** * Maps the given {@link InetAddress} to a {@link RRType} enumeration value. * * @param address the address to map/* w w w .ja v a 2s . com*/ * @return the {@code RRType} enumeration value corresponding to the type of address given * @throws IllegalArgumentException if {@code address} cannot be mapped to a value in the {@code RRType} enumeration */ private static RRType getResourceRecordType(InetAddress address) { if (address instanceof Inet4Address) { return RRType.A; } else if (address instanceof Inet6Address) { return RRType.AAAA; } else { throw new IllegalArgumentException("Unsupported address type " + address.getClass()); } }
From source file:org.ofbiz.tenant.amazonaws.util.AwsUtil.java
License:Apache License
/** * get resource record type//www . j a v a 2 s .c o m * @param value * @return * @throws GeneralException */ public static RRType getRRType(String value) throws GeneralException { RRType rrType = null; if ("A".equals(value)) { rrType = RRType.A; } else if ("CNAME".equals(value)) { rrType = RRType.CNAME; } else if ("MX".equals(value)) { rrType = RRType.MX; } else if ("AAAA".equals(value)) { rrType = RRType.AAAA; } else if ("TXT".equals(value)) { rrType = RRType.TXT; } else if ("PTR".equals(value)) { rrType = RRType.PTR; } else if ("SRV".equals(value)) { rrType = RRType.SRV; } else if ("SPF".equals(value)) { rrType = RRType.SPF; } else if ("NS".equals(value)) { rrType = RRType.NS; } else if ("SOA".equals(value)) { rrType = RRType.SOA; } else { throw new GeneralException( "The type need to be one of: A, CNAME, MX, AAAA, TXT, PTR, SRV, SPF, NS, SOA"); } return rrType; }