The Components construct in a StyleBook is considered as the most important section in the StyleBook. In this section, you define the configuration objects that have to be created. Using this construct, you can build one or multiple configuration objects of the same type.
The components construct can use the input provided in the parameters section to adapt the configuration generated by the StyleBook. This is an optional section, although most StyleBooks have a components section.
The following table describes the main attributes of a component.
|name||The name of the component. You can specify an alphanumeric name. The name must begin with an alphabet, and can include additional alphabets, numbers, hyphen (-), or underscore (_).|
|description||A description of the role of this component in the StyleBook.|
|type||The type determines what properties this component provides. Components have two kind of types: Built-in type: This type is provided by the system and you do not have to define it, for example, the NITRO entity types
|properties||The sub-attributes that can be used for a component type attribute. The properties that are valid for a component are dictated by its type. For a built-in type, these are the properties or attributes of the corresponding NITRO object. For a component whose type is another StyleBook, that is, a composite type, the properties correspond to the parameters defined in that StyleBook.|
components: - name: my-lbvserver-comp type: ns::lbvserver properties: name: $parameters.name servicetype: HTTP ipv46: $parameters.ip port: 80 lbmethod: $parameters.lb-alg <!--NeedCopy-->
In this example, you have defined a component called
my-lbvserver-comp. This component is of type ns::lbvserver (a built-in type), where “ns” is the prefix that refers to the namespace netscaler.nitro.config and version 10.5 that you had specified in the import-stylebooks section, and
lbvserver is a NITRO resource in this namespace.
The properties in this section include four mandatory and one optional attribute (
lbmethod) of the
lbvserver resource and allows you to specify values for these attributes. In this example, you are specifying static values for
servicetype and port while the name, ipv46, and
lbmethod properties get their values from the input parameters. You refer to the parameter names defined in the parameters section by using $parameters.<name> notation, for example, $parameters.ip.
To learn more about all the available Citrix ADC NITRO resources and their attributes/properties, see the Citrix ADC NITRO REST API documentation.
You have to use lower case for the attribute names of NITRO resource types (its component properties). Otherwise, the import of a StyleBook will fail.