查询弹性公网IP列表 - ListPublicips
功能介绍
查询用户当前局点全量弹性公网IP列表信息。
调试
您可以在API Explorer中调试该接口,支持自动认证鉴权。
授权信息
账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权,具体权限要求请参见权限和授权项。
- 如果使用身份策略授权,当前API调用无需身份策略权限。
URI
GET /v3/{project_id}/eip/publicips
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
project_id |
是 |
String |
项目ID,获取项目ID请参见获取项目ID 最大长度:32 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
marker |
否 |
String |
最小长度:0 最大长度:36 |
|
offset |
否 |
Integer |
最小值:0 最大值:99999 |
|
limit |
否 |
Integer |
最小值:0 最大值:2000 |
|
fields |
否 |
Array of strings |
数组长度:0 - 999 |
|
sort_key |
否 |
String |
|
|
sort_dir |
否 |
String |
|
|
id |
否 |
Array of strings |
数组长度:0 - 999 |
|
ip_version |
否 |
Array of integers |
数组长度:0 - 999 |
|
public_ip_address |
否 |
Array of strings |
数组长度:0 - 999 |
|
public_ip_address_like |
否 |
String |
最小长度:0 最大长度:64 |
|
public_ipv6_address |
否 |
Array of strings |
数组长度:0 - 999 |
|
public_ipv6_address_like |
否 |
String |
最小长度:0 最大长度:64 |
|
type |
否 |
Array of strings |
数组长度:0 - 999 |
|
network_type |
否 |
Array of strings |
数组长度:0 - 999 |
|
publicip_pool_name |
否 |
Array of strings |
数组长度:0 - 999 |
|
status |
否 |
Array of strings |
数组长度:0 - 999 |
|
alias_like |
否 |
String |
最小长度:0 最大长度:64 |
|
alias |
否 |
Array of strings |
数组长度:0 - 999 |
|
description |
否 |
Array of strings |
数组长度:0 - 999 |
|
vnic.private_ip_address |
否 |
Array of strings |
数组长度:0 - 999 |
|
vnic.private_ip_address_like |
否 |
String |
最小长度:0 最大长度:64 |
|
vnic.device_id |
否 |
Array of strings |
数组长度:0 - 999 |
|
vnic.device_owner |
否 |
Array of strings |
数组长度:0 - 999 |
|
vnic.vpc_id |
否 |
Array of strings |
数组长度:0 - 999 |
|
vnic.port_id |
否 |
Array of strings |
数组长度:0 - 999 |
|
vnic.device_owner_prefixlike |
否 |
String |
最小长度:0 最大长度:64 |
|
vnic.instance_type |
否 |
Array of strings |
数组长度:0 - 999 |
|
vnic.instance_id |
否 |
Array of strings |
数组长度:0 - 999 |
|
bandwidth.id |
否 |
Array of strings |
数组长度:0 - 999 |
|
bandwidth.name |
否 |
Array of strings |
数组长度:0 - 999 |
|
bandwidth.name_like |
否 |
Array of strings |
数组长度:0 - 999 |
|
bandwidth.size |
否 |
Array of integers |
数组长度:0 - 999 |
|
bandwidth.share_type |
否 |
Array of strings |
数组长度:0 - 999 |
|
bandwidth.charge_mode |
否 |
Array of strings |
数组长度:0 - 999 |
|
billing_info |
否 |
Array of strings |
数组长度:0 - 999 |
|
billing_mode |
否 |
String |
|
|
associate_instance_type |
否 |
Array of strings |
数组长度:0 - 999 |
|
associate_instance_id |
否 |
Array of strings |
数组长度:0 - 999 |
|
enterprise_project_id |
否 |
Array of strings |
数组长度:0 - 999 |
|
public_border_group |
否 |
Array of strings |
数组长度:0 - 999 |
|
allow_share_bandwidth_type_any |
否 |
Array of strings |
数组长度:0 - 999 |
请求参数
无
响应参数
状态码:200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
request_id |
String |
本次请求的编号 最小长度:0 最大长度:36 |
|
publicips |
Array of PublicipSingleShowResp objects |
弹性公网IP对象 数组长度:0 - 9999 |
|
page_info |
PageInfoOption object |
分页页码信息 |
|
total_count |
Integer |
公网IP总条目数 最小值:0 最大值:999999 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
id |
String |
|
|
project_id |
String |
|
|
ip_version |
Integer |
|
|
public_ip_address |
String |
|
|
public_ipv6_address |
String |
|
|
network_type |
String |
|
|
status |
String |
|
|
description |
String |
|
|
public_border_group |
String |
|
|
created_at |
String |
|
|
updated_at |
String |
|
|
type |
String |
|
|
vnic |
VnicInfo object |
|
|
bandwidth |
PublicipBandwidthInfo object |
功能说明:公网IP绑定带宽信息 |
|
enterprise_project_id |
String |
功能说明:企业项目ID。最大长度36字节,带“-”连字符的UUID格式,或者是字符串“0”。创建弹性公网IP时,给弹性公网IP绑定企业项目ID。 |
|
billing_info |
String |
|
|
lock_status |
String |
|
|
associate_instance_type |
String |
|
|
associate_instance_id |
String |
|
|
publicip_pool_id |
String |
|
|
publicip_pool_name |
String |
|
|
alias |
String |
|
|
profile |
ProfileInfo object |
|
|
fake_network_type |
Boolean |
|
|
tags |
Array of strings |
数组长度:0 - 9999 |
|
associate_instance_metadata |
String |
|
|
associate_mode |
String |
最小长度:1 最大长度:36 |
|
allow_share_bandwidth_types |
Array of strings |
最大长度:64 数组长度:0 - 9999 |
|
cascade_delete_by_instance |
Boolean |
|
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
private_ip_address |
String |
|
|
device_id |
String |
|
|
device_owner |
String |
|
|
vpc_id |
String |
|
|
port_id |
String |
|
|
port_profile |
String |
|
|
mac |
String |
|
|
vtep |
String |
|
|
vni |
String |
|
|
instance_id |
String |
|
|
instance_type |
String |
|
|
port_vif_details |
String |
|
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
id |
String |
|
|
size |
Integer |
|
|
share_type |
String |
|
|
charge_mode |
String |
|
|
name |
String |
|
|
billing_info |
String |
|
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
local_network_port |
String |
|
|
standalone |
Boolean |
|
|
notify_status |
String |
|
|
create_time |
String |
|
|
fake_network_type |
Boolean |
如果为false,则该eip不可以切换bgp类型 |
|
create_source |
String |
|
|
ecs_id |
String |
|
|
lock_status |
String |
eg:“POLICE,LOCKED”。POLICE-公安冻结;LOCKED-普通冻结;普通冻结细分状态:ARREAR-欠费;DELABLE-可删除; |
|
freezed_status |
String |
|
|
bandwith_info |
BandwidthInfoResp object |
|
请求示例
查询全量弹性公网IP列表
GET https://{Endpoint}/v3/{project_id}/eip/publicips
响应示例
状态码:200
GET正常返回
{
"page_info" : {
"current_count" : 1,
"next_marker" : "0490aeae-ab8f-4764-b012-45645e9c0aa9",
"previous_marker" : "0490aeae-ab8f-4764-b012-45645e9c0aa9"
},
"publicips" : [ {
"created_at" : "2022-03-17T09:46:22Z",
"updated_at" : "2022-03-30T02:46:04Z",
"lock_status" : null,
"allow_share_bandwidth_types" : [ "bgp", "sbgp", "share", "share_yidongdanxian", "share_youxuan" ],
"id" : "006343a1-32bf-4361-958a-efd158153dd0",
"alias" : null,
"project_id" : "060576787a80d5762fa2c00f07ddfcf4",
"ip_version" : 4,
"public_ip_address" : "88.88.1.141",
"public_ipv6_address" : null,
"status" : "DOWN",
"description" : "",
"enterprise_project_id" : "0",
"billing_info" : null,
"type" : "弹性公网IP",
"vnic" : {
"private_ip_address" : "172.16.1.235",
"device_id" : "cdaba63f-d85d-4399-81c2-ee9764ad34dd",
"device_owner" : "compute:regionB",
"vpc_id" : "1c30f428-9741-48b2-a788-0b2f359705eb",
"port_id" : "22d3576d-c042-4f3d-8c7c-1330a2724627",
"mac" : "fa:16:3e:3a:22:66",
"vtep" : "26.111.111.11",
"vni" : 961184,
"instance_id" : "",
"instance_type" : "",
"port_profile" : null,
"port_vif_details" : "{\"primary_interface\": true}"
},
"bandwidth" : {
"id" : "149ff19b-5de4-4436-958f-2eca39952e93",
"size" : 100,
"share_type" : "PER",
"charge_mode" : "traffic",
"name" : "bandwidth-xym-br-eqos",
"billing_info" : ""
},
"associate_instance_type" : "PORT",
"associate_instance_id" : "22d3576d-c042-4f3d-8c7c-1330a2724627",
"publicip_pool_id" : "9af5f2e5-1765-4b86-b342-ece52e785c8b",
"publicip_pool_name" : "5_union",
"public_border_group" : "center",
"tags" : [ "key=value" ]
} ],
"request_id" : "c4962d006b34af3c2343de7f88ef65e3",
"total_count" : 100
}
SDK代码示例
SDK代码示例如下。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.eip.v3.region.EipRegion; import com.huaweicloud.sdk.eip.v3.*; import com.huaweicloud.sdk.eip.v3.model.*; public class ListPublicipsSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); EipClient client = EipClient.newBuilder() .withCredential(auth) .withRegion(EipRegion.valueOf("<YOUR REGION>")) .build(); ListPublicipsRequest request = new ListPublicipsRequest(); try { ListPublicipsResponse response = client.listPublicips(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkeip.v3.region.eip_region import EipRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkeip.v3 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = EipClient.new_builder() \ .with_credentials(credentials) \ .with_region(EipRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListPublicipsRequest() response = client.list_publicips(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" eip "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/eip/v3" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/eip/v3/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/eip/v3/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := eip.NewEipClient( eip.EipClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ListPublicipsRequest{} response, err := client.ListPublicips(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
|
状态码 |
描述 |
|---|---|
|
200 |
GET正常返回 |
错误码
请参见错误码。