Created
November 2, 2017 13:53
-
-
Save mbentley/7ff3d2b3487001d538be43f6be1a4195 to your computer and use it in GitHub Desktop.
Remove all UCP bundles for a user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
USERNAME="" | |
PASSWORD="" | |
UCP_FQDN="" | |
AUTH_TOKEN="$(curl -sk -d '{"username":"'${USERNAME}'","password":"'${PASSWORD}'"}' "https://${UCP_FQDN}/auth/login" | jq -r .auth_token 2>/dev/null)" | |
CURL_OPTS=(-ks --header "Content-Type: application/json" --header "Accept: application/json" -H "Authorization: Bearer ${AUTH_TOKEN}") | |
BUNDLE_IDS="$(curl "${CURL_OPTS[@]}" "https://${UCP_FQDN}/accounts/${USERNAME}/publicKeys?limit=65000" | jq -r '.accountPublicKeys|.[]|.id')" | |
for ID in ${BUNDLE_IDS} | |
do | |
echo "Deleting client bundle ${ID}..." | |
curl -X DELETE "${CURL_OPTS[@]}" "https://${UCP_FQDN}/accounts/${USERNAME}/publicKeys/${ID}" | |
echo -e "done.\n" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment