GET /api/hosts/:host_id/interfaces
列出主機的所有介面卡

GET /api/domains/:domain_id/interfaces
列出區域中的所有介面卡

GET /api/subnets/:subnet_id/interfaces
列出子網路中的所有介面卡

示例

GET /api/hosts/host727/interfaces
404
{
  "error": {
    "message": "Resource interface not found by id ''"
  }
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

host_id
必填

主機的 ID 或名稱

Validations:

  • Must be a String

domain_id
選填

區域的 ID 或名稱

Validations:

  • Must be a String

subnet_id
選填

子網路的 ID 或名稱

Validations:

  • Must be a String

page
選填

頁數,從 1 開始

Validations:

  • Must be a number.

per_page
選填

每頁要傳回的結果數量

Validations:

  • Must be a number.


GET /api/hosts/:host_id/interfaces/:id
顯示主機的介面卡

示例

GET /api/hosts/host2647/interfaces/19
200
{
  "subnet_id": null,
  "subnet_name": null,
  "subnet6_id": null,
  "subnet6_name": null,
  "domain_id": null,
  "domain_name": null,
  "created_at": "2019-09-11 14:58:36 UTC",
  "updated_at": "2019-09-11 14:58:36 UTC",
  "managed": true,
  "identifier": "eth852",
  "id": 19,
  "name": null,
  "ip": "0.0.0.203",
  "ip6": null,
  "mac": "00:33:45:ab:01:46",
  "mtu": null,
  "fqdn": null,
  "primary": false,
  "provision": false,
  "type": "interface",
  "virtual": false
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

host_id
必填

主機的 ID 或名稱

Validations:

  • Must be a String

id
必填

介面卡的 ID 或名稱

Validations:

  • Must be a String


POST /api/hosts/:host_id/interfaces
在主機上建立介面

示例

POST /api/hosts/host2642/interfaces
{
  "interface": {
    "name": "test.foreman.com",
    "ip": "10.0.1.1",
    "mac": "AA:AA:AA:AA:AA:AA",
    "username": "foo",
    "password": "bar",
    "provider": "IPMI",
    "type": "bmc",
    "ip6": "2001:db8::1"
  }
}
201
{
  "subnet_id": null,
  "subnet_name": null,
  "subnet6_id": null,
  "subnet6_name": null,
  "domain_id": null,
  "domain_name": null,
  "created_at": "2019-09-11 14:58:36 UTC",
  "updated_at": "2019-09-11 14:58:36 UTC",
  "managed": true,
  "identifier": null,
  "id": 5,
  "name": "test.foreman.com",
  "ip": "10.0.1.1",
  "ip6": "2001:db8::1",
  "mac": "aa:aa:aa:aa:aa:aa",
  "mtu": null,
  "fqdn": "test.foreman.com",
  "primary": false,
  "provision": false,
  "type": "bmc",
  "username": "foo",
  "password": "bar",
  "provider": "IPMI",
  "virtual": false
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

host_id
必填

主機的 ID 或名稱

Validations:

  • Must be a String

interface
必填

介面卡資訊

Validations:

  • Must be a Hash

interface[mac]
選填 , 允許空值

介面卡的 MAC 位址。在空機上的管理介面所需。

Validations:

  • Must be a String

interface[ip]
選填 , 允許空值

IPv4 address of interface

Validations:

  • Must be a String

interface[ip6]
選填 , 允許空值

IPv6 address of interface

Validations:

  • Must be a String

interface[type]
選填 , 允許空值

介面卡類型,例如 bmc。預設值為 interface

Validations:

  • Must be one of: interface, bmc, bond, bridge.

interface[name]
選填 , 允許空值

介面的 DNS 名稱

Validations:

  • Must be a String

interface[subnet_id]
選填 , 允許空值

Foreman subnet ID of IPv4 interface

Validations:

  • Must be a number.

interface[subnet6_id]
選填 , 允許空值

Foreman subnet ID of IPv6 interface

Validations:

  • Must be a number.

interface[domain_id]
選填 , 允許空值

介面卡的 Foreman 區域 ID。在受管理主機上的主介面所需。

Validations:

  • Must be a number.

interface[identifier]
選填 , 允許空值

裝置辨識子,例如 eth0 或 eth1.1

Validations:

  • Must be a String

interface[managed]
選填 , 允許空值

這個介面卡是否應該透過 DHCP 和 DNS 智慧型代理伺服器管理,以及它是否應該在佈建時進行配置?

Validations:

  • Must be one of: true, false, 1, 0.

interface[primary]
選填 , 允許空值

這介面是否要用來建立主機的 FQDN?每個受管理的主機需要有一組主介面。

Validations:

  • Must be one of: true, false, 1, 0.

interface[provision]
選填 , 允許空值

這介面是否要給 PXELinux 的 TFTP(或映像檔為主的 SSH)使用?每個受管理的主機需要有一個佈建介面。

Validations:

  • Must be one of: true, false, 1, 0.

interface[username]
選填 , 允許空值

僅適用於 BMC 介面卡。

Validations:

  • Must be a String

interface[password]
選填 , 允許空值

僅適用於 BMC 介面卡。

Validations:

  • Must be a String

interface[provider]
選填 , 允許空值

介面卡供應者,例如 IPMI。僅適用於 BMC 介面卡。

Validations:

  • Must be one of: IPMI, SSH.

interface[virtual]
選填 , 允許空值

別名或 VLAN 裝置

Validations:

  • Must be one of: true, false, 1, 0.

interface[tag]
選填 , 允許空值

VLAN 標籤,這個屬性擁有比子網路 VLAN ID 更高的優先權。僅適用於虛擬介面卡。

Validations:

  • Must be a String

interface[mtu]
選填 , 允許空值

MTU, this attribute has precedence over the subnet MTU.

Validations:

  • Must be a Integer

interface[attached_to]
選填 , 允許空值

辨識此介面卡的辨識子,例如 eth1。僅適用於虛擬介面卡。

Validations:

  • Must be a String

interface[mode]
選填 , 允許空值

介面的綁定模式,例如 balance-rr。僅用於綁定介面。

Validations:

  • Must be one of: balance-rr, active-backup, balance-xor, broadcast, 802.3ad, balance-tlb, balance-alb.

interface[attached_devices]
選填 , 允許空值

相關連介面的識別子,例如['eth1', 'eth2']。對於綁定介面來說,這些是從屬的。僅用於綁定與橋接介面。

Validations:

  • Must be an array of any type

interface[bond_options]
選填 , 允許空值

以空格區隔開的選項,例如 miimon=100。僅適用於 bond 介面卡。

Validations:

  • Must be a String

interface[compute_attributes]
選填 , 允許空值

該介面的額外運算資源特定的屬性。

Validations:

  • Must be a Hash


PUT /api/hosts/:host_id/interfaces/:id
更新主機的介面卡

示例

PUT /api/hosts/host2643/interfaces/7
{
  "interface": {
    "name": "wuhebbfueg"
  }
}
200
{
  "subnet_id": null,
  "subnet_name": null,
  "subnet6_id": null,
  "subnet6_name": null,
  "domain_id": null,
  "domain_name": null,
  "created_at": "2019-09-11 14:58:36 UTC",
  "updated_at": "2019-09-11 14:58:36 UTC",
  "managed": true,
  "identifier": "eth844",
  "id": 7,
  "name": "wuhebbfueg",
  "ip": "0.0.0.195",
  "ip6": null,
  "mac": "00:33:45:ab:01:3e",
  "mtu": null,
  "fqdn": "wuhebbfueg",
  "primary": false,
  "provision": false,
  "type": "interface",
  "virtual": false
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

host_id
必填

主機的 ID 或名稱

Validations:

  • Must be a String

id
必填

介面卡的 ID

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.

interface
必填

介面卡資訊

Validations:

  • Must be a Hash

interface[mac]
選填 , 允許空值

介面卡的 MAC 位址。在空機上的管理介面所需。

Validations:

  • Must be a String

interface[ip]
選填 , 允許空值

IPv4 address of interface

Validations:

  • Must be a String

interface[ip6]
選填 , 允許空值

IPv6 address of interface

Validations:

  • Must be a String

interface[type]
選填 , 允許空值

介面卡類型,例如 bmc。預設值為 interface

Validations:

  • Must be one of: interface, bmc, bond, bridge.

interface[name]
選填 , 允許空值

介面的 DNS 名稱

Validations:

  • Must be a String

interface[subnet_id]
選填 , 允許空值

Foreman subnet ID of IPv4 interface

Validations:

  • Must be a number.

interface[subnet6_id]
選填 , 允許空值

Foreman subnet ID of IPv6 interface

Validations:

  • Must be a number.

interface[domain_id]
選填 , 允許空值

介面卡的 Foreman 區域 ID。在受管理主機上的主介面所需。

Validations:

  • Must be a number.

interface[identifier]
選填 , 允許空值

裝置辨識子,例如 eth0 或 eth1.1

Validations:

  • Must be a String

interface[managed]
選填 , 允許空值

這個介面卡是否應該透過 DHCP 和 DNS 智慧型代理伺服器管理,以及它是否應該在佈建時進行配置?

Validations:

  • Must be one of: true, false, 1, 0.

interface[primary]
選填 , 允許空值

這介面是否要用來建立主機的 FQDN?每個受管理的主機需要有一組主介面。

Validations:

  • Must be one of: true, false, 1, 0.

interface[provision]
選填 , 允許空值

這介面是否要給 PXELinux 的 TFTP(或映像檔為主的 SSH)使用?每個受管理的主機需要有一個佈建介面。

Validations:

  • Must be one of: true, false, 1, 0.

interface[username]
選填 , 允許空值

僅適用於 BMC 介面卡。

Validations:

  • Must be a String

interface[password]
選填 , 允許空值

僅適用於 BMC 介面卡。

Validations:

  • Must be a String

interface[provider]
選填 , 允許空值

介面卡供應者,例如 IPMI。僅適用於 BMC 介面卡。

Validations:

  • Must be one of: IPMI, SSH.

interface[virtual]
選填 , 允許空值

別名或 VLAN 裝置

Validations:

  • Must be one of: true, false, 1, 0.

interface[tag]
選填 , 允許空值

VLAN 標籤,這個屬性擁有比子網路 VLAN ID 更高的優先權。僅適用於虛擬介面卡。

Validations:

  • Must be a String

interface[mtu]
選填 , 允許空值

MTU, this attribute has precedence over the subnet MTU.

Validations:

  • Must be a Integer

interface[attached_to]
選填 , 允許空值

辨識此介面卡的辨識子,例如 eth1。僅適用於虛擬介面卡。

Validations:

  • Must be a String

interface[mode]
選填 , 允許空值

介面的綁定模式,例如 balance-rr。僅用於綁定介面。

Validations:

  • Must be one of: balance-rr, active-backup, balance-xor, broadcast, 802.3ad, balance-tlb, balance-alb.

interface[attached_devices]
選填 , 允許空值

相關連介面的識別子,例如['eth1', 'eth2']。對於綁定介面來說,這些是從屬的。僅用於綁定與橋接介面。

Validations:

  • Must be an array of any type

interface[bond_options]
選填 , 允許空值

以空格區隔開的選項,例如 miimon=100。僅適用於 bond 介面卡。

Validations:

  • Must be a String

interface[compute_attributes]
選填 , 允許空值

該介面的額外運算資源特定的屬性。

Validations:

  • Must be a Hash


DELETE /api/hosts/:host_id/interfaces/:id
刪除主機的介面卡

示例

DELETE /api/hosts/host2645/interfaces/13
{
  "interface": {}
}
200
{
  "id": 13,
  "mac": "00:33:45:ab:01:42",
  "ip": "0.0.0.199",
  "name": null,
  "host_id": 5,
  "subnet_id": null,
  "domain_id": null,
  "attrs": {},
  "created_at": "2019-09-11T14:58:36.301Z",
  "updated_at": "2019-09-11T14:58:36.301Z",
  "provider": null,
  "username": null,
  "password": null,
  "virtual": false,
  "link": true,
  "identifier": "eth848",
  "tag": "",
  "attached_to": "",
  "managed": true,
  "mode": "balance-rr",
  "attached_devices": "",
  "bond_options": "",
  "primary": false,
  "provision": false,
  "compute_attributes": {},
  "ip6": null,
  "subnet6_id": null
}

參數

參數名字 描述
location_id
選填

位置範圍

Validations:

  • Must be a Integer

organization_id
選填

組織範圍

Validations:

  • Must be a Integer

host_id
必填

主機的 ID 或名稱

Validations:

  • Must be a String

id
必填

介面卡的 ID

Validations:

  • Must be a String