Created
June 5, 2020 14:19
-
-
Save briandenicola/393e6d8f2a9015606130e2a5a0d9ca7b 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
export PAT='' | |
export DB-WORKSPACE='' | |
export WHITELIST='1.1.1.1/32' | |
#Enable | |
curl -X PATCH -H "Authorization: Bearer ${PAT}" https://${DB-WORKSPACE}/api/2.0/preview/workspace-conf?keys=enableIpAccessLists -d '{ "enableIpAccessLists": "true", }' | |
#Create | |
curl -X PUT -H 'Authorization: Bearer ${PAT}' https://${DB-WORKSPACE}/api/2.0/preview/ip-access-lists -d "{ \"label\": \"home\", \"list_type\": \"WHITELIST\", \"ip_addresses\": [ $WHITELIST ] }" | |
#Update | |
export ip_list=`curl -sX GET -H "Authorization: Bearer ${PAT}" https://${DB-WORKSPACE}/api/2.0/preview/ip-access-lists | jq ".ip_access_lists[0].list_id" | tr -d "\""` | |
curl -X PUT -H "Authorization: Bearer ${PAT}" https://${DB-WORKSPACE}/api/2.0/preview/ip-access-lists/$IPLIST -d "{ \"label\": \"home\", \"list_type\": \"WHITELIST\", \"ip_addresses\": [ $WHITELIST ], \"enabled\": \"true\" }" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment