Document navigation

VPC Operations

CreateVpcVRouter

API Request

URLs
POST zstack/v1/vpc/virtual-routers
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "TestVPC",
    "virtualRouterOfferingUuid": "d9a495f730564ce58328dbfdb1d05721",
    "description": "this is a vpc for test"
  },
  "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":"TestVPC","virtualRouterOfferingUuid":"81e8c1f14a6e352884e6941c4a2de95a","description":"this is a vpc for test"}}' \
http://localhost:8080/zstack/v1/vpc/virtual-routers
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The resource name. 2.3
virtualRouterOfferingUuid String body (contained in the params structure) The vRouter offering UUID. 2.3
description String body (contained in the params structure) Optional. The detailed description of the resource. 2.3
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 2.3
zoneUuid String body (contained in the params structure) Optional. The zone UUID. 3.10.0
clusterUuid String body (contained in the params structure) Optional. The cluster UUID. 3.10.0
hostUuid String body (contained in the params structure) Optional. The host UUID. 3.10.0
systemTags List body Optional. The system tags. 2.3
userTags List body Optional. The user tags. 2.3
primaryStorageUuidForRootVolume String body (contained in the params structure) Optional. The primary storage UUID. 4.4.24
rootVolumeSystemTags List body (contained in the params structure) Optional. The system tags required by VPC vRouter root volume. 4.4.24
Note:
  • When you create a VPC vRouter in ZStack Cloud, the cloud records whether the VPC vRouter is added to an HA group. Note that you can add the haUuid option to SystemTags.
    • Format of the haUuid option: haUuid::HA_GROUP_UUID
    • Example: haUuid::e2af8f869eff49d2a3d6f86cadc27090
  • When you create a VPC vRouter in ZStack Cloud, you can specify a public IP by adding the staticVip option to SystemTags.
    • Format of the staticVip option: staticVip::L3UUID::IP. Here, L3UUID is the L3 public network UUID in the vRouter offering, and IP is the public IP address that you specified.
    • Example: staticVip::4ed5cce4f55a43aca8e61ebbc0c3985d::172.20.1.1
  • When you create a VPC vRouter in ZStack Cloud, you can bind the VPC vRouter to the cluster by adding the resourceBinding option to SystemTags. This disables the VPC vRouter auto cross-cluster migrations.
    • Format of the resourceBinding option: resourceBindings::Cluster:clusterUuid,其中clusterUuid为对应的集群uuid
    • Example: resourceBindings::Cluster:2sdasf231jvznsdak

API Response

Sample Response
{
  "inventory": {
    "applianceVmType": "vpcvrouter",
    "managementNetworkUuid": "a01fad3eb1d14bd787b8830e1d287ee3",
    "status": "Connected",
    "agentPort": 7272.0,
    "uuid": "4de286dcb34343a0b5dedaea96307c06",
    "name": "TestVPC",
    "description": "this is a vpc for test",
    "zoneUuid": "88634bc51a1345b98058c1827999bd75",
    "clusterUuid": "5ebca05bc3cf4d5b970ddb32b10455c0",
    "imageUuid": "490043dfeb814b119f0f6c264ed6bb1e",
    "hostUuid": "a19572ae4fcc4b7d8a090d06c99067fa",
    "lastHostUuid": "d374797d2d01495cb4dedd9e452909d0",
    "instanceOfferingUuid": "8fcc3c2b5e1b41e586ed07ffece475e4",
    "rootVolumeUuid": "ed5b232109f64f0dbe3342ffa8924d14",
    "platform": "Linux",
    "defaultL3NetworkUuid": "2aedc4cd00f8495f8fc08c991dd7be4c",
    "type": "ApplianceVm",
    "hypervisorType": "KVM",
    "memorySize": 8.589934592E9,
    "cpuNum": 4.0,
    "allocatorStrategy": "LastHostPreferredAllocatorStrategy",
    "createDate": "Nov 9, 2017 4:20:39 PM",
    "lastOpDate": "Nov 9, 2017 4:20:39 PM",
    "state": "Running",
    "vmNics": [
      {
        "uuid": "6c8b46eec225440bb7179b6c797937ed",
        "vmInstanceUuid": "4de286dcb34343a0b5dedaea96307c06",
        "usedIpUuid": "033b876b861f4b9abaf594a893c1c94f",
        "l3NetworkUuid": "49e2d31895c94bf0808372360ebcae31",
        "ip": "192.168.1.10",
        "mac": "00:0c:29:bd:99:fc",
        "netmask": "255.255.255.0",
        "gateway": "192.168.1.1",
        "deviceId": 0.0,
        "createDate": "Nov 9, 2017 4:20:39 PM",
        "lastOpDate": "Nov 9, 2017 4:20:39 PM"
      }
    ],
    "allVolumes": [
      {
        "uuid": "ed5b232109f64f0dbe3342ffa8924d14",
        "name": "Root-Volume-For-VM-4de286dcb34343a0b5dedaea96307c06",
        "primaryStorageUuid": "c3f1cbaf9b014c1d8989ff940ed5593a",
        "vmInstanceUuid": "4de286dcb34343a0b5dedaea96307c06",
        "diskOfferingUuid": "93bfd802ebea486ab4ce071967235b76",
        "rootImageUuid": "490043dfeb814b119f0f6c264ed6bb1e",
        "installPath": "/Cloud_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-ed5b232109f64f0dbe3342ffa8924d14/ed5b232109f64f0dbe3342ffa8924d14.qcow2",
        "type": "Root",
        "format": "qcow2",
        "size": 1.073741824E11,
        "actualSize": 2.147483648E10,
        "deviceId": 0.0,
        "state": "Enabled",
        "status": "Ready",
        "createDate": "Nov 9, 2017 4:20:39 PM",
        "lastOpDate": "Nov 9, 2017 4:20:39 PM"
      }
    ]
  }
}
Name Type Description Starting Version
success boolean 0.6
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.3
inventory VmInstanceInventory 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
name String The resource name. 2.3
description String The detailed description of the resource. 2.3
zoneUuid String The zone UUID. 2.3
clusterUuid String The cluster UUID. 2.3
imageUuid String The image UUID. 2.3
hostUuid String The host UUID. 2.3
lastHostUuid String The UUID of the host where the vRouter VM instance was running last time. 2.3
instanceOfferingUuid String The instance offering UUID. 2.3
rootVolumeUuid String The root volume UUID. 2.3
platform String The operating platform of the vRouter device. 2.3
architecture String 2.3
defaultL3NetworkUuid String The default L3 network UUID. 2.3
type String The vRouter device type. 2.3
hypervisorType String The hypervisor type of the vRouter device. 2.3
memorySize Long The memory size. 2.3
cpuNum Integer The CPU count. 2.3
cpuSpeed Long The CPU speed. 2.3
allocatorStrategy String The allocator strategy. 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3
state String Thea state of the vRouter device. 2.3
guestOsType String 2.3
vmNics List See vmNics. 2.3
allVolumes List See allVolumes. 2.3
vmCdRoms List See vmCdRoms. 2.3
#vmNics
Name Type Description Starting Version
uuid String The resource UUID. 2.3
vmInstanceUuid String The VM instance UUID. 2.3
l3NetworkUuid String The L3 network UUID. 2.3
ip String The IP address. 2.3
mac String The MAC address. 2.3
hypervisorType String 2.3
netmask String The netmask. 2.3
gateway String The gateway. 2.3
metaData String The reserved field for internal use. 2.3
deviceId Integer The device ID.
  • Indicates the sequence (an integer) of the NIC on the Ethernet device of the guest operating system.
  • For example, 0 means eth0, while 1 means eth1.
2.3
internalName String 2.3
deviceId Integer 2.3
type String 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3
usedIps List See usedIps 2.3
#usedIps
Name Type Description Starting Version
uuid String The resource UUID. 2.3
ipRangeUuid String The IP range UUID. 2.3
l3NetworkUuid String The L3 network UUID. 2.3
ipVersion Integer 2.3
ip String 2.3
netmask String 2.3
gateway String 2.3
usedFor String 2.3
ipInLong long 2.3
vmNicUuid String The VM NIC UUID. 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3
#allVolumes
Name Type Description Starting Version
uuid String The resource UUID. 2.3
name String The resource name. 2.3
description String The detailed description of the resource. 2.3
primaryStorageUuid String The primary storage UUID. 2.3
vmInstanceUuid String The VM instance UUID. 2.3
diskOfferingUuid String The disk offering UUID. 2.3
rootImageUuid String The root image UUID. 2.3
installPath String The installation path. 2.3
type String The volume type. 2.3
format String The volume format. 2.3
size Long The virtual size of the volume. 2.3
actualSize Long The actual size of the volume. 2.3
deviceId Integer The device ID. 2.3
state String The state of the volume. 2.3
status String The status of the volume. 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3
volumeQos String 2.3
lastDetachDate Timestamp 2.3
lastVmInstanceUuid String 2.3
isShareable Boolean Whether the volume is shareable. 2.3

