提供在边缘端上批量分配规则到网关、解除分配的规则、分页查询已分配/未分配规则的功能。
功能描述:提供解除已分配的规则的功能
POST  /api/v1/rules/gateway/deallocate
Body:
| Name | Type | Description | Required | 
|---|---|---|---|
| ruleId | string | 规则名 | Yes | 
| gatewayId | string | 网关ID | Yes | 
Body example:
{
    "ruleId":"8ae48daf7163309a0171f7555f4e001c",
    "productId":"100695",
    "gatewayId":"10237745"
}
cURL example:
   curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/rules/gateway/deallocate?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
 --header 'platform: 3' \
 --header 'projectId: {projectId}' \
 --header 'Content-Type: application/json' \
 --data-raw '{
    "ruleId":"8ae48daf7163309a0171f7555f4e001c",
    "productId":"100695",
    "gatewayId":"10237745"
}'
Response example:
{    
    "success": true,
    "code": 0,
    "msg": null,
    "data": null
}
功能描述:批量分配规则到网关的功能。
POST  /api/v1/rules/gateway/allocate/multi
Body:
| Name | Type | Description | Required | 
|---|---|---|---|
| ruleIdList | string[] | 规则名列表 | Yes | 
| gatewayId | int | 网关ID | Yes | 
| allocatedTime | long | 分配时间 | No | 
Body example:
{
  "gatewayId": 10237745,
  "productId": 100695,
  "ruleIdList": [
    "8ae48daf7163309a0171f7555f4e001c"
  ]
}
cURL example:
   curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/rules/gateway/allocate/multi?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
 --header 'platform: 3' \
 --header 'projectId: {projectId}' \
 --header 'Content-Type: application/json' \
 --data-raw '{
    "gatewayId": 10237745,
    "productId": 100695,
    "ruleIdList": [
      "8ae48daf7163309a0171f7555f4e001c"
    ]
}'
Response example:
{    
    "success": true,
    "code": 0,
    "msg": null,
    "data": null
}
功能描述:分页查询已分配规则的功能。
POST  /api/v1/rules/gateway/allocated
Body:
| Name | Type | Description | Required | 
|---|---|---|---|
| currentPage | int | 当前页码 | Yes | 
| pageSize | int | 页码大小 | Yes | 
| filter | struct | 筛选条件 | Yes | 
filter的子对象结构体:
| Name | Type | Description | Required | 
|---|---|---|---|
| name | string | 规则引擎的名称 | No | 
| gatewayId | int | 网关ID | Yes | 
| type | int | 规则类型(0:边缘端 2:kubeedge) | Yes | 
Body example:
{
    "currentPage":1,
    "pageSize":10,
    "filter": {
            "name":"test",
            "gatewayId": 10000080
     }
}
cURL example:
   curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/rules/gateway/allocated?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
 --header 'platform: 3' \
 --header 'projectId: {projectId}' \
 --header 'Content-Type: application/json' \
 --data-raw '{
    "currentPage":1,
    "pageSize":10,
    "filter": {
           "name":"test",
           "gatewayId": 10000080
         }
}'
Response data:
| Name | Type | Description | 
|---|---|---|
| totalCount | int | 总数量 | 
| pageSize | int | 分页大小 | 
| currentPage | int | 页码 | 
| totalPage | int | 总页数 | 
| content | struct[] | 内容 | 
Response data content的子对象结构体:
| Name | Type | Description | 
|---|---|---|
| id | string | 规则ID | 
| name | string | 规则名称 | 
| allocatedTime | long | 分配时间 | 
Response example:
{
  "success": true,
  "code": 0,
  "msg": "",
  "data": {
    "currentPage": 1,
    "pageSize": 10,
    "totalCount": 1,
    "totalPage": 1,
    "content": [
      {
        "id": "8ae48daf7163309a0171f7555f4e001c",
        "name": "string2111",
        "allocatedTime": 1589004792593
      }
    ]
  }
}
功能描述:分页查询未分配规则的功能。
POST  /api/v1/rules/gateway/unallocated
Body:
| Name | Type | Description | Required | 
|---|---|---|---|
| currentPage | int | 当前页码 | Yes | 
| pageSize | int | 页码大小 | Yes | 
| filter | struct | 筛选条件 | Yes | 
filter的子对象结构体:
| Name | Type | Description | Required | 
|---|---|---|---|
| name | string | 规则引擎的名字 | No | 
| gatewayId | int | 网关ID | Yes | 
| type | int | 规则类型(0:边缘端 2:kubeedge) | Yes | 
Body example:
{
    "currentPage":1,
    "pageSize":10,
    "filter": {
            "name":"test",
            "gatewayId": 10000080
     }
}
cURL example:
   curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/rules/gateway/unallocated?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
 --header 'platform: 3' \
 --header 'projectId: {projectId}' \
 --header 'Content-Type: application/json' \
 --data-raw '{
    "currentPage":1,
    "pageSize":10,
    "filter": {
           "name":"test",
           "gatewayId": 10000080
         }
}'
Response data:
| Name | Type | Description | 
|---|---|---|
| totalCount | int | 总数量 | 
| pageSize | int | 分页大小 | 
| currentPage | int | 页码 | 
| totalPage | int | 总页数 | 
| content | struct[] | 内容 | 
Response data content的子对象结构体:
| Name | Type | Description | 
|---|---|---|
| id | string | 规则ID | 
| name | string | 规则名称 | 
| userId | string | 用户ID | 
| userName | string | 用户名称 | 
| timeTrigger | string | 时间触发器,支持cron表达式 | 
| conditions | struct[] | 触发器结构体数组 | 
| actions | struct[] | 执行设备信息结构体数组 | 
| subscription | string[] | 接收人邮箱列表 | 
| mailServerId | string | 邮箱服务器ID | 
| mailServerName | string | 邮箱服务器名称 | 
| mailPatternId | string | 邮件模板ID | 
| mailPatternName | string | 邮件模板名称 | 
| export | boolean | 是否推送到export client | 
| exportClientId | int | 消息路由客户端ID | 
| ruleType | int | 规则类型,1:云端 | 
| status | enum | 规则状态(0:禁用,1:启用) | 
Response data conditions的子对象结构体:
| Name | Type | Description | 
|---|---|---|
| type | int | 条件类型(1:数据点条件 2:设备上线 3:设备下线 4:设备删除) | 
| productId | int | 触发产品ID | 
| didList | int[] | 触发设备ID列表 | 
| productName | string | 触发产品名称 | 
| nameList | string[] | 触发设备名称列表 | 
| protocolType | int | 协议类型 | 
| check | struct | 触发器详情 | 
Response data check的子对象结构体:
| Name | Type | Description | 
|---|---|---|
| parameter | string | 触发设备属性名(定义功能时添加的属性名) | 
| operation | string | 触发设备判定符号(目前支持:> ; >= ; == ; < ; <= ; !=)(注:string,bool,byte只支持 == 与 != ) | 
| operand | 任意类型 | 阈值(bool值写成true或者false,int写成数字) | 
| type | int | 条件类型(1:数据点条件 2:设备上线 3:设备下线 4:设备删除) | 
Response data actions的子对象结构体:
| Name | Type | Description | 
|---|---|---|
| productId | int | 执行产品ID | 
| deviceId | int | 执行设备ID | 
| identifier | string | 需执行的属性名(具有写权限的属性) | 
| value | 任意类型 | 值(bool值写成true或者false,int写成数字) | 
| type | int | 条件类型(1:数据点条件 2:设备上线 3:设备下线 4:设备删除) | 
| protocolType | int | 协议类型 | 
| deviceName | string | 执行设备名称 | 
| productName | string | 执行产品名称 | 
Response example:
{
  "success": true,
  "code": 0,
  "msg": null,
  "data": {
    "currentPage": 1,
    "pageSize": 10,
    "totalCount": 1,
    "totalPage": 1,
    "content": [
                     {
                        "id": "8ae48daf7163309a0171ee0575150010",
                        "name": "string111",
                        "userId": "1bb9909ee93647df883b9043743a345d",
                        "userName": "liubo3",
                        "timeTrigger": null,
                        "conditions": [
                            {
                                "productName": "cdedd",
                                "productId": 100235,
                                "protocolType": 5,
                                "check": {
                                    "parameter": "abcd",
                                    "operation": "!=",
                                    "operand": "true",
                                    "type": 2
                                },
                                "type": 2,
                                "nameList": [
                                    "crcr"
                                ],
                                "didList": [
                                    10000781
                                ]
                            }
                        ],
                        "filters": [],
                        "actions": [
                            {
                                "deviceId": 10000781,
                                "deviceName": "crcr",
                                "productName": "cdedd",
                                "productId": 100235,
                                "protocolType": 5,
                                "identifier": "abcd",
                                "value": "true",
                                "type": 2
                            }
                        ],        
                        "subscription": [],
                        "mailServerId": "",
                        "mailServerName": "",
                        "mailPatternId": "",
                        "mailPatternName": "",           
                        "export": false,
                        "exportClientId": null,           
                        "ruleType": 0
                     }
                   ]
               }
    }