hostinterface.create

Description 说明

object hostinterface.create(object/array hostInterfaces)

This method allows to create new host interfaces.该方法允许创建新的主机接口。

Parameters 参数

(object/array) Host interfaces to create. The method accepts host interfaces with the standard host interface properties.主机接口创建。 该方法接受具有标准主机接口属性的主机接口

Return values 返回值

(object) Returns an object containing the IDs of the created host interfaces under the interfaceids property. The order of the returned IDs matches the order of the passed host interfaces.返回一个包含“interfaceID”属性下创建的主机接口的ID的对象。返回的ID的顺序与传递的主机接口的顺序相匹配。

Examples 示例

Create a new interface创建一个新的接口

Create a secondary IP agent interface on host “30052.”在主机“30052”上创建一个辅助IP代理接口。

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "hostinterface.create",
  4. "params": {
  5. "hostid": "30052",
  6. "dns": "",
  7. "ip": "127.0.0.1",
  8. "main": 0,
  9. "port": "10050",
  10. "type": 1,
  11. "useip": 1
  12. },
  13. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  14. "id": 1
  15. }

Response:

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

See also 参见

Source 来源

CHostInterface::create() in frontends/php/include/classes/api/services/CHostInterface.php.