com.carrotgarden.maven.aws.dns.NameServEnsureCNAME Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of carrot-maven-aws-plugin Show documentation
Show all versions of carrot-maven-aws-plugin Show documentation
${project.organization.name} AWS Maven Plugin
/**
* Copyright (C) 2010-2012 Andrei Pozolotin
*
* All rights reserved. Licensed under the OSI BSD License.
*
* http://www.opensource.org/licenses/bsd-license.php
*/
package com.carrotgarden.maven.aws.dns;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
/**
* route53:
*
* ensure cname record
*
* @goal route53-ensure-cname
*
* @phase prepare-package
*
* @inheritByDefault true
*
* @requiresDependencyResolution test
*
*/
public class NameServEnsureCNAME extends NameServ {
/**
* source dns name, or left-hand side of CNAME record
*
* @required
* @parameter default-value="source.default.example.com"
*/
private String dnsSource;
/**
* target dns name, or right-hand side of CNAME record
*
* @required
* @parameter default-value="target.default.example.com"
*/
private String dnsTarget;
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
try {
final String entry = dnsSource + " -> " + dnsTarget;
getLog().info("dns cname init [" + entry + "]");
final CarrotRoute53 route53 = newRoute53();
route53.ensureCNAME( //
route53.canonical(dnsSource), route53.canonical(dnsTarget));
getLog().info("dns cname done [" + entry + "]");
} catch (final Exception e) {
throw new MojoFailureException("bada-boom", e);
}
}
}