#!/bin/sh

set -e
set -x

usage () {
	echo "Usage: $0 --hostname <HOSTNAME> --ip-address <IP_ADDRESS>"
	exit 1
}

for i in $@ ; do
	case "${1}" in
	"--hostname")
		MY_HOST=${2}
		shift
		shift
	;;
	"--ip-address")
		IP_ADDRESS=${2}
		shift
		shift
	;;
	*)
	;;
	esac
done

if [ -z "${MY_HOST}" ] ; then
	usage
fi

if [ -z "${IP_ADDRESS}" ] ; then
	usage
fi

# Example calls:
# ssh ONE_HOSTNAME "dns-command add-record ${MY_HOST} ${IP_ADDRESS}"
# curl https://example.com/dns-api/create-host/${MY_HOST}/${IP_ADDRESS}
