Created
August 4, 2020 21:09
-
-
Save phact/302f9a542b027cd0770bb50131011be0 to your computer and use it in GitHub Desktop.
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 | |
CLIENT_NAME= | |
CLIENT_SECRET= | |
CLIENT_ID= | |
DB_ID= | |
TOKEN=$(curl --request POST \ | |
--url https://api.astra.datastax.com/v2/authenticateServiceAccount \ | |
--header 'accept: application/json' \ | |
--header 'content-type: application/json' \ | |
--data "{\"clientName\":\"$CLIENT_NAME\",\"clientSecret\":\"$CLIENT_SECRET\",\"clientId\":\"$CLIENT_ID\"}" | jq -r ".token") | |
if [ ! -z "$TOKEN" ]; then | |
INTERNAL=$(curl --request POST \ | |
--url https://api.astra.datastax.com/v2/databases/$DB_ID/secureBundleURL \ | |
--header 'accept: application/json' \ | |
--header "authorization: Bearer $TOKEN" | jq -r '.downloadURLInternal') | |
EXTERNAL=$(curl --request POST \ | |
--url https://api.astra.datastax.com/v2/databases/$DB_ID/secureBundleURL \ | |
--header 'accept: application/json' \ | |
--header "authorization: Bearer $TOKEN" | jq -r '.downloadURL') | |
echo $INTERNAL | |
echo $EXTERNAL | |
curl -L --output internal.zip --url $INTERNAL | |
curl -L --output external.zip --url $EXTERNAL | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment