This content has been machine translated dynamically.
Dieser Inhalt ist eine maschinelle Übersetzung, die dynamisch erstellt wurde. (Haftungsausschluss)
Cet article a été traduit automatiquement de manière dynamique. (Clause de non responsabilité)
Este artículo lo ha traducido una máquina de forma dinámica. (Aviso legal)
此内容已经过机器动态翻译。 放弃
このコンテンツは動的に機械翻訳されています。免責事項
이 콘텐츠는 동적으로 기계 번역되었습니다. 책임 부인
Este texto foi traduzido automaticamente. (Aviso legal)
Questo contenuto è stato tradotto dinamicamente con traduzione automatica.(Esclusione di responsabilità))
This article has been machine translated.
Dieser Artikel wurde maschinell übersetzt. (Haftungsausschluss)
Ce article a été traduit automatiquement. (Clause de non responsabilité)
Este artículo ha sido traducido automáticamente. (Aviso legal)
この記事は機械翻訳されています.免責事項
이 기사는 기계 번역되었습니다.책임 부인
Este artigo foi traduzido automaticamente.(Aviso legal)
这篇文章已经过机器翻译.放弃
Questo articolo è stato tradotto automaticamente.(Esclusione di responsabilità))
Translation failed!
参数-默认源代码构造
可以使用此构造来重用其他样书中的参数定义。
假设这样一个场景:一个参数或一组参数在多个样本中重复使用。为了避免重新定义这些参数,每次要创建新样书时,可以将其定义一次,然后使用 parameters-default-sources 构造将其定义导入需要这些参数的样书。
例如,如果多个样书需要配置虚拟 IP,可能必须在创建的每个新样书中定义与虚拟 IP 有关的相同参数。但是可以创建一个单独的样书(例如,名为“vip-params”),在其中定义与其有关的所有参数,如以下示例中所示:
- name: vip-params namespace: com.acme.commontypes version: "1.0" description: This StyleBook defines a typical virtual IP config. private: true schema-version: "1.0" parameters: - name: lb-appname label: Load Balanced Application Name description: Name of the Load Balanced application type: string required: true - name: lb-virtual-ip label: Load Balanced App Virtual IP address description: Virtual IP address representing the Load Balanced application type: ipaddress required: true - name: lb-virtual-port label: Load Balanced App Virtual Port description: TCP port representing the Load Balanced application type: tcp-port default: 80 - name: lb-service-type label: Load Balanced App Protocol description: Protocol used for the Load Balanced application. type: string default: HTTP required: true allowed-values: - HTTP - SSL - TCP
之后可以创建利用这些参数的其他样书。下面是这样一个样本示例。
- name: acme-biz-app namespace: com.acme.stylebooks version: "1.0" description: This stylebook defines the Citrix ADC configuration for Biz App schema-version: "1.0" import-stylebooks: - namespace: com.acme.commontypes prefix: cmtypes version: "1.0" parameters-default-sources: - cmtypes::vip-params parameters: - name: monitorname label: Monitor Name description: Name of the monitor type: string required: true - name: type label: Monitor Type description: Type of the monitor type: string required: true allowed-values: - PING - TCP - HTTP - HTTP-ECV - TCP-ECV - HTTP-INLINE
在 acme-biz-app 样书中,首先通过使用“import-样书”部分导入 vip-params 样书的命名空间和版本。然后添加 parameters-default-sources 构造,并指定样书名称,即 vip-params。这与在此样本中直接定义 vip-params 样本的参数效果一样。
由于 parameters-default-sources 是一个列表,且列表中的每个项目都需要是一个样书,因此可以包括多个样书中的参数。
除了包括其他样本中的参数外,还可以使用 parameters 部分定义您自己的参数。样本的完整参数列表是从其他样本中添加的参数和此样本中定义的参数的组合。因此,表达式 $parameters 是指此参数组合。
请注意,如果一个参数在导入的样本和当前样本中都定义了,则当前样本中的定义覆盖从其他样本导入的定义。可以在需要时自定义一些导入参数,同时按原样使用其余导入参数,有效利用这一点。
parameters-default-sources 构造还可以用于嵌套的参数中,如下所示:
parameters: - name: vip-details label: Virtual IP details description: Details of the Virtual IP type: object required: true parameters-default-sources: - cmtypes::vip-params
这与在此样书中将 vip-params 样书的参数直接作为 vip-details 参数的子参数添加类似。
This Preview product documentation is Cloud Software Group Confidential.
You agree to hold this documentation confidential pursuant to the terms of your Cloud Software Group Beta/Tech Preview Agreement.
The development, release and timing of any features or functionality described in the Preview documentation remains at our sole discretion and are subject to change without notice or consultation.
The documentation is for informational purposes only and is not a commitment, promise or legal obligation to deliver any material, code or functionality and should not be relied upon in making Cloud Software Group product purchase decisions.
If you do not agree, select I DO NOT AGREE to exit.