Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save briandenicola/393e6d8f2a9015606130e2a5a0d9ca7b to your computer and use it in GitHub Desktop.
Save briandenicola/393e6d8f2a9015606130e2a5a0d9ca7b to your computer and use it in GitHub Desktop.
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