Querying Backend Server Groups
Function
This API is used to query all backend server groups.
Constraints
This API has the following constraints:
-
Parameters marker, limit, and page_reverse are used for pagination query.
-
Parameters marker and page_reverse take effect only when they are used together with parameter limit.
Calling Method
For details, see Calling APIs.
URI
GET /v3/{project_id}/elb/pools
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Definition: Specifies the project ID. For details about how to obtain a project ID, see Obtaining a Project ID. Constraints: N/A Range: The value can contain a maximum of 32 characters, including digits and lowercase letters. Default value: N/A |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
marker |
No |
String |
Definition: Specifies the ID of the last record on the previous page. Constraints:
Range: N/A Default value: N/A |
limit |
No |
Integer |
Definition: Specifies the number of records returned on each page. Constraints: N/A Range: 0 to 2000 Default value: 2000 |
page_reverse |
No |
Boolean |
Definition: Specifies whether to use reverse query. Constraints:
Range:
Default value: false |
description |
No |
Array of strings |
Definition: Specifies supplementary information about the backend server group. Multiple descriptions can be used for query in the format of description=xxx&description=xxx. Constraints: N/A Range: N/A Default value: N/A |
admin_state_up |
No |
Boolean |
Definition: Specifies the administrative status of the backend server group. Constraints: N/A Range: N/A Default value: N/A |
healthmonitor_id |
No |
Array of strings |
Definition: Specifies the ID of the health check configured for the backend server group. Multiple IDs can be used for query in the format of healthmonitor_id=xxx&healthmonitor_id=xxx. Constraints: N/A Range: N/A Default value: N/A |
id |
No |
Array of strings |
Definition: Specifies the ID of the backend server group. Multiple IDs can be used for query in the format of id=xxx&id=xxx. Constraints: N/A Range: N/A Default value: N/A |
name |
No |
Array of strings |
Definition: Specifies the backend server group name. Multiple names can be used for query in the format of name=xxx&name=xxx. Constraints: N/A Range: N/A Default value: N/A |
loadbalancer_id |
No |
Array of strings |
Definition: Specifies the ID of the load balancer with which the backend server group is associated. Multiple IDs can be used for query in the format of loadbalancer_id=xxx&loadbalancer_id=xxx. Constraints: N/A Range: N/A Default value: N/A |
protocol |
No |
Array of strings |
Definition: Specifies the protocol used by the backend server group to receive requests from the load balancer. Multiple protocols can be used for query in the format of protocol=xxx&protocol=xxx. Constraints: N/A Range: The value can be TCP, UDP, TLS, HTTP, HTTPS, GRPC, or QUIC. Default value: N/A |
lb_algorithm |
No |
Array of strings |
Definition: Specifies the load balancing algorithm used by the load balancer to route requests to backend servers in the associated backend server group. Multiple algorithms can be used for query in the format of lb_algorithm=xxx&lb_algorithm=xxx. Constraints: N/A Range:
Default value: N/A |
enterprise_project_id |
No |
Array of strings |
Definition: Specifies the ID of the enterprise project. Multiple values can be used for query in the format of: enterprise_project_id=xxx&enterprise_project_id=xxx. Constraints:
Range: N/A Default value: N/A |
ip_version |
No |
Array of strings |
Definition: Specifies the IP address version supported by the backend server group. Multiple versions can be used for query in the format of ip_version=xxx&ip_version=xxx. Constraints: N/A Range: N/A Default value: N/A |
member_address |
No |
Array of strings |
Definition: Specifies the IP address of the backend server. This is a query parameter and will not be included in the response. Multiple IP addresses can be used for query in the format of member_address=xxx&member_address=xxx. Constraints: N/A Range: N/A Default value: N/A |
member_device_id |
No |
Array of strings |
Definition: Specifies the ID of the ECS that is associated with the load balancer as a backend server. This is a query parameter and will not be included in the response. Multiple IDs can be used for query in the format of member_device_id=xxx&member_device_id=xxx. Constraints: N/A Range: N/A Default value: N/A |
member_deletion_protection_enable |
No |
Boolean |
Definition: Specifies whether to enable deletion protection. Constraints: N/A Range: false (disable this option) or true (enable this option). All resources will be queried if this parameter is not passed. Default value: N/A |
listener_id |
No |
Array of strings |
Definition: Specifies the IDs of the associated listeners, including the listeners associated through forwarding policies. Multiple IDs can be used for query in the format of listener_id=xxx&listener_id=xxx. Constraints: N/A Range: N/A Default value: N/A |
member_instance_id |
No |
Array of strings |
Definition: Specifies the backend server ID. This is a query parameter and will not be included in the response. Multiple IDs can be used for query in the format of member_instance_id=xxx&member_instance_id=xxx. Constraints: N/A Range: N/A Default value: N/A |
vpc_id |
No |
Array of strings |
Definition: Specifies the ID of the VPC where the backend server group works. Constraints: N/A Range: N/A Default value: N/A |
type |
No |
Array of strings |
Definition: Specifies the type of the backend server group. Constraints: N/A Range:
Default value: N/A |
protection_status |
No |
Array of strings |
Definition: Specifies the protection status. Constraints: N/A Range:
Default value: N/A |
connection_drain |
No |
Boolean |
Definition: Specifies a connection_drain value for query, in the format of connection_drain=true or connection_drain=false. Constraints: N/A Range: N/A Default value: N/A |
pool_health |
No |
String |
Definition: Specifies a pool_health value for query, in the format of minimum_healthy_member_count=0 or minimum_healthy_member_count=1. Constraints: N/A Range: N/A Default value: N/A |
any_port_enable |
No |
Boolean |
Definition: Specifies whether any_port_enable is enabled. If this option is enabled, the listener routes the requests to the backend server over the same port as the frontend port. Constraints: N/A Range: The value can be true (enabled) or false (disabled). Default value: N/A |
public_border_group |
No |
String |
Definition: Specifies the public border group. Multiple public border groups can be queried in the format of public_border_group=xxx&public_border_group=xxx. Constraints: N/A Range:
Default value: N/A |
quic_cid_len |
No |
Integer |
Definition: Specifies the QUIC connection ID that is used to query backend server groups. It is used only as a query condition but not as a response parameter. Multiple values can be used for query in the format of quic_cid_len=3&quic_cid_len=5. Constraints: N/A Range: N/A Default value: N/A |
quic_cid_offset |
No |
Integer |
Definition: Specifies the QUIC connection ID offset that is used to query backend server groups. It is used only as a query condition but not as a response parameter. Multiple values can be used for query in the format of quic_cid_offset=1&quic_cid_offset=3. Constraints: N/A Range: N/A Default value: N/A |
az_affinity |
No |
Array of strings |
Definition: Specifies whether AZ affinity of a backend server group is enabled. The following is an example: "az_affinity": { "enable": "true" } Multiple values can be used for query in the format of az_affinity=enable=true&az_affinity=enable=false. Constraints: N/A Range: N/A Default value: N/A |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Definition: Specifies the token used for IAM authentication. Constraints:N/A Range: N/A Default value: N/A |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Definition: Specifies the request ID. Range: The value is automatically generated, and can contain characters including digits, lowercase letters, and hyphens (-). |
page_info |
PageInfo object |
Definition: Specifies the pagination information. |
pools |
Array of Pool objects |
Definition: Lists the backend server groups. |
Parameter |
Type |
Description |
---|---|---|
previous_marker |
String |
Definition: Specifies the ID of the first record in the pagination query result. If page_reverse is set to true, this parameter is used together to query resources on the previous page. Range: N/A |
next_marker |
String |
Definition: Specifies the ID of the last record in the pagination query result. It is usually used to query resources on the next page. Range: N/A |
current_count |
Integer |
Definition: Specifies the number of records returned on the current page. Range: N/A |
Parameter |
Type |
Description |
---|---|---|
admin_state_up |
Boolean |
Definition: Specifies the administrative status of the backend server group. The value can only be true. Range: true (enabled) |
az_affinity |
AzAffinity object |
Definition: Specifies how AZ affinity is configured for the backend server group. |
description |
String |
Definition: Provides supplementary information about the backend server group. Range: N/A |
healthmonitor_id |
String |
Definition: Specifies the ID of the health check configured for the backend server group. Range: N/A |
id |
String |
Definition: Specifies the backend server group ID. Range: N/A |
lb_algorithm |
String |
Definition: Specifies the load balancing algorithm used by the load balancer to route requests to backend servers in the associated backend server group. Range:
|
listeners |
Array of ListenerRef objects |
Definition: Specifies the IDs of the listeners with which the backend server group is associated. |
loadbalancers |
Array of LoadBalancerRef objects |
Definition: Specifies the IDs of the load balancers with which the backend server group is associated. |
members |
Array of MemberRef objects |
Definition: Specifies the IDs of backend servers in the backend server group. |
name |
String |
Definition: Specifies the backend server group name. Range: N/A |
project_id |
String |
Definition: Specifies the project ID of the backend server group. Range: N/A |
protocol |
String |
Definition: Specifies the protocol used by the backend server group to receive requests from the load balancer. Constraints: N/A Range: The value can be TCP, UDP, TLS, HTTP, HTTPS, GRPC, or QUIC. Default value: N/A |
session_persistence |
SessionPersistence object |
Definition: Specifies the sticky session. |
ip_version |
String |
Definition: Specifies the IP address version supported by the backend server group. Range:
|
slow_start |
SlowStart object |
Definition: Specifies slow start details. After you enable slow start, new backend servers added to the backend server group are warmed up, and the number of requests they can receive increases linearly during the configured slow start duration. |
member_deletion_protection_enable |
Boolean |
Definition: Whether to enable removal protection for the backend server. Once the option is enabled, backend servers cannot be removed from the backend server group. Range: false (disable this option) or true (enable this option).
NOTE:
Disable deletion protection or removal protection for your resources before deregistering your account.
|
created_at |
String |
Definition: Specifies the creation time. Range: The value must be a UTC time in the yyyy-MM-dd'T'HH:mm:ss'Z' format. Note: This parameter will not be returned for resources associated with existing dedicated load balancers and for resources associated with existing and new shared load balancers. |
updated_at |
String |
Definition: Specifies the update time. Range: The value must be a UTC time in the yyyy-MM-dd'T'HH:mm:ss'Z' format. Note: This parameter will not be returned for resources associated with existing dedicated load balancers and for resources associated with existing and new shared load balancers. |
vpc_id |
String |
Definition: Specifies the ID of the VPC where the backend server group works. Range: N/A |
type |
String |
Definition: Specifies the backend server group type. Range:
|
protection_status |
String |
Definition: Specifies the protection status. Range:
|
protection_reason |
String |
Definition: Specifies why modification protection is enabled. Range: The value can contain a maximum of 255 Unicode characters, excluding angle brackets (<>). |
any_port_enable |
Boolean |
Definition: Specifies whether to enable any_port_enable for a backend server group. If this option is enabled, the listener routes the requests to the backend server over the same port as the frontend port. If this option is disabled, the listener routes the requests over the port specified by protocol_port. Constraints: This option is available only for TCP, UDP, or QUIC backend server groups. |
connection_drain |
ConnectionDrain object |
Definition: Specifies the configurations of deregistration delay. This parameter takes effect when:
|
enterprise_project_id |
String |
Definition: Specifies the ID of the enterprise project. Range:
|
pool_health |
PoolHealth object |
Definition: Specifies the configurations of the pool health feature. |
public_border_group |
String |
Definition: Specifies the public border group. Range:
|
quic_cid_hash_strategy |
QuicCidHashStrategy object |
Definition: Specifies multi-path distribution configuration based on destination connection IDs. |
Parameter |
Type |
Description |
---|---|---|
enable |
Boolean |
Definition: Specifies whether to enable AZ affinity for the backend server group. If this parameter is set to true, ELB forwards traffic across the backend servers in the same AZ as the load balancer. Constraints:
Range: false (disable this option) or true (enable this option). Default value: N/A |
az_minimum_healthy_member_percentage |
Integer |
Definition: Specifies a percentage that is used to determine the health of an AZ. If the percentage of healthy servers in the AZ of the load balancer falls below the specified value, az_unhealthy_fallback_strategy is triggered. az_minimum_healthy_member_percentage shows the percentage of backend servers that are healthy in a backend server group of an AZ. The number of healthy servers is rounded up. For example, in AZ A, if there are three backend servers in the backend server group and az_minimum_healthy_member_percentage is set to 66%, the number of healthy servers is rounded up to 2 (3 × 0.66 = 1.98). If there are fewer than two healthy servers in AZ A, az_unhealthy_fallback_strategy is triggered. If az_minimum_healthy_member_percentage is set to 67%, the number of healthy servers is rounded up to 3 (3 × 0.67 = 2.01). If there are fewer than three healthy servers in AZ A, az_unhealthy_fallback_strategy is triggered. Constraints:
Range: an integer ranging from -1 to 100. An integer from 0 to 100 indicates the percentage of healthy servers in the AZ of the load balancer. -1 indicates that az_minimum_healthy_member_count takes effect. Default value: N/A |
az_minimum_healthy_member_count |
Integer |
Definition: Specifies a number that is used to determine the health of an AZ. If the number of healthy servers in the AZ of the load balancer falls below the specified value, az_unhealthy_fallback_strategy is triggered. az_minimum_healthy_member_count shows the number of healthy servers in a backend server group of an AZ. Constraints:
Range: an integer ranging from -1 to 10000. An integer from 0 to 10000 indicates the number of healthy servers in the AZ of the load balancer. -1 indicates that az_minimum_healthy_member_percentage takes effect. Default value: N/A |
az_unhealthy_fallback_strategy |
String |
Definition: Specifies how traffic will be distributed across backend servers in an AZ if the percentage or number of healthy servers in the AZ of the load balancer falls below the specified value. Range:
Constraints: N/A Default value: forward_to_all_member_of_local_az |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Definition: Specifies the listener ID. Range: N/A |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Definition: Specifies the load balancer ID. Range: N/A |
Parameter |
Type |
Description |
---|---|---|
cookie_name |
String |
Definition: Specifies the cookie name. Range: The value can contain a maximum of 1,024 characters. |
type |
String |
Definition: Specifies the sticky session type. Range: SOURCE_IP, HTTP_COOKIE, or APP_COOKIE. |
persistence_timeout |
Integer |
Definition: Specifies the stickiness duration, in minutes. This parameter will not take effect when type is set to APP_COOKIE. Range:
|
Parameter |
Type |
Description |
---|---|---|
enable |
Boolean |
Definition: Specifies whether to enable slow start. Range:
|
duration |
Integer |
Definition: Specifies the slow start duration, in seconds. Range: 30 to 1200, in seconds. |
Parameter |
Type |
Description |
---|---|---|
enable |
Boolean |
Definition: Specifies whether to enable connection_drain. Constraints: N/A Range: The value can be true (enable this option) or false (disable this option). Default value: N/A |
timeout |
Integer |
Definition: Specifies the deregistration delay timeout, in seconds. Constraints: N/A Range: 10 to 4000, in seconds. Constraints: N/A |
Parameter |
Type |
Description |
---|---|---|
minimum_healthy_member_count |
Integer |
Definition: Specifies the number of healthy backend servers below which the backend server group is considered as unhealthy. Range:
|
Parameter |
Type |
Description |
---|---|---|
len |
Integer |
Definition: Specifies the length of the hash factor in the connection ID. Constraints: This parameter is valid only when the load balancing algorithm is QUIC_CID. Range: 1 to 20 Default value: 3 |
offset |
Integer |
Definition: Specifies the start position in the connection ID as the hash factor. Constraints: This parameter is valid only when the load balancing algorithm is QUIC_CID. Range: 0 to 19 Default value: 1 |
Example Requests
Querying backend server groups
GET https://{ELB_Endpoint}/v3/99a3fff0d03c428eac3678da6a7d0f24/elb/pools?limit=2
Example Responses
Status code: 200
Successful request.
{ "pools" : [ { "lb_algorithm" : "ROUND_ROBIN", "protocol" : "HTTP", "type" : "", "vpc_id" : "", "description" : "", "admin_state_up" : true, "member_deletion_protection_enable" : false, "loadbalancers" : [ { "id" : "309a0f61-0b62-45f2-97d1-742f3434338e" } ], "project_id" : "99a3fff0d03c428eac3678da6a7d0f24", "session_persistence" : { "cookie_name" : "my_cookie", "type" : "APP_COOKIE", "persistence_timeout" : 1 }, "healthmonitor_id" : "", "listeners" : [ ], "members" : [ ], "id" : "73bd4fe0-ffbb-4b56-aab4-4f26ddf7a103", "name" : "", "ip_version" : "v4", "pool_health" : { "minimum_healthy_member_count" : 0 } }, { "lb_algorithm" : "SOURCE_IP", "protocol" : "TCP", "description" : "", "admin_state_up" : true, "member_deletion_protection_enable" : false, "loadbalancers" : [ { "id" : "d9763e59-64b7-4e93-aec7-0ff7881ef9bc" } ], "project_id" : "99a3fff0d03c428eac3678da6a7d0f24", "session_persistence" : { "cookie_name" : "", "type" : "SOURCE_IP", "persistence_timeout" : 1 }, "healthmonitor_id" : "", "listeners" : [ { "id" : "8d21db6f-b475-429e-a9cb-90439b0413b2" } ], "members" : [ ], "id" : "74db02d1-5711-4c77-b383-a450e2b93142", "name" : "pool_tcp_001", "ip_version" : "dualstack", "pool_health" : { "minimum_healthy_member_count" : 0 }, "az_affinity" : { "enable" : true, "az_minimum_healthy_member_percentage" : -1, "az_minimum_healthy_member_count" : 10000, "az_unhealthy_fallback_strategy" : "forward_to_all_member_of_local_az" } } ], "page_info" : { "next_marker" : "74db02d1-5711-4c77-b383-a450e2b93142", "previous_marker" : "73bd4fe0-ffbb-4b56-aab4-4f26ddf7a103", "current_count" : 2 }, "request_id" : "a1a7e852-1928-48f7-bbc9-ca8469898713" }
SDK Sample Code
The SDK sample code is as follows.
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.elb.v3.region.ElbRegion; import com.huaweicloud.sdk.elb.v3.*; import com.huaweicloud.sdk.elb.v3.model.*; public class ListPoolsSolution { 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(); ListPoolsRequest request = new ListPoolsRequest(); try { ListPoolsResponse response = client.listPools(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 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 = ListPoolsRequest() response = client.list_pools(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" 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.ListPoolsRequest{} response, err := client.ListPools(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
Status Code |
Description |
---|---|
200 |
Successful request. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot