Helper components

July 31, 2018

| Contributed by:

The primary use of components section in a StyleBook is to generate configuration objects through Nitro built-in types or another StyleBook that creates the actual configuration objects. The helper components do not build configuration objects by themselves. Helper components take the inputs from other sections like parameter objects, properties of other components, or outputs of other components and transform them into other forms. This can be later used by other components to generate the actual configuration objects. A helper component can be of two types: object type or another StyleBook that does not contain a component section.

The following example shows a snippet of a StyleBook that is used to create a load balancing server with monitor (lb-mon-comp) on a NetScaler instance.

parameters:

-

name: appname

type: string

-

name: ips

type: ipaddress[]

-

name: vip

type: ipaddress

components:

-

name: help-comp

type: cmtypes::server-ip-port-params

repeat:

repeat-list: $parameters.ips

repeat-item: server-ip

properties:

ip: $server-ip

port: 80

-

name: lb-mon-comp

type: stlb::lb-mon

properties:

lb-appname: $parameters.appname

lb-virtual-ip: $parameters.vip

lb-virtual-port: 80

lb-service-type: HTTP

svc-service-type: HTTP

svc-servers: $components.help-comp.properties

The parameters section allows you to enter the name of the application and the IP addresses of the load balancing servers. In the lb-mon-comp component section, the svc-servers parameter of lb-mon StyleBook expects a list of objects where each item has two sub-parameters: ip and port.

However, the parameters section of this StyleBook only accepts the server IPs through $parameters.ips. The StyleBook assumes that all servers are running on port 80. To create the load balancing configuration using lb-mon StyleBook, you must transform the $parameters.ips to a list of objects. This is achieved using the helper component, help-comp in the above example.The help-comp component is of type server-ip-port-params StyleBook. This StyleBook does not have any components. As a result, it does not create any configuration objects. The help-comp creates a repeat list over $parameters.ips and constructs an object which consists of ip and port (that is set to a static 80) for each item of $parameters.ips. Thus, help-comp transforms a list of IP addresses into a list of objects that can be later used in lb-mon-comp to assign svc-servers property. The result of the help-comp is assigned to the svc-servers property of lb-mon-comp.

The official version of this content is in English. Some of the Citrix documentation content is machine translated for your convenience only. Citrix has no control over machine-translated content, which may contain errors, inaccuracies or unsuitable language. No warranty of any kind, either expressed or implied, is made as to the accuracy, reliability, suitability, or correctness of any translations made from the English original into any other language, or that your Citrix product or service conforms to any machine translated content, and any warranty provided under the applicable end user license agreement or terms of service, or any other agreement with Citrix, that the product or service conforms with any documentation shall not apply to the extent that such documentation has been machine translated. Citrix will not be held responsible for any damage or issues that may arise from using machine-translated content.