查询负载均衡器详情
功能介绍
查询负载均衡器详情。
调用方法
请参见如何调用API。
URI
GET /v3/{project_id}/elb/loadbalancers/{loadbalancer_id}
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
参数解释:项目ID。获取方式请参见获取项目ID。 约束限制:不涉及 取值范围:长度为32个字符,由小写字母和数字组成。 默认取值:不涉及 |
loadbalancer_id |
是 |
String |
参数解释:负载均衡器ID。 约束限制:不涉及 取值范围:不涉及 默认取值:不涉及 |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
是 |
String |
参数解释:IAM鉴权Token。 约束限制:不涉及 取值范围:不涉及 默认取值:不涉及 |
响应参数
状态码:200
参数 |
参数类型 |
描述 |
---|---|---|
request_id |
String |
参数解释:请求ID。 取值范围:由数字、小写字母和中划线(-)组成的字符串,自动生成。 |
loadbalancer |
LoadBalancer object |
参数解释:负载均衡器的详细信息。 默认取值:不涉及 |
参数 |
参数类型 |
描述 |
---|---|---|
id |
String |
参数解释:负载均衡器ID。 取值范围:不涉及 |
description |
String |
参数解释:负载均衡器描述信息。 取值范围:不涉及 |
provisioning_status |
String |
参数解释:负载均衡器的配置状态。 取值范围:
|
admin_state_up |
Boolean |
参数解释:负载均衡器的启用状态。 取值范围:
|
provider |
String |
参数解释:负载均衡器的生产者名称。固定为vlb。 取值范围:不涉及 |
pools |
Array of PoolRef objects |
参数解释:负载均衡器直接关联的后端服务器组的ID列表。 取值范围:不涉及 |
listeners |
Array of ListenerRef objects |
参数解释:负载均衡器关联的监听器的ID列表。 取值范围:不涉及 |
operating_status |
String |
参数解释:负载均衡器的操作状态。 取值范围:
|
name |
String |
参数解释:负载均衡器的名称。 取值范围:不涉及 |
project_id |
String |
参数解释:负载均衡器所属的项目ID。 取值范围:不涉及 |
vip_subnet_cidr_id |
String |
参数解释:负载均衡器所在子网的IPv4子网ID,也称为该负载均衡器实例的前端子网。 取值范围:不涉及 |
vip_address |
String |
参数解释:负载均衡器的IPv4私网IP地址。 取值范围:不涉及 |
vip_port_id |
String |
参数解释:负载均衡器的IPv4对应的port ID。 取值范围:不涉及 |
tags |
Array of Tag objects |
参数解释:负载均衡的标签列表。 取值范围:不涉及 |
created_at |
String |
参数解释:负载均衡器的创建时间。 取值范围: 格式:yyyy-MM-dd'T'HH:mm:ss'Z' |
updated_at |
String |
参数解释:负载均衡器的更新时间。 取值范围: 格式:yyyy-MM-dd'T'HH:mm:ss'Z' |
guaranteed |
Boolean |
参数解释:是否独享型LB。 取值范围:
|
vpc_id |
String |
参数解释:负载均衡器所在VPC ID。 取值范围:不涉及 |
eips |
Array of EipInfo objects |
参数解释:负载均衡器绑定的EIP。 取值范围:不涉及
该字段与publicips一致。
|
ipv6_vip_address |
String |
参数解释:双栈类型负载均衡器的IPv6地址。 取值范围:不涉及 |
ipv6_vip_virsubnet_id |
String |
参数解释:双栈类型负载均衡器所在子网的IPv6网络ID,也称为该负载均衡器实例的前端子网。 取值范围:不涉及 |
ipv6_vip_port_id |
String |
参数解释:双栈类型负载均衡器的IPv6对应的port ID。 取值范围:不涉及 |
availability_zone_list |
Array of strings |
参数解释:负载均衡器所在的可用区列表。 取值范围:不涉及 |
enterprise_project_id |
String |
参数解释:资源所属的企业项目ID。 取值范围:
|
billing_info |
String |
参数解释:资源账单信息。 取值范围:
|
l4_flavor_id |
String |
参数解释:负载均衡器4层规格ID。 若当前负载均衡器是弹性规格实例,则该字段表示4层上限规格。 取值范围:不涉及 |
l4_scale_flavor_id |
String |
参数解释:四层弹性规格ID。 取值范围:不涉及
该字段已经废弃,请勿使用。
|
l7_flavor_id |
String |
参数解释:负载均衡器7层规格ID。 若当前负载均衡器是弹性规格实例,则该字段表示7层上限规格。 取值范围:不涉及 |
l7_scale_flavor_id |
String |
参数解释:七层弹性Flavor ID。 取值范围:不涉及
该字段已经废弃,请勿使用。
|
gw_flavor_id |
String |
参数解释:网关型负载均衡器的规格ID。 取值范围:不涉及 不支持该字段,请勿使用。 |
loadbalancer_type |
String |
参数解释:负载均衡器类别。 取值范围:
不支持该字段,请勿使用。 |
publicips |
Array of PublicIpInfo objects |
参数解释:负载均衡器绑定的公网IP。 取值范围:不涉及
该字段与eips一致。
|
global_eips |
Array of GlobalEipInfo objects |
参数解释:负载均衡器绑定的global eip。 取值范围:不涉及 |
elb_virsubnet_ids |
Array of strings |
参数解释:下联面子网的网络ID列表。 取值范围:不涉及 |
elb_virsubnet_type |
String |
参数解释:下联面子网类型。 取值范围:
|
ip_target_enable |
Boolean |
参数解释:是否启用跨VPC后端转发。 开启跨VPC后端转发后,后端服务器组不仅支持添加云上VPC内的服务器,还支持添加其他VPC、其他公有云、云下数据中心的服务器。 取值范围:
|
frozen_scene |
String |
参数解释:负载均衡器的冻结场景。 若负载均衡器有多个冻结场景,用逗号分隔。 取值范围:
|
deletion_protection_enable |
Boolean |
参数解释:是否开启删除保护。仅当前局点启用删除保护特性后才会返回该字段。 取值范围:
|
autoscaling |
AutoscalingRef object |
参数解释:弹性扩缩容配置信息。负载均衡器开启弹性扩缩容后,可根据负载情况自动调整负载均衡器的规格。 默认取值:不涉及
该字段已经废弃,但仍然保留兼容性支持,建议不要使用该字段。如果传入该字段,创建的弹性实例将会有保底规格并产生对应保底规格的费用。
|
public_border_group |
String |
参数解释:公网边界组。 取值范围:
|
charge_mode |
String |
参数解释:负载均衡器实例的计费模式。 取值范围:
|
service_lb_mode |
String |
参数解释:LB模式。 取值范围:
不支持该字段,请勿使用。 |
instance_type |
String |
参数解释:标识实例归属哪个内部服务。 取值范围:不涉及 不支持该字段,请勿使用。 |
instance_id |
String |
参数解释:标识实例绑定内部服务的实例ID。 取值范围:不涉及 不支持该字段,请勿使用。 |
proxy_protocol_extensions |
Array of ProxyProtocolExtension objects |
参数解释:pp扩展。 取值范围:不涉及 不支持该字段,请勿使用。 |
waf_failure_action |
String |
参数解释:WAF故障时的流量处理策略。 取值范围:discard:丢弃,forward: 转发到后端。 |
protection_status |
String |
参数解释:修改保护状态。 取值范围:
|
protection_reason |
String |
参数解释:设置保护的原因。作为protection_status的转态设置的原因。 取值范围:除'<'和'>'外通用Unicode字符集字符,最大255个字符。 |
log_group_id |
String |
参数解释:LB所关联的云日志服务(LTS)的日志组ID。 取值范围:不涉及 |
log_topic_id |
String |
参数解释:LB所关联的云日志服务(LTS)的日志组下的日志流ID。 取值范围:不涉及 |
参数 |
参数类型 |
描述 |
---|---|---|
eip_id |
String |
参数解释:弹性IP的ID。 取值范围:不涉及 |
eip_address |
String |
参数解释:弹性IP的IP地址。 取值范围:不涉及 |
ip_version |
Integer |
参数解释:IP版本号。 取值范围:
|
参数 |
参数类型 |
描述 |
---|---|---|
publicip_id |
String |
参数解释:弹性公网EIP的ID。 取值范围:不涉及 |
publicip_address |
String |
参数解释:EIP的IP地址。 取值范围:不涉及 |
ip_version |
Integer |
参数解释:IP版本信息。 取值范围:
|
参数 |
参数类型 |
描述 |
---|---|---|
global_eip_id |
String |
参数解释:global eip的ID。 取值范围:不涉及 |
global_eip_address |
String |
参数解释:global eip的ip地址。 取值范围:不涉及 |
ip_version |
Integer |
参数解释:IP版本信息。 取值范围:
|
参数 |
参数类型 |
描述 |
---|---|---|
enable |
Boolean |
参数解释:当前负载均衡器是否开启弹性扩缩容。 取值范围:
|
min_l7_flavor_id |
String |
参数解释:弹性扩缩容的最小七层规格ID(规格类型L7_elastic)。 取值范围:不涉及 |
参数 |
参数类型 |
描述 |
---|---|---|
vip_address |
String |
参数解释:ipv4 vip地址。 约束限制:不涉及 取值范围:不涉及 默认取值:不涉及 |
ipv6_vip_address |
String |
参数解释:ipv6 vip地址。 约束限制:不涉及 取值范围:不涉及 默认取值:不涉及 |
extension |
Extension object |
参数解释:pp 扩展。 约束限制:不涉及 取值范围:不涉及 默认取值:不涉及 |
请求示例
查询指定负载均衡器的详情信息
GET https://{ELB_Endpoint}/v3/060576782980d5762f9ec014dd2f1148/elb/loadbalancers/3dbde7e5-c277-4ea3-a424-edd339357eff
响应示例
状态码:200
操作正常返回。
{
"loadbalancer" : {
"id" : "3dbde7e5-c277-4ea3-a424-edd339357eff",
"project_id" : "060576782980d5762f9ec014dd2f1148",
"name" : "elb-l4-no-delete",
"description" : null,
"vip_port_id" : "f079c7ee-65a9-44ef-be86-53d8927e59be",
"vip_address" : "10.0.0.196",
"admin_state_up" : true,
"provisioning_status" : "ACTIVE",
"operating_status" : "ONLINE",
"listeners" : [ ],
"pools" : [ {
"id" : "1d864dc9-f6ef-4366-b59d-7034cde2328f"
}, {
"id" : "c0a2e4a1-c028-4a24-a62f-e721c52f5513"
}, {
"id" : "79308896-6169-4c28-acbc-e139eb661996"
} ],
"tags" : [ ],
"provider" : null,
"created_at" : "2019-12-02T09:55:11Z",
"updated_at" : "2019-12-02T09:55:11Z",
"vpc_id" : "70711260-9de9-4d96-9839-0ae698e00109",
"enterprise_project_id" : "0",
"availability_zone_list" : [ ],
"ipv6_vip_address" : null,
"ipv6_vip_virsubnet_id" : null,
"ipv6_vip_port_id" : null,
"publicips" : [ ],
"elb_virsubnet_ids" : [ "ad5d63bf-3b50-4e88-b4d9-e94a59aade48" ],
"eips" : [ ],
"guaranteed" : true,
"billing_info" : null,
"l4_flavor_id" : "e5acacda-f861-404e-9871-df480c49d185",
"l4_scale_flavor_id" : null,
"l7_flavor_id" : null,
"l7_scale_flavor_id" : null,
"vip_subnet_cidr_id" : "396d918a-756e-4163-8450-3bdc860109cf",
"deletion_protection_enable" : false,
"autoscaling" : {
"enable" : true,
"min_l7_flavor_id" : "0c8cf29d-51cb-4c1d-8e25-1c61cf5c2b00"
},
"public_border_group" : "center"
},
"request_id" : "1a47cfbf-969f-4e40-8c0e-c2e60b14bcac"
}
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 ShowLoadBalancerSolution {
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();
ShowLoadBalancerRequest request = new ShowLoadBalancerRequest();
request.withLoadbalancerId("{loadbalancer_id}");
try {
ShowLoadBalancerResponse response = client.showLoadBalancer(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 = ShowLoadBalancerRequest()
request.loadbalancer_id = "{loadbalancer_id}"
response = client.show_load_balancer(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 |
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 := basic.NewCredentialsBuilder().
WithAk(ak).
WithSk(sk).
WithProjectId(projectId).
Build()
client := elb.NewElbClient(
elb.ElbClientBuilder().
WithRegion(region.ValueOf("<YOUR REGION>")).
WithCredential(auth).
Build())
request := &model.ShowLoadBalancerRequest{}
request.LoadbalancerId = "{loadbalancer_id}"
response, err := client.ShowLoadBalancer(request)
if err == nil {
fmt.Printf("%+v\n", response)
} else {
fmt.Println(err)
}
}
|
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的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 ShowLoadBalancerSolution {
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();
ShowLoadBalancerRequest request = new ShowLoadBalancerRequest();
request.withLoadbalancerId("{loadbalancer_id}");
try {
ShowLoadBalancerResponse response = client.showLoadBalancer(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 = ShowLoadBalancerRequest()
request.loadbalancer_id = "{loadbalancer_id}"
response = client.show_load_balancer(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 |
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 := basic.NewCredentialsBuilder().
WithAk(ak).
WithSk(sk).
WithProjectId(projectId).
Build()
client := elb.NewElbClient(
elb.ElbClientBuilder().
WithRegion(region.ValueOf("<YOUR REGION>")).
WithCredential(auth).
Build())
request := &model.ShowLoadBalancerRequest{}
request.LoadbalancerId = "{loadbalancer_id}"
response, err := client.ShowLoadBalancer(request)
if err == nil {
fmt.Printf("%+v\n", response)
} else {
fmt.Println(err)
}
}
|
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
状态码 |
描述 |
---|---|
200 |
操作正常返回。 |
错误码
请参见错误码。