Config

2 minute readReferenceExtensibilityDeveloper productivity

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 FlowPDF::Config object you need to use the getConfigValues() method from FlowPDF::Context.

isParameterExists($parameterName)

Returns true if parameter exists in the current configuration.

Parameters

(String) Name of parameter

Returns

(Boolean) True if parameter exists.

Usage

if ($configValues->isParameterExists('endpoint')) { ...; }

getParameter($parameterName)

Returns either a FlowPDF::Parameter object or a FlowPDF::Credential object based on how it called.

Parameters

(String) Name of parameter to get.

Returns

Returns one of the following by name.

  • FlowPDF::Parameter

  • FlowPDF::Credential

Usage

To retrieve parameter object:

my $query = $configValues->getParameter('query');

If parameter is a FlowPDF::Parameter you can either use getValue() method or the string context:

print "Query:", $query->getValue();

Or:

print "Query: $query"

If parameter is FlowPDF::Credential follow the steps in its documentation.

getRequiredParameter($parameterName)

Returns a FlowPDF::Parameter object or a FlowPDF::Credential object if parameter exists.

If parameter does not exist, this method aborts execution with exit code 1.

This exception cannot be caught.

Parameters

(String) Name of parameter

Returns

One of - FlowPDF::Parameter - FlowPDF::Credential

Usage

To retrieve parameter object:

my $query = $stepParameters->getRequiredParameter('query');

If your parameter is of type FlowPDF::Parameter you can retrieve its value either by getValue() method, or using string context:

print "Query:", $query->getValue();

Or:

print "Query: $query"

If your parameter is of type FlowPDF::Credential refer to its documentation.

asHashRef()

This function returns a HASH reference that is made from FlowPDF::Config object. Where key is a name of parameter and value is a value of parameter.

For credentials the same pattern as for getConfigValue() from FlowPDF::Context is being followed.

Parameters

None

Returns

  • (HASH reference) A HASH reference to a HASH with config values.

Exceptions

None

Usage

my $config = $context->getConfigValues()->asHashref(); logInfo("Endpoint is: $config->{endpoint}");