Skip to content

Commit

Permalink
Added script to display all records for a given zone. Assumes authent…
Browse files Browse the repository at this point in the history
…ication has happened

and that an authentication token is available in the credentials file.
  • Loading branch information
mbjones committed Oct 29, 2013
1 parent eccf497 commit 14eb97d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
19 changes: 19 additions & 0 deletions records.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
#
# Matt Jones 2013
#
# Output a basic set of records for the domain
# Usage: ./details.sh <mydomain.org>

. ./rsdns_functions.sh

DOMAIN=$1
CRED=credentials
. ./$CRED

getDomainId

curl -s \
-H "X-Auth-Token: $TOKEN" \
-H 'Accept: application/xml' \
"https://dns.api.rackspacecloud.com/v1.0/${TENANT}/domains/${DOMAINID}" | xmlstarlet fo
9 changes: 9 additions & 0 deletions rsdns_functions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Utility functions that are used across the RSDNS scripts and provide common functionality
#
# Matt Jones, 2013

# Get the Identifier for a Domain given the DOMAIN name and the TENANT, as well as an authorization TOKEN
function getDomainId() {
DOMAINID=`curl -s -H "X-Auth-Token: $TOKEN" -H 'Accept: application/xml' "https://dns.api.rackspacecloud.com/v1.0/${TENANT}/domains?name=$DOMAIN" | xmlstarlet fo | xmlstarlet sel -N ns2=http://docs.rackspacecloud.com/dns/api/v1.0 -T -t -m "/ns2:domains/ns2:domain" -v "@id" --nl`
}

0 comments on commit 14eb97d

Please sign in to comment.