Created
August 25, 2017 18:16
-
-
Save trisharia/c30eb81a41d448b9974fa38aede20420 to your computer and use it in GitHub Desktop.
Get Cluster by Name
This file contains 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
// VMware vRealize Orchestrator action sample | |
// | |
// Returns the vCenter ClusterComputeResource with the given name | |
// Assumes there is only 1 | |
// Does a case-insensitive search | |
// | |
// For vRO 7.0+/vCenter 6.0+ | |
// | |
// Action Inputs: | |
// clustername - string - Name of the cluster to find | |
// | |
// Return type: VC:ClusterComputeResource - the cluster with the given name | |
var clusters = VcPlugin.getAllClusterComputeResources(null, | |
"xpath:matches(translate(name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'), '" + clusterName.toLowerCase() + "')"); | |
if (clusters.length > 0) { | |
return clusters[0]; | |
} | |
System.warn("VC:ClusterComputeResource named '" + clusterName + "' not found."); | |
return null; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment