功能介绍
查询端口列表
调试
您可以在API Explorer中调试该接口。
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}
名称 |
是否必选 |
参数类型 |
说明 |
---|---|---|---|
project_id |
是 |
String |
项目ID,请参见获取项目ID。 |
id |
否 |
String |
按照port_id过滤查询 |
name |
否 |
String |
|
admin_state_up |
否 |
Boolean |
按照admin_state_up进行过滤 |
network_id |
否 |
String |
按照network_id过滤查询 |
mac_address |
否 |
String |
按照mac_address过滤查询 |
device_id |
否 |
String |
按照device_id过滤查询 |
device_owner |
否 |
String |
按照device_owner过滤查询 |
status |
否 |
String |
|
security_groups |
否 |
Array of strings |
按照security_groups过滤查询 |
marker |
否 |
String |
分页查询的起始资源ID,表示从指定资源的下一条记录开始查询。 marker需要和limit配合使用:
|
limit |
否 |
Integer |
分页查询每页返回的记录个数,取值范围为0~intmax(2^31-1),默认值2000。 limit需要和marker配合使用,详细规则请见marker的参数说明。 |
fixed_ips |
否 |
Array of strings |
按照fixed_ips=ip_address或者fixed_ips=subnet_id过滤查询 |
ent erp rise_project_id |
否 |
String |
说明:
关于企业项目ID的获取及企业项目特性的详细信息,请参见《企业管理用户指南》。 |
enable_efi |
否 |
Boolean |
按照端口是否使能efi过滤查询 |
请求参数
无
请求示例
GET https://{Endpoint}/v1/{project_id}/ports
响应参数
名称 |
参数类型 |
说明 |
---|---|---|
id |
String |
端口唯一标识 |
name |
String |
|
network_id |
String |
|
admin_state_up |
Boolean |
|
mac_address |
String |
|
fixed_ips |
||
device_id |
String |
|
device_owner |
String |
|
tenant_id |
String |
项目ID。 |
status |
String |
如果allowed_address_pairs回显值为 云服务器 网卡IP地址,表示虚拟IP的端口处于绑定状态。 |
security_groups |
Array of strings |
安全组的UUID(扩展属性) |
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 |
端口所属的可用分区 |
enable_efi |
Boolean |
|
名称 |
参数类型 |
说明 |
---|---|---|
subnet_id |
String |
功能说明:所属子网ID 如果您使用管理控制台,此值即为子网详情中的“IPv4子网ID”或“IPv6子网ID”参数值。 约束:不支持更新 |
ip_address |
String |
端口IP地址 |
名称 |
参数类型 |
说明 |
---|---|---|
ip_address |
String |
|
mac_address |
String |
MAC地址 |
名称 |
参数类型 |
说明 |
---|---|---|
opt_name |
String |
DHCP选项名称,目前仅支持填写“51”,表示DHCP租约时间。 |
opt_value |
String |
DHCP选项的值。 当“opt_name”为“51”时,参数格式为“Xh”,表示DHCP租约时间为X小时。 “X”的取值范围为1~30000或“-1”,“-1”表示DHCP租约时间无限长。 |
响应示例
{
"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
}
]
}
状态码
请参见状态码。
错误码
请参考错误码。