หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา
Updating a Backend Server Group
Function
This API is used to update a backend server group.
Constraints
The backend server group can be updated only when the provisioning status of the associated load balancer is ACTIVE.
Calling Method
For details, see Calling APIs.
URI
PUT /v3/{project_id}/elb/pools/{pool_id}
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
pool_id |
Yes |
String |
Specifies the backend server group ID. |
project_id |
Yes |
String |
Specifies the project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Specifies the token used for IAM authentication. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
pool |
Yes |
UpdatePoolOption object |
Specifies the backend server group. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
admin_state_up |
No |
Boolean |
Specifies the administrative status of the backend server group. The value can only be updated to true. |
description |
No |
String |
Provides supplementary information about the backend server group. |
lb_algorithm |
No |
String |
Specifies the load balancing algorithm used by the load balancer to route requests to backend servers in the associated backend server group. Value options:
|
name |
No |
String |
Specifies the backend server group name. |
session_persistence |
No |
Specifies the sticky session. |
|
slow_start |
No |
UpdatePoolSlowStartOption object |
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. Note: This parameter can be used when the protocol of the backend server group is HTTP or HTTPS. |
member_deletion_protection_enable |
No |
Boolean |
Specifies whether to enable deletion protection. Value options:
Disable deletion protection for all your resources before deleting your account. |
vpc_id |
No |
String |
Specifies the ID of the VPC where the backend server group works. This parameter can be updated only when vpc_id is left blank. |
type |
No |
String |
Specifies the type of the backend server group. Value options:
Note: This parameter can be updated only when type is left blank. |
protection_status |
No |
String |
Specifies the protection status. Value options:
|
protection_reason |
No |
String |
Specifies why the modification protection is enabled. Note: This parameter is valid only when protection_status is set to consoleProtection. The value can contain a maximum of 255 Unicode characters, excluding angle brackets (<>). |
any_port_enable |
No |
Boolean |
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. Value options:
Note: This option is available only for TCP, UDP, or QUIC backend server groups. |
connection_drain |
No |
ConnectionDrain object |
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:
|
pool_health |
No |
PoolHealth object |
Specifies the configurations of the pool health feature. |
quic_cid_hash_strategy |
No |
QuicCidHashStrategy object |
Specifies multi-path distribution configuration based on destination connection IDs. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
cookie_name |
No |
String |
Specifies the cookie name. Note:
Value ranges:
|
type |
No |
String |
Specifies the sticky session type. The value can be SOURCE_IP, HTTP_COOKIE, or APP_COOKIE.Note:
|
persistence_timeout |
No |
Integer |
Specifies the stickiness duration, in minutes. This parameter will not take effect when type is set to APP_COOKIE.
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
enable |
No |
Boolean |
Specifies whether to enable slow start.
|
duration |
No |
Integer |
Specifies the slow start duration, in seconds. The value ranges from 30 to 1200, and the default value is 30. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
enable |
No |
Boolean |
Specifies whether to enable connection_drain. Value options:
|
timeout |
No |
Integer |
Specifies the deregistration delay timeout, in seconds. The value ranges from 10 to 4000. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
minimum_healthy_member_count |
No |
Integer |
If the number of healthy backend servers is less than the value specified for this parameter, the backend server group is considered as unhealthy. The value can be 0 (disabled) or 1 (enabled). |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
len |
Yes |
Integer |
Specifies the length of the hash factor in the connection ID, in byte. This parameter is valid only when the load balancing algorithm is QUIC_CID. Value range: 1 to 20 Default value: 3 |
offset |
Yes |
Integer |
Specifies the start position in the connection ID as the hash factor, in byte. This parameter is valid only when the load balancing algorithm is QUIC_CID. Value range: 0 to 19 Default value: 1 |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Specifies the request ID. Note: The value is automatically generated. |
pool |
Pool object |
Specifies the backend server group. |
Parameter |
Type |
Description |
---|---|---|
admin_state_up |
Boolean |
Specifies the administrative status of the backend server group. |
description |
String |
Provides supplementary information about the backend server group. |
healthmonitor_id |
String |
Specifies the ID of the health check configured for the backend server group. |
id |
String |
Specifies the backend server group ID. |
lb_algorithm |
String |
Specifies the load balancing algorithm used by the load balancer to route requests to backend servers in the associated backend server group. Value options:
|
listeners |
Array of ListenerRef objects |
Specifies the IDs of the listeners with which the backend server group is associated. |
loadbalancers |
Array of LoadBalancerRef objects |
Specifies the IDs of the load balancers with which the backend server group is associated. |
members |
Array of MemberRef objects |
Specifies the IDs of the backend servers in the backend server group. |
name |
String |
Specifies the backend server group name. |
project_id |
String |
Specifies the project ID. |
protocol |
String |
Specifies the protocol used by the backend server group to receive requests. The value can be TCP, UDP, TLS, HTTP, HTTPS, GRPC, or QUIC. Note:
Note:
|
session_persistence |
SessionPersistence object |
Specifies the sticky session. |
ip_version |
String |
Specifies the IP address version supported by the backend server group. Value range:
|
slow_start |
SlowStart object |
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. This parameter can be used when the protocol of the backend server group is HTTP or HTTPS. An error will be returned if the protocol is not HTTP or HTTPS. |
member_deletion_protection_enable |
Boolean |
Specifies whether to enable deletion protection. Value options:
Disable deletion protection for all your resources before deleting your account. |
created_at |
String |
Specifies the time when the backend server group was created. The format is yyyy-MM-dd'T'HH:mm:ss'Z' (UTC time). This is a new field in this version, and it 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 |
Specifies the time when the backend server group was updated. The format is yyyy-MM-dd'T'HH:mm:ss'Z' (UTC time). This is a new field in this version, and it 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 |
Specifies the ID of the VPC where the backend server group works. |
type |
String |
Specifies the type of the backend server group. Value options:
|
protection_status |
String |
Specifies the protection status. Value options:
|
protection_reason |
String |
Specifies why the modification protection is enabled. Note: This parameter is valid only when protection_status is set to consoleProtection. The value can contain a maximum of 255 Unicode characters, excluding angle brackets (<>). |
any_port_enable |
Boolean |
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. Value options:
Note: This option is available only for TCP, UDP, or QUIC backend server groups. |
connection_drain |
ConnectionDrain object |
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 |
Specifies the ID of the enterprise project that the IP address group belongs to. |
pool_health |
PoolHealth object |
Specifies the configurations of the pool health feature. |
public_border_group |
String |
Specifies the public border group, for example, center. |
quic_cid_hash_strategy |
QuicCidHashStrategy object |
Specifies multi-path forwarding policy based on destination connection IDs. |
Parameter |
Type |
Description |
---|---|---|
cookie_name |
String |
Specifies the cookie name. Note:
Value ranges:
|
type |
String |
Specifies the sticky session type. The value can be SOURCE_IP, HTTP_COOKIE, or APP_COOKIE. Note:
|
persistence_timeout |
Integer |
Specifies the stickiness duration, in minutes. This parameter will not take effect when type is set to APP_COOKIE.
|
Parameter |
Type |
Description |
---|---|---|
enable |
Boolean |
Specifies whether to enable slow start.
|
duration |
Integer |
Specifies the slow start duration, in seconds. The value ranges from 30 to 1200, and the default value is 30. |
Parameter |
Type |
Description |
---|---|---|
enable |
Boolean |
Specifies whether to enable connection_drain. Value options:
|
timeout |
Integer |
Specifies the deregistration delay timeout, in seconds. The value ranges from 10 to 4000. |
Parameter |
Type |
Description |
---|---|---|
minimum_healthy_member_count |
Integer |
If the number of healthy backend servers is less than the value specified for this parameter, the backend server group is considered as unhealthy. The value can be 0 (disabled) or 1 (enabled). |
Parameter |
Type |
Description |
---|---|---|
len |
Integer |
Specifies the length of the hash factor in the connection ID, in byte. This parameter is valid only when the load balancing algorithm is QUIC_CID. Value range: 1 to 20 Default value: 3 |
offset |
Integer |
Specifies the start position in the connection ID as the hash factor, in byte. This parameter is valid only when the load balancing algorithm is QUIC_CID. Value range: 0 to 19 Default value: 1 |
Example Requests
Changing the load balancing algorithm of a backend server group
PUT https://{ELB_Endpoint}/v3/99a3fff0d03c428eac3678da6a7d0f24/elb/pools/36ce7086-a496-4666-9064-5ba0e6840c75 { "pool" : { "name" : "My pool.", "description" : "My pool update", "lb_algorithm" : "LEAST_CONNECTIONS" } }
Example Responses
Status code: 200
Successful request.
{ "pool" : { "type" : "", "vpc_id" : "", "lb_algorithm" : "LEAST_CONNECTIONS", "protocol" : "TCP", "description" : "My pool update", "admin_state_up" : true, "member_deletion_protection_enable" : false, "loadbalancers" : [ { "id" : "098b2f68-af1c-41a9-8efd-69958722af62" } ], "project_id" : "99a3fff0d03c428eac3678da6a7d0f24", "session_persistence" : null, "healthmonitor_id" : null, "listeners" : [ { "id" : "0b11747a-b139-492f-9692-2df0b1c87193" }, { "id" : "61942790-2367-482a-8b0e-93840ea2a1c6" }, { "id" : "fd8f954c-f0f8-4d39-bb1d-41637cd6b1be" } ], "members" : [ ], "id" : "36ce7086-a496-4666-9064-5ba0e6840c75", "name" : "My pool.", "ip_version" : "dualstack", "pool_health" : { "minimum_healthy_member_count" : 0 } }, "request_id" : "8f40128b-c72b-4b64-986a-f7e2c633d75f" }
SDK Sample Code
The SDK sample code is as follows.
Changing the load balancing algorithm of a backend server group
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 51 52 53 54 55 |
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 UpdatePoolSolution { 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(); UpdatePoolRequest request = new UpdatePoolRequest(); request.withPoolId("{pool_id}"); UpdatePoolRequestBody body = new UpdatePoolRequestBody(); UpdatePoolOption poolbody = new UpdatePoolOption(); poolbody.withDescription("My pool update") .withLbAlgorithm("LEAST_CONNECTIONS") .withName("My pool."); body.withPool(poolbody); request.withBody(body); try { UpdatePoolResponse response = client.updatePool(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()); } } } |
Changing the load balancing algorithm of a backend server group
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 |
# 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 = UpdatePoolRequest() request.pool_id = "{pool_id}" poolbody = UpdatePoolOption( description="My pool update", lb_algorithm="LEAST_CONNECTIONS", name="My pool." ) request.body = UpdatePoolRequestBody( pool=poolbody ) response = client.update_pool(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Changing the load balancing algorithm of a backend server group
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 := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := elb.NewElbClient( elb.ElbClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.UpdatePoolRequest{} request.PoolId = "{pool_id}" descriptionPool:= "My pool update" lbAlgorithmPool:= "LEAST_CONNECTIONS" namePool:= "My pool." poolbody := &model.UpdatePoolOption{ Description: &descriptionPool, LbAlgorithm: &lbAlgorithmPool, Name: &namePool, } request.Body = &model.UpdatePoolRequestBody{ Pool: poolbody, } response, err := client.UpdatePool(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.
Changing the load balancing algorithm of a backend server group
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 51 52 53 54 55 |
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 UpdatePoolSolution { 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(); UpdatePoolRequest request = new UpdatePoolRequest(); request.withPoolId("{pool_id}"); UpdatePoolRequestBody body = new UpdatePoolRequestBody(); UpdatePoolOption poolbody = new UpdatePoolOption(); poolbody.withDescription("My pool update") .withLbAlgorithm("LEAST_CONNECTIONS") .withName("My pool."); body.withPool(poolbody); request.withBody(body); try { UpdatePoolResponse response = client.updatePool(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()); } } } |
Changing the load balancing algorithm of a backend server group
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 |
# 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 = UpdatePoolRequest() request.pool_id = "{pool_id}" poolbody = UpdatePoolOption( description="My pool update", lb_algorithm="LEAST_CONNECTIONS", name="My pool." ) request.body = UpdatePoolRequestBody( pool=poolbody ) response = client.update_pool(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Changing the load balancing algorithm of a backend server group
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 := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := elb.NewElbClient( elb.ElbClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.UpdatePoolRequest{} request.PoolId = "{pool_id}" descriptionPool:= "My pool update" lbAlgorithmPool:= "LEAST_CONNECTIONS" namePool:= "My pool." poolbody := &model.UpdatePoolOption{ Description: &descriptionPool, LbAlgorithm: &lbAlgorithmPool, Name: &namePool, } request.Body = &model.UpdatePoolRequestBody{ Pool: poolbody, } response, err := client.UpdatePool(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