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 类型,则在当前迭代中不会构建任何配置对象,并且迭代会移动到列表中的下一个证书。

重复条件构造