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

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

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

示例

GET /api/hosts/host368/interfaces
200
{
  "total": 3,
  "subtotal": 3,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "subnet_id": null,
      "subnet_name": null,
      "subnet6_id": null,
      "subnet6_name": null,
      "domain_id": null,
      "domain_name": null,
      "created_at": "2019-11-07 08:37:16 UTC",
      "updated_at": "2019-11-07 08:37:16 UTC",
      "managed": true,
      "identifier": null,
      "id": 53,
      "name": "host368",
      "ip": null,
      "ip6": null,
      "mac": null,
      "mtu": null,
      "fqdn": "host368",
      "primary": true,
      "provision": true,
      "type": "interface",
      "virtual": false
    },
    {
      "subnet_id": null,
      "subnet_name": null,
      "subnet6_id": null,
      "subnet6_name": null,
      "domain_id": null,
      "domain_name": null,
      "created_at": "2019-11-07 08:37:16 UTC",
      "updated_at": "2019-11-07 08:37:16 UTC",
      "managed": true,
      "identifier": "eth184",
      "id": 54,
      "name": null,
      "ip": "0.0.0.38",
      "ip6": null,
      "mac": "00:33:45:ab:00:4e",
      "mtu": null,
      "fqdn": null,
      "primary": false,
      "provision": false,
      "type": "interface",
      "virtual": false
    },
    {
      "subnet_id": null,
      "subnet_name": null,
      "subnet6_id": null,
      "subnet6_name": null,
      "domain_id": null,
      "domain_name": null,
      "created_at": "2019-11-07 08:37:16 UTC",
      "updated_at": "2019-11-07 08:37:16 UTC",
      "managed": true,
      "identifier": "eth185",
      "id": 55,
      "name": null,
      "ip": "0.0.0.39",
      "ip6": null,
      "mac": "00:33:45:ab:00:4f",
      "mtu": null,
      "fqdn": null,
      "primary": false,
      "provision": false,
      "type": "bond",
      "mode": "balance-rr",
      "attached_devices": "",
      "bond_options": "",
      "virtual": true
    }
  ]
}

參數

參數名字 描述
location_id
選填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
選填

Set the current organization context for the request

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/host369/interfaces/57
200
{
  "subnet_id": null,
  "subnet_name": null,
  "subnet6_id": null,
  "subnet6_name": null,
  "domain_id": null,
  "domain_name": null,
  "created_at": "2019-11-07 08:37:16 UTC",
  "updated_at": "2019-11-07 08:37:16 UTC",
  "managed": true,
  "identifier": "eth186",
  "id": 57,
  "name": null,
  "ip": "0.0.0.40",
  "ip6": null,
  "mac": "00:33:45:ab:00:50",
  "mtu": null,
  "fqdn": null,
  "primary": false,
  "provision": false,
  "type": "interface",
  "virtual": false
}

參數

參數名字 描述
location_id
選填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
選填

Set the current organization context for the request

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/26/interfaces
{
  "interface": {
    "name": "谚喪駏篬庿濱麢鐨耼孞",
    "ip": "10.0.1.1",
    "mac": "AA:AA:AA:AA:AA:AA",
    "username": "foo",
    "password": "bar",
    "provider": "IPMI",
    "type": "bmc",
    "ip6": "2001:db8::1"
  }
}
422
{
  "error": {
    "id": null,
    "errors": {
      "name": [
        "hostname can contain only lowercase letters, numbers, dashes and dots according to RFC921, RFC952 and RFC1123"
      ]
    },
    "full_messages": [
      "Name hostname can contain only lowercase letters, numbers, dashes and dots according to RFC921, RFC952 and RFC1123"
    ]
  }
}

參數

參數名字 描述
location_id
選填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
選填

Set the current organization context for the request

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/host360/interfaces/30
{
  "interface": {
    "name": "test.foreman.com",
    "ip": "10.0.1.1",
    "mac": "AA:AA:AA:AA:AA:AA",
    "username": "foo",
    "password": "bar",
    "provider": "IPMI",
    "ip6": "2001:db8::1"
  }
}
200
{
  "subnet_id": null,
  "subnet_name": null,
  "subnet6_id": null,
  "subnet6_name": null,
  "domain_id": null,
  "domain_name": null,
  "created_at": "2019-11-07 08:37:15 UTC",
  "updated_at": "2019-11-07 08:37:15 UTC",
  "managed": true,
  "identifier": "eth169",
  "id": 30,
  "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": "interface",
  "virtual": false
}

參數

參數名字 描述
location_id
選填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
選填

Set the current organization context for the request

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/32/interfaces/45
{
  "interface": {}
}
422
{
  "error": {
    "id": 45,
    "errors": {
      "primary": [
        "can't delete primary interface of managed host"
      ],
      "provision": [
        "can't delete provision interface of managed host"
      ]
    },
    "full_messages": [
      "Primary can't delete primary interface of managed host",
      "Provision can't delete provision interface of managed host"
    ]
  }
}

參數

參數名字 描述
location_id
選填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
選填

Set the current organization context for the request

Validations:

  • Must be a Integer

host_id
必填

主機的 ID 或名稱

Validations:

  • Must be a String

id
必填

介面卡的 ID

Validations:

  • Must be a String