Application Delivery Management

Helper components

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 Citrix ADC instance.

    name: appname
    type: string
    name: ips
    type: ipaddress[]
    name: vip
    type: ipaddress

    name: help-comp
    type: cmtypes::server-ip-port-params
      repeat-list: $parameters.ips
      repeat-item: server-ip
      ip: $server-ip
      port: 80
    name: lb-mon-comp
    type: stlb::lb-mon
      lb-appname: $parameters.appname
      lb-virtual-ip: $
      lb-virtual-port: 80
      lb-service-type: HTTP
      svc-service-type: HTTP
      svc-servers: $

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.

Helper components