StyleBook configuration

Use target ADC instances as data sources

You can also use the target ADC 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 ADC to create new configurations on that ADC.

To use target instances as data sources, you don’t have to use the datum built-in type parameter, since no ADC 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 ADC instance.

Use the following expression to retrieve the following from the target ADC 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 ADC instance as a data source

The following is an example StyleBook to demonstrate how to use the target ADC 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 ADC instances. And, if the given load-balancing virtual server IP address is matched, it retrieves the name and service group name.

Target ADC instance as a data source

Use target ADC instances as data sources