removed zone verification

zone verification not needed, instead check for 404 response on del api call
This commit is contained in:
Matthew Saunders Brown 2022-02-02 15:48:19 -08:00
parent 9e6deb7a2a
commit c1be3a004e

View File

@ -56,12 +56,6 @@ if [[ -z $type ]]; then
exit
fi
# first query to see if zone already exists
zone_status=$(/usr/bin/curl --silent --output /dev/null --write-out "%{http_code}" -H "X-API-Key: $api_key" "$api_base_url/zones/$zone?rrsets=false")
if [[ $zone_status = 200 ]]; then
# verified zone exists, delete record
data="{\"rrsets\":[{\"name\":\"$name\",\"type\":\"$type\",\"changetype\":\"DELETE\",\"records\":[]}]}"
# delete record(s)
@ -69,12 +63,8 @@ if [[ $zone_status = 200 ]]; then
if [[ $zone_status = 204 ]]; then
echo "Success. Record(s) for $zone deleted."
else
echo "Error. http response deleting record(s) for $zone was: $zone_status"
fi
elif [[ $zone_status = 404 ]]; then
echo "Zone $zone does not exist, can't delete record."
else
echo "Unexpected http response checking for Zone $zone: $zone_status"
echo "Error. http response deleting record(s) for $zone was: $zone_status"
fi