Document navigation

VIP Operations

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": []
}

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

action = CreateVipAction()
action.name = "vip1"
action.l3NetworkUuid = "b75e7bddf2803f6c85f8450b01262546"
action.ipRangeUuid = "2e6e249189d83883aeb4c0fe79f82967"
action.requiredIp = "10.0.0.2"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

DeleteVip

API Request

URLs

DELETE zstack/v1/vips/{uuid}?deleteMode={deleteMode}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 191031ca5ac34d5e92e1a86cde878edf" \
-X DELETE http://localhost:8080/zstack/v1/vips/38791fa2927b459cbeff033db96c3479?deleteMode=Permissive

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
deleteMode String body Optional. The delete mode. 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

DeleteVipAction action = new DeleteVipAction();
action.uuid = "8da4c26b4089423f93cbce8ab804f9e9";
action.deleteMode = "Permissive";
action.sessionId = "772f7846b7c24d9b933deb8b03fc3024";
DeleteVipAction.Result res = action.call();

Python SDK

action = DeleteVipAction()
action.uuid = "addc2d7cb578402f9ce1569402338c1b"
action.deleteMode = "Permissive"
action.sessionId = "429360288ef140afaeb86961b638ea62"
res = action.call()

QueryVip

API Request

URLs

GET zstack/v1/vips
GET zstack/v1/vips/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth fbe1443215334b0aa609b5417f5f36ab" \
-X GET http://localhost:8080/zstack/v1/vips?q=uuid=ba1cf7be9f20433fa5091bec091ba22d
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 39036aee2ef641afac5b253aae2377be" \
-X GET http://localhost:8080/zstack/v1/vips/a077653982cb422daa06e6c2d840b140

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryVip, and pressing the Tab key.

API Response

Sample Response

{
  "inventories": [
    {
      "uuid": "8c5eb4938be549218fda4c87de4d8cad",
      "name": "new name",
      "ipRangeUuid": "7d0dda5b1c4f40069ec4cfd6b66bdf48",
      "l3NetworkUuid": "a81054a6807e47a09922473e9ab376cb",
      "ip": "192.168.0.1",
      "state": "Enabled",
      "gateway": "127.0.0.1",
      "netmask": "255.255.0.0",
      "peerL3NetworkUuid": [
        "64ef7a2ea9ec4095b343ea239a7ba344"
      ]
    }
  ]
}
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
inventories List See inventories. 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

#inventories

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 L3 network UUID. 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 L3 private network UUID or the VPC L3 network UUID. 0.6
useFor String The usage, such as port forwarding. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6

SDK Sample

Java SDK

QueryVipAction action = new QueryVipAction();
action.conditions = asList("uuid=0a573b1c687246ff970c04ef5d0eaf07");
action.sessionId = "bf2f206d12d742d3a9182ea663e12265";
QueryVipAction.Result res = action.call();

Python SDK

action = QueryVipAction()
action.conditions = ["uuid=5a3bf1e979944ea4a958fdac5a8bcef2"]
action.sessionId = "bc563fd71d014e84a49f1d280ef020ff"
res = action.call()

CheckVipPortAvailability

API Request

URLs

GET zstack/v1/vips/{vipUuid}/check-port-availability

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json";charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET -d '{"params":{"vipUuid":"b75e7bddf2803f6c85f8450b01262546","protocolType":"TCP","port":5}}' http://localhost:8080/zstack/v1/vips/e6ac71f8cf433c51822bedea67cf4781//check-port-availability

Parameters

Name Type Location Description Valid Values Starting Version
vipUuid String body(contained in the paramsstructure) The VIP UUID. 4.7.21
protocolType String body(contained in the paramsstructure) The protocol type. 4.7.21
port int body(contained in the paramsstructure) The port to be queried. 4.7.21

API Response

Sample Response

{
  "available":true
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 4.7.21
available boolean The available. 4.7.21

#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. 4.7.21
description String The brief description of the error. 4.7.21
details String The details about the error. 4.7.21
elaboration String The reserved field. Default value: null. 4.7.21
opaque LinkedHashMap The reserved field. Default value: null. 4.7.21
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.7.21

SDK Sample

Java SDK

CheckVipPortAvailabilityAction action = new CheckVipPortAvailabilityAction();
action.vipUuid = "e6ac71f8cf433c51822bedea67cf4781";
action.protocolType = "TCP";
action.port = 5;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CheckVipPortAvailabilityAction.Result res = action.call();

Python SDK

CheckVipPortAvailabilityAction action = new CheckVipPortAvailabilityAction();
action.vipUuid = "e6ac71f8cf433c51822bedea67cf4781";
action.protocolType = "TCP";
action.port = 5;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CheckVipPortAvailabilityAction.Result res = action.call();

GetVipAvailablePort

API Request

URLs

GET zstack/v1/vips/{vipUuid}/get-port-availability

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json";charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \-X GET -d '{"params":{"vipUuid":"b75e7bddf2803f6c85f8450b01262546","protocolType":"TCP","start":5,"limit":20}}' http://localhost:8080/zstack/v1/vips/e6ac71f8cf433c51822bedea67cf4781/get-port-availability

Parameters

Name Type Location Description Valid Values Starting Version
vipUuid String body(contained in the paramsstructure) The VIP UUID. 4.7.21
protocolType String body(contained in the paramsstructure) The protocol type. 4.7.21
start Integer body(contained in the paramsstructure) The query start point. 4.7.21
limit Integer body(contained in the paramsstructure) The query limit. 4.7.21

API Response

Sample Response

{
  "availablePort":[1,2,3]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 4.7.21
availablePort List The available port. 4.7.21

#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. 4.7.21
description String The brief description of the error. 4.7.21
details String The details about the error. 4.7.21
elaboration String The reserved field. Default value: null. 4.7.21
opaque LinkedHashMap The reserved field. Default value: null. 4.7.21
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.7.21

SDK Sample

Java SDK

GetVipAvailablePortAction action = new GetVipAvailablePortAction();
action.vipUuid = "e6ac71f8cf433c51822bedea67cf4781";
action.protocolType = "TCP";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetVipAvailablePortAction.Result res = action.call();

Python SDK

GetVipAvailablePortAction action = new GetVipAvailablePortAction();
action.vipUuid = "e6ac71f8cf433c51822bedea67cf4781";
action.protocolType = "TCP";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetVipAvailablePortAction.Result res = action.call();

UpdateVip

API Request

URLs

PUT zstack/v1/vips/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateVip": {
    "name": "new name"
  },
  "systemTags": [],
  "userTags": []
}

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 '{"updateVip":{"name":"new name"}}' \
http://localhost:8080/zstack/v1/vips/cb7f47adc9e0386d952990c88835048c/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
name String body (contained in the updateVip structure) Optional. The resource name. 0.6
description String body (contained in the updateVip structure) Optional. The detailed description of the resource. 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": "afc62fc544524344804c558156b57938",
    "name": "new name",
    "ipRangeUuid": "cbe101ec40844785ac64f0693e56122a",
    "l3NetworkUuid": "06272fa02c0b4776a0fb1bab6171ba34",
    "ip": "192.168.0.1",
    "state": "Enabled",
    "gateway": "127.0.0.1",
    "netmask": "255.255.0.0",
    "peerL3NetworkUuid": [
      "e35c8f6a65d14e8492e6fb72382dc1b4"
    ]
  }
}
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 L3 network UUID. 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 L3 private network UUID or the VPC L3 network UUID. 0.6
useFor String The usage, such as port forwarding. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6

SDK Sample

Java SDK

UpdateVipAction action = new UpdateVipAction();
action.uuid = "dbea243ee5c04eb5b68f8905baec42c6";
action.name = "new name";
action.sessionId = "b9f7110e36c147e7abcfbd0215c56368";
UpdateVipAction.Result res = action.call();

Python SDK

action = UpdateVipAction()
action.uuid = "620313f8f6724571addc8ef00959d951"
action.name = "new name"
action.sessionId = "4632313cde0a4cbaa67c7ff2109ebe60"
res = action.call()

ChangeVipState

API Request

URLs

PUT zstack/v1/vips/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "changeVipState": {
    "stateEvent": "enable"
  },
  "systemTags": [],
  "userTags": []
}

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 '{"changeVipState":{"stateEvent":"enable"}}' \
http://localhost:8080/zstack/v1/vips/5dae8db6e42831a1a219768d1f16abb5/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
stateEvent String body (contained in the changeVipState structure) The state event.
  • enable
  • disable
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": "50be5da2ebcc41b1aa0413b611f2a723",
    "name": "vip1",
    "ipRangeUuid": "6c8c280a596846a3967c1202cc049770",
    "l3NetworkUuid": "df62c1dedde04fffbd591dc737a10772",
    "ip": "192.168.0.1",
    "state": "Enabled",
    "gateway": "127.0.0.1",
    "netmask": "255.255.0.0",
    "peerL3NetworkUuid": [
      "bdb49f66946143538608b8feb6b3c35a"
    ]
  }
}
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 L3 network UUID. 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 L3 private network UUID or the VPC L3 network UUID. 0.6
useFor String The usage, such as port forwarding. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6

SDK Sample

Java SDK

ChangeVipStateAction action = new ChangeVipStateAction();
action.uuid = "2165a4d5e45441088244ff4fa3614412";
action.stateEvent = "enable";
action.sessionId = "2e1079fe6f4f45dab2f97f86d5a0fbc8";
ChangeVipStateAction.Result res = action.call();

Python SDK

action = ChangeVipStateAction()
action.uuid = "0191aa0014ae4b24ac7a87886a6d5527"
action.stateEvent = "enable"
action.sessionId = "1549fc2b0547482fb562020512ad89b6"
res = action.call()

GetVipUsedPorts

API Request

URLs

GET zstack/v1/vips/{uuid}/usedports

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth e7b86195e5f74c698dc5d0521b0ad25d" \
-X GET http://localhost:8080/zstack/v1/vips/d8474e0dbfe84d47a449bb34979cbcb9/usedports?protocol=TCP

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String query The VIP UUID. 2.2
protocol String query The protocol.
  • tcp
  • udp
2.2
systemTags List query Optional. The system tags. 2.2
userTags List query Optional. The user tags. 2.2

API Response

Sample Response

{
  "inventories": [
    {
      "uuid": "4f5f926580f4452a897b05b8f99e67ec",
      "protcol": "TCP",
      "usedPorts": [
        "100",
        "200",
        "201",
        "202",
        "204",
        "1000"
      ]
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.2
inventories List See inventories. 2.2

#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. 2.2
description String The brief description of the error. 2.2
details String The details about the error. 2.2
elaboration String The reserved field. Default value: null. 2.2
opaque LinkedHashMap The reserved field. Default value: null. 2.2
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.2

#inventories

Name Type Description Starting Version
uuid String The VIP UUID. 2.2
protcol String The protcol. 2.2
usedPorts List The used ports. 2.2

SDK Sample

Java SDK

GetVipUsedPortsAction action = new GetVipUsedPortsAction();
action.uuid = "771a6f6fae9d49dca26ae309d137549e";
action.protocol = "TCP";
action.sessionId = "ef2bbc8896fa4368a4da1c4b2e39a9d8";
GetVipUsedPortsAction.Result res = action.call();

Python SDK

action = GetVipUsedPortsAction()
action.uuid = "66313677af4e42fe8926703d89cf0164"
action.protocol = "TCP"
action.sessionId = "62f7ea6470954497966345142873bbfa"
res = action.call()

SetVipQos

API Request

URLs

PUT zstack/v1/vips/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "setVipQos": {
    "port": 22.0,
    "outboundBandwidth": 1048576.0,
    "inboundBandwidth": 1048576.0
  },
  "systemTags": [],
  "userTags": []
}

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 '{"setVipQos":{"port":22.0,"outboundBandwidth":1048576.0,"inboundBandwidth":1048576.0}}' \
http://localhost:8080/zstack/v1/vips/9b500046ab303d42a8d8a17565b5673b/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.3
port Integer body (contained in the setVipQos structure) Optional. The port. 2.3
outboundBandwidth Long body (contained in the setVipQos structure) Optional. The outbound bandwidth of the request port. 2.3
inboundBandwidth Long body (contained in the setVipQos structure) Optional. The inbound bandwidth of the request port. Make sure that either inboundBandwidth or outboundBandwidth is not null. 2.3
systemTags List body Optional. The system tags. 2.3
userTags List body Optional. The user tags. 2.3

Make sure that either inboundBandwidth or outboundBandwidth is not null.

API Response

Sample Response

{
  "inventory": {
    "uuid": "dd9459fe90ff4ae0b26ab3cbf1f1e3a2",
    "vipUuid": "e82e583934b441aaaf37039ff5eba877",
    "port": 80.0,
    "inboundBandwidth": 1048576.0,
    "outboundBandwidth": 1048576.0
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.3
inventory VipQosInventory See inventory. 2.3

#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. 2.3
description String The brief description of the error. 2.3
details String The details about the error. 2.3
elaboration String The reserved field. Default value: null. 2.3
opaque LinkedHashMap The reserved field. Default value: null. 2.3
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.3

#inventory

Name Type Description Starting Version
uuid String The resource UUID. 2.3
vipUuid String The VIP UUID. 2.3
port Integer The port. 2.3
inboundBandwidth Long The outbound bandwidth of the response port. 2.3
outboundBandwidth Long The inbound bandwidth of the response port. 2.3
type String The QoS unit type. 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3

SDK Sample

Java SDK

SetVipQosAction action = new SetVipQosAction();
action.uuid = "9b500046ab303d42a8d8a17565b5673b";
action.port = 22.0;
action.outboundBandwidth = 1048576.0;
action.inboundBandwidth = 1048576.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetVipQosAction.Result res = action.call();

Python SDK

action = SetVipQosAction()
action.uuid = "9b500046ab303d42a8d8a17565b5673b"
action.port = 22.0
action.outboundBandwidth = 1048576.0
action.inboundBandwidth = 1048576.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

GetVipQos

API Request

URLs

GET zstack/v1/vip/{uuid}/vip-qos

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vip/e7bd5b22962e33ba8608533f18f10bd1/vip-qos

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url Optional. The resource UUID. 2.3
systemTags List query Optional. The system tags. 2.3
userTags List query Optional. The user tags. 2.3

API Response

Sample Response

{
  "inventories": [
    {
      "uuid": "5a0b0e4ab75c4fffa890cf085add862f",
      "vipUuid": "23349810e3874c2dad85042db1ac11dc",
      "port": 80.0,
      "inboundBandwidth": 1048576.0,
      "outboundBandwidth": 1048576.0
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.3
inventories List See inventories. 2.3

#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. 2.3
description String The brief description of the error. 2.3
details String The details about the error. 2.3
elaboration String The reserved field. Default value: null. 2.3
opaque LinkedHashMap The reserved field. Default value: null. 2.3
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.3

#inventories

Name Type Description Starting Version
uuid String The resource UUID. 2.3
vipUuid String The VIP UUID. 2.3
port Integer The port. 2.3
inboundBandwidth Long The outbound bandwidth of the response port. 2.3
outboundBandwidth Long The inbound bandwidth of the response port. 2.3
type String The QoS unit type. 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3

SDK Sample

Java SDK

GetVipQosAction action = new GetVipQosAction();
action.uuid = "e7bd5b22962e33ba8608533f18f10bd1";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetVipQosAction.Result res = action.call();

Python SDK

action = GetVipQosAction()
action.uuid = "e7bd5b22962e33ba8608533f18f10bd1"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

DeleteVipQos

API Request

URLs

DELETE zstack/v1/vips/{uuid}/vip-qos?port={port}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/vips/cbfc39af27633b31927fa0c259bfde80/vip-qos?

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.3
port Integer url Optional. The port. 2.3
systemTags List body Optional. The system tags. 2.3
userTags List body Optional. The user tags. 2.3

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

DeleteVipQosAction action = new DeleteVipQosAction();
action.uuid = "cbfc39af27633b31927fa0c259bfde80";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteVipQosAction.Result res = action.call();

Python SDK

action = DeleteVipQosAction()
action.uuid = "cbfc39af27633b31927fa0c259bfde80"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()