功能介紹
查詢端口列表
調(diào)試
您可以在API Explorer中調(diào)試該接口。
URI
GET /v1/{project_id}/ports
GET https://{Endpoint}/v1/{project_id}/ports?id={port_id}&name={port_name}&admin_state_up={is_admin_status_up}&
network_id={network_id}&mac_address={port_mac}&device_id={port_device_id}&
device_owner={device_owner}&status={port_status}&fixed_ips=ip_address={ip_address}&fixed_ips=subnet_id={subnet_id}
|
名稱(chēng) |
是否必選 |
參數(shù)類(lèi)型 |
說(shuō)明 |
|---|---|---|---|
|
project_id |
是 |
String |
項(xiàng)目ID,請(qǐng)參見(jiàn)獲取項(xiàng)目ID。 |
|
id |
否 |
String |
按照port_id過(guò)濾查詢 |
|
name |
否 |
String |
|
|
admin_state_up |
否 |
Boolean |
按照admin_state_up進(jìn)行過(guò)濾 |
|
network_id |
否 |
String |
按照network_id過(guò)濾查詢 |
|
mac_address |
否 |
String |
按照mac_address過(guò)濾查詢 |
|
device_id |
否 |
String |
按照device_id過(guò)濾查詢 |
|
device_owner |
否 |
String |
按照device_owner過(guò)濾查詢 |
|
status |
否 |
String |
|
|
security_groups |
否 |
Array of strings |
按照security_groups過(guò)濾查詢 |
|
marker |
否 |
String |
分頁(yè)查詢的起始資源ID,表示從指定資源的下一條記錄開(kāi)始查詢。 marker需要和limit配合使用:
|
|
limit |
否 |
Integer |
分頁(yè)查詢每頁(yè)返回的記錄個(gè)數(shù),取值范圍為0~intmax(2^31-1),默認(rèn)值2000。 limit需要和marker配合使用,詳細(xì)規(guī)則請(qǐng)見(jiàn)marker的參數(shù)說(shuō)明。 |
|
fixed_ips |
否 |
Array of strings |
按照f(shuō)ixed_ips=ip_address或者fixed_ips=subnet_id過(guò)濾查詢 |
|
enterprise_project_id |
否 |
String |
說(shuō)明:
關(guān)于企業(yè)項(xiàng)目ID的獲取及企業(yè)項(xiàng)目特性的詳細(xì)信息,請(qǐng)參見(jiàn)《企業(yè)管理用戶指南》。 |
|
enable_efi |
否 |
Boolean |
按照端口是否使能efi過(guò)濾查詢 |
請(qǐng)求參數(shù)
無(wú)
請(qǐng)求示例
GET https://{Endpoint}/v1/{project_id}/ports
響應(yīng)參數(shù)
|
名稱(chēng) |
參數(shù)類(lèi)型 |
說(shuō)明 |
|---|---|---|
|
ports |
|
名稱(chēng) |
參數(shù)類(lèi)型 |
說(shuō)明 |
|---|---|---|
|
id |
String |
端口唯一標(biāo)識(shí) |
|
name |
String |
|
|
network_id |
String |
說(shuō)明:
網(wǎng)絡(luò)ID的獲取方式:
|
|
admin_state_up |
Boolean |
|
|
mac_address |
String |
|
|
fixed_ips |
||
|
device_id |
String |
|
|
device_owner |
String |
|
|
tenant_id |
String |
項(xiàng)目ID。 |
|
status |
String |
如果allowed_address_pairs回顯值為 云服務(wù)器 網(wǎng)卡IP地址,表示虛擬IP的端口處于綁定狀態(tài)。 |
|
security_groups |
Array of strings |
安全組的UUID(擴(kuò)展屬性) |
|
allowed_address_pairs |
||
|
extra_dhcp_opts |
||
|
binding:vif_details |
||
|
binding:profile |
Object |
|
|
binding:vnic_type |
String |
|
|
dns_assignment |
|
|
|
dns_name |
String |
|
|
instance_id |
String |
|
|
instance_type |
String |
|
|
port_security_enabled |
Boolean |
|
|
zone_id |
String |
端口所屬的可用分區(qū) |
|
enable_efi |
Boolean |
|
|
名稱(chēng) |
參數(shù)類(lèi)型 |
說(shuō)明 |
|---|---|---|
|
subnet_id |
String |
功能說(shuō)明:所屬子網(wǎng)ID 如果您使用管理控制臺(tái),此值即為子網(wǎng)詳情中的“IPv4子網(wǎng)ID”或“IPv6子網(wǎng)ID”參數(shù)值。 約束:不支持更新 |
|
ip_address |
String |
端口IP地址 |
|
名稱(chēng) |
參數(shù)類(lèi)型 |
說(shuō)明 |
|---|---|---|
|
ip_address |
String |
|
|
mac_address |
String |
MAC地址 |
|
名稱(chēng) |
參數(shù)類(lèi)型 |
說(shuō)明 |
|---|---|---|
|
opt_name |
String |
DHCP選項(xiàng)名稱(chēng),目前僅支持填寫(xiě)“51”,表示DHCP租約時(shí)間。 |
|
opt_value |
String |
DHCP選項(xiàng)的值。 當(dāng)“opt_name”為“51”時(shí),參數(shù)格式為“Xh”,表示DHCP租約時(shí)間為X小時(shí)。 “X”的取值范圍為1~30000或“-1”,“-1”表示DHCP租約時(shí)間無(wú)限長(zhǎng)。 |
響應(yīng)示例
{
"ports": [
{
"id": "d00f9c13-412f-4855-8af3-de5d8c24cd60",
"name": "test",
"status": "DOWN",
"admin_state_up": "true",
"fixed_ips": [
{
"subnet_id": "70f2e74b-e660-410a-b754-0ca46744348a",
"ip_address": "10.128.1.10"
}
],
"dns_name": "",
"mac_address": "fa:16:3e:d7:f2:6c",
"network_id": "5b808927-13c9-4e60-a4f4-ed6ffe225167",
"tenant_id": "43f2d1cca56a40729dcb17212482f34d",
"device_id": "",
"device_owner": "",
"security_groups": [
"02b4e8ee-74fa-4a31-802e-5490df11245e"
],
"extra_dhcp_opts": [],
"allowed_address_pairs": [],
"binding:vnic_type": "normal",
"instance_type": "RDS",
"instance_id": "03a4e9ee-64eb-4a31-802e-5490df22146c",
"enable_efi": false
},
{
"id": "28ba8f45-7636-45e4-8c0a-675d7663717c",
"name": "test1",
"status": "DOWN",
"admin_state_up": "true",
"fixed_ips": [
{
"subnet_id": "061d3ca2-bd1f-4bd1-a01d-7a5155328c0e",
"ip_address": "192.168.10.10"
}
],
"dns_name": "",
"mac_address": "fa:16:3e:3d:91:cd",
"network_id": "be2fe79a-3ee2-4d87-bd71-5afa78a5670d",
"tenant_id": "43f2d1cca56a40729dcb17212482f34d",
"device_id": "",
"device_owner": "",
"security_groups": [
"0bfc8687-ca18-4c37-ac84-d2198baba585"
],
"extra_dhcp_opts": [],
"allowed_address_pairs": [],
"binding:vnic_type": "normal",
"enable_efi": false
}
]
}
狀態(tài)碼
請(qǐng)參見(jiàn)狀態(tài)碼。
錯(cuò)誤碼
請(qǐng)參考錯(cuò)誤碼。
