Use a NetScaler instance as the data source
managed-adc is a built-in data source type that can be readily used as the data sources in NetScaler Console. Each managed NetScaler instance in NetScaler Console is a data source by default. You can start using these data sources in your StyleBooks if you need data from an existing NetScaler managed by NetScaler Console while creating config packs.
datum built-in type parameter. You can use the data source types in your StyleBook. The StyleBook users can select a data source that can be used to retrieve data from that source.
Using the built-in data source without collection
parameters:
- name: selected-adc
label: Select an existing NetScaler
type: datum
required: true
data-source:
type: managed-adc
datum parameter is used to select any NetScaler instance managed by NetScaler Console. The managed-adc built-in data source allows you to retrieve data from any NetScaler instance managed by NetScaler Console.
$parameters.selected-adc.collections.<collection-name>
$parameters.selected-adc.collections.lbvserver
lbvserver entities on the selected NetScaler instance. For example, you can iterate over this list to select a specific lbvserver that meets a certain condition.
Example StyleBook without collection
name: add-vservers-from-managed-adc-instances
namespace: com.citrix.adc.stylebooks
version: "1.0"
schema-version: "1.0"
import-stylebooks:
-
namespace: netscaler.nitro.config
prefix: ns
version: "10.5"
parameters:
-
name: selected-adc
label: Select a NetScaler instance
type: datum
required: true
data-source:
type: "managed-adc"
components:
-
name: sslvserver-comp
type: ns::sslvserver
repeat: $parameters.selected-adc.collections.lbvserver
repeat-item: lbvs
repeat-condition: $lbvs.attributes.servicetype == "SSL"
properties:
name: $lbvs.attributes.name
ssl2: DISABLED
ssl3: DISABLED
tls1: DISABLED
tls11: ENABLED
tls12: ENABLED
lbvserver entities. It selects the SSL virtual servers and sets the allowed SSL protocol versions on each virtual server.
lbvserver entities in the NetScaler instance.
repeat: $parameters.selected-adc.collections.lbvserver
-
collections: Refers to all entity types on the NetScaler instance. For examplecsvserver,lbmonitor,servicegroup, etc. -
lbvserver: Refers to the list of load-balancing virtual server entities in the NetScaler instance.
Using the built-in data source with collection
parameters:
- name: selected-lbvserver
label: Select an existing lbvserver
type: datum
required: true
data-source:
type: managed-adc
collection: lbvserver
datum parameter is used to allow a user to select both the NetScaler instance and a specific lbvserver from the managed-adc data source type.
parameters section, the StyleBook users can select the NetScaler instance and a specific entity from a collection on that instance.
$parameters.selected-lbvserver.attributes.<attribute-name>
datum is lbvserver. So, you can access any attribute of the NetScaler entity lbvserver such as name, servicetype, ipv46, and so on.
$parameters.selected-lbvserver.attributes.ipv46
parameters:
- name: selected-lbvservers
label: Select existing lbvservers
type: datum[]
required: true
data-source:
type: managed-adc
collection: lbvserver
components:
- name: sslvserver-comp
type: ns::sslvserver
repeat:
repeat-list: $parameters.selected-lbvservers
repeat-item: vserverObj
properties:
name: $vserverObj.attributes.name
ssl2: DISABLED
ssl3: DISABLED
tls1: DISABLED
tls11: ENABLED
tls12: ENABLED
components section:
$parameters.selected-lbvserver.datasource.collections.<collection-name>
$parameters.selected-lbvserver.datasource.collections.csvserver
lbvservers and servicegroups:
$parameters.selected-lbvserver.datasource.collections.lbvserver_servicegroup_binding
Example StyleBook with a collection
name: bind-lb-to-servicegroup-using-ADC-as-datasource
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 where we allow the user to select an existing lbvserver on the NetScaler using datum type parameter. Then a servicegroup for the selected lb is created if it does not exist on the NetScaler. Finally, the selected lbvserver is bound to the service "
schema-version: "1.0"
import-stylebooks:
-
namespace: netscaler.nitro.config
prefix: ns
version: "10.5"
parameters:
-
name: selected-vserver
label: "Select an Existing VServer"
description: "Load Balancing Application Vservers to be bound to service on the ADC"
type: datum
required: true
data-source:
type: managed-adc
collection: lbvserver
components:
-
name: servicegroup-discovery-comp
type: object
repeat: $parameters.selected-vserver.datasource.collections.servicegroup
repeat-item: svcgrp
repeat-condition: $svcgrp.attributes.servicegroupname == $parameters.selected-vserver.attributes.name + "-svcgrp"
properties:
servicegroupname: $svcgrp.attributes.servicegroupname
-
name: servicegroup-creation-if-not-exists-comp
type: ns::servicegroup
condition: not exists($components.servicegroup-discovery-comp)
properties:
servicegroupname: $parameters.selected-vserver.attributes.name + "-svcgrp"
servicetype: $parameters.selected-vserver.attributes.servicetype
components:
-
name: lbvserver-servicegroup-binding
type: ns::lbvserver_servicegroup_binding
properties:
name: $parameters.selected-vserver.attributes.name
servicegroupname: $parent.properties.servicegroupname
components section checks for the service group name that matches the selected load-balancing virtual server name concatenated with svcgrp.
lbv1, this StyleBook checks for the service group with the name lbv1-svcgrp. If it is not found, it creates a service group lbv1-svcgrp and binds with the lbv1 virtual server.
repeat: $parameters.selected-vserver.datasource.collections.servicegroup
-
datasource: Refers to the selected NetScaler instance managed by NetScaler Console. -
collections: Refers to all the entities in the NetScaler instance. -
servicegroup: Refers to the service groups in the NetScaler instance.
parameters:
- name: selected-lbvserver
label: Select an existing lbvserver
type: datum
required: true
data-source:
type: managed-adc
collection: lbvserver
collection-filters:
protocol: SSL