CreateVip

API Request

URLs
POST zstack/v1/vips
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "vip1",
    "l3NetworkUuid": "15788630ef6644af99c5378edf4e54da",
    "ipRangeUuid": "2e6e249189d83883aeb4c0fe79f82967",
    "requiredIp": "10.0.0.2"
  },
  "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 POST -d '{"params":{"name":"vip1","l3NetworkUuid":"b75e7bddf2803f6c85f8450b01262546","ipRangeUuid":"2e6e249189d83883aeb4c0fe79f82967","requiredIp":"10.0.0.2"}}' http://localhost:8080/zstack/v1/vips
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
l3NetworkUuid String body (contained in the params structure) The UUID of the L3 network that uses the VIP service. 0.6
ipRangeUuid String body (contained in the params structure) Optional. The IP range UUID. 3.9.0
allocatorStrategy String body (contained in the params structure) Optional. The allocator strategy.
  • DefaultHostAllocatorStrategy
  • LastHostPreferredAllocatorStrategy
  • LeastVmPreferredHostAllocatorStrategy
  • MinimumCPUUsageHostAllocatorStrategy
  • MinimumMemoryUsageHostAllocatorStrategy
  • MaxInstancePerHostHostAllocatorStrategy
0.6
requiredIp String body (contained in the params structure) Optional. The IP address that you specified. 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

Sample Response
 {
  "inventory": {
    "uuid": "45a2700283f039a39f40100505a68609",
    "name": "vip1",
    "ipRangeUuid": "da8d443f5c923c969118721845891d53",
    "l3NetworkUuid": "e43b5613fd8039ee888cca53dae87341",
    "ip": "192.168.0.1",
    "state": "Enabled",
    "gateway": "127.0.0.1",
    "netmask": "255.255.0.0",
    "peerL3NetworkUuids": [
      "1f970d11e2be3b0da5ad65cd4d20a549"
    ],
    "system": false
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory VipInventory See inventory. 0.6
#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. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
l3NetworkUuid String The UUID of the L3 network that uses the VIP service. 0.6
ip String The IP address of the IPv4 type. 0.6
state String The state of the VIP, including Enabled and Enabled. 0.6
gateway String The gateway. 0.6
netmask String The netmask. 0.6
prefixLen String The prefix length. 3.1.0
serviceProvider String The service provider that provides the VIP service. 0.6
peerL3NetworkUuid String The UUID of the L3 network that provides the VIP service. 0.6
useFor String The usage, such as port forwarding. 0.6
system boolean Whether the VIP is created by the system. 3.9.0
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
servicesRefs List See servicesRefs. 0.6
#servicesRefs
Name Type Description Starting Version
uuid String The resource UUID. 3.9.0
serviceType String The service type. 3.9.0
vipUuid String The VIP UUID. 3.9.0
createDate Timestamp The creation date. 3.9.0
lastOpDate Timestamp The last operation date. 3.9.0

SDK Sample

Java SDK
CreateVipAction action = new CreateVipAction();
action.name = "vip1";
action.l3NetworkUuid = "b75e7bddf2803f6c85f8450b01262546";
action.ipRangeUuid = "2e6e249189d83883aeb4c0fe79f82967";
action.requiredIp = "10.0.0.2";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVipAction.Result res = action.call();
Python SDK
CreateVipAction action = CreateVipAction()
action.name = "vip1"
action.l3NetworkUuid = "b75e7bddf2803f6c85f8450b01262546"
action.ipRangeUuid = "2e6e249189d83883aeb4c0fe79f82967"
action.requiredIp = "10.0.0.2"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateVipAction.Result res = action.call()