Description: Simple script to replace as-* cli from AWS
 The AWS Auto Scaling tools include an array of command-line tools which are
 chain on each other. To reduce the maintenance burden, the as-* commands are
 replaced with as symlinks to /usr/bin/ascli. ascli uses the arg zero to
 determine which application called it and then directly invokes the Java JVM.
 The advantage with this approach is that the invocation and maintenance is
 very straight forward.
 .
 ascli (1.0.61.0-0ubuntu1) UNRELEASED; urgency=low
 .
   * New upstream release.
Author: Ben Howard <ben.howard@ubuntu.com>

--- /dev/null
+++ b/ascli
@@ -0,0 +1,158 @@
+#!/bin/bash
+#
+## Copyright 2012, Ben Howard <ben.howard@ubuntu.com>
+##
+## This program is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+## This is a simple wrapper around the AWS Auto Scaling JAR files. This
+## script replaces all the Auto Scaling scripts and makes it easy to
+## both maintain and add new features.
+
+# Find out what command are we running
+link_cmd="${0##*/}"
+
+usage() {
+	echo "${0##*/} is a wrapper script for invoking Auto Scaling commands"
+	echo "Usage:"
+	echo "   --desc <name>   : Shows help for a single Auto Scaling Command"
+	echo "   --commands      : Shows available command line programs"
+	echo "   --help          : Shows this menu"
+	echo "   <COMMAND> <OPT> : Run Auto Scaling commands directly"
+}
+
+
+# Set home paths
+export AWS_AUTO_SCALING_HOME=${AWS_AUTO_SCALING_HOME:-"/usr/share/ascli"}
+export jshared=${AWS_AUTO_SCALING_JAVA_SHARED_CLASSPATH:-"/usr/share/java/activation.jar:/usr/share/java/commons-cli.jar:/usr/share/java/commons-codec.jar:/usr/share/java/commons-discovery.jar:/usr/share/java/commons-httpclient.jar:/usr/share/java/commons-logging.jar:/usr/share/java/commons-logging-api.jar:/usr/share/java/jdom1.jar:/usr/share/java/joda-time.jar:/usr/share/java/log4j-1.2.jar:/usr/share/java/serializer.jar:/usr/share/java/stax-api.jar:/usr/share/java/wsdl4j.jar:/usr/share/java/wss4j.jar:/usr/share/java/xalan2.jar"}
+
+# Discover service home for jar file discovery
+[ -d "${AWS_AUTO_SCALING_HOME}/lib" ] && LIBDIR="${AWS_AUTO_SCALING_HOME}/lib" ||
+   LIBDIR="${AWS_AUTO_SCALING_HOME}"
+
+# Preserve classpaths an
+for j in "${LIBDIR}"/*.jar; do cp="${cp:+${cp}:}${j}"; done
+[ -n "${CLASSPATH%:}" ] && cp="${CLASSPATH%:}:${cp}"
+[ "${jshared#@@}" != "${jshared}" ] || cp="${cp}:${jshared}"
+
+
+# Check AWS_AUTO_SCALING_HOME
+if [ -z "${AWS_AUTO_SCALING_HOME}" ]; then
+        echo AWS_AUTO_SCALING_HOME is not set
+        exit 1
+fi
+
+# Construct a list of the valid commands
+valid_cmds=("as-create-auto-scaling-group"
+	"as-create-launch-config"
+	"as-create-or-update-tags"
+	"as-delete-auto-scaling-group"
+	"as-delete-launch-config"
+	"as-delete-notification-configuration"
+	"as-delete-policy"
+	"as-delete-scheduled-action"
+	"as-delete-tags"
+	"as-describe-adjustment-types"
+	"as-describe-auto-scaling-groups"
+	"as-describe-auto-scaling-instances"
+	"as-describe-auto-scaling-notification-types"
+	"as-describe-launch-configs"
+	"as-describe-metric-collection-types"
+	"as-describe-notification-configurations"
+	"as-describe-policies"
+	"as-describe-process-types"
+	"as-describe-scaling-activities"
+	"as-describe-scheduled-actions"
+	"as-describe-tags"
+	"as-disable-metrics-collection"
+	"as-enable-metrics-collection"
+	"as-execute-policy"
+	"as-put-notification-configuration"
+	"as-put-scaling-policy"
+	"as-put-scheduled-update-group-action"
+	"as-resume-processes"
+	"as-set-desired-capacity"
+	"as-set-instance-health"
+	"as-suspend-processes"
+	"as-terminate-instance-in-auto-scaling-group"
+	"as-update-auto-scaling-group"
+	"as-version")
+
+JAVA_CMD="${JAVA_COMMAND:-`which java`} ${AWS_AUTO_SCALING_JVM_ARGS} -classpath ${cp} com.amazon.webservices.Cli"
+ld=${AWS_AUTO_SCALING_HOME:-/usr/share/ascli}
+
+[ "${link_cmd}" == "as-version" ] && exec ${JAVA_CMD} version
+
+# Execute the command
+for cmd in ${valid_cmds[@]}
+do
+	[ "${link_cmd}" == "as-version" ] && link_cmd="version"
+
+	if [ "${link_cmd}" = "${cmd}" ]; then
+		exec ${JAVA_CMD} "${cmd}" "${@}"
+	fi
+done
+
+# Check if ascli was executed directly
+if [ "${link_cmd}" == "ascli" ]; then
+	if [ "${1}" == "--commands" ]; then
+
+		# Show valid commands
+		for cmd in "${valid_cmds[@]}"; do echo "$cmd"; done
+		exit 0
+
+	elif [ "${1}" == "--desc" ]; then
+
+		if [ "${2}" == "Command" ]; then
+			# If no command is defined, show all
+			exec ${JAVA_CMD}
+
+		elif [ "${2}" == "ascli" ]; then
+			usage
+			exit 0
+
+		else
+			# Describe individual command
+			exec ${JAVA_CMD} "${2}" "--help"
+		fi
+
+	elif [ "${1}" == "--version" ]; then
+
+		# Get the version
+		exec ${JAVA_CMD} version
+
+	elif [ "${1}" == "--help" -o "${1}" == "-h" ]; then
+
+		usage
+		exit 0
+
+	elif [[ "${1}" =~ "as-" ]]; then
+
+		# Direct execution of command, by passing link
+		exec ${JAVA_CMD} "${@}"
+
+	else
+
+		# Otherwise command is invalid
+		ver=$($JAVA_CMD version)
+		echo "${ver}"
+		echo "${0} is a simple wrapper script used for executing AWS Auto Scaling"
+		echo "commands. Please see --help or --commands determine what commands"
+		echo "are available"
+		exit 1
+
+	fi
+fi
+
+echo "${link_cmd} is an invalid command!"
+exit 1
--- /dev/null
+++ b/ascli.1
@@ -0,0 +1,48 @@
+.TH ASCLI "1" "1.0.61.0 api=" "Auto Scaling command line tools" "User Commands"
+.SH NAME
+.B ascli
+\- Auto Scaling command line tool wrapper.
+.SH SYNOPSIS
+ascli [--help|--desc|<COMMAND>]
+.br
+.SH OPTIONS
+.TP
+.B --help
+Show the usage information
+.TP
+.B --desc
+Describe an Auto Scaling command's help.
+.TP
+.B [COMMAND] [ARGS]
+Invoke Auto Scaling command
+.SH DESCRIPTION
+ascli is a wrapper script around the AWS Auto Scaling Commands. Its usual invocation is as a symbolic link via the direct name of the Auto Scaling command intended to be used. ascli replaces the stacked scripts provided by AWS with a single script.
+.br
+.SH EXAMPLES
+Example 1:  ascli as-describe-auto-scaling-groups --region us-east-1
+.br
+Show Auto Scaling groups in us-east-1
+.P
+Example 2:  ascli --help
+.br
+Show the help page
+.P
+Example 3:  ascli --desc as-resume-processes
+.br
+Show the help for as-resume-processes Auto Scaling Command
+.P
+.SH VERSION
+This documentation describes
+.B ascli
+version 1.0.61.0
+.SH "SEE ALSO"
+
+.br
+.I http://docs.amazonwebservices.com/AutoScaling/DeveloperGuide/
+.br
+.I http://docs.amazonwebservices.com/AutoScaling/latest/DeveloperGuide/
+.SH AUTHOR
+.br
+.B Ben Howard
+.br
+.I \<ben.howard@canonical.com\>
