Skip to content

Commit

Permalink
rsdns-mx improve output & add -J
Browse files Browse the repository at this point in the history
  • Loading branch information
linickx committed May 5, 2016
1 parent cf96ce6 commit d87e89c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/func.sh
Expand Up @@ -231,6 +231,8 @@ function rackspace_cloud() {
then
echo $RC | jq -r '(.response.domains[] | " ID: \(.id) | NAME: \(.name) | Account: \(.accountId) | TTL: \(.ttl) | EMAIL: \(.emailAddress) | CREATED: \(.created) | UPDATED: \(.updated)")' | tr -s '|' "\n"
echo $RC | jq -r '(.response.domains[] | " NAMESERVERS: \(.nameservers[].name)")'
elif [[ "$RCOUTPUT" == "mx" ]]; then
echo $RC | jq -r '(.response.records[] | " ID: \(.id) | TYPE: \(.type) | NAME: \(.name) | DATA: \(.data) | PRIORITY: \(.priority) | TTL: \(.ttl) | CREATED: \(.created) | UPDATED: \(.updated)")' | tr -s '|' "\n"
else
echo $RC | jq -r '(.response.records[] | " ID: \(.id) | TYPE: \(.type) | NAME: \(.name) | DATA: \(.data) | TTL: \(.ttl) | CREATED: \(.created) | UPDATED: \(.updated)")' | tr -s '|' "\n"
fi
Expand Down
5 changes: 4 additions & 1 deletion rsdns-mx.sh
Expand Up @@ -26,6 +26,7 @@ function usage () {
printf "\t-k Use London/UK Servers.\n"
printf "\t-x Delete record.\n"
printf "\t-h Show this.\n"
printf "\t-J Output in JSON (raw RS API data)\n"
printf "\n"
}

Expand All @@ -45,6 +46,7 @@ function create_mx () {
then

RSPOST=`echo '{"records":[{ "priority" : '$PRIORITY',"type" : "MX", "name" : "'$NAME'", "data" : "'$DATA'", "ttl" : '$TTL' }]}'`
RCOUTPUT="mx"

create_record

Expand All @@ -67,7 +69,7 @@ function words () {
}

#Get options from the command line.
while getopts "u:a:c:d:n:D:p::hkqxw" option
while getopts "u:a:c:d:n:D:p::hkqxwJ" option
do
case $option in
u ) RSUSER=$OPTARG ;;
Expand All @@ -83,6 +85,7 @@ do
k ) UKAUTH=1 ;;
x ) DEL=1 ;;
w ) words;exit 0 ;;
J ) RSJSON=1 ;;
esac
done

Expand Down

0 comments on commit d87e89c

Please sign in to comment.