StyleBook configuration

Use target NetScaler instances as data sources

You can also use the target NetScaler of your configuration itself as a data source input for your configuration. In this scenario, you might want to refer the existing configuration on the target NetScaler to create new configurations on that NetScaler.

To use target instances as data sources, you don’t have to use the datum built-in type parameter, since no NetScaler instances need to be selected by the StyleBook user. You can directly write expressions in the components section of your StyleBook that retrieve data from the target NetScaler instance.

Use the following expression to retrieve the following from the target NetScaler instances:

  • Collections:

     $current-target-as-datasource.collections.<collection-name>
     <!--NeedCopy-->
    

    Example:

     $current-target-as-datasource.collections.lbvserver
     <!--NeedCopy-->
    
  • Attributes:

     $current-target-as-datasource.collections.attributes.<attribute>
     <!--NeedCopy-->
    

Example StyleBook to use the target NetScaler instance as a data source

The following is an example StyleBook to demonstrate how to use the target NetScaler instance as a data source:

---
name: lb-add-service-with-target-adc
namespace: com.citrix.adc.stylebooks
version: "1.1"
display-name: "HTTP/SSL LoadBalancing StyleBook with Service Binding"
description: "This stylebook defines a typical Load Balanced Application configuration."
schema-version: "1.0"
import-stylebooks:
  -
    namespace: netscaler.nitro.config
    prefix: ns
    version: "10.5"

components:
  -
    name: servicegroup-comp
    type: ns::servicegroup
    properties:
      servicegroupname: "lb-demo-svcgrp"
      servicetype: "HTTP"

    components:
      -
        name: lbvserver-svg-binding
        type: ns::lbvserver_servicegroup_binding
        repeat: $current-target-as-datasource.collections.lbvserver
        repeat-item: lbvsrvr
        repeat-condition: $lbvsrvr.attributes.name == "lb-demo-lb"
        properties:
          name: $lbvsrvr.attributes.name
          servicegroupname: $parent.properties.servicegroupname
<!--NeedCopy-->

In this example, the configuration pack checks for the load-balancing virtual servers in the target NetScaler instances. And, if the given load-balancing virtual server IP address is matched, it retrieves the name and service group name.

Target NetScaler instance as a data source

Use target NetScaler instances as data sources