Application Delivery Management

重复条件构造

重复条件构造在重复构造的每次迭代中进行评估,其结果决定是在该迭代中构建配置对象还是移至下一个迭代。以下示例展示了重复条件构造的用法:

示例

components
  -
    name: der-key-files-comp
    type: ns::systemfile
    repeat:
      repeat-list: $parameters.certificates
      repeat-item: certificate
      repeat-condition: $certificate.ssl-inform == DER
      properties:
        filecontent: base64($certificate.keyfile.contents)
        fileencoding: BASE64
        filelocation: /nsconfig/ssl
        filename: $certificate.keyfile.file
<!--NeedCopy-->

在此示例中,der-key-files-comp 组件会遍历用户提供的所有证书,但它仅构建与具有 DER 编码的证书对应的配置对象。在每次迭代中,都会评估 repeat-condition 表达式,以测试证书编码是否为 DER 类型。如果不是 DER 类型,则当前迭代中不会构建配置对象,并且迭代会移至列表中的下一个证书。

重复条件构造