Last active
September 23, 2019 00:23
-
-
Save aweiteka/dfd155a6f7352a04ca1420d98fea8290 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
IFS=' | |
' | |
URL="https://api.openshift.com" | |
for CLUSTER in $(ocm cluster list --managed --columns "name,subscription.href" --padding 70 | grep -v SUBSCRIPTION) | |
do | |
SUBREF=$(echo $CLUSTER | awk '{print $2}') | |
CLUSTERNAME=$(echo $CLUSTER | awk '{print $1}') | |
ENTITY=$(curl -s -H "Authorization: Bearer $(ocm token)" $URL/$(curl -s -H "Authorization: Bearer $(ocm token)" $URL$SUBREF | jq -r .creator.href) |jq -r .organization.name) | |
echo -e "$CLUSTERNAME\t\t$ENTITY" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment