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

com.carrotgarden.maven.aws.dns.NameServListZone 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 java.util.List;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;

import com.carrotgarden.maven.aws.util.Util;

/**
 * route53:
 * 
 * list dns zone entires
 * 
 * @goal route53-list-zone
 * 
 * @phase prepare-package
 * 
 * @inheritByDefault true
 * 
 * @requiresDependencyResolution test
 * 
 */
public class NameServListZone extends NameServ {

	/**
	 * dns zone name to be listed
	 * 
	 * @required
	 * @parameter default-value="default.example.com"
	 */
	private String dnsZoneName;

	/**
	 * name of the maven project.property that will contain dns name list after
	 * execution of this maven goal
	 * 
	 * @required
	 * @parameter default-value="dnsNameList"
	 */
	private String dnsResultProperty;

	/**
	 * separator character to use when building dns result name list
	 * 
	 * @required
	 * @parameter default-value=";"
	 */
	private String dnsResultSeparator;

	@Override
	public void execute() throws MojoExecutionException, MojoFailureException {

		try {

			getLog().info("dns list init [" + dnsZoneName + "]");

			final CarrotRoute53 route53 = newRoute53();

			final List list = route53.listZone(dnsZoneName);

			final String dnsResultNameList = Util.concatenate(list,
					dnsResultSeparator);

			getLog().info("dns name list : " + dnsResultNameList);

			project().getProperties().put(dnsResultProperty, dnsResultNameList);

			getLog().info("dns list done [" + dnsZoneName + "]");

		} catch (final Exception e) {

			throw new MojoFailureException("bada-boom", e);

		}

	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy