CreateLoadBalancer

API Request

URLs
POST zstack/v1/load-balancers
Headers
Authorization: OAuth the-session-uuid
Body
{
"params": {
"name": "Test-Lb",
"vipUuid": "59a98484f6fe43b9af1d782f725f40ac"
  },
"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 855586410b7b4c0cba21bfd5ed2df4fb" \
-X POST -d '{"params":{"name":"Test-Lb","vipUuid":"d7720f0981853e91b37678e4acb1d4f0"}}' http://localhost:8080/zstack/v1/load-balancers
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The resource name. 0.6
description String body (contained in the params structure) Optional. The detailed description of the resource. 0.6
vipUuid String body (contained in the params structure) The VIP UUID. 0.6
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK
CreateLoadBalancerAction action = new CreateLoadBalancerAction();
action.name = "Test-Lb";
action.vipUuid = "861b79a91e894ea68f77ffd7007bb57d";
action.sessionId = "056fdb04a78544fd9a43f757d6af4700";
CreateLoadBalancerAction.Result res = action.call();
Python SDK
CreateLoadBalancerAction action = CreateLoadBalancerAction()
action.name = "Test-Lb"
action.vipUuid = "3b1839e4bef9437a9b0cf28789951009"
action.sessionId = "b21c8f46991440d48be3dcf5c4a36f15"
CreateLoadBalancerAction.Result res = action.call()