Browse Source

added dnsapi for internetx autodns json api

pull/4526/head
aa 3 years ago
parent
commit
5899090bbc
  1. 6
      dnsapi/dns_autodns_json.sh

6
dnsapi/dns_autodns_json.sh

@ -45,7 +45,7 @@ dns_autodns_json_add() {
_post_data="{\"adds\":[{\"name\":\"$_autodns_sub_domain\",\"ttl\":600,\"type\":\"TXT\",\"value\":\"$txtvalue\"}]}" _post_data="{\"adds\":[{\"name\":\"$_autodns_sub_domain\",\"ttl\":600,\"type\":\"TXT\",\"value\":\"$txtvalue\"}]}"
_response="$(dns_autodns_api_call "/zone/$_autodns_zone/_stream" "$_post_data")" _response="$(dns_autodns_api_call "/zone/$_autodns_zone/_stream" "$_post_data")"
if [ "$?" -eq "0" ] && _contains "$_response" '{"type":"Zone","summary":1}'; then
if _contains "$_response" '{"type":"Zone","summary":1}'; then
_info "Added, OK" _info "Added, OK"
return 0 return 0
fi fi
@ -64,7 +64,6 @@ dns_autodns_json_rm() {
AUTODNS_PASSWORD="${AUTODNS_PASSWORD:-$(_readaccountconf_mutable AUTODNS_PASSWORD)}" AUTODNS_PASSWORD="${AUTODNS_PASSWORD:-$(_readaccountconf_mutable AUTODNS_PASSWORD)}"
AUTODNS_CONTEXT="${AUTODNS_CONTEXT:-$(_readaccountconf_mutable AUTODNS_CONTEXT)}" AUTODNS_CONTEXT="${AUTODNS_CONTEXT:-$(_readaccountconf_mutable AUTODNS_CONTEXT)}"
if ! _get_autodns_zone "$fulldomain"; then if ! _get_autodns_zone "$fulldomain"; then
_err "invalid domain" _err "invalid domain"
return 1 return 1
@ -74,7 +73,7 @@ dns_autodns_json_rm() {
_post_data="{\"rems\":[{\"name\":\"$_autodns_sub_domain\",\"type\":\"TXT\",\"value\":\"$txtvalue\"}]}" _post_data="{\"rems\":[{\"name\":\"$_autodns_sub_domain\",\"type\":\"TXT\",\"value\":\"$txtvalue\"}]}"
_response="$(dns_autodns_api_call "/zone/$_autodns_zone/_stream" "$_post_data")" _response="$(dns_autodns_api_call "/zone/$_autodns_zone/_stream" "$_post_data")"
if [ "$?" -eq "0" ] && _contains "$_response" '{"type":"Zone","summary":1}'; then
if _contains "$_response" '{"type":"Zone","summary":1}'; then
_info "Deleted, OK" _info "Deleted, OK"
return 0 return 0
fi fi
@ -82,7 +81,6 @@ dns_autodns_json_rm() {
return 1 return 1
} }
dns_autodns_api_call() { dns_autodns_api_call() {
_api_route="$1" _api_route="$1"
_post_data="$2" _post_data="$2"

Loading…
Cancel
Save