ChangeLoadBalancerListener

API Response

URLs
PUT zstack/v1/load-balancers/listeners/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "changeLoadBalancerListener": {
    "connectionIdleTimeout": 300.0,
    "maxConnection": 5000.0,
    "balancerAlgorithm": "roundrobin",
    "healthCheckTarget": "default",
    "healthyThreshold": 2.0,
    "unhealthyThreshold": 3.0,
    "healthCheckInterval": 5.0
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeLoadBalancerListener":{"connectionIdleTimeout":300.0,"maxConnection":5000.0,"balancerAlgorithm":"roundrobin","healthCheckTarget":"default","healthyThreshold":2.0,"unhealthyThreshold":3.0,"healthCheckInterval":5.0}}' http://localhost:8080/zstack/v1/load-balancers/listeners/ca4f7cea0c5a3a329742b127d7f80615/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.4.0
connectionIdleTimeout Integer body (contained in the changeLoadBalancerListener structure) Optional. 3.4.0
maxConnection Integer body (contained in the changeLoadBalancerListener structure) Optional. 3.4.0
balancerAlgorithm String body (contained in the changeLoadBalancerListener structure) Optional.
  • roundrobin
  • leastconn
  • source
3.4.0
healthCheckTarget String body (contained in the changeLoadBalancerListener structure) Optional. 3.4.0
healthyThreshold Integer body (contained in the changeLoadBalancerListener structure) Optional. 3.4.0
unhealthyThreshold Integer body (contained in the changeLoadBalancerListener structure) Optional. 3.4.0
healthCheckInterval Integer body (contained in the changeLoadBalancerListener structure) Optional. 3.4.0
healthCheckProtocol String body (contained in the changeLoadBalancerListener structure) Optional. The health check protocol.
  • tcp
  • udp
  • http
3.9.0
healthCheckMethod String body (contained in the changeLoadBalancerListener structure) Optional. The health check method.
  • GET
  • HEAD
3.9.0
healthCheckURI String body (contained in the changeLoadBalancerListener structure) Optional. The health check URI. 3.9.0
healthCheckHttpCode String body (contained in the changeLoadBalancerListener structure) Optional. The expected response code of the health check. 3.9.0
aclStatus String body (contained in the changeLoadBalancerListener structure) The access control status.
  • enable
  • disable
3.9.0
systemTags List body Optional. The system tags. 3.4.0
userTags List body Optional. The user tags. 3.4.0
Note:
  • When you change a parameter of a load balancer listener in ZStack Cloud, you can set the weight of the backend server by adding the balancerWeight option to SystemTags.
    • Format of the balancerWeight option: balancerWeight::{nicUuid}::{weight} . Here, weight is the weight of the backend server. Weight range: 0-100, integer. Default value: 100.
    • Example: balancerWeight::{"c44007641c9040c6b2587e19b1b3e2b0"}::{100}

API Response

Sample Response
{
  "inventory": {
    "uuid": "6356c8f8ae7534bab9a2175144dbc997",
    "name": "Test-Listener",
    "description": "desc info",
    "loadBalancerUuid": "4b32d1a27d8e3d77a606e5014caddd86",
    "instancePort": 80.0,
    "loadBalancerPort": 80.0,
    "protocol": "http"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.4.0
inventory LoadBalancerListenerInventory See inventory. 3.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.4.0
description String The brief description of the error. 3.4.0
details String The details about the error. 3.4.0
elaboration String The reserved field. Default value: null. 3.4.0
opaque LinkedHashMap The reserved field. Default value: null. 3.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.4.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.4.0
name String The resource name. 3.4.0
description String The detailed description of the resource. 3.4.0
loadBalancerUuid String The load balancer UUID. 3.4.0
instancePort Integer 3.4.0
loadBalancerPort Integer 3.4.0
protocol String 3.4.0
createDate Timestamp The creation date. 3.4.0
lastOpDate Timestamp The last operation date. 3.4.0
vmNicRefs List See vmNicRefs. 3.4.0
aclRefs List See aclRefs. 3.9.0
certificateRefs List See certificateRefs. 3.4.0
#vmNicRefs
Name Type Description Starting Version
id Long 3.4.0
listenerUuid String 3.4.0
vmNicUuid String The VM NIC UUID. 3.4.0
status String 3.4.0
createDate Timestamp The creation date. 3.4.0
lastOpDate Timestamp The last operation date. 3.4.0
#aclRefs
Name Type Description Starting Version
id Long The resource UUID. 3.9.0
listenerUuid String The listener UUID. 3.9.0
aclUuid String The UUID of the access control list. 3.9.0
type String The access control type. 3.9.0
createDate Timestamp The creation date. 3.9.0
lastOpDate Timestamp The last operation date. 3.9.0
#certificateRefs
Name Type Description Starting Version
id Long 3.4.0
listenerUuid String 3.4.0
certificateUuid String 3.4.0
createDate Timestamp The creation date. 3.4.0
lastOpDate Timestamp The last operation date. 3.4.0

SDK Sample

Java SDK
ChangeLoadBalancerListenerAction action = new ChangeLoadBalancerListenerAction();
action.uuid = "ca4f7cea0c5a3a329742b127d7f80615";
action.connectionIdleTimeout = 300.0;
action.maxConnection = 5000.0;
action.balancerAlgorithm = "roundrobin";
action.healthCheckTarget = "default";
action.healthyThreshold = 2.0;
action.unhealthyThreshold = 3.0;
action.healthCheckInterval = 5.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeLoadBalancerListenerAction.Result res = action.call();
Python SDK
ChangeLoadBalancerListenerAction action = ChangeLoadBalancerListenerAction()
action.uuid = "ca4f7cea0c5a3a329742b127d7f80615"
action.connectionIdleTimeout = 300.0
action.maxConnection = 5000.0
action.balancerAlgorithm = "roundrobin"
action.healthCheckTarget = "default"
action.healthyThreshold = 2.0
action.unhealthyThreshold = 3.0
action.healthCheckInterval = 5.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeLoadBalancerListenerAction.Result res = action.call()