if _exoscale_rest POST "domains/$_domain_id/records""{\"record\":{\"name\":\"$_sub_domain\",\"record_type\":\"TXT\",\"content\":\"$txtvalue\",\"ttl\":120}}""$_domain_token";then
if _contains "$response""$txtvalue";then
_info "Added, OK"
return 0
fi
fi
_err "Add txt record error."
return 1
}
# Usage: fulldomain txtvalue
# Used to remove the txt record after validation
dns_exoscale_rm(){
fulldomain=$1
txtvalue=$2
if! _checkAuth;then
return 1
fi
_debug "First detect the root zone"
if! _get_root "$fulldomain";then
_err "invalid domain"
return 1
fi
_debug _sub_domain "$_sub_domain"
_debug _domain "$_domain"
_debug "Getting txt records"
_exoscale_rest GET "domains/${_domain_id}/records?type=TXT&name=$_sub_domain""""$_domain_token"
if _contains "$response""\"name\":\"$_sub_domain\"">/dev/null;then