文档首页/ 弹性负载均衡 ELB/ API参考/ API(V3)/ 负载均衡器/ 查询负载均衡器IP地址的域名解析配置 - ListDomainIPs
更新时间:2026-07-15 GMT+08:00
分享

查询负载均衡器IP地址的域名解析配置 - ListDomainIPs

功能介绍

查询负载均衡器所有IP的域名解析配置信息,即负载均衡器的IP是否加入了域名解析,以及对应的域名。

注意:只返回启用的域名类型对应的配置。若只开启公网域名解析,则只返回该负载均衡器的公网IP的域名解析配置;若负载均衡器的公网域名解析和私网域名解析都没有开启,则该返回空列表。

调用方法

请参见如何调用API

授权信息

账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限。

  • 如果使用角色与策略授权,具体权限要求请参见权限和授权项
  • 如果使用身份策略授权,当前API调用无需身份策略权限。

URI

GET /v3/{project_id}/elb/loadbalancers/{loadbalancer_id}/dns/ips

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

参数解释:项目ID。获取方式请参见获取项目ID

约束限制:不涉及

取值范围:长度为32个字符,由小写字母和数字组成。

默认取值:不涉及

loadbalancer_id

String

参数解释:负载均衡器ID。

约束限制:不涉及

取值范围:不涉及

默认取值:不涉及

表2 Query参数

参数

是否必选

参数类型

描述

marker

String

参数解释:上一页最后一条记录的ID。

约束限制

  • 必须与limit一起使用。

  • 不指定时表示查询第一页。

  • 该字段不允许为空或无效的ID。

取值范围:不涉及

默认取值:不涉及

limit

Integer

参数解释:每页返回的个数。

约束限制:不涉及

取值范围:0-2000

默认取值:2000

page_reverse

Boolean

参数解释:是否反向查询。

约束限制

  • 必须与limit一起使用。

  • 当page_reverse=true时,若要查询上一页,marker取值为当前页返回值的previous_marker。

取值范围

  • true:查询上一页。

  • false:查询下一页。

默认取值:false

ip_address

Array of strings

参数解释:IPv4或IPv6地址。

支持多值查询,查询条件格式:

ip_address=xxx&ip_address=xxx

约束限制:必须是当前负载均衡器绑定的私网地址或者公网地址。

取值范围:不涉及

默认取值:不涉及

enable

Boolean

参数解释:IP地址是否已加入到域名解析。

约束限制:不涉及

取值范围

  • true:已加入域名解析。

  • false:未加入域名解析。

默认取值:不涉及

type

Array of strings

参数解释:IP地址类型。

支持多值查询,查询条件格式:

type=xxx&type=xxx

约束限制:不涉及

取值范围

  • vip:私网IP。

  • eip:公网IP。

默认取值:不涉及

domain_name

Array of strings

参数解释:当前IP地址关联的负载均衡实例域名。

支持多值查询,查询条件格式:

domain_name=xxx&domain_name=xxx

约束限制

  • 如果IP为私网类型,则这里为负载均衡实例的私网域名。

  • 如果IP为公网类型,则这里为负载均衡实例的公网域名。

取值范围:不涉及

默认取值:不涉及

enterprise_project_id

Array of strings

参数解释:所属的企业项目ID。

支持多值查询,查询条件格式:

enterprise_project_id=xxx&enterprise_project_id=xxx

约束限制

如果enterprise_project_id不传值,默认查询所有企业项目下的资源,鉴权按照细粒度权限鉴权,必须在用户组下分配elb:loadbalancers:listDnsConfig权限。

如果enterprise_project_id传值,鉴权按照企业项目权限鉴权,分为传入具体eps_id和all_granted_eps两种场景,前者查询指定eps_id的eps下的资源,后者查询的是所有有list权限的eps下的资源。

取值范围:不涉及

默认取值:不涉及

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

参数解释:IAM鉴权Token。

约束限制:不涉及

取值范围:不涉及

默认取值:不涉及

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

ips

Array of DnsIpResponse objects

负载均衡器IP地址的域名解析配置列表。

page_info

PageInfo object

参数解释:分页信息。

request_id

String

参数解释:请求ID。

取值范围:由数字、小写字母和中划线(-)组成的字符串,自动生成。

表5 DnsIpResponse

参数

参数类型

描述

enable

Boolean

参数解释:IP地址是否已加入到域名解析。

取值范围

  • true:已加入域名解析。

  • false:未加入域名解析。

ip_address

String

参数解释:IPv4或IPv6地址。

type

String

参数解释:IP地址类型。

取值范围

  • vip:私网IP。

  • eip:公网IP。

domain_name

String

参数解释:当前IP地址关联的负载均衡实例域名。

created_at

String

参数解释:创建时间。

取值范围:不涉及

updated_at

String

参数解释:更新时间。

取值范围:不涉及

表6 PageInfo

参数

参数类型

描述

previous_marker

String

参数解释:分页查询结果中第一条记录的ID。通常用于配合page_reverse=true查询上一页。

取值范围:不涉及

next_marker

String

参数解释:分页查询结果中最后一条记录的ID。通常用于查询下一页。

取值范围:不涉及

current_count

Integer

参数解释:当前页返回记录数。

取值范围:不涉及

请求示例

查询负载均衡器IP地址的域名解析配置

GET https://{ELB_Endpoint}/v3/{project_id}/elb/loadbalancers/38278031-cfca-44be-81be-a412f618773b/dns/ips

响应示例

状态码:200

操作成功正常返回。

{
  "request_id" : "888189c3-06b0-4e37-bba9-9063e18a420e",
  "ips" : [ {
    "enable" : true,
    "type" : "eip",
    "created_at" : "2026-01-29T06:57:26Z",
    "updated_at" : "2026-01-29T06:57:26Z",
    "ip_address" : "10.83.50.35",
    "domain_name" : "737b61b6-ff56-4112-a14a-c7abaa4e58bf.elb.example.com"
  }, {
    "enable" : true,
    "type" : "vip",
    "created_at" : "2026-01-29T07:01:46Z",
    "updated_at" : "2026-01-29T07:01:46Z",
    "ip_address" : "192.168.0.166",
    "domain_name" : "737b61b6-ff56-4112-a14a-c7abaa4e58bf-internal.elb.elb-test"
  } ],
  "page_info" : {
    "previous_marker" : "7b8eec37-fd21-49ac-83d5-31e54fc052e8",
    "current_count" : 2
  }
}

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
48
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.elb.v3.region.ElbRegion;
import com.huaweicloud.sdk.elb.v3.*;
import com.huaweicloud.sdk.elb.v3.model.*;


public class ListDomainIPsSolution {

    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);

        ElbClient client = ElbClient.newBuilder()
                .withCredential(auth)
                .withRegion(ElbRegion.valueOf("<YOUR REGION>"))
                .build();
        ListDomainIPsRequest request = new ListDomainIPsRequest();
        request.withLoadbalancerId("{loadbalancer_id}");
        try {
            ListDomainIPsResponse response = client.listDomainIPs(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
32
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkelb.v3.region.elb_region import ElbRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkelb.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 = ElbClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(ElbRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListDomainIPsRequest()
        request.loadbalancer_id = "{loadbalancer_id}"
        response = client.list_domain_i_ps(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
38
39
40
41
42
43
44
45
46
47
48
49
50
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    elb "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/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, err := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        SafeBuild()

    if err != nil {
        fmt.Println(err)
        return
    }

    hcClient, err := elb.ElbClientBuilder().
         WithRegion(region.ValueOf("<YOUR REGION>")).
         WithCredential(auth).
         SafeBuild()


    if err != nil {
        fmt.Println(err)
        return
    }

    client := elb.NewElbClient(hcClient)

    request := &model.ListDomainIPsRequest{}
	request.LoadbalancerId = "{loadbalancer_id}"
	response, err := client.ListDomainIPs(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

操作成功正常返回。

错误码

请参见错误码

相关文档