Digicert AP Redirect Script added (#687)

Added digicert ap redirect script from scripts directory (since it is private)
This commit is contained in:
dutta-rohan
2022-08-18 22:07:54 -07:00
committed by GitHub
parent 98b9bde0ff
commit 8fc9cac298

View File

@@ -0,0 +1,28 @@
# normalizes a MAC address by removing all non alphanumeric and uppercasing all characters
function normalize_mac() {
local mac=$1
echo "$mac" | tr -d ":" | tr -d "-" | tr "[:lower:]" "[:upper:]"
}
set -e
# Print usage
if [ $# -lt 1 ]; then
echo "Not enough arguments provided!"
echo "This script gets the redirector URL for an AP identified by the provided MAC address."
echo "Usage: $0 <mac-address>"
echo "mac-address - the primary MAC address of your AP device"
exit 1
fi
mac="$(normalize_mac "$1")"
device_details=$(curl \
--silent \
--request GET "${DIGICERT_BASE_URL}v2/device?limit=1&device_identifier=${mac}" \
--header "x-api-key: $DIGICERT_API_KEY" | jq --raw-output .records[0])
current_fields=$(echo "$device_details" | jq --raw-output .fields)
echo "$current_fields" | jq --raw-output '.[] | select( .name == "Redirector" ) | .value'