Tanzu Mission Control API Overview

Reading Time: 2 mins

Overview

VMware Tanzu Mission Control is a centralised management platform for consistently operating and securing your Kubernetes infrastructure and modern applications across multiple teams and clouds. In this post, I will cover few API commands that can be used to manage TMC services. FYI, you can find complete list of API’s here

Generate API token from TMC Console

Follow the below steps to get API Token from TMC console

  • Token Name: Provide your name followed by demo
  • Define Scopes: All Roles

Note: Copy the token and save it for later use

API Commands

  • fetch API Token:
refresh_token=<replace me with TMC API Token>
  • Generate Access token from above Refresh Token
access_token=$(curl -d "refresh_token=$refresh_token" https://console.cloud.vmware.com/csp/gateway/am/api/auth/api-tokens/authorize | jq -r '.access_token')
  • Read the Access Token
echo $access_token
  • Verify the access(Optional) using access token. Access the URL and copy the access token collected above
  • Get the organisation ID and account details
curl -s --request POST --url https://console.cloud.vmware.com/csp/gateway/am/api/auth/api-tokens/details --header 'content-type: application/json' --data '{"tokenValue":"'"$refresh_token"'"}' | jq '.'
  • Get the cluster groups
curl -s 'searchScope.name=*' https://partnertanzuseamericas.tmc.cloud.vmware.com/v1alpha1/clustergroups -H "Authorization: Bearer $access_token" | jq '.clusterGroups[].fullName.name'
  • Get the clusters
curl -s 'searchScope.name=*' https://partnertanzuseamericas.tmc.cloud.vmware.com/v1alpha1/clusters -H "Authorization: Bearer $access_token" | jq '.clusters[].fullName.name'
  • Get the management clusters
curl -s 'searchScope.name=*' https://partnertanzuseamericas.tmc.cloud.vmware.com/v1alpha1/managementclusters -H "Authorization: Bearer $access_token" | jq '.managementClusters[].fullName.name'
  • Delete the cluster group: capv-workload-cg
curl -X DELETE https://partnertanzuseamericas.tmc.cloud.vmware.com/v1alpha1/clustergroups/capv-workload-cg -H "Authorization: Bearer $access_token"

2 thoughts on “Tanzu Mission Control API Overview

Comments are closed.