feat: implement retrieve dns records by domain, type, and subdomain
This commit is contained in:
@@ -28,7 +28,7 @@ The following API endpoints are the ones that will be supported, the currently i
|
|||||||
- [x] [DNS Delete Record by Domain and ID](https://porkbun.com/api/json/v3/documentation#DNS%20Delete%20Record%20by%20Domain%20and%20ID)
|
- [x] [DNS Delete Record by Domain and ID](https://porkbun.com/api/json/v3/documentation#DNS%20Delete%20Record%20by%20Domain%20and%20ID)
|
||||||
- [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 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 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 Retrieve Records by Domain, Subdomain and Type](https://porkbun.com/api/json/v3/documentation#DNS%20Retrieve%20Records%20by%20Domain,%20Subdomain%20and%20Type)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
@@ -822,6 +822,11 @@ case $1 in
|
|||||||
|
|
||||||
handle_show_help_on_error dns_list_record $@
|
handle_show_help_on_error dns_list_record $@
|
||||||
;;
|
;;
|
||||||
|
$DNS_LIST_RECORDS)
|
||||||
|
shift
|
||||||
|
|
||||||
|
handle_show_help_on_error dns_list_records $@
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
handle_dns_list_help
|
handle_dns_list_help
|
||||||
|
|
||||||
@@ -835,6 +840,7 @@ function handle_dns_list_help {
|
|||||||
echo
|
echo
|
||||||
echo "Commands:"
|
echo "Commands:"
|
||||||
echo " $DNS_LIST_RECORD List a DNS record by Domain and ID"
|
echo " $DNS_LIST_RECORD List a DNS record by Domain and ID"
|
||||||
|
echo " $DNS_LIST_RECORDS List DNS records by Domain, Subdomain, and Type"
|
||||||
}
|
}
|
||||||
|
|
||||||
DNS_LIST_RECORD="record"
|
DNS_LIST_RECORD="record"
|
||||||
@@ -892,6 +898,66 @@ function dns_list_record_help {
|
|||||||
echo " The ID of the record."
|
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
|
# endregion
|
||||||
|
|
||||||
###################################################
|
###################################################
|
||||||
|
Reference in New Issue
Block a user