SDK Sample

Java SDK
CreateVpcVRouterAction action = new CreateVpcVRouterAction();
action.name = "TestVPC";
action.virtualRouterOfferingUuid = "c9cfb57035294ff4abeb400922f50d09";
action.description = "this is a vpc for test";
action.sessionId = "41652c67906143948e1fecc1054b65bd";
CreateVpcVRouterAction.Result res = action.call();
Python SDK
CreateVpcVRouterAction action = CreateVpcVRouterAction()
action.name = "TestVPC"
action.virtualRouterOfferingUuid = "a7eaafd48945481fa2d9a35032b8770b"
action.description = "this is a vpc for test"
action.sessionId = "9d1cc409dd8b47d3aa4ead7bccf875f2"
CreateVpcVRouterAction.Result res = action.call()

QueryVpcRouter

API Request

URLs
GET zstack/v1/vpc/virtual-routers
GET zstack/v1/vpc/virtual-routers/{uuid}
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/vpc/virtual-routers?q=name=vpcRouter
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vpc/virtual-routers/205d11a687d03b46852d4d24fc85ae75

Queryable Fields

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

API Response

Sample Response
{
  "inventories": [
    {
      "dns": [
        {
          "vpcRouterUuid": "4183325c367d384a84458f89c35d62a8",
          "dns": "8.8.8.8"
        }
      ],
      "uuid": "4183325c367d384a84458f89c35d62a8",
      "name": "Test-VM",
      "description": "web server VM",
      "zoneUuid": "77689ed989253db0bb5863b103e06ecd",
      "clusterUuid": "7f124c177f1535cebca9b0a555998e8e",
      "imageUuid": "9e0eaf2e7ea93bc0bfc9f22d3f7328cd",
      "hostUuid": "72547613a0bf320caca7a149d99e3ed4",
      "lastHostUuid": "9e54bc8261f6396db6c66eb8a76e246d",
      "instanceOfferingUuid": "e115b1542d2e35c8b9fbb5afd9fd067c",
      "rootVolumeUuid": "48afbfcc2d36391586f7b6b44df93712",
      "platform": "Linux",
      "defaultL3NetworkUuid": "70dc6311679638c0a1e323d583332463",
      "type": "UserVm",
      "hypervisorType": "KVM",
      "memorySize": 8.589934592E9,
      "cpuNum": 1.0,
      "allocatorStrategy": "LastHostPreferredAllocatorStrategy",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM",
      "state": "Running",
      "vmNics": [
        {
          "uuid": "df1eae8361983c86a46d3d922ad0a6f4",
          "vmInstanceUuid": "4183325c367d384a84458f89c35d62a8",
          "usedIpUuid": "2bdc1a927ebb34f89a880d8aefc7c763",
          "l3NetworkUuid": "70dc6311679638c0a1e323d583332463",
          "ip": "192.168.1.10",
          "mac": "00:0c:29:bd:99:fc",
          "netmask": "255.255.255.0",
          "gateway": "192.168.1.1",
          "deviceId": 0.0,
          "createDate": "Nov 14, 2017 10:20:57 PM",
          "lastOpDate": "Nov 14, 2017 10:20:57 PM"
        }
      ],
      "allVolumes": [
        {
          "uuid": "48afbfcc2d36391586f7b6b44df93712",
          "name": "Root-Volume-For-VM-4183325c367d384a84458f89c35d62a8",
          "primaryStorageUuid": "a33d58803a2a307bb1762b9209e64ba2",
          "vmInstanceUuid": "4183325c367d384a84458f89c35d62a8",
          "diskOfferingUuid": "c762d59a3e6f36d89bff2ce3ea4b864c",
          "rootImageUuid": "9e0eaf2e7ea93bc0bfc9f22d3f7328cd",
          "installPath": "/Cloud_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-48afbfcc2d36391586f7b6b44df93712/48afbfcc2d36391586f7b6b44df93712.qcow2",
          "type": "Root",
          "format": "qcow2",
          "size": 1.073741824E11,
          "actualSize": 2.147483648E10,
          "deviceId": 0.0,
          "state": "Enabled",
          "status": "Ready",
          "createDate": "Nov 14, 2017 10:20:57 PM",
          "lastOpDate": "Nov 14, 2017 10:20:57 PM"
        }
      ]
    }
  ]
}
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
publicNetworkUuid String 0.6
virtualRouterVips List 0.6
applianceVmType String 0.6
managementNetworkUuid String 0.6
defaultRouteL3NetworkUuid String 0.6
status String 0.6
agentPort Integer 0.6
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
zoneUuid String The zone UUID. 0.6
clusterUuid String The cluster UUID. 0.6
imageUuid String The image UUID. 0.6
hostUuid String The host UUID. 0.6
lastHostUuid String 0.6
instanceOfferingUuid String The instance offering UUID. 0.6
rootVolumeUuid String The root volume UUID. 0.6
platform String 0.6
defaultL3NetworkUuid String 0.6
type String 0.6
hypervisorType String 0.6
memorySize Long 0.6
cpuNum Integer 0.6
cpuSpeed Long 0.6
allocatorStrategy String 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
state String 0.6
dns List See dns. 2.4
vmNics List See vmNics. 0.6
allVolumes List See allVolumes. 0.6
#dns
Name Type Description Starting Version
vpcRouterUuid String 2.4
dns String 2.4
createDate Timestamp The creation date. 2.4
lastOpDate Timestamp The last operation date. 2.4
#vmNics
Name Type Description Starting Version
uuid String The resource UUID. 0.6
vmInstanceUuid String The VM instance UUID. 0.6
l3NetworkUuid String The L3 network UUID. 0.6
ip String 0.6
mac String 0.6
netmask String 0.6
gateway String 0.6
metaData String 0.6
deviceId Integer 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
#allVolumes
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
primaryStorageUuid String The primary storage UUID. 0.6
vmInstanceUuid String The VM instance UUID. 0.6
diskOfferingUuid String The disk offering UUID. 0.6
rootImageUuid String 0.6
installPath String 0.6
type String 0.6
format String 0.6
size Long 0.6
actualSize Long 0.6
deviceId Integer 0.6
state String 0.6
status String 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
isShareable Boolean 0.6

SDK Sample

Java SDK
QueryVpcRouterAction action = new QueryVpcRouterAction();
action.conditions = asList("name=vpcRouter");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryVpcRouterAction.Result res = action.call();
Python SDK
QueryVpcRouterAction action = QueryVpcRouterAction()
action.conditions = ["name=vpcRouter"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryVpcRouterAction.Result res = action.call()

GetAttachableVpcL3Network

API Request

URLs
POST zstack/v1/vpc/virtual-routers/{uuid}/attachable-vpc-l3s
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {},
  "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":{}}' http://localhost:8080/zstack/v1/vpc/virtual-routers/417478f0b61732408176f16615ab6d32/attachable-vpc-l3s
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.3
systemTags List body Optional. The system tags. 2.3
userTags List body Optional. The user tags. 2.3

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "81c29ac529163ffa9d4f246d68518dd1",
      "name": "test-l3",
      "description": "test l3",
      "type": "L3VpcNetwork",
      "zoneUuid": "aea3c47aa8273399ac8827fbc78aae67",
      "l2NetworkUuid": "cbba13d2e8273d529cfcb89c66d54fb2",
      "system": false,
      "category": "Private",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM",
      "ipRanges": [
        {
          "l3NetworkUuid": "cc5980d5c4173dd5b57dc1b28cdb0683",
          "name": "test ip range",
          "startIp": "100.64.0.10",
          "endIp": "100.64.0.100",
          "netmask": "255.255.255.0",
          "gateway": "100.64.0.1",
          "networkCidr": "100.64.0.0/24",
          "createDate": "Nov 14, 2017 10:20:57 PM",
          "lastOpDate": "Nov 14, 2017 10:20:57 PM"
        }
      ]
    }
  ]
}
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
name String The resource name. 2.3
description String The detailed description of the resource. 2.3
type String The L3 network type. 2.3
zoneUuid String The zone UUID. 2.3
l2NetworkUuid String The L2 network UUID. 2.3
state String The state of the L3 network. 2.3
dnsDomain String The DNS domain. 2.3
system Boolean Whether the L3 network can be applied to appliance VM instances. 2.3
category String The network type, which must be used with the system tags. If system is set to true, this parameter can be set to Public or Private. 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3
dns List The DNS server. 2.3
ipRanges List See ipRanges. 2.3
networkServices List See networkServices. 2.3
hostRoute List See hostRoute.
#ipRanges
Name Type Description Starting Version
uuid String The resource UUID. 2.3
l3NetworkUuid String The L3 network UUID. 2.3
name String The resource name. 2.3
description String The detailed description of the resource. 2.3
startIp String The start IP address. 2.3
endIp String The end IP address. 2.3
netmask String The netmask. 2.3
gateway String The gateway. 2.3
networkCidr String The network CIDR. 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3
#networkServices
Name Type Description Starting Version
l3NetworkUuid String The L3 network UUID. 2.3
networkServiceProviderUuid String The network service provider UUID. 2.3
networkServiceType String The network service type. 2.3
#hostRoute
Name Type Description Starting Version
id Long 2.3
l3NetworkUuid String The L3 network UUID. 2.3
prefix String 2.3
nexthop String 2.3
createDate Timestamp The creation date. 2.3
lastOpDate Timestamp The last operation date. 2.3

SDK Sample

Java SDK
GetAttachableVpcL3NetworkAction action = new GetAttachableVpcL3NetworkAction();
action.uuid = "417478f0b61732408176f16615ab6d32";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetAttachableVpcL3NetworkAction.Result res = action.call();
Python SDK
GetAttachableVpcL3NetworkAction action = GetAttachableVpcL3NetworkAction()
action.uuid = "417478f0b61732408176f16615ab6d32"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetAttachableVpcL3NetworkAction.Result res = action.call()

GetVpcVRouterDistributedRoutingConnections

API Request

URLs
GET zstack/v1/vpc/virtual-routers/{uuid}/tracked-connections
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/vpc/virtual-routers/f37467649dca3ee8a0ddad0b856a8df6/tracked-connections
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The VPC vRouter UUID. To obtain the real-time traffic state of a VPC vRouter, enable distributed routing. 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": {
    "192.168.31.156,192.168.105.175": {
      "sourceL2NetworkType": "L2VlanNetwork",
      "destinationL2NetworkType": "L2VlanNetwork",
      "sourceMac": "fa:bf:6e:37:c3:00",
      "destinationMac": "fa:3a:b3:ae:f4:00",
      "sourceL2NetworkVni": 3101.0,
      "destinationL2NetworkVni": 3105.0,
      "lastOpDate": "2017-12-02 15:23:44.872099448 +0800 CST m\u003d+70467.712498312",
      "status": "ZSNP_DST_SUCC"
    }
  }
}
Name Type Description Starting Version
inventories Map The collection of the real-time traffic state. Its structure is Map.
  • Key is the communication address on each side.
  • The API response content is a Map, including the source network, destination network type, VNI, the MAC address on each side, the last operation date, and the current optimization status.
  • In the content, ZSNP_DST_SUCC means that the optimization succeeds.
2.3
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, seeerror. 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

SDK Sample

Java SDK
GetVpcVRouterDistributedRoutingConnectionsAction action = new GetVpcVRouterDistributedRoutingConnectionsAction();
action.uuid = "f37467649dca3ee8a0ddad0b856a8df6";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetVpcVRouterDistributedRoutingConnectionsAction.Result res = action.call();
Python SDK
GetVpcVRouterDistributedRoutingConnectionsAction action = GetVpcVRouterDistributedRoutingConnectionsAction()
action.uuid = "f37467649dca3ee8a0ddad0b856a8df6"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetVpcVRouterDistributedRoutingConnectionsAction.Result res = action.call()

GetVpcVRouterDistributedRoutingEnabled

API Request

URLs
GET zstack/v1/vpc/virtual-routers/{uuid}/distributed-routing
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/vpc/virtual-routers/9fab45026c2239d884db36ce9190660f/distributed-routing
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url 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

{
  "enabled": true
}
Name Type Description Starting Version
enabled boolean Checks whether the distributed routing of the VPC vRouter is enabled. 2.3
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 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

SDK Sample

Java SDK
GetVpcVRouterDistributedRoutingEnabledAction action = new GetVpcVRouterDistributedRoutingEnabledAction();
action.uuid = "9fab45026c2239d884db36ce9190660f";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetVpcVRouterDistributedRoutingEnabledAction.Result res = action.call();
Python SDK
GetVpcVRouterDistributedRoutingEnabledAction action = GetVpcVRouterDistributedRoutingEnabledAction()
action.uuid = "9fab45026c2239d884db36ce9190660f"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetVpcVRouterDistributedRoutingEnabledAction.Result res = action.call()

SetVpcVRouterDistributedRoutingEnabled

API Request

URLs
POST zstack/v1/vpc/virtual-routers/{uuid}/distributed-routing
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "stateEvent": "enable"
  },
  "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":{"stateEvent":"enable"}}' \
http://localhost:8080/zstack/v1/vpc/virtual-routers/fed6eb5e41d83512ba1f836b5473b4fc/distributed-routing
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.3
stateEvent String body (contained in the params structure) The state of the resource.
  • enable
  • disable
2.3
systemTags List body Optional. The system tags. 2.3
userTags List body Optional. The user tags. 2.3

API Response

Sample Response
{
  "enabled": true
}
Name Type Description Starting Version
enabled boolean Checks whether the distributed routing of the VPC vRouter is enabled. 2.3
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 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

SDK Sample

Java SDK
SetVpcVRouterDistributedRoutingEnabledAction action = new SetVpcVRouterDistributedRoutingEnabledAction();
action.uuid = "fed6eb5e41d83512ba1f836b5473b4fc";
action.stateEvent = "enable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetVpcVRouterDistributedRoutingEnabledAction.Result res = action.call();
Python SDK
SetVpcVRouterDistributedRoutingEnabledAction action = SetVpcVRouterDistributedRoutingEnabledAction()
action.uuid = "fed6eb5e41d83512ba1f836b5473b4fc"
action.stateEvent = "enable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SetVpcVRouterDistributedRoutingEnabledAction.Result res = action.call()

AddDnsToVpcRouter

API Request

URLs
POST zstack/v1/vpc/virtual-routers/{uuid}/dns
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "dns": "8.8.8.8"
  },
  "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":{"dns":"8.8.8.8"}}' \
http://localhost:8080/zstack/v1/vpc/virtual-routers/a6b12587c0c93b50956c689cae6e4404/dns
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.4.0
dns String body (contained in the params structure) 2.4.0
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

Sample Response
{
  "inventory": {
    "dns": [
      {
        "vpcRouterUuid": "8ddf2e00f7623bf38125744211f17c12",
        "dns": "8.8.8.8"
      }
    ],
    "applianceVmType": "vpcvrouter",
    "managementNetworkUuid": "363b0211294d3fe1af316723d18d54a3",
    "status": "Connected",
    "agentPort": 7272.0,
    "uuid": "8ddf2e00f7623bf38125744211f17c12",
    "name": "TestVPC",
    "description": "this is a vpc for test",
    "zoneUuid": "d3cd927aa5953371aa13b82688258c13",
    "clusterUuid": "61a2077d121637a09f27f5d1926d545e",
    "imageUuid": "09024d35eab63bc080dc0f0e7aa3fa5c",
    "hostUuid": "092e3f1b71a53b01bcc2919fb31b43a3",
    "lastHostUuid": "64eb21f707d53db4822602c3714fc69e",
    "instanceOfferingUuid": "ec1a12c9f896392bb42757c02f24870c",
    "rootVolumeUuid": "857592621b163444899c275b258d780c",
    "platform": "Linux",
    "defaultL3NetworkUuid": "ad1173e8e97e385a8d3aaec182ee1fc3",
    "type": "ApplianceVm",
    "hypervisorType": "KVM",
    "memorySize": 8.589934592E9,
    "cpuNum": 4.0,
    "allocatorStrategy": "LastHostPreferredAllocatorStrategy",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM",
    "state": "Running",
    "vmNics": [
      {
        "uuid": "e0ba27ddc8fe33e882cc15dc60dcd58e",
        "vmInstanceUuid": "8ddf2e00f7623bf38125744211f17c12",
        "usedIpUuid": "0aecfc23129a3b7395fbff6e5d17303c",
        "l3NetworkUuid": "d3d2b9e10ce4376782ccf210ad62f49e",
        "ip": "192.168.1.10",
        "mac": "00:0c:29:bd:99:fc",
        "netmask": "255.255.255.0",
        "gateway": "192.168.1.1",
        "deviceId": 0.0,
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "lastOpDate": "Nov 14, 2017 10:20:57 PM"
      }
    ],
    "allVolumes": [
      {
        "uuid": "857592621b163444899c275b258d780c",
        "name": "Root-Volume-For-VM-8ddf2e00f7623bf38125744211f17c12",
        "primaryStorageUuid": "1b880ac4a03e3ce0859b52e4c4274e76",
        "vmInstanceUuid": "8ddf2e00f7623bf38125744211f17c12",
        "diskOfferingUuid": "37537d10d728350687d0739141dd4b42",
        "rootImageUuid": "09024d35eab63bc080dc0f0e7aa3fa5c",
        "installPath": "/Cloud_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-857592621b163444899c275b258d780c/857592621b163444899c275b258d780c.qcow2",
        "type": "Root",
        "format": "qcow2",
        "size": 1.073741824E11,
        "actualSize": 2.147483648E10,
        "deviceId": 0.0,
        "state": "Enabled",
        "status": "Ready",
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "lastOpDate": "Nov 14, 2017 10:20:57 PM"
      }
    ]
  }
}
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.4
inventory VpcRouterVmInventory See inventory. 2.4
#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
publicNetworkUuid String 0.6
virtualRouterVips List 0.6
applianceVmType String 0.6
managementNetworkUuid String 0.6
defaultRouteL3NetworkUuid String 0.6
status String 0.6
agentPort Integer 0.6
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
zoneUuid String The zone UUID. 0.6
clusterUuid String The cluster UUID. 0.6
imageUuid String The image UUID. 0.6
hostUuid String The host UUID. 0.6
lastHostUuid String 0.6
instanceOfferingUuid String The instance offering UUID. 0.6
rootVolumeUuid String The root volume UUID. 0.6
platform String 0.6
defaultL3NetworkUuid String 0.6
type String 0.6
hypervisorType String 0.6
memorySize Long 0.6
cpuNum Integer 0.6
cpuSpeed Long 0.6
allocatorStrategy String 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
state String 0.6
dns List See dns. 2.4
vmNics List See vmNics. 0.6
allVolumes List See allVolumes. 0.6
#dns
Name Type Description Starting Version
vpcRouterUuid String 2.4
dns String 2.4
createDate Timestamp The creation date. 2.4
lastOpDate Timestamp The last operation date. 2.4
#vmNics
Name Type Description Starting Version
uuid String The resource UUID. 0.6
vmInstanceUuid String The VM instance UUID. 0.6
l3NetworkUuid String The L3 network UUID. 0.6
ip String 0.6
mac String 0.6
netmask String 0.6
gateway String 0.6
metaData String 0.6
deviceId Integer 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
#allVolumes
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
primaryStorageUuid String The primary storage UUID. 0.6
vmInstanceUuid String The VM instance UUID. 0.6
diskOfferingUuid String The disk offering UUID. 0.6
rootImageUuid String 0.6
installPath String 0.6
type String 0.6
format String 0.6
size Long 0.6
actualSize Long 0.6
deviceId Integer 0.6
state String 0.6
status String 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
isShareable Boolean 0.6

SDK Sample

Java SDK
AddDnsToVpcRouterAction action = new AddDnsToVpcRouterAction();
action.uuid = "a6b12587c0c93b50956c689cae6e4404";
action.dns = "8.8.8.8";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddDnsToVpcRouterAction.Result res = action.call();
Python SDK
AddDnsToVpcRouterAction action = AddDnsToVpcRouterAction()
action.uuid = "a6b12587c0c93b50956c689cae6e4404"
action.dns = "8.8.8.8"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddDnsToVpcRouterAction.Result res = action.call()

RemoveDnsFromVpcRouter

API Request

URLs
DELETE zstack/v1/vpc/virtual-routers/{uuid}/dns?dns={dns}
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/vpc/virtual-routers/704e0c0e0fd23566bfac3416fb5cd5dd/dns?dns=8.8.4.4
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
dns String url 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": {
    "dns": [
      {
        "vpcRouterUuid": "67a8f5c346923086bff064bc332dee1f",
        "dns": "8.8.8.8"
      }
    ],
    "applianceVmType": "vpcvrouter",
    "managementNetworkUuid": "8afbedef6a8c3c44b0da74ac251c8710",
    "status": "Connected",
    "agentPort": 7272.0,
    "uuid": "67a8f5c346923086bff064bc332dee1f",
    "name": "TestVPC",
    "description": "this is a vpc for test",
    "zoneUuid": "ed322832de35346e83ee3af58ae0ba1f",
    "clusterUuid": "8152b3dd20ad39eab72feeb39b54bd5a",
    "imageUuid": "d9f78c772d123b72b423f2d38d177404",
    "hostUuid": "2936a13adb2d321aaf2f8a6bad17b512",
    "lastHostUuid": "dc046362b4903f87b4cf99a31bf8b0c0",
    "instanceOfferingUuid": "d0656359210c3448baaedb3284a59607",
    "rootVolumeUuid": "7df4d03d3f773176b84d0015b26eba3a",
    "platform": "Linux",
    "defaultL3NetworkUuid": "91fce38c41e83adcbd1a2ddc7a657a68",
    "type": "ApplianceVm",
    "hypervisorType": "KVM",
    "memorySize": 8.589934592E9,
    "cpuNum": 4.0,
    "allocatorStrategy": "LastHostPreferredAllocatorStrategy",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM",
    "state": "Running",
    "vmNics": [
      {
        "uuid": "13f3d555d0083171b02f542e359699b6",
        "vmInstanceUuid": "67a8f5c346923086bff064bc332dee1f",
        "usedIpUuid": "da61650287ed32238b557d6c11c245d5",
        "l3NetworkUuid": "27fc48db6d34311e9a68c61c4f7737b1",
        "ip": "192.168.1.10",
        "mac": "00:0c:29:bd:99:fc",
        "netmask": "255.255.255.0",
        "gateway": "192.168.1.1",
        "deviceId": 0.0,
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "lastOpDate": "Nov 14, 2017 10:20:57 PM"
      }
    ],
    "allVolumes": [
      {
        "uuid": "7df4d03d3f773176b84d0015b26eba3a",
        "name": "Root-Volume-For-VM-67a8f5c346923086bff064bc332dee1f",
        "primaryStorageUuid": "e274d0516c1432bdbc9187a95f03958b",
        "vmInstanceUuid": "67a8f5c346923086bff064bc332dee1f",
        "diskOfferingUuid": "f36042caf77835b0912e008a1ff49d88",
        "rootImageUuid": "d9f78c772d123b72b423f2d38d177404",
        "installPath": "/Cloud_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-7df4d03d3f773176b84d0015b26eba3a/7df4d03d3f773176b84d0015b26eba3a.qcow2",
        "type": "Root",
        "format": "qcow2",
        "size": 1.073741824E11,
        "actualSize": 2.147483648E10,
        "deviceId": 0.0,
        "state": "Enabled",
        "status": "Ready",
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "lastOpDate": "Nov 14, 2017 10:20:57 PM"
      }
    ]
  }
}
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 VpcRouterVmInventory 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
publicNetworkUuid String 0.6
virtualRouterVips List 0.6
applianceVmType String 0.6
managementNetworkUuid String 0.6
defaultRouteL3NetworkUuid String 0.6
status String 0.6
agentPort Integer 0.6
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
zoneUuid String The zone UUID. 0.6
clusterUuid String The cluster UUID. 0.6
imageUuid String The image UUID. 0.6
hostUuid String The host UUID. 0.6
lastHostUuid String 0.6
instanceOfferingUuid String The instance offering UUID. 0.6
rootVolumeUuid String The root volume UUID. 0.6
platform String 0.6
defaultL3NetworkUuid String 0.6
type String 0.6
hypervisorType String 0.6
memorySize Long 0.6
cpuNum Integer 0.6
cpuSpeed Long 0.6
allocatorStrategy String 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
state String 0.6
dns List See dns. 2.4
vmNics List See vmNics. 0.6
allVolumes List See allVolumes. 0.6
#dns
Name Type Description Starting Version
vpcRouterUuid String 2.4
dns String 2.4
createDate Timestamp The creation date. 2.4
lastOpDate Timestamp The last operation date. 2.4
#vmNics
Name Type Description Starting Version
uuid String The resource UUID. 0.6
vmInstanceUuid String The VM instance UUID. 0.6
l3NetworkUuid String The L3 network UUID. 0.6
ip String 0.6
mac String 0.6
netmask String 0.6
gateway String 0.6
metaData String 0.6
deviceId Integer 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
#allVolumes
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
primaryStorageUuid String The primary storage UUID. 0.6
vmInstanceUuid String The VM instance UUID. 0.6
diskOfferingUuid String The disk offering UUID. 0.6
rootImageUuid String 0.6
installPath String 0.6
type String 0.6
format String 0.6
size Long 0.6
actualSize Long 0.6
deviceId Integer 0.6
state String 0.6
status String 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
isShareable Boolean 0.6

SDK Sample

Java SDK
RemoveDnsFromVpcRouterAction action = new RemoveDnsFromVpcRouterAction();
action.uuid = "704e0c0e0fd23566bfac3416fb5cd5dd";
action.dns = "8.8.4.4";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveDnsFromVpcRouterAction.Result res = action.call();
Python SDK
RemoveDnsFromVpcRouterAction action = RemoveDnsFromVpcRouterAction()
action.uuid = "704e0c0e0fd23566bfac3416fb5cd5dd"
action.dns = "8.8.4.4"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveDnsFromVpcRouterAction.Result res = action.call()

GetVpcVRouterNetworkServiceState

API Request

URLs
GET zstack/v1/vpc/virtual-routers/{uuid}/networkservicestate
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/vpc/virtual-routers/51d5917daba83390978604d7b9c8c13a/networkservicestate?networkService=SNAT
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.4.0
networkService String query The vRouter network service.
  • SNAT
3.4.0
systemTags List query Optional. The vRouter system tags. 3.4.0
userTags List query Optional. The vRouter user tags. 3.4.0
Note:
  • When you obtain the network service state of a VPC vRouter in ZStack Cloud, you can disable the SNAT service of the VPC vRouter by adding the disabledService option to SystemTags.
    • Format of the disabledService option: disabledService::SNAT
    • Example: disabledService::SNAT
    • If the SystemTag of the VPC vRouter does not contain the resourceType::VirtualRouterVmVO flag, the SNAT service of the VPC vRouter is enabled. Otherwise, if the SystemTag contains the resourceType::VirtualRouterVmVO flag, the SNAT service is disabled.

API Response

Sample Response
{
  "state": "enable"
}
Name Type Description Starting Version
state String 3.4.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 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

SDK Sample

Java SDK
GetVpcVRouterNetworkServiceStateAction action = new GetVpcVRouterNetworkServiceStateAction();
action.uuid = "51d5917daba83390978604d7b9c8c13a";
action.networkService = "SNAT";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetVpcVRouterNetworkServiceStateAction.Result res = action.call();
Python SDK
GetVpcVRouterNetworkServiceStateAction action = GetVpcVRouterNetworkServiceStateAction()
action.uuid = "51d5917daba83390978604d7b9c8c13a"
action.networkService = "SNAT"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetVpcVRouterNetworkServiceStateAction.Result res = action.call()

SetVpcVRouterNetworkServiceState

API Request

URLs
POST zstack/v1/vpc/virtual-routers/{uuid}/networkservicestate
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "networkService": "SNAT",
    "state": "enable"
  },
  "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":{"networkService":"SNAT","state":"enable"}}' http://localhost:8080/zstack/v1/vpc/virtual-routers/824ad6ab1b5a3bd1ad935fa098d77826/networkservicestate
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.4.0
networkService String body (contained in the params structure) The vRouter network service.
  • SNAT
3.4.0
state String body (contained in the params structure) The service state.
  • enable
  • disable
3.4.0
systemTags List body Optional. The vRouter system tags. 3.4.0
userTags List body Optional. The vRouter user tags. 3.4.0
Note:
  • When you obtain the network service state of a VPC vRouter in ZStack Cloud, you can disable the SNAT service of the VPC vRouter by adding the disabledService option to SystemTags.
    • Format of the disabledService option: disabledService::SNAT
    • Example: disabledService::SNAT
    • If the SystemTag of the VPC vRouter does not contain the resourceType::VirtualRouterVmVO flag, the SNAT service of the VPC vRouter is enabled. Otherwise, if the SystemTag contains the resourceType::VirtualRouterVmVO flag, the SNAT service is disabled.

API Response

Sample Response
{
  "state": "enable"
}
Name Type Description Starting Version
state String 3.4.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 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

SDK Sample

Java SDK
SetVpcVRouterNetworkServiceStateAction action = new SetVpcVRouterNetworkServiceStateAction();
action.uuid = "824ad6ab1b5a3bd1ad935fa098d77826";
action.networkService = "SNAT";
action.state = "enable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetVpcVRouterNetworkServiceStateAction.Result res = action.call();
Python SDK
SetVpcVRouterNetworkServiceStateAction action = SetVpcVRouterNetworkServiceStateAction()
action.uuid = "824ad6ab1b5a3bd1ad935fa098d77826"
action.networkService = "SNAT"
action.state = "enable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SetVpcVRouterNetworkServiceStateAction.Result res = action.call()

ChangeVpcHaGroupMonitorIps

API Request

URLs
PUT zstack/v1/vpc/hagroups/{uuid}/monitorIps
Headers
Authorization: OAuth the-session-uuid
Body
{
  "changeVpcHaGroupMonitorIps": {
    "monitorIps": [
      "8.8.8.8"
    ]
  },
  "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 '{"changeVpcHaGroupMonitorIps":{"monitorIps":["8.8.8.8"]}}' http://localhost:8080/zstack/v1/vpc/hagroups/580eaca0eceb3da1bc03aa0b2dfaed64/monitorIps
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.5.1
monitorIps List body (contained in the changeVpcHaGroupMonitorIps structure) Optional. 3.5.1
systemTags List body Optional. The system tags. 3.5.1
userTags List body Optional. The user tags. 3.5.1

API Response

Sample Response
{
  "inventory": {
    "uuid": "85ba2342e37930f6a0cdd056565654cd",
    "name": "test-vpcha",
    "monitors": [
      {
        "id": 0.0,
        "vpcHaRouterUuid": "85ba2342e37930f6a0cdd056565654cd",
        "monitorIp": "1.1.1.1"
      }
    ],
    "vrRefs": [
      {
        "uuid": "c109f7860f2439ca86d1dbc51dbece39",
        "vpcHaRouterUuid": "85ba2342e37930f6a0cdd056565654cd"
      }
    ]
  }
}
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.5
inventory VpcHaGroupInventory See inventory. 3.5
#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. 3.5
name String The resource name. 3.5
description String The detailed description of the resource. 3.5
createDate Timestamp The creation date. 3.5
lastOpDate Timestamp The last operation date. 3.5
monitors List See monitors. 3.5
vrRefs List See vrRefs. 3.5
services List See services. 3.5
usedIps List See usedIps. 3.5
#monitors
Name Type Description Starting Version
id Long 3.5
vpcHaRouterUuid String 3.5
monitorIp String 3.5
createDate Timestamp The creation date. 3.5
lastOpDate Timestamp The last operation date. 3.5
#vrRefs
Name Type Description Starting Version
uuid String The resource UUID. 3.5
VpcHaRouterUuid String 3.5
#services
Name Type Description Starting Version
id Long 3.5
vpcHaRouterUuid String 3.5
networkServiceName String 3.5
networkServiceUuid String 3.5
createDate Timestamp The creation date. 3.5
lastOpDate Timestamp The last operation date. 3.5
#usedIps
Name Type Description Starting Version
id Long 3.5
vpcHaRouterUuid String 3.5
vipUuid String The VIP UUID. 3.5
l3NetworkUuid String The L3 network UUID. 3.5
ip String 3.5
netmask String 3.5
createDate Timestamp The creation date. 3.5
lastOpDate Timestamp The last operation date. 3.5

SDK Sample

Java SDK
ChangeVpcHaGroupMonitorIpsAction action = new ChangeVpcHaGroupMonitorIpsAction();
action.uuid = "580eaca0eceb3da1bc03aa0b2dfaed64";
action.monitorIps = asList("8.8.8.8");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeVpcHaGroupMonitorIpsAction.Result res = action.call();
Python SDK
ChangeVpcHaGroupMonitorIpsAction action = ChangeVpcHaGroupMonitorIpsAction()
action.uuid = "580eaca0eceb3da1bc03aa0b2dfaed64"
action.monitorIps = [8.8.8.8]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeVpcHaGroupMonitorIpsAction.Result res = action.call()

CreateVpcHaGroup

API Request

URLs
POST zstack/v1/vpc/hagroups
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "vpcha-router",
    "description": "this is a vpc for test",
    "monitorIps": [
      "8.8.8.8"
    ]
  },
  "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":"vpcha-router","description":"this is a vpc for test","monitorIps":["8.8.8.8"]}}' http://localhost:8080/zstack/v1/vpc/hagroups
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The resource name. 3.5.1
description String body (contained in the params structure) Optional. The detailed description of the resource. 3.5.1
monitorIps List body (contained in the params structure) Optional. 3.5.1
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 3.5.1
tagUuids List body (contained in the params structure) Optional. The tag UUID list. 3.5.1
systemTags List body Optional. The system tags. 3.5.1
userTags List body Optional. The user tags. 3.5.1

API Response

Sample Response
{
  "inventory": {
    "uuid": "d32cd856d4603754aa30d8fe60ea07a4",
    "name": "test-vpcha",
    "monitors": [
      {
        "id": 0.0,
        "vpcHaRouterUuid": "d32cd856d4603754aa30d8fe60ea07a4",
        "monitorIp": "1.1.1.1"
      }
    ],
    "vrRefs": [
      {
        "uuid": "a26bee5e86153d2aa579c01756ca0944",
        "vpcHaRouterUuid": "d32cd856d4603754aa30d8fe60ea07a4"
      }
    ]
  }
}
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.5.1
inventory VpcHaGroupInventory See inventory. 3.5.1
#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.5.1
description String The brief description of the error. 3.5.1
details String The details about the error. 3.5.1
elaboration String The reserved field. Default value: null. 3.5.1
opaque LinkedHashMap The reserved field. Default value: null. 3.5.1
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.5.1
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.5.1
name String The resource name. 3.5.1
description String The detailed description of the resource. 3.5.1
createDate Timestamp The creation date. 3.5.1
lastOpDate Timestamp The last operation date. 3.5.1
monitors List See monitors. 3.5.1
vrRefs List See vrRefs. 3.5.1
services List See services. 3.5.1
usedIps List See usedIps. 3.5.1
#monitors
Name Type Description Starting Version
id Long 3.5.1
vpcHaRouterUuid String 3.5.1
monitorIp String 3.5.1
createDate Timestamp The creation date. 3.5.1
lastOpDate Timestamp The last operation date. 3.5.1
#vrRefs
Name Type Description Starting Version
uuid String The resource UUID. 3.5.1
VpcHaRouterUuid String 3.5.1
#services
Name Type Description Starting Version
id Long 3.5.1
vpcHaRouterUuid String 3.5.1
networkServiceName String 3.5.1
networkServiceUuid String 3.5.1
createDate Timestamp The creation date. 3.5.1
lastOpDate Timestamp The last operation date. 3.5.1
#usedIps
Name Type Description Starting Version
id Long 3.5.1
vpcHaRouterUuid String 3.5.1
vipUuid String The VIP UUID. 3.5.1
l3NetworkUuid String The L3 network UUID. 3.5.1
ip String 3.5.1
netmask String 3.5.1
createDate Timestamp The creation date. 3.5.1
lastOpDate Timestamp The last operation date. 3.5.1

SDK Sample

Java SDK
CreateVpcHaGroupAction action = new CreateVpcHaGroupAction();
action.name = "vpcha-router";
action.description = "this is a vpc for test";
action.monitorIps = asList("8.8.8.8");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVpcHaGroupAction.Result res = action.call();
Python SDK
CreateVpcHaGroupAction action = CreateVpcHaGroupAction()
action.name = "vpcha-router"
action.description = "this is a vpc for test"
action.monitorIps = [8.8.8.8]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateVpcHaGroupAction.Result res = action.call()

DeleteVpcHaGroup

API Request

URLs
DELETE zstack/v1/vpc/hagroups/{uuid}?deleteMode={deleteMode}
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/vpc/hagroups/90376847491b3d9a85df382f65d60a16?deleteMode=Permissive
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.5.1
deleteMode String body Optional. The delete mode. 3.5.1
systemTags List body Optional. The system tags. 3.5.1
userTags List body Optional. The user tags. 3.5.1

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
DeleteVpcHaGroupAction action = new DeleteVpcHaGroupAction();
action.uuid = "90376847491b3d9a85df382f65d60a16";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteVpcHaGroupAction.Result res = action.call();
Python SDK
DeleteVpcHaGroupAction action = DeleteVpcHaGroupAction()
action.uuid = "90376847491b3d9a85df382f65d60a16"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteVpcHaGroupAction.Result res = action.call()

UpdateVpcHaGroup

API Request

URLs
PUT zstack/v1/vpc/hagroups/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateVpcHaGroup": {
    "name": "ha-1",
    "description": "vpc ha test"
  },
  "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 '{"updateVpcHaGroup":{"name":"ha-1","description":"vpc ha test"}}' http://localhost:8080/zstack/v1/vpc/hagroups/0f3d8a0c297f3972b798d128070ca785/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.5.1
name String body (contained in the updateVpcHaGroup structure) Optional. The resource name. 3.5.1
description String body (contained in the updateVpcHaGroup structure) Optional. The detailed description of the resource. 3.5.1
systemTags List body Optional. The system tags. 3.5.1
userTags List body Optional. The user tags. 3.5.1

API Response

Sample Response
{
  "inventory": {
    "uuid": "5ddaa8fa444c3b0a8e9187d87eb026f6",
    "name": "test-vpcha",
    "monitors": [
      {
        "id": 0.0,
        "vpcHaRouterUuid": "5ddaa8fa444c3b0a8e9187d87eb026f6",
        "monitorIp": "1.1.1.1"
      }
    ],
    "vrRefs": [
      {
        "uuid": "184c6cab367e3da0aaf7624aa40bb3d0",
        "vpcHaRouterUuid": "5ddaa8fa444c3b0a8e9187d87eb026f6"
      }
    ]
  }
}
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.5.1
inventory VpcHaGroupInventory See inventory. 3.5.1
#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.5.1
description String The brief description of the error. 3.5.1
details String The details about the error. 3.5.1
elaboration String The reserved field. Default value: null. 3.5.1
opaque LinkedHashMap The reserved field. Default value: null. 3.5.1
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.5.1
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.5.1
name String The resource name. 3.5.1
description String The detailed description of the resource. 3.5.1
createDate Timestamp The creation date. 3.5.1
lastOpDate Timestamp The last operation date. 3.5.1
monitors List See monitors. 3.5.1
vrRefs List See vrRefs. 3.5.1
services List See services. 3.5.1
usedIps List See usedIps. 3.5.1
#monitors
Name Type Description Starting Version
id Long 3.5.1
vpcHaRouterUuid String 3.5.1
monitorIp String 3.5.1
createDate Timestamp The creation date. 3.5.1
lastOpDate Timestamp The last operation date. 3.5.1
#vrRefs
Name Type Description Starting Version
uuid String The resource UUID. 3.5.1
VpcHaRouterUuid String 3.5.1
#services
Name Type Description Starting Version
id Long 3.5.1
vpcHaRouterUuid String 3.5.1
networkServiceName String 3.5.1
networkServiceUuid String 3.5.1
createDate Timestamp The creation date. 3.5.1
lastOpDate Timestamp The last operation date. 3.5.1
#usedIps
Name Type Description Starting Version
id Long 3.5.1
vpcHaRouterUuid String 3.5.1
vipUuid String The VIP UUID. 3.5.1
l3NetworkUuid String The L3 network UUID. 3.5.1
ip String 3.5.1
netmask String 3.5.1
createDate Timestamp The creation date. 3.5.1
lastOpDate Timestamp The last operation date. 3.5.1

SDK Sample

Java SDK
UpdateVpcHaGroupAction action = new UpdateVpcHaGroupAction();
action.uuid = "0f3d8a0c297f3972b798d128070ca785";
action.name = "ha-1";
action.description = "vpc ha test";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateVpcHaGroupAction.Result res = action.call();
Python SDK
UpdateVpcHaGroupAction action = UpdateVpcHaGroupAction()
action.uuid = "0f3d8a0c297f3972b798d128070ca785"
action.name = "ha-1"
action.description = "vpc ha test"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateVpcHaGroupAction.Result res = action.call()

QueryVpcHaGroup

API Request

URLs
GET zstack/v1/vpc/hagroups
GET zstack/v1/vpc/hagroups/{uuid}
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/vpc/hagroups?q=uuid=3c5648a2a8a931cb9396d07479e833f7
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vpc/hagroups/2dc01a9b66a73a9399a7c1f29c91863a

Queryable Fields

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

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "843c2f1083d33689b1ecc19bd802158b",
      "name": "test-vpcha",
      "monitors": [
        {
          "id": 0.0,
          "vpcHaRouterUuid": "843c2f1083d33689b1ecc19bd802158b",
          "monitorIp": "1.1.1.1"
        }
      ],
      "vrRefs": [
        {
          "uuid": "87c3f098d2c7387b867ba0beb5d1a561",
          "vpcHaRouterUuid": "843c2f1083d33689b1ecc19bd802158b"
        }
      ]
    }
  ]
}
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.5.1
inventories List See inventories. 3.5.1
#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.5.1
description String The brief description of the error. 3.5.1
details String The details about the error. 3.5.1
elaboration String The reserved field. Default value: null. 3.5.1
opaque LinkedHashMap The reserved field. Default value: null. 3.5.1
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.5.1
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 3.5.1
name String The resource name. 3.5.1
description String The detailed description of the resource. 3.5.1
createDate Timestamp The creation date. 3.5.1
lastOpDate Timestamp The last operation date. 3.5.1
monitors List See monitors. 3.5.1
vrRefs List See vrRefs. 3.5.1
services List See services. 3.5.1
usedIps List See usedIps. 3.5.1
#monitors
Name Type Description Starting Version
id Long 3.5.1
vpcHaRouterUuid String 3.5.1
monitorIp String 3.5.1
createDate Timestamp The creation date. 3.5.1
lastOpDate Timestamp The last operation date. 3.5.1
#vrRefs
Name Type Description Starting Version
uuid String The resource UUID. 3.5.1
VpcHaRouterUuid String 3.5.1
#services
Name Type Description Starting Version
id Long 3.5.1
vpcHaRouterUuid String 3.5.1
networkServiceName String 3.5.1
networkServiceUuid String 3.5.1
createDate Timestamp The creation date. 3.5.1
lastOpDate Timestamp The last operation date. 3.5.1
#usedIps
Name Type Description Starting Version
id Long 3.5.1
vpcHaRouterUuid String 3.5.1
vipUuid String The VIP UUID. 3.5.1
l3NetworkUuid String The L3 network UUID. 3.5.1
ip String 3.5.1
netmask String 3.5.1
createDate Timestamp The creation date. 3.5.1
lastOpDate Timestamp The last operation date. 3.5.1

SDK Sample

Java SDK
QueryVpcHaGroupAction action = new QueryVpcHaGroupAction();
action.conditions = asList("uuid=26a2360f164c3a7fba94281b9e24046c");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryVpcHaGroupAction.Result res = action.call();
Python SDK
QueryVpcHaGroupAction action = QueryVpcHaGroupAction()
action.conditions = ["uuid=ddbc6e5deaee3fdfad33738ea1daefca"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryVpcHaGroupAction.Result res = action.call()

UpdateVirtualRouter

API Request

URLs
PUT zstack/v1/vm-instances/appliances/virtual-routers/{vmInstanceUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateVirtualRouter": {
    "defaultRouteL3NetworkUuid": "9889c6be639d3aefb72ae84f435c94c7"
  },
  "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 '{"updateVirtualRouter":{"defaultRouteL3NetworkUuid":"9889c6be639d3aefb72ae84f435c94c7"}}' http://localhost:8080/zstack/v1/vm-instances/appliances/virtual-routers/abd7e9700ed839a583c5af6f8b4dd417/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
vmInstanceUuid String body (contained in the updateVirtualRouter structure) The resource UUID. 3.9.0
defaultRouteL3NetworkUuid String body (contained in the updateVirtualRouter structure) Optional. The default route L3 network UUID. 3.9.0
systemTags List body Optional. The system tags. 3.9.0
userTags List body Optional. The user tags. 3.9.0

API Response

Sample Response
{
  "inventory": {
    "publicNetworkUuid": "142981c8c8243113b52db453575fb03f",
    "managementNetworkUuid": "1d182cdfa0a93daa9e4eb275b86645ff",
    "name": "Test-Router",
    "description": "this is a virtual router vm",
    "clusterUuid": "ea4cb55d692a3c45a154892539117472",
    "imageUuid": "3764ffab842333c895a9e1746315fab3",
    "instanceOfferingUuid": "ba4019cd841430258d8943f281b36c19"
  }
}
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.9.0
inventory VirtualRouterVmInventory See inventory. 3.9.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.9.0
description String The brief description of the error. 3.9.0
details String The details about the error. 3.9.0
elaboration String The reserved field. Default value: null. 3.9.0
opaque LinkedHashMap The reserved field. Default value: null. 3.9.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.9.0
#inventory
Name Type Description Starting Version
publicNetworkUuid String 3.9.0
virtualRouterVips List 3.9.0
applianceVmType String 3.9.0
managementNetworkUuid String 3.9.0
defaultRouteL3NetworkUuid String 3.9.0
status String 3.9.0
agentPort Integer 3.9.0
haStatus String 3.9.0
uuid String The resource UUID. 3.9.0
name String The resource name. 3.9.0
description String The detailed description of the resource. 3.9.0
zoneUuid String The zone UUID. 3.9.0
clusterUuid String The cluster UUID. 3.9.0
imageUuid String The image UUID. 3.9.0
hostUuid String The host UUID. 3.9.0
lastHostUuid String 3.9.0
instanceOfferingUuid String The instance offering UUID. 3.9.0
rootVolumeUuid String The root volume UUID. 3.9.0
platform String 3.9.0
defaultL3NetworkUuid String 3.9.0
type String 3.9.0
hypervisorType String 3.9.0
memorySize Long 3.9.0
cpuNum Integer 3.9.0
cpuSpeed Long 3.9.0
allocatorStrategy String 3.9.0
createDate Timestamp The creation date. 3.9.0
lastOpDate Timestamp The last operation date. 3.9.0
state String 3.9.0
vmNics List See vmNics. 3.9.0
allVolumes List See allVolumes. 3.9.0
vmCdRoms List See vmCdRoms. 3.9.0
#vmNics
Name Type Description Starting Version
uuid String The resource UUID. 3.9.0
vmInstanceUuid String The VM instance UUID. 3.9.0
l3NetworkUuid String The L3 network UUID. 3.9.0
ip String 3.9.0
mac String 3.9.0
hypervisorType String 3.9.0
netmask String 3.9.0
gateway String 3.9.0
metaData String 3.9.0
ipVersion Integer 3.9.0
driverType String 3.9.0
deviceId Integer 3.9.0
createDate Timestamp The creation date. 3.9.0
lastOpDate Timestamp The last operation date. 3.9.0
usedIps List See usedIps. 3.9.0
#usedIps
Name Type Description Starting Version
uuid String The resource UUID. 3.9.0
ipRangeUuid String The IP range UUID. 3.9.0
l3NetworkUuid String The L3 network UUID. 3.9.0
ipVersion Integer 3.9.0
ip String 3.9.0
netmask String 3.9.0
gateway String 3.9.0
usedFor String 3.9.0
ipInLong long 3.9.0
vmNicUuid String The VM NIC UUID. 3.9.0
createDate Timestamp The creation date. 3.9.0
lastOpDate Timestamp The last operation date. 3.9.0
#allVolumes
Name Type Description Starting Version
uuid String The resource UUID. 3.9.0
name String The resource name. 3.9.0
description String The detailed description of the resource. 3.9.0
primaryStorageUuid String The primary storage UUID. 3.9.0
vmInstanceUuid String The VM instance UUID. 3.9.0
diskOfferingUuid String The disk offering UUID. 3.9.0
rootImageUuid String 3.9.0
installPath String 3.9.0
type String 3.9.0
format String 3.9.0
size Long 3.9.0
actualSize Long 3.9.0
deviceId Integer 3.9.0
state String 3.9.0
status String 3.9.0
createDate Timestamp The creation date. 3.9.0
lastOpDate Timestamp The last operation date. 3.9.0
isShareable Boolean 3.9.0
volumeQos String 3.9.0
#vmCdRoms
Name Type Description Starting Version
uuid String The resource UUID. 3.9.0
vmInstanceUuid String The VM instance UUID. 3.9.0
deviceId Integer 3.9.0
isoUuid String 3.9.0
isoInstallPath String 3.9.0
name String The resource name. 3.9.0
description String The detailed description of the resource. 3.9.0
createDate Timestamp The creation date. 3.9.0
lastOpDate Timestamp The last operation date. 3.9.0

SDK Sample

Java SDK
UpdateVirtualRouterAction action = new UpdateVirtualRouterAction();
action.vmInstanceUuid = "abd7e9700ed839a583c5af6f8b4dd417";
action.defaultRouteL3NetworkUuid = "9889c6be639d3aefb72ae84f435c94c7";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateVirtualRouterAction.Result res = action.call();
Python SDK
UpdateVirtualRouterAction action = UpdateVirtualRouterAction()
action.vmInstanceUuid = "abd7e9700ed839a583c5af6f8b4dd417"
action.defaultRouteL3NetworkUuid = "9889c6be639d3aefb72ae84f435c94c7"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateVirtualRouterAction.Result res = action.call()

UpdateVirtualRouterSoftwareVersion

API Request

URLs
POST zstack/v1/vpc/virtual-routers/{uuid}/softwareversion
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "softwareName": "IPsec",
    "targetVersion": "5.9.4"
  },
  "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":{"softwareName":"IPsec","targetVersion":"5.9.4"}}' \
http://localhost:8080/zstack v1/vpc/virtual-routers/8971d40547ca3641ac809bb967426e17/softwareversion
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 4.5.0
softwareName String body (contained in the params structure) The VPC software name. IPsec 4.5.0
targetVersion String body (contained in the params structure) The target version.
  • 4.5.2
  • 5.9.4
4.5.0
systemTags List body Optional. The system tag. 4.5.0
userTags List body Optional. the user tag. 4.5.0

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
UpdateVirtualRouterSoftwareVersionAction action = new UpdateVirtualRouterSoftwareVersionAction();
action.uuid = "8971d40547ca3641ac809bb967426e17";
action.softwareName = "IPsec";
action.targetVersion = "5.9.4";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateVirtualRouterSoftwareVersionAction.Result res = action.call();
Python SDK
UpdateVirtualRouterSoftwareVersionAction action = UpdateVirtualRouterSoftwareVersionAction()
action.uuid = "8971d40547ca3641ac809bb967426e17"
action.softwareName = "IPsec"
action.targetVersion = "5.9.4"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateVirtualRouterSoftwareVersionAction.Result res = action.call()

GetVirtualRouterSoftwareVersion

API Request

URLs
GET zstack/v1/vpc/virtual-routers/{uuid}/softwareversion
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/vpc/virtual-routers/softwareversion \
uuid=c25bedf80bde367a86344add1264ed06&softwareName=IPsec&needUpdate=false
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String query Optional. The resource UUID. 4.5.0
softwareName String query The VPC software name. IPsec 4.5.0
needUpdate Boolean query Optional. Choose whether to update. 4.5.0
systemTags List query Optional. The system tag. 4.5.0
userTags List query Optional. The user tag. 4.5.0

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "4eb255bf21ff3b3384768b06aa612818",
      "softwareName": "IPsec",
      "currentVersion": "4.5.2",
      "latestVersion": "5.9.4"
    }
  ]
}
Name Type Description Starting Version
success boolean 4.5.0
inventories List See inventories 4.5.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 4.5.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 4.5.0
softwareName String The VPC software name. 4.5.0
currentVersion String The current version. 4.5.0
latestVersion String The latest version. 4.5.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. 4.5.0
description String The brief description of the error. 4.5.0
details String The details about the error. 4.5.0
elaboration String The reserved field. Default value: null. 4.5.0
opaque LinkedHashMap The reserved field. Default value: null. 4.5.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. 4.5.0

SDK Sample

Java SDK
GetVirtualRouterSoftwareVersionAction action = new GetVirtualRouterSoftwareVersionAction();
action.uuid = "c25bedf80bde367a86344add1264ed06";
action.softwareName = "IPsec";
action.needUpdate = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetVirtualRouterSoftwareVersionAction.Result res = action.call();
Python SDK
GetVirtualRouterSoftwareVersionAction action = GetVirtualRouterSoftwareVersionAction()
action.uuid = "c25bedf80bde367a86344add1264ed06"
action.softwareName = "IPsec"
action.needUpdate = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetVirtualRouterSoftwareVersionAction.Result res = action.call()

GetRouteTableVpcVRouterCandidate

API Request

URLs
POST zstack/v1/vpc/virtual-routers/get-vpc-candidate
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {},
  "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":{}}' http://localhost:8080/zstack/v1/vpc/virtual-routers/get-vpc-candidate
Request Parameters
Name Type Location Description Valid Value Starting Version
systemTags List body Optional. 4.2.0
userTags List body Optional. 4.2.0

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "d7f0b3eeb8b63de29be7ecd1f37e4538",
      "name": "trigger",
      "description": "this is a scheduler trigger",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
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.2.0
inventory List See inventories. 4.2.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. 4.2.0
description String The brief description of the error. 4.2.0
details String The details about the error. 4.2.0
elaboration String The reserved field. Default value: null. 4.2.0
opaque LinkedHashMap The reserved field. Default value: null. 4.2.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. 4.2.0
#inventories
Name Type Description Starting Version
publicNetworkUuid String 4.2.0
virtualRouterVips List 4.2.0
applianceVmType String 4.2.0
managementNetworkUuid String 4.2.0
defaultRouteL3NetworkUuid String 4.2.0
status String 4.2.0
agentPort Integer 4.2.0
haStatus String 4.2.0
uuid String The resource UUID. 4.2.0
name String The resource name. 4.2.0
description String The detailed description of the resource. 4.2.0
zoneUuid String The zone UUID. 4.2.0
clusterUuid String The cluster UUID. 4.2.0
imageUuid String The image UUID. 4.2.0
hostUuid String The host UUID. 4.2.0
lastHostUuid String 4.2.0
instanceOfferingUuid String The instance offering UUID. 4.2.0
rootVolumeUuid String The root volume UUID. 4.2.0
platform String 4.2.0
defaultL3NetworkUuid String 4.2.0
type String 4.2.0
hypervisorType String 4.2.0
memorySize Long 4.2.0
cpuNum Integer 4.2.0
cpuSpeed Long 4.2.0
allocatorStrategy String 4.2.0
createDate Timestamp The creation time. 4.2.0
lastOpDate Timestamp The last operation time. 4.2.0
state String 4.2.0
dns List See dns. 4.2.0
haRef List See haRef. 4.2.0
vmNics List See vmNics. 4.2.0
allVolumes List See allVolumes. 4.2.0
vmCdRoms List See vmCdRoms. 4.2.0
#dns
Name Type Description Starting Version
id Long 4.2.0
vpcRouterUuid String 4.2.0
dns String 4.2.0
createDate Timestamp The creation time. 4.2.0
lastOpDate Timestamp The last operation time. 4.2.0
#haRef
Name Type Description Starting Version
uuid String The resource UUID. 4.2.0
vpcHaRouterUuid String 4.2.0
#vmNics
Name Type Description Starting Version
uuid String The resource UUID. 4.2.0
vmInstanceUuid String The VM instance UUID. 4.2.0
l3NetworkUuid String The L3 network UUID. 4.2.0
ip String The IP address. 4.2.0
mac String The MAC address. 4.2.0
hypervisorType String The hypervisor type. 4.2.0
netmask String The netmask. 4.2.0
gateway String The gateway. 4.2.0
metaData String 4.2.0
ipVersion Integer The IP version. 4.2.0
deviceId Integer The device ID. 4.2.0
type String The NIC type. 4.2.0
createDate Timestamp The creation time. 4.2.0
lastOpDate Timestamp The last operation time. 4.2.0
usedIps List See usedIps. 4.2.0
#usedIps
Name Type Description Starting Version
uuid String The resource UUID. 4.2.0
ipRangeUuid String The IP range UUID. 4.2.0
l3NetworkUuid String The L3 network UUID. 4.2.0
ipVersion Integer The IP version. 4.2.0
ip String The IP address. 4.2.0
netmask String The netmask. 4.2.0
gateway String The gateway. 4.2.0
usedFor String 4.2.0
ipInLong long 4.2.0
vmNicUuid String The VM NIC UUID. 4.2.0
createDate Timestamp The creation time. 4.2.0
lastOpDate Timestamp The last operation time. 4.2.0
#allVolumes
Name Type Description Starting Version
uuid String The resource UUID. 4.2.0
name String The resource name. 4.2.0
description String The detailed description of the resource. 4.2.0
primaryStorageUuid String The primary storage UUID. 4.2.0
vmInstanceUuid String The VM UUID. 4.2.0
diskOfferingUuid String The disk offering UUID. 4.2.0
rootImageUuid String The root volume image UUID. 4.2.0
installPath String The installation path of the volume on the primary storage. 4.2.0
type String The volume type. 4.2.0
format String The volume type. 4.2.0
size Long The volume size. 4.2.0
actualSize Long The actual size of the volume. 4.2.0
deviceId Integer 4.2.0
state String Indicates whether the disk is enabled. 4.2.0
status String The volume status. 4.2.0
createDate Timestamp The creation time. 4.2.0
lastOpDate Timestamp The last update time. 4.2.0
isShareable Boolean Indicates whether the volume is a shared volume. 4.2.0
volumeQos String The volume QoS, for example, total=1048576 4.2.0
#vmCdRoms
Name Type Description Starting Version
uuid String The resource UUID. 4.2.0
vmInstanceUuid String The VM instance UUID. 4.2.0
deviceId Integer The device ID. 4.2.0
isoUuid String The ISO image UUID. 4.2.0
isoInstallPath String The installation path of the ISO image. 4.2.0
name String The resource name. 4.2.0
description String The detailed description of the resource. 4.2.0
createDate Timestamp The creation time. 4.2.0
lastOpDate Timestamp The last operation time. 4.2.0

SDK Sample

Java SDK
GetRouteTableVpcVRouterCandidateAction action = new GetRouteTableVpcVRouterCandidateAction();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetRouteTableVpcVRouterCandidateAction.Result res = action.call();
Python SDK
GetRouteTableVpcVRouterCandidateAction action = GetRouteTableVpcVRouterCandidateAction()
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetRouteTableVpcVRouterCandidateAction.Result res = action.call()
API Reference | 4.8.38 | ZStack Cloud · ZCF | ZStack Resource Center