This class provides methods to handle current configuration (global values) available in current run context based on the name of the configuration provided. To get a handle to a Config object you need to use the getConfigValues() method from Context.
getParameter(String parameterName)
getCredential(String credentialName)
Returns the Credential object for the given name.
Returns
Returns Credential instance for the given parameter name. If parameter with given name doesn’t exist, will return null.
Usage
To retrieve credential object:
def cred = configValues.getCredential('credential') println("UserName: " + cred.getUserName()) println("Password: " + cred.getSecretValue())
Or:
def cred = configValues.getCredential('credential') println("Credential: ${cred}") // toString() is overridden, so the password part (secretValue) will be masked
getRequiredParameter(String parameterName)
Returns a Parameter object if parameter exists.
If parameter does not exist, this method will throw an UnexpectedMissingValue exception.
getRequiredCredential(String credentialName)
Returns a Credential object if parameter exists.
If parameter does not exist, this method will throw an UnexpectedMissingValue exception.
Usage
To retrieve credential object:
def cred = configValues.getRequiredCredential('credential') println("UserName: " + cred.getUserName()) println("Password: " + cred.getSecretValue())
Or:
def cred = configValues.getRequiredCredential('credential') println("Credential: ${cred}") // toString() is overridden, so the password part (secretValue) will be masked