Skip to content

Instantly share code, notes, and snippets.

@YagmurOzden
Last active December 24, 2021 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YagmurOzden/abc71c12c5bafd6a2883d641c8ce2be8 to your computer and use it in GitHub Desktop.
Save YagmurOzden/abc71c12c5bafd6a2883d641c8ce2be8 to your computer and use it in GitHub Desktop.
This action returns all cluster names as string array (VMware vRO action)
// VMware vRealize Orchestrator action sample
// vRA 8.4
//action input type: None
//action return type: string (ARRAY)
// this code below gets all clusters
var clusters=VcPlugin.getAllClusterComputeResources();
//this creates a array names clusterNames
var clusterNames = new Array();
//just to make sure the action started and works
System.log("getAllClusters action started")
//this loop is for pushing cluster names to the clusterNames array.
for (var i in clusters){
clusterNames.push(clusters[i].name);
}
//just says the action is over
System.log("finish")
//and returns the cluster names as string array
return clusterNames;
//these are some variables that we can acces as example.
//----------------------------------------------------------//
//System.log("SUMMARY: "+clusters[i].summary);
//System.log("NETWORK: "+clusters[i].network);
//System.log("TYPE: "+clusters[i].type);
//System.log("VIM HOST: "+clusters[i].vimHost.name);
//System.log(clusters[i].datastore.values);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment