7.函数解析 · GitBook

引擎提供对于复杂json结构体的参数求解功能。

Fn::GetAtt

从一个json结构体中,取某一个参数

{“processInstanceId” : 
    {
          "Fn::GetAtt": [
            {
              "createProcessInstanceId" : "111",
              "name":"jason"
            },
            "createProcessInstanceId"
          ]
        }
}
等同于
{"processInstanceId" : "111"}
  • 参数1:json结构体
  • 参数2:取参数的key

如上所示,为取出json结构体中的createProcessInstanceId值。

Fn::GetProcessOutputs

从一个已有的流程实例中获取某一个输出结果

{
    "DefaultValue": {
      "Fn::GetProcessOutputs": [
        “111”,
        "createTomcat01",
        {
          "Exclude": [
            "instanceCode",
            "instanceId",
            "privateIp",
            "name"
          ]
        }
      ]
    }
}
以下为流程实例111的createTomcat01节点的所有输出结果
{
  "orderId": "2018091000005",
  "type": "SIP::EC2::Instance",
  "instanceCode": "i-2E1038C0",
  "instanceId": "f6f5abf5-4375-421a-bfd1-154baae92be0",
  "privateIp": "10.201.84.99",
  "regionId": "bcc",
  "zoneCode": null,
  "vpcId": "vpc-5DF3E505",
  "expireTime": "-1",
  "imageId": "ami-6B67809C",
  "securityGroupName": "default",
  "appSystemId": "6b9308a7-854d-46e3-9b07-9f6b35a142c7",
  "envId": "2928adde-8abb-4b79-8a8c-c0c9b67d963d",
  "subnetId": "subnet-F726EFAB",
  "projectId": "11111",
  "keypairName": "",
  "storageId": "storage-cloud",
  "disableApiTermination": "false",
  "instanceType": "c1.small"
}
排除掉instanceCode,instanceId,privateIp,name的参数集合
{
  "orderId": "2018091000005",
  "type": "SIP::EC2::Instance",
  "regionId": "bcc",
  "zoneCode": null,
  "vpcId": "vpc-5DF3E505",
  "expireTime": "-1",
  "imageId": "ami-6B67809C",
  "securityGroupName": "default",
  "appSystemId": "6b9308a7-854d-46e3-9b07-9f6b35a142c7",
  "envId": "2928adde-8abb-4b79-8a8c-c0c9b67d963d",
  "subnetId": "subnet-F726EFAB",
  "projectId": "11111",
  "keypairName": "",
  "storageId": "storage-cloud",
  "disableApiTermination": "false",
  "instanceType": "c1.small"
}
  • 参数1:流程实例ID
  • 参数2:流程节点的编号
    1. 如果没有第三个参数,则取全部的参数集
    2. 如果第三个参数为json结构体,则为排除算法,将排除Exclude中列出的所有参数
    3. 如果第三个参数为数组结构,则取其中枚举出的参数集