Example usage for com.amazonaws.services.route53.model ResourceRecordSet withTTL

List of usage examples for com.amazonaws.services.route53.model ResourceRecordSet withTTL

Introduction

In this page you can find the example usage for com.amazonaws.services.route53.model ResourceRecordSet withTTL.

Prototype


public ResourceRecordSet withTTL(Long tTL) 

Source Link

Document

The resource record cache time to live (TTL), in seconds.

Usage

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);
    set.withResourceRecords(//from   w  w w .ja va 2s.  c o  m
            new ResourceRecord(isVpc ? instance.getPrivateIpAddress() : instance.getPublicDnsName()));

    return new Change(ChangeAction.UPSERT, set);
}