drule.update

Description

描述

object drule.update(object/array **discoveryRules**) 对象 drule.update(object/array **discoveryRules**)

This method allows to update existing discovery rules. 该方法用于更新已存在的发现规则。

Parameters

参数

(object/array) Discovery rule properties to be updated. (对象/数组) 要更新的发现规则属性

The druleid property must be defined for each discovery rule, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged. 必须为每条发现规则定义 druleid 属性,其它属性是可选的. 只有传参进去的属性才会被更新,其它属性不变.

Additionally to the standard discovery rule properties, the method accepts the following parameters. 除了标准的发现规则属性外, 该方法还接受以下参数.

ParameterTypeDescription
dchecksarrayDiscovery checks to replace existing checks.
参数类型描述
dchecksarray替代已存在的发现检查.

Return values

返回值

(object) Returns an object containing the IDs of the updated discovery rules under the druleids property. (对象)druleids 属性下,返回包含已更新的发现规则的ID对象.

Examples

例子

Change the IP range of a discovery rule

更改发现规则的IP范围

Change the IP range of a discovery rule to “192.168.2.1-255”. 将发现规则的IP范围更改为192.168.2.1-255

Request: 请求:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "drule.update",
  4. "params": {
  5. "druleid": "6",
  6. "iprange": "192.168.2.1-255"
  7. },
  8. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  9. "id": 1
  10. }

Response: 响应:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "druleids": [
  5. "6"
  6. ]
  7. },
  8. "id": 1
  9. }

See also

参考

Source

来源

CDRule::update() in frontends/php/include/classes/api/services/CDRule.php.