This class provides methods to process current step parameters, that are either defined in a procedure step or a pipeline task. To initialize a StepParameters object you need to use the getStepParameters() 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 = stepParameters.getCredential('credential') println("UserName: " + cred.getUserName()) println("Password: " + cred.getSecretValue())
Or:
def cred = stepParameters.getCredential('credential') println("Credential: ${cred}") // toString() is overridden, and 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 = stepParameters.getRequiredCredential('credential') println("UserName: " + cred.getUserName()) println("Password: " + cred.getSecretValue())
Or:
def cred = stepParameters.getRequiredCredential('credential') println("Credential: ${cred}") // toString() is overridden, and the password part (secretValue) will be masked