Compare commits
13 Commits
57da7e2b79
...
main
Author | SHA1 | Date | |
---|---|---|---|
2ab0cbce59
|
|||
84197cefd2
|
|||
b756df56c7
|
|||
34b288576c
|
|||
6ece65cd55
|
|||
9fb69ee568
|
|||
1197e46b56
|
|||
c6ab4cf758
|
|||
cbb7ca25fd
|
|||
4279fd8750
|
|||
340741bfdc
|
|||
32211f25a0
|
|||
2266b1be37
|
12
README.md
12
README.md
@@ -23,17 +23,17 @@ The following API endpoints are the ones that will be supported, the currently i
|
||||
- [ ] [Domain Delete Url Forward](https://porkbun.com/api/json/v3/documentation#Domain%20Delete%20URL%20Forward)
|
||||
- DNS
|
||||
- [x] [DNS Create Record](https://porkbun.com/api/json/v3/documentation#DNS%20Create%20Record)
|
||||
- [ ] [DNS Edit Record by Domain and ID](https://porkbun.com/api/json/v3/documentation#DNS%20Edit%20Record%20by%20Domain%20and%20ID)
|
||||
- [ ] [DNS Edit Records by Domain, Subdomain and Type](https://porkbun.com/api/json/v3/documentation#DNS%20Edit%20Record%20by%20Domain,%20Subdomain%20and%20Type)
|
||||
- [x] [DNS Edit Record by Domain and ID](https://porkbun.com/api/json/v3/documentation#DNS%20Edit%20Record%20by%20Domain%20and%20ID)
|
||||
- [x] [DNS Edit Records by Domain, Subdomain and Type](https://porkbun.com/api/json/v3/documentation#DNS%20Edit%20Record%20by%20Domain,%20Subdomain%20and%20Type)
|
||||
- [x] [DNS Delete Record by Domain and ID](https://porkbun.com/api/json/v3/documentation#DNS%20Delete%20Record%20by%20Domain%20and%20ID)
|
||||
- [ ] [DNS Delete Records by Domain, Subdomain and Type](https://porkbun.com/api/json/v3/documentation#DNS%20Delete%20Records%20by%20Domain,%20Subdomain%20and%20Type)
|
||||
- [ ] [DNS Retrieve Records by Domain or ID](https://porkbun.com/api/json/v3/documentation#DNS%20Retrieve%20Records%20by%20Domain%20or%20ID)
|
||||
- [ ] [DNS Retrieve Records by Domain, Subdomain and Type](https://porkbun.com/api/json/v3/documentation#DNS%20Retrieve%20Records%20by%20Domain,%20Subdomain%20and%20Type)
|
||||
- [x] [DNS Delete Records by Domain, Subdomain and Type](https://porkbun.com/api/json/v3/documentation#DNS%20Delete%20Records%20by%20Domain,%20Subdomain%20and%20Type)
|
||||
- [x] [DNS Retrieve Records by Domain or ID](https://porkbun.com/api/json/v3/documentation#DNS%20Retrieve%20Records%20by%20Domain%20or%20ID)
|
||||
- [x] [DNS Retrieve Records by Domain, Subdomain and Type](https://porkbun.com/api/json/v3/documentation#DNS%20Retrieve%20Records%20by%20Domain,%20Subdomain%20and%20Type)
|
||||
|
||||
## Usage
|
||||
|
||||
1. Create API keys for your account, on [Account > API Access](https://porkbun.com/account/api)
|
||||
2. Enable "API Access" on the domains, press on "Details" and check the "API Access" settings on the desires domains.
|
||||
2. Enable "API Access" on the domains, press on "Details" and check the "API Access" settings on the desired domains.
|
||||
3. Execute the script, it will prompt for your API credentials the first time you launch it. The configuration file is saved on the same location as is the script.
|
||||
|
||||
> The generated file is in plain text, with 600 (rw-------) permission.
|
||||
|
@@ -8,7 +8,7 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
# Environment file with API_KEY and SECRET_KEY
|
||||
ENV_FILE="$SCRIPT_DIR/.env"
|
||||
VERSION="0.2.0"
|
||||
VERSION="0.4.1"
|
||||
|
||||
# Porkbun API base url
|
||||
BASE_URL=https://api.porkbun.com/api/json/v3
|
||||
@@ -196,22 +196,12 @@ function ping {
|
||||
echo $(request "$BASE_URL/ping")
|
||||
}
|
||||
|
||||
# TODO: implement method
|
||||
function ping_help {
|
||||
echo "TODO"
|
||||
}
|
||||
|
||||
HANDLE_PING_IPV4="ping-ipv4"
|
||||
|
||||
function ping_ipv4 {
|
||||
echo $(request "$BASE_URL_IPV4/ping")
|
||||
}
|
||||
|
||||
# TODO: implement method
|
||||
function ping_ipv4_help {
|
||||
echo "TODO"
|
||||
}
|
||||
|
||||
# endregion
|
||||
|
||||
###################################################
|
||||
@@ -306,15 +296,25 @@ function handle_dns {
|
||||
$PARAM_HELP_SHORT|$PARAM_HELP)
|
||||
handle_dns_help
|
||||
;;
|
||||
$HANDLE_DNS_EDIT)
|
||||
shift
|
||||
|
||||
handle_dns_edit $@
|
||||
;;
|
||||
$DNS_CREATE_RECORD)
|
||||
shift
|
||||
|
||||
handle_show_help_on_error dns_create_record $@
|
||||
;;
|
||||
$DNS_DELETE_RECORD)
|
||||
$HANDLE_DNS_DELETE)
|
||||
shift
|
||||
|
||||
handle_show_help_on_error dns_delete_record $@
|
||||
handle_dns_delete $@
|
||||
;;
|
||||
$HANDLE_DNS_LIST)
|
||||
shift
|
||||
|
||||
handle_dns_list $@
|
||||
;;
|
||||
*)
|
||||
handle_dns_help
|
||||
@@ -330,7 +330,245 @@ function handle_dns_help {
|
||||
echo
|
||||
echo "Commands:"
|
||||
echo " $DNS_CREATE_RECORD Create a DNS record"
|
||||
echo " $DNS_DELETE_RECORD Delete a DNS record"
|
||||
echo " $HANDLE_DNS_EDIT Edit DNS record(s)"
|
||||
echo " $HANDLE_DNS_DELETE Delete DNS record(s)"
|
||||
echo " $HANDLE_DNS_LIST List DNS record(s)"
|
||||
}
|
||||
|
||||
HANDLE_DNS_EDIT="edit"
|
||||
|
||||
function handle_dns_edit {
|
||||
case $1 in
|
||||
$PARAM_HELP_SHORT|$PARAM_HELP)
|
||||
handle_dns_edit_help
|
||||
;;
|
||||
$DNS_EDIT_RECORD)
|
||||
shift
|
||||
|
||||
handle_show_help_on_error dns_edit_record $@
|
||||
;;
|
||||
$DNS_EDIT_RECORDS)
|
||||
shift
|
||||
|
||||
handle_show_help_on_error dns_edit_records $@
|
||||
;;
|
||||
*)
|
||||
handle_dns_edit_help
|
||||
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function handle_dns_edit_help {
|
||||
echo "Usage: $0 $HANDLE_DNS $HANDLE_DNS_EDIT <command>"
|
||||
echo
|
||||
echo "Commands:"
|
||||
echo " $DNS_EDIT_RECORD Edit a DNS record by Domain and ID"
|
||||
echo " $DNS_EDIT_RECORDS Edit DNS records by Domain, Subdomain, and Type"
|
||||
}
|
||||
|
||||
DNS_EDIT_RECORD="record"
|
||||
|
||||
function dns_edit_record {
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
$PARAM_DOMAIN_SHORT|$PARAM_DOMAIN)
|
||||
DOMAIN="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
$PARAM_ID_SHORT|$PARAM_ID)
|
||||
ID="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
$PARAM_NAME_SHORT|$PARAM_NAME)
|
||||
NAME="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
$PARAM_TYPE_SHORT|$PARAM_TYPE)
|
||||
TYPE="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
$PARAM_CONTENT_SHORT|$PARAM_CONTENT)
|
||||
CONTENT="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
$PARAM_TTL_SHORT|$PARAM_TTL)
|
||||
TTL="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
$PARAM_PRIORITY_SHORT|$PARAM_PRIORITY)
|
||||
PRIORITY="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-*|--*)
|
||||
echo "Unknown option $1"
|
||||
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z $DOMAIN || -z $ID || -z $TYPE || -z $CONTENT ]]; then
|
||||
echo "Missing domain, id, type, or content parameters"
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PAYLOAD="
|
||||
\"type\": \"$TYPE\",
|
||||
\"content\": \"$CONTENT\"
|
||||
"
|
||||
|
||||
if [[ ! -z $NAME ]]; then
|
||||
PAYLOAD="
|
||||
$PAYLOAD,
|
||||
\"name\": \"$NAME\"
|
||||
"
|
||||
fi
|
||||
|
||||
if [[ ! -z $TTL ]]; then
|
||||
PAYLOAD="
|
||||
$PAYLOAD,
|
||||
\"ttl\": \"$TTL\"
|
||||
"
|
||||
fi
|
||||
|
||||
if [[ ! -z $PRIORITY ]]; then
|
||||
PAYLOAD="
|
||||
$PAYLOAD,
|
||||
\"prio\": \"$PRIORITY\"
|
||||
"
|
||||
fi
|
||||
|
||||
echo $(request "$BASE_URL/dns/edit/$DOMAIN/$ID" "$PAYLOAD")
|
||||
}
|
||||
|
||||
function dns_edit_record_help {
|
||||
echo "Usage: $0 $HANDLE_DNS $HANDLE_DNS_EDIT $DNS_EDIT_RECORD [OPTIONS]"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " $PARAM_DOMAIN_SHORT, $PARAM_DOMAIN"
|
||||
echo " The domain of the record being edited."
|
||||
echo " $PARAM_ID_SHORT, $PARAM_ID"
|
||||
echo " The ID of the record."
|
||||
echo " $PARAM_NAME_SHORT, $PARAM_NAME (optional)"
|
||||
echo " The subdomain of the record being edited, not including the domain itself. Leave blank to edit a record on the root domain. Use * to edit a wildcard record."
|
||||
echo " $PARAM_TYPE_SHORT, $PARAM_TYPE"
|
||||
echo " The type of record being edited. Valid types are: A, MX, CNAME, ALIAS, TXT, NS, AAAA, SRV, TLSA, CAA"
|
||||
echo " $PARAM_CONTENT_SHORT, $PARAM_CONTENT"
|
||||
echo " The answer content for the record. Please see the DNS management popup from the domain management console for proper formatting of each record type."
|
||||
echo " $PARAM_TTL_SHORT, $PARAM_TTL (optional)"
|
||||
echo " The time to live in seconds for the record. The minimum and the default is 600 seconds."
|
||||
echo " $PARAM_PRIORITY_SHORT, $PARAM_PRIORITY (optional)"
|
||||
echo " The priority of the record for those that support it."
|
||||
}
|
||||
|
||||
DNS_EDIT_RECORDS="records"
|
||||
|
||||
function dns_edit_records {
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
$PARAM_DOMAIN_SHORT|$PARAM_DOMAIN)
|
||||
DOMAIN="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
$PARAM_TYPE_SHORT|$PARAM_TYPE)
|
||||
TYPE="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
$PARAM_NAME_SHORT|$PARAM_NAME)
|
||||
NAME="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
$PARAM_CONTENT_SHORT|$PARAM_CONTENT)
|
||||
CONTENT="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
$PARAM_TTL_SHORT|$PARAM_TTL)
|
||||
TTL="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
$PARAM_PRIORITY_SHORT|$PARAM_PRIORITY)
|
||||
PRIORITY="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-*|--*)
|
||||
echo "Unknown option $1"
|
||||
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z $DOMAIN || -z $TYPE || -z $CONTENT ]]; then
|
||||
echo "Missing domain, type, or content parameters"
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
URL="$BASE_URL/dns/editByNameType/$DOMAIN/$TYPE"
|
||||
|
||||
PAYLOAD="
|
||||
\"content\": \"$CONTENT\"
|
||||
"
|
||||
|
||||
if [[ ! -z $NAME ]]; then
|
||||
URL="$URL/$NAME"
|
||||
fi
|
||||
|
||||
if [[ ! -z $TTL ]]; then
|
||||
PAYLOAD="
|
||||
$PAYLOAD,
|
||||
\"ttl\": \"$TTL\"
|
||||
"
|
||||
fi
|
||||
|
||||
if [[ ! -z $PRIORITY ]]; then
|
||||
PAYLOAD="
|
||||
$PAYLOAD,
|
||||
\"prio\": \"$PRIORITY\"
|
||||
"
|
||||
fi
|
||||
|
||||
echo $(request "$URL" "$PAYLOAD")
|
||||
}
|
||||
|
||||
function dns_edit_records_help {
|
||||
echo "Usage: $0 $HANDLE_DNS $HANDLE_DNS_EDIT $DNS_EDIT_RECORDS [OPTIONS]"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " $PARAM_DOMAIN_SHORT, $PARAM_DOMAIN"
|
||||
echo " The domain of the record being edited."
|
||||
echo " $PARAM_TYPE_SHORT, $PARAM_TYPE"
|
||||
echo " The type of record being edited. Valid types are: A, MX, CNAME, ALIAS, TXT, NS, AAAA, SRV, TLSA, CAA"
|
||||
echo " $PARAM_NAME_SHORT, $PARAM_NAME (optional)"
|
||||
echo " The subdomain of the record being edited, not including the domain itself. Leave blank to edit a record on the root domain. Use * to edit a wildcard record."
|
||||
echo " $PARAM_CONTENT_SHORT, $PARAM_CONTENT"
|
||||
echo " The answer content for the record. Please see the DNS management popup from the domain management console for proper formatting of each record type."
|
||||
echo " $PARAM_TTL_SHORT, $PARAM_TTL (optional)"
|
||||
echo " The time to live in seconds for the record. The minimum and the default is 600 seconds."
|
||||
echo " $PARAM_PRIORITY_SHORT, $PARAM_PRIORITY (optional)"
|
||||
echo " The priority of the record for those that support it."
|
||||
}
|
||||
|
||||
DNS_CREATE_RECORD="create"
|
||||
@@ -414,7 +652,6 @@ function dns_create_record {
|
||||
echo $(request "$BASE_URL/dns/create/$DOMAIN" "$PAYLOAD")
|
||||
}
|
||||
|
||||
|
||||
function dns_create_record_help {
|
||||
echo "Usage: $0 $HANDLE_DNS $DNS_CREATE_RECORD [OPTIONS]"
|
||||
echo
|
||||
@@ -433,7 +670,40 @@ function dns_create_record_help {
|
||||
echo " The priority of the record for those that support it."
|
||||
}
|
||||
|
||||
DNS_DELETE_RECORD="delete"
|
||||
HANDLE_DNS_DELETE="delete"
|
||||
|
||||
function handle_dns_delete {
|
||||
case $1 in
|
||||
$PARAM_HELP_SHORT|$PARAM_HELP)
|
||||
handle_dns_delete_help
|
||||
;;
|
||||
$DNS_DELETE_RECORD)
|
||||
shift
|
||||
|
||||
handle_show_help_on_error dns_delete_record $@
|
||||
;;
|
||||
$DNS_DELETE_RECORDS)
|
||||
shift
|
||||
|
||||
handle_show_help_on_error dns_delete_records $@
|
||||
;;
|
||||
*)
|
||||
handle_dns_delete_help
|
||||
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function handle_dns_delete_help {
|
||||
echo "Usage: $0 $HANDLE_DNS $HANDLE_DNS_DELETE <command>"
|
||||
echo
|
||||
echo "Commands:"
|
||||
echo " $DNS_DELETE_RECORD Delete a DNS record by Domain and ID"
|
||||
echo " $DNS_DELETE_RECORDS Delete DNS records by Domain, Subdomain, and Type"
|
||||
}
|
||||
|
||||
DNS_DELETE_RECORD="record"
|
||||
|
||||
function dns_delete_record {
|
||||
while [[ $# -gt 0 ]]; do
|
||||
@@ -462,7 +732,7 @@ function dns_delete_record {
|
||||
done
|
||||
|
||||
if [[ -z $DOMAIN || -z $ID ]]; then
|
||||
echo "Missing domain or record id"
|
||||
echo "Missing domain or record id parameters"
|
||||
|
||||
exit 1
|
||||
fi
|
||||
@@ -480,6 +750,214 @@ function dns_delete_record_help {
|
||||
echo " The record id being deleted."
|
||||
}
|
||||
|
||||
DNS_DELETE_RECORDS="records"
|
||||
|
||||
function dns_delete_records {
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
$PARAM_DOMAIN_SHORT|$PARAM_DOMAIN)
|
||||
DOMAIN="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
$PARAM_TYPE_SHORT|$PARAM_TYPE)
|
||||
TYPE="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
$PARAM_NAME_SHORT|$PARAM_NAME)
|
||||
NAME="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-*|--*)
|
||||
echo "Unknown option $1"
|
||||
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z $DOMAIN || -z $TYPE ]]; then
|
||||
echo "Missing domain or type parameters"
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
URL="$BASE_URL/dns/deleteByNameType/$DOMAIN/$TYPE"
|
||||
|
||||
PAYLOAD=""
|
||||
|
||||
if [[ ! -z $NAME ]]; then
|
||||
URL="$URL/$NAME"
|
||||
fi
|
||||
|
||||
echo $(request "$URL" "$PAYLOAD")
|
||||
}
|
||||
|
||||
function dns_delete_records_help {
|
||||
echo "Usage: $0 $HANDLE_DNS $HANDLE_DNS_EDIT $DNS_EDIT_RECORDS [OPTIONS]"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " $PARAM_DOMAIN_SHORT, $PARAM_DOMAIN"
|
||||
echo " The domain of the record being deleted."
|
||||
echo " $PARAM_TYPE_SHORT, $PARAM_TYPE"
|
||||
echo " The type of record being deleted. Valid types are: A, MX, CNAME, ALIAS, TXT, NS, AAAA, SRV, TLSA, CAA"
|
||||
echo " $PARAM_NAME_SHORT, $PARAM_NAME (optional)"
|
||||
echo " The subdomain of the record being deleted."
|
||||
}
|
||||
|
||||
HANDLE_DNS_LIST="list"
|
||||
|
||||
function handle_dns_list {
|
||||
case $1 in
|
||||
$PARAM_HELP_SHORT|$PARAM_HELP)
|
||||
handle_dns_list_help
|
||||
;;
|
||||
$DNS_LIST_RECORD)
|
||||
shift
|
||||
|
||||
handle_show_help_on_error dns_list_record $@
|
||||
;;
|
||||
$DNS_LIST_RECORDS)
|
||||
shift
|
||||
|
||||
handle_show_help_on_error dns_list_records $@
|
||||
;;
|
||||
*)
|
||||
handle_dns_list_help
|
||||
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function handle_dns_list_help {
|
||||
echo "Usage: $0 $HANDLE_DNS $HANDLE_DNS_LIST <command>"
|
||||
echo
|
||||
echo "Commands:"
|
||||
echo " $DNS_LIST_RECORD List DNS records by Domain and ID"
|
||||
echo " $DNS_LIST_RECORDS List DNS records by Domain, Type, and Subdomain"
|
||||
}
|
||||
|
||||
DNS_LIST_RECORD="record"
|
||||
|
||||
function dns_list_record {
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
$PARAM_DOMAIN_SHORT|$PARAM_DOMAIN)
|
||||
DOMAIN="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
$PARAM_ID_SHORT|$PARAM_ID)
|
||||
ID="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-*|--*)
|
||||
echo "Unknown option $1"
|
||||
|
||||
exit 1
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z $DOMAIN ]]; then
|
||||
echo "Missing domain parameter"
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
URL="$BASE_URL/dns/retrieve/$DOMAIN"
|
||||
|
||||
PAYLOAD=""
|
||||
|
||||
if [[ ! -z $ID ]]; then
|
||||
URL="$URL/$ID"
|
||||
fi
|
||||
|
||||
echo $(request "$URL" "$PAYLOAD")
|
||||
}
|
||||
|
||||
function dns_list_record_help {
|
||||
echo "Usage: $0 $HANDLE_DNS $HANDLE_DNS_LIST $DNS_LIST_RECORD [OPTIONS]"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " $PARAM_DOMAIN_SHORT, $PARAM_DOMAIN"
|
||||
echo " The domain to list records from."
|
||||
echo " $PARAM_ID_SHORT, $PARAM_ID (optional)"
|
||||
echo " The ID of the record."
|
||||
}
|
||||
|
||||
DNS_LIST_RECORDS="records"
|
||||
|
||||
function dns_list_records {
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
$PARAM_DOMAIN_SHORT|$PARAM_DOMAIN)
|
||||
DOMAIN="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
$PARAM_TYPE_SHORT|$PARAM_TYPE)
|
||||
TYPE="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
$PARAM_NAME_SHORT|$PARAM_NAME)
|
||||
NAME="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-*|--*)
|
||||
echo "Unknown option $1"
|
||||
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z $DOMAIN || -z $TYPE ]]; then
|
||||
echo "Missing domain or type parameters"
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
URL="$BASE_URL/dns/retrieveByNameType/$DOMAIN/$TYPE"
|
||||
|
||||
PAYLOAD=""
|
||||
|
||||
if [[ ! -z $NAME ]]; then
|
||||
URL="$URL/$NAME"
|
||||
fi
|
||||
|
||||
echo $(request "$URL" "$PAYLOAD")
|
||||
}
|
||||
|
||||
function dns_list_records_help {
|
||||
echo "Usage: $0 $HANDLE_DNS $HANDLE_DNS_LIST $DNS_LIST_RECORDS [OPTIONS]"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " $PARAM_DOMAIN_SHORT, $PARAM_DOMAIN"
|
||||
echo " The domain of the records being listed."
|
||||
echo " $PARAM_TYPE_SHORT, $PARAM_TYPE"
|
||||
echo " The type of record being listed. Valid types are: A, MX, CNAME, ALIAS, TXT, NS, AAAA, SRV, TLSA, CAA"
|
||||
echo " $PARAM_NAME_SHORT, $PARAM_NAME (optional)"
|
||||
echo " The subdomain of the record being listed, not including the domain itself."
|
||||
}
|
||||
|
||||
# endregion
|
||||
|
||||
###################################################
|
||||
|
Reference in New Issue
Block a user