소스 검색

add godaddy scripts to make cleaning up stale dns records easier

tags/v0.12.4
Jonathan Cobb 4 년 전
부모
커밋
46fec2db76
3개의 변경된 파일42개의 추가작업 그리고 0개의 파일을 삭제
  1. +8
    -0
      bin/godaddy/gd_list_records.sh
  2. +8
    -0
      bin/godaddy/gd_update_records.sh
  3. +26
    -0
      bin/godaddy/gdcurl

+ 8
- 0
bin/godaddy/gd_list_records.sh 파일 보기

@@ -0,0 +1,8 @@
#!/bin/bash

DOMAIN=${1:?no domain provided}

THISDIR=$(cd $(dirname ${0}) && pwd)
GDCURL=${THISDIR}/gdcurl

${GDCURL} ${DOMAIN}/records

+ 8
- 0
bin/godaddy/gd_update_records.sh 파일 보기

@@ -0,0 +1,8 @@
#!/bin/bash
DOMAIN=${1:?no domain provided}
RECORDS_JSON="${2:?no JSON DNS records file provided}"

THISDIR=$(cd $(dirname ${0}) && pwd)
GDCURL=${THISDIR}/gdcurl

${GDCURL} ${DOMAIN}/records "${RECORDS_JSON}" PUT

+ 26
- 0
bin/godaddy/gdcurl 파일 보기

@@ -0,0 +1,26 @@
#!/bin/bash

if [[ -z "${GODADDY_API_KEY}" ]] ; then
echo "GODADDY_API_KEY not defined in environment"
exit 1
fi
if [[ -z "${GODADDY_API_SECRET}" ]] ; then
echo "GODADDY_API_SECRET not defined in environment"
exit 1
fi

URI="${1:?no uri}"
POST_FILE="${2}"
HTTP_METHOD=${3}

API_BASE=https://api.godaddy.com/v1/domains/

if [[ ! -z "${POST_FILE}" ]] ; then
if [[ -z "${HTTP_METHOD}" ]] ; then
curl -d @${POST_FILE} -s -H 'Content-Type: application/json' -H "Authorization: sso-key ${GODADDY_API_KEY}:${GODADDY_API_SECRET}" ${API_BASE}${URI}
else
curl -d @${POST_FILE} -X ${HTTP_METHOD} -s -H 'Content-Type: application/json' -H "Authorization: sso-key ${GODADDY_API_KEY}:${GODADDY_API_SECRET}" ${API_BASE}${URI}
fi
else
curl -s -H "Authorization: sso-key ${GODADDY_API_KEY}:${GODADDY_API_SECRET}" ${API_BASE}${URI}
fi

불러오는 중...
취소
저장