StyleBook configuration

Parameter conditions

Parameters conditions are used to modify the behavior of certain parameters in the StyleBook definition. Parameters in a StyleBook definition are the input provided to create a configuration pack. Use parameters-conditions to define a parameter condition in the definition.

A parameter can have many constraints in the StyleBook definition. The parameter conditions are used to resolve conflicts when a user changes the parameter behavior. For example, when a user selects the SSL protocol, the certificate details are required to create a configuration pack. However, the certificate details might not be set as the required field at first.

The parameter condition has the following attributes:

Note

Currently, the parameter conditions cannot be applied for the parameters within list objects.

‘show’ or ‘hide’

When the action is show and the specified condition returns True, the target parameter appears on the GUI.

When the action is hide and the specified condition returns True, the target parameter disappears from the GUI.

Example:

parameters-conditions:
  -
   target: $parameters.security-settings.cert-details
   action: show
   condition: $parameters.protocol in ["SSL", "SSL-BRIDGE"]
<!--NeedCopy-->

At first, the certificate details are hidden for the security-settings parameter. When a user selects SSL or SSL-Bridge protocols, the certificate details appear.

‘set-default’

When the action is set-default and the specified condition returns True, the target parameter’s value is set to the default value.

Example 1:

parameters-conditions:
  -
   target: $parameters.port
   action: set-default
   condition: $parameters.protocol == "SSL"
   value: 443
  -
   target: $parameters.port
   action: set-default
   condition: $parameters.protocol != "SSL"
   value: 80
<!--NeedCopy-->

Example 2:

parameters-conditions:
  -
   target: $parameters.port
   action: set-default-value
   value: if-then-else($parameters.protocol == "SSL", 443, 80)
<!--NeedCopy-->

When a user selects the SSL protocol, the default port value is set to 443. For other protocols, the default port value is set to 80. Example 1 and 2 gives you the same result.

‘set-required’

When the action is set-required and the specified condition returns True, the target parameter becomes a required field to create a configuration pack.

parameters-conditions:
  -
   target: $parameters.security-settings.cert-details
   action: set-required
   condition: $parameters.protocol in ["SSL", "SSL-BRIDGE"]
<!--NeedCopy-->

At first, the certificate details might not be required for the security-settings parameter. When a user selects SSL or SSL-Bridge protocols, the certificate details become a required field to create a configuration pack.

‘set-allowed-values’

When the action is set-allowed-values and the specified condition returns True, the target parameter allows you to select only specified values.

Example:

parameters-conditions:
  -
   target: $parameters.app-name
   action: set-allowed-values
   value:
    - "SSL"
   condition: $parameters.lb-virtual-port ==  443
<!--NeedCopy-->

When a user specifies 443 as a load-balancer virtual port, the application’s name allows only SSL option.

‘set-label’

When the action is set-label and the specified condition returns True, the target parameter’s label changes to the specified text.

Example:

parameters-conditions:
  -
   target: $parameters.app-name
   action: set-label
   value: if-then-else($parameters.lb-service-type == "TCP", "TCPApp","UDPApp")
<!--NeedCopy-->

When a user selects the load-balancer protocol as TCP, the application’s label changes to TCPApp. If the user selects a different option, the application’s label changes to UDPApp.

‘set-description’

When the action is set-description and the specified condition returns True, the target parameter’s description changes to the specified text. This description appears in the tool tip of a target parameter.

Example:

parameters-conditions:
  -
   target: $parameters.app-name
   action: set-description
   value: if-then-else($parameters.lb-service-type == "TCP", "Select a TCP application name","Select a UDP application name")
<!--NeedCopy-->

When a user selects the load-balancer protocol as TCP, the application’s tool tip displays a text: Select a TCP application name. If the user selects a different option, the application’s description displays Select a UDP application name.

‘collapse-pane’ or ‘expand-pane’

When the action is collapse-pane and the specified condition returns True, the target parameter’s pane collapses in the GUI.

When the action is expand-pane and the specified condition returns True, the target parameter’s pane expands in the GUI.

Example:

parameters-conditions:
  -
    target: $parameters.security-settings.cert-details
    action: expand-pane
    condition: $parameters.protocol in ["SSL", "SSL-BRIDGE"]
<!--NeedCopy-->

At first, the certificate details pane might not be expanded for the security-settings parameter. When a user selects SSL or SSL-Bridge protocols, the certificate details pane expands on the GUI.

‘set-pattern’

When the action is set-pattern and the specified condition returns True, the target parameter field is set to the specified pattern.

Example:

parameters-conditions:
  -
    target: $parameters.app-name
    action: set-pattern
    value: "[a-z]+"
<!--NeedCopy-->

In this example, the application’s name allow only lowercase alphabetical characters.

Parameter conditions