Last active
September 22, 2017 16:12
-
-
Save trisharia/1f9cf9e9e0bf98cdd5cb08f3ac6f4e03 to your computer and use it in GitHub Desktop.
Get a configuration element's attribute value
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 | |
// | |
// This sample retrieves the value of an attribute defined in a configuration element | |
// Note: This calls another action defined in getConfigurationElement.js | |
// | |
// For vRO 6.0+ | |
// | |
// Action Inputs: | |
// configurationCategoryPath - string - Path of the configuration element; e.g., PSO/VAPI/ | |
// configurationName - string - name of the configuration element | |
// | |
// Return type: Any | |
var attribute; | |
var configElement = getConfigurationElement(configurationCategoryPath, configurationName); | |
if (!configElement) { | |
throw "Missing configuration element " + configurationCategoryPath + "/" + configurationName; | |
} | |
attribute = configElement.getAttributeWithKey(attributeName); | |
if (attribute) { | |
return attribute.value; | |
} | |
System.warn("Cannot find attribute " + attribute + " in " + configurationCategoryPath + "/" + configurationName + " configuration element"); | |
return null; |
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 | |
// | |
// This sample retrieves the value of an attribute defined in a configuration element | |
// | |
// For vRO 6.0+ | |
// | |
// Action Inputs: | |
// configurationCategoryPath - string - Path of the configuration element; e.g., PSO/VAPI/ | |
// configurationName - string - name of the configuration element | |
// attributeName - string - name of the attribute in the configuration element | |
// | |
// Return type: ConfigurationElement | |
var category = Server.getConfigurationElementCategoryWithPath(configurationCategoryPath); | |
if (!category) { | |
throw "Missing configuration element category " + configurationCategoryPath; | |
} | |
for each (var configuration in category.configurationElements) { | |
if (configuration.name === configurationName) { | |
return configuration; | |
} | |
} | |
System.warn("Cannot find " + configurationCategoryPath + "/" + configurationName + " configuration element"); | |
return null; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment