華為云計算 云知識 查詢云服務(wù)器網(wǎng)卡信息NovaListServerInterfaces
查詢云服務(wù)器網(wǎng)卡信息NovaListServerInterfaces

 

功能介紹

查詢 云服務(wù)器 網(wǎng)卡信息。

調(diào)試

您可以在API Explorer中調(diào)試該接口。

URI

GET /v2.1/{project_id}/servers/{server_id}/os-interface

參數(shù)說明請參見表1。
表1 參數(shù)說明

參數(shù)

是否必選

描述

project_id

項目ID。

獲取方法請參見獲取項目ID

server_id

云服務(wù)器ID

請求消息

響應(yīng)消息

響應(yīng)參數(shù)如表2所示。
表2 響應(yīng)參數(shù)

參數(shù)

參數(shù)類型

描述

interfaceAttachments

Array of objects

云服務(wù)器網(wǎng)卡信息列表,詳情請參見表3。

表3 interfaceAttachments字段數(shù)據(jù)結(jié)構(gòu)說明

參數(shù)

參數(shù)類型

描述

port_state

String

網(wǎng)卡端口狀態(tài)。

fixed_ips

Array of objects

網(wǎng)卡私網(wǎng)IP信息列表,詳情請參見表4。

net_id

String

網(wǎng)卡端口所屬網(wǎng)絡(luò)ID(network_id)。

port_id

String

網(wǎng)卡端口ID。

mac_addr

String

網(wǎng)卡Mac地址信息。

表4 fixed_ips字段數(shù)據(jù)結(jié)構(gòu)說明

參數(shù)

參數(shù)類型

描述

subnet_id

String

網(wǎng)卡私網(wǎng)IP對應(yīng)子網(wǎng)信息。

ip_address

String

網(wǎng)卡私網(wǎng)IP信息。

請求示例

查詢指定云服務(wù)器網(wǎng)卡信息。

GET https://{endpoint}/v2.1/{project_id}/servers/{server_id}/os-interface

響應(yīng)示例

{
    "interfaceAttachments": [
        {
            "port_state": "ACTIVE",
            "fixed_ips": [
                {
                    "subnet_id": "f8a6e8f8-c2ec-497c-9f23-da9616de54ef",
                    "ip_address": "192.168.1.3"
                }
            ],
            "net_id": "3cb9bc59-5699-4588-a4b1-b87f96708bc6",
            "port_id": "ce531f90-199f-48c0-816c-13e38010b442",
            "mac_addr": "fa:16:3e:4c:2c:30"
        }
    ]
}

返回值

請參考通用請求返回值