Create a composite StyleBook 编辑
Create a composite StyleBook
An important and powerful feature of StyleBooks is that they can be used as building blocks for other StyleBooks. A StyleBook can be imported into another StyleBook and it can be referred to as a type that is used by components of the second StyleBook similar to a NITRO built-in StyleBook.
For example, you can use the basic-lb-config StyleBook that you built in the previous section, to build another StyleBook called composite-example. To use the “basic-lb-config” StyleBook, you have to import it in the new StyleBook in the import-stylebooks section.
Build your StyleBook
The new StyleBook would look as follows:
name: composite-example
namespace: com.example.stylebooks
version: "0.1"
display-name: Load Balancing Virtual Server (HTTP/RoundRobin)
description: This StyleBook defines a RoundRobin load balancing configuration with a monitor.
schema-version: "1.0"
import-stylebooks:
-
namespace: netscaler.nitro.config
version: "10.5"
prefix: ns
-
namespace: com.example.stylebooks
version: "0.1"
prefix: stlb
parameters:
-
name: name
type: string
label: Application Name
description: Give a name to the application configuration.
required: true
-
name: ip
type: ipaddress
label: Application Virtual IP (VIP)
description: The Application VIP that clients access
required: true
-
name: svc-servers
type: ipaddress[]
label: Application Server IPs
description: The IP addresses of all the servers of this application
required: true
-
name: response-code
type: string[]
label: List of Response Codes
description: List of Response Codes - Provide a list of response codes in integer.
components:
-
name: basic-lb-comp
type: stlb::basic-lb-config
description: This component's type is another StyleBook that builds the NetScaler lbvserver, servicegroups and services configuration objects.
properties:
name: $parameters.name
ip: $parameters.ip
svc-servers: $parameters.svc-servers
-
name: monit-comp
type: ns::lbmonitor
description: This component is a basic Nitro type (a Builtin StyleBook) that builds the NetScaler monitor configuration object.
properties:
monitorname: $parameters.name + "-mon"
type: HTTP
respcode: $parameters.response-code
httprequest: "'GET /'"
lrtm: ENABLED
secure: "YES"
components:
-
name: monit-svcgrp-bind-comp
type: ns::servicegroup_lbmonitor_binding
properties:
servicegroupname: $components.basic-lb-comp.outputs.servicegroup-comp.properties.servicegroupname
monitor_name: $parent.properties.monitorname
<!--NeedCopy-->
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论