#!/bin/bash source $SDK_VERSIONS/testdata/pycipres.conf usage() { echo echo "You must supply username and password of a cipres admin account " echo "with -u username and -p password. Use -c to create the accounts (default)," echo "-d to delete them. " echo echo "Rest Service must be up and running." echo exit 1 } if [[ $# < 2 ]] ; then usage fi action=create while [[ $# > 1 ]] do key="$1" shift case $key in -u) AUSER="$1" shift ;; -p) APASS="$1" shift ;; -c) action=create ;; -d) action=delete ;; *) usage ;; esac done if [[ -z $AUSER || -z $APASS ]] ; then usage fi case $action in create) echo "Create/update $PYCIPRES_ADMIN User" curl -k -u $AUSER:$APASS $URL/user/$PYCIPRES_ADMIN \ -d role=REST_ADMIN \ -d password=$TESTPASS\ -d email="$PYCIPRES_ADMIN@yahoo.com" \ -d first_name=$PYCIPRES_ADMIN \ -d last_name=$PYCIPRES_ADMIN echo "Create/update $PYCIPRES_APP Application" curl -k -u $AUSER:$APASS $URL/application/$PYCIPRES_ADMIN/$PYCIPRES_APP \ -d longname="pycipres scripts" \ -d authtype=DIRECT echo "Create/update $PYCIPRES_EU End User" curl -k $URL/user/$PYCIPRES_EU \ -d role=REST_END_USER_DIRECT \ -d password=$TESTPASS\ -d appname=$PYCIPRES_APP \ -d email=$PYCIPRES_EU@yahoo.com \ -d first_name=$PYCIPRES_EU \ -d last_name=$PYCIPRES_EU ;; delete) echo "not implemented" ;; esac