Querying Backend Server Groups
Function
This API is used to query all backend server groups.
Constraints
This API has the following constraints:
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
elb:pools:list
List
pool *
-
-
-
-
g:EnterpriseProjectId
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 |
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, IP, TLS, HTTP, HTTPS, GRPC, or QUIC. |
| 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. Range: true (enable this option) or false (disable this option) |
| connection_drain | ConnectionDrain object | Definition: Specifies the configurations of deregistration delay. This parameter is only available for TCP, UDP, and QUIC backend server groups and TCP and UDP listeners. 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 |
|---|---|---|
| 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 |
|---|---|---|
| enable | Boolean | Definition: Specifies whether to enable slow start. Range: |
| duration | Integer | Definition: Specifies the slow start duration, in seconds. Range: 30 to 1200 |
| 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 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/{project_id}/elb/pools?limit=2 Example Responses
Status code: 200
Successful request.
{
"request_id" : "cc07698a1f12dd65c7d70bf1c56e62e8",
"pools" : [ {
"name" : "server_group-0149",
"id" : "00ed68a5-8784-424e-8936-8dbb7a9d41e9",
"description" : "",
"lb_algorithm" : "ROUND_ROBIN",
"protocol" : "TCP",
"admin_state_up" : true,
"loadbalancers" : [ ],
"type" : "instance",
"project_id" : "0c1503d710984bad92306faea3654dfd",
"enterprise_project_id" : "0",
"session_persistence" : null,
"slow_start" : null,
"healthmonitor_id" : "a5f47d4c-1187-402f-849c-c0a7767e36f5",
"listeners" : [ ],
"members" : [ {
"id" : "87b1130c-80dc-493d-b98a-add98ea4c6a2"
} ],
"ip_version" : "dualstack",
"member_deletion_protection_enable" : false,
"created_at" : "2024-08-19T17:49:53Z",
"updated_at" : "2024-09-09T09:21:05Z",
"protection_status" : "nonProtection",
"protection_reason" : "",
"vpc_id" : "651594cf-18a0-4a77-942f-1a4ae216c123",
"connection_drain" : {
"enable" : true,
"timeout" : 300
},
"pool_health" : {
"minimum_healthy_member_count" : 0
},
"az_affinity" : {
"enable" : true,
"az_minimum_healthy_member_percentage" : -1,
"az_minimum_healthy_member_count" : 1,
"az_unhealthy_fallback_strategy" : "forward_to_all_member_of_local_az"
},
"quic_cid_hash_strategy" : null,
"public_border_group" : "center",
"any_port_enable" : false
}, {
"name" : "server_group-9930-jpp",
"id" : "0149afd9-18b8-444f-ae7c-87f1b0ddacde",
"description" : "",
"lb_algorithm" : "ROUND_ROBIN",
"protocol" : "HTTP",
"admin_state_up" : true,
"loadbalancers" : [ ],
"type" : "instance",
"project_id" : "0c1503d710984bad92306faea3654dfd",
"enterprise_project_id" : "0",
"session_persistence" : null,
"slow_start" : {
"enable" : false,
"duration" : 30
},
"healthmonitor_id" : "9e48250b-4e2a-402a-bc3d-e0c431e82d63",
"listeners" : [ ],
"members" : [ {
"id" : "bd1500d4-a06d-47d9-bed7-2454b716f63e"
} ],
"ip_version" : "v4",
"member_deletion_protection_enable" : false,
"created_at" : "2024-04-29T08:21:47Z",
"updated_at" : "2024-07-23T03:41:03Z",
"protection_status" : "nonProtection",
"protection_reason" : "",
"vpc_id" : "60cb5110-771b-4459-89cd-becb303263fc",
"connection_drain" : null,
"pool_health" : {
"minimum_healthy_member_count" : 0
},
"az_affinity" : null,
"quic_cid_hash_strategy" : null,
"public_border_group" : "center",
"any_port_enable" : false
} ],
"page_info" : {
"next_marker" : "0149afd9-18b8-444f-ae7c-87f1b0ddacde",
"previous_marker" : "00ed68a5-8784-424e-8936-8dbb7a9d41e9",
"current_count" : 2
}
} 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 38 39 40 41 42 43 44 45 46 47 48 49 | 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.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