Skip to content

Instantly share code, notes, and snippets.

@aweiteka
Last active September 23, 2019 00:23
Show Gist options
  • Save aweiteka/dfd155a6f7352a04ca1420d98fea8290 to your computer and use it in GitHub Desktop.
Save aweiteka/dfd155a6f7352a04ca1420d98fea8290 to your computer and use it in GitHub Desktop.
#!/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