All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.carrotgarden.maven.aws.dns.NameServEnsureCNAME Maven / Gradle / Ivy

There is a newer version: 1.2.6
Show newest version
/**
 * 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);

		}

	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy