Skip to content

Commit b2e004e

Browse files
committed
Script to download DRaaS Swagger
1 parent cd429a5 commit b2e004e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

shell/download_draas_swagger_json.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
if [ ${#} -ne 1 ]; then
4+
echo -e "Usage: \n\t$0 [REFRESH_TOKEN]\n"
5+
exit 1
6+
fi
7+
8+
REFRESH_TOKEN=$1
9+
10+
CSP_URL="console.cloud.vmware.com"
11+
DRAAS_SWAGGER_URL="https://vmc.vmware.com/vmc/draas/swagger/swagger.json"
12+
13+
RESULTS=$(curl -s -X POST -H "application/x-www-form-urlencoded" "https://${CSP_URL}/csp/gateway/am/api/auth/api-tokens/authorize" -d "refresh_token=${REFRESH_TOKEN}")
14+
CSP_ACCESS_TOKEN=$(echo $RESULTS | jq -r .access_token)
15+
16+
curl -X GET -H "Content-Type: application/json" -H "csp-auth-token: ${CSP_ACCESS_TOKEN}" ${DRAAS_SWAGGER_URL} -o draas.json

0 commit comments

Comments
 (0)