Policy Routing Operations
CreatePolicyRouteRuleSet
API Request
POST zstack/v1/policy-routes/rulesetsAuthorization: OAuth the-session-uuid{
"params": {
"name": "ruleSet",
"description": "description",
"vRouterUuid": "85eb5d9f50bc3919b793b3caf9f3e859"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"ruleSet","description":"description","vRouterUuid":"85eb5d9f50bc3919b793b3caf9f3e859"}}' http://localhost:8080/zstack/v1/policy-routes/rulesets| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The resource name. | 3.6.0 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the resource. | 3.6.0 | |
| vRouterUuid | String | body (contained in the params structure) | The vRouter UUID. | 3.6.0 | |
| type | String | body (contained in the params structure) | Optional. The type. |
|
3.9.0 |
| resourceUuid | String | body (contained in the params structure) | Optional. The resource UUID. | 3.6.0 | |
| tagUuids | List | body (contained in the params structure) | Optional. The tag UUID list. | 3.6.0 | |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"inventory": {
"name": "name",
"description": "example-des",
"rules": [
{
"uuid": "74cc4fed46f633f2a618b0e06d122377",
"ruleNumber": 1.0,
"ruleSetUuid": "00693e31fa3b3e3fba017ed714c02cdf",
"tableUuid": "b273e0c273c03559872efa272194492c",
"destIp": "192.168.1.1",
"sourceIp": "10.0.0.1",
"destPort": "22",
"sourcePort": "80",
"protocol": "tcp",
"state": "enable"
}
]
}
}| 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.6.0 |
| inventory | PolicyRouteRuleSetInventory | See inventory. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| name | String | The resource name. | 3.6.0 |
| description | String | The detailed description of the resource. | 3.6.0 |
| type | String | 3.9.0 | |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| rules | List | See rules | 3.6.0 |
| l3Refs | List | See l3Refs. | 3.9.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| ruleNumber | int | The priority. | 3.6.0 |
| ruleSetUuid | String | The UUID of the policy route rule set. | 3.6.0 |
| tableUuid | String | The policy route table UUID. | 3.6.0 |
| destIp | String | The destination IP address. | 3.6.0 |
| sourceIp | String | The source IP address. | 3.6.0 |
| destPort | String | The destination port. | 3.6.0 |
| sourcePort | String | The source port. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| protocol | PolicyRouteRuleProtocol | See protocol. | 3.6.0 |
| state | PolicyRouteRuleState | See state. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| tcp | PolicyRouteRuleProtocol | 3.6.0 | |
| udp | PolicyRouteRuleProtocol | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| enable | PolicyRouteRuleState | 3.6.0 | |
| disable | PolicyRouteRuleState | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | long | 3.9.0 | |
| l3NetworkUuid | String | The L3 network UUID. | 3.9.0 |
| ruleSetUuid | String | 3.9.0 | |
| createDate | Timestamp | The creation date. | 3.9.0 |
| lastOpDate | Timestamp | The last operation date. | 3.9.0 |
SDK Sample
CreatePolicyRouteRuleSetAction action = new CreatePolicyRouteRuleSetAction();
action.name = "ruleSet";
action.description = "description";
action.vRouterUuid = "85eb5d9f50bc3919b793b3caf9f3e859";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreatePolicyRouteRuleSetAction.Result res = action.call();CreatePolicyRouteRuleSetAction action = CreatePolicyRouteRuleSetAction()
action.name = "ruleSet"
action.description = "description"
action.vRouterUuid = "85eb5d9f50bc3919b793b3caf9f3e859"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreatePolicyRouteRuleSetAction.Result res = action.call()DeletePolicyRouteRuleSet
API Request
DELETE zstack/v1/policy-routes/ruleSets/{uuid}?deleteMode={deleteMode}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/policy-routes/ruleSets/f430004bc0ed315c89eb7909a48d27e7?deleteMode=Permissive| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 3.6.0 | |
| deleteMode | String | body | Optional. The delete mode. | 3.6.0 | |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DeletePolicyRouteRuleSetAction action = new DeletePolicyRouteRuleSetAction();
action.uuid = "f430004bc0ed315c89eb7909a48d27e7";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeletePolicyRouteRuleSetAction.Result res = action.call();DeletePolicyRouteRuleSetAction action = DeletePolicyRouteRuleSetAction()
action.uuid = "f430004bc0ed315c89eb7909a48d27e7"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeletePolicyRouteRuleSetAction.Result res = action.call()UpdatePolicyRouteRuleSet
API Request
PUT zstack/v1/policy-routes/ruleSets/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"updatePolicyRouteRuleSet": {
"name": "name",
"description": "desc"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updatePolicyRouteRuleSet":{"name":"name","description":"desc"}}' http://localhost:8080/zstack/v1/policy-routes/ruleSets/e58212f4cd0c3f2f96d27dde19de1383/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 3.6.0 | |
| name | String | body (contained in the updatePolicyRouteRuleSet structure) | Optional. The resource name. | 3.6.0 | |
| description | String | body (contained in the updatePolicyRouteRuleSet structure) | Optional. The detailed description of the resource. | 3.6.0 | |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"inventory": {
"name": "name",
"description": "example-des",
"rules": []
}
}| 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.6.0 |
| inventory | PolicyRouteRuleSetInventory | See inventory. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| name | String | The resource name. | 3.6.0 |
| description | String | The detailed description of the resource. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| rules | List | See rules. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| ruleNumber | int | The priority. | 3.6.0 |
| ruleSetUuid | String | The UUID of the policy route rule set. | 3.6.0 |
| tableUuid | String | The policy route table UUID. | 3.6.0 |
| destIp | String | The destination IP address. | 3.6.0 |
| sourceIp | String | The source IP address. | 3.6.0 |
| destPort | String | The destination port. | 3.6.0 |
| sourcePort | String | The source port. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| protocol | PolicyRouteRuleProtocol | See protocol. | 3.6.0 |
| state | PolicyRouteRuleState | See state. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| tcp | PolicyRouteRuleProtocol | 3.6.0 | |
| udp | PolicyRouteRuleProtocol | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| enable | PolicyRouteRuleState | 3.6.0 | |
| disable | PolicyRouteRuleState | 3.6.0 |
SDK Sample
UpdatePolicyRouteRuleSetAction action = new UpdatePolicyRouteRuleSetAction();
action.uuid = "e58212f4cd0c3f2f96d27dde19de1383";
action.name = "name";
action.description = "desc";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdatePolicyRouteRuleSetAction.Result res = action.call();UpdatePolicyRouteRuleSetAction action = UpdatePolicyRouteRuleSetAction()
action.uuid = "e58212f4cd0c3f2f96d27dde19de1383"
action.name = "name"
action.description = "desc"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdatePolicyRouteRuleSetAction.Result res = action.call()QueryPolicyRouteRuleSet
API Request
GET zstack/v1/policy-routes/rulesetsGET zstack/v1/policy-routes/rulesets/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/policy-routes/rulesetscurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/policy-routes/rulesets/f3c338fa05d63ceaa90fedcaffebfd66Queryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryPolicyRouteRuleSet, and pressing the Tab key.
API Response
{
"inventories": [
{
"name": "name",
"description": "example-des",
"rules": [
{
"uuid": "2e05ab3c36323487baea2414005817ee",
"ruleNumber": 1.0,
"ruleSetUuid": "4c86543d473f3127885b3ffc8be5ec88",
"tableUuid": "d2ad1f7ad9aa354e8da24829bbd31a05",
"destIp": "192.168.1.1",
"sourceIp": "10.0.0.1",
"destPort": "22",
"sourcePort": "80",
"protocol": "tcp",
"state": "enable"
}
]
}
]
}| 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.6.0 |
| inventories | List | See inventories. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| name | String | The resource name. | 3.6.0 |
| description | String | The detailed description of the resource. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| rules | List | See rules. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| ruleNumber | int | The priority. | 3.6.0 |
| ruleSetUuid | String | The UUID of the policy route rule set. | 3.6.0 |
| tableUuid | String | The policy route table UUID. | 3.6.0 |
| destIp | String | The destination IP address. | 3.6.0 |
| sourceIp | String | The source IP address. | 3.6.0 |
| destPort | String | The destination port. | 3.6.0 |
| sourcePort | String | The source port. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| protocol | PolicyRouteRuleProtocol | See protocol. | 3.6.0 |
| state | PolicyRouteRuleState | See state. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| tcp | PolicyRouteRuleProtocol | 3.6.0 | |
| udp | PolicyRouteRuleProtocol | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| enable | PolicyRouteRuleState | 3.6.0 | |
| disable | PolicyRouteRuleState | 3.6.0 |
SDK Sample
QueryPolicyRouteRuleSetAction action = new QueryPolicyRouteRuleSetAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryPolicyRouteRuleSetAction.Result res = action.call();QueryPolicyRouteRuleSetAction action = QueryPolicyRouteRuleSetAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryPolicyRouteRuleSetAction.Result res = action.call()QueryPolicyRouteRuleSetL3Ref
API Request
GET zstack/v1/policy-routes/rulesets/l3networdks/refsAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/policy-routes/rulesets/l3networdks/refsQueryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryPolicyRouteRuleSetL3Ref, and pressing the Tab key.
API Response
{
"inventories": [
{
"id": 1.0,
"l3NetworkUuid": "764cba1766563fd683ef1fcf76c7295c",
"ruleSetUuid": "ddb87b28f0253810b753fc9ae62ebd31"
}
]
}| 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.6.0 |
| inventories | List | See inventories. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | long | 3.6.0 | |
| l3NetworkUuid | String | The L3 network UUID. | 3.6.0 |
| ruleSetUuid | String | The UUID of the policy route rule set. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
SDK Sample
QueryPolicyRouteRuleSetL3RefAction action = new QueryPolicyRouteRuleSetL3RefAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryPolicyRouteRuleSetL3RefAction.Result res = action.call();QueryPolicyRouteRuleSetL3RefAction action = QueryPolicyRouteRuleSetL3RefAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryPolicyRouteRuleSetL3RefAction.Result res = action.call()QueryPolicyRouteRuleSetVRouterRef
API Request
GET zstack/v1/policy-routes/rulesets/vrouters/refsAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/policy-routes/rulesets/vrouters/refsQueryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryPolicyRouteRuleSetVRouterRef, and pressing the Tab key.
API Response
{
"inventories": [
{
"id": 1.0,
"vRouterUuid": "8715faa19cb03995a864330766fdc77c",
"ruleSetUuid": "2e27f9015ad3357996546fd51c2d808e"
}
]
}| 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.6.0 |
| inventories | List | See inventories. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | long | 3.6.0 | |
| vRouterUuid | String | The vRouter UUID. | 3.6.0 |
| ruleSetUuid | String | The UUID of the policy route rule set. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
SDK Sample
QueryPolicyRouteRuleSetVRouterRefAction action = new QueryPolicyRouteRuleSetVRouterRefAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryPolicyRouteRuleSetVRouterRefAction.Result res = action.call();QueryPolicyRouteRuleSetVRouterRefAction action = QueryPolicyRouteRuleSetVRouterRefAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryPolicyRouteRuleSetVRouterRefAction.Result res = action.call()CreatePolicyRouteRule
API Request
POST zstack/v1/policy-routes/rulesAuthorization: OAuth the-session-uuid{
"params": {
"ruleSetUuid": "ec2472bf205931318e02a2bb5356c0ee",
"tableUuid": "b4c03beba98c3502ac53d784dd9bfe61",
"ruleNumber": 1001.0,
"destIp": "192.168.1.0/24",
"sourceIp": "192.168.2.0/24",
"destPort": "22",
"sourcePort": "33",
"protocol": "tcp"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"ruleSetUuid":"ec2472bf205931318e02a2bb5356c0ee","tableUuid":"b4c03beba98c3502ac53d784dd9bfe61","ruleNumber":1001.0,"destIp":"192.168.1.0/24","sourceIp":"192.168.2.0/24","destPort":"22","sourcePort":"33","protocol":"tcp"}}' http://localhost:8080/zstack/v1/policy-routes/rules| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| ruleSetUuid | String | body (contained in the params structure) | The UUID of the policy route rule set. | 3.6.0 | |
| tableUuid | String | body (contained in the params structure) | The policy route table UUID. | 3.6.0 | |
| ruleNumber | int | body (contained in the params structure) | The priority. | 3.6.0 | |
| destIp | String | body (contained in the params structure) | Optional. The destination IP address. | 3.6.0 | |
| sourceIp | String | body (contained in the params structure) | Optional. The source IP address. | 3.6.0 | |
| destPort | String | body (contained in the params structure) | Optional. The destination port. | 3.6.0 | |
| sourcePort | String | body (contained in the params structure) | Optional. The source port. | 3.6.0 | |
| protocol | String | body (contained in the params structure) | Optional. The protocol. | 3.6.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The resource UUID. | 3.6.0 | |
| tagUuids | List | body (contained in the params structure) | Optional. The tag UUID list. | 3.6.0 | |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"inventory": {
"uuid": "8b14e8fd1bae3b35acb67d19b8c7580e",
"ruleNumber": 1.0,
"ruleSetUuid": "7cd6023e32c639169b2316ffec4c79f3",
"tableUuid": "3d5c0b99cfac3654a451c854cf449091",
"destIp": "192.168.1.1",
"sourceIp": "80",
"destPort": "22",
"protocol": "tcp",
"state": "enable"
}
}| 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.6.0 |
| inventory | PolicyRouteRuleInventory | See inventory. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| ruleNumber | int | The priority. | 3.6.0 |
| ruleSetUuid | String | The UUID of the policy route rule set. | 3.6.0 |
| tableUuid | String | The policy route table UUID. | 3.6.0 |
| destIp | String | The destination IP address. | 3.6.0 |
| sourceIp | String | The source IP address. | 3.6.0 |
| destPort | String | The destination port. | 3.6.0 |
| sourcePort | String | The source port. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| protocol | PolicyRouteRuleProtocol | See protocol. | 3.6.0 |
| state | PolicyRouteRuleState | See state. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| tcp | PolicyRouteRuleProtocol | 3.6.0 | |
| udp | PolicyRouteRuleProtocol | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| enable | PolicyRouteRuleState | 3.6.0 | |
| disable | PolicyRouteRuleState | 3.6.0 |
SDK Sample
CreatePolicyRouteRuleAction action = new CreatePolicyRouteRuleAction();
action.ruleSetUuid = "ec2472bf205931318e02a2bb5356c0ee";
action.tableUuid = "b4c03beba98c3502ac53d784dd9bfe61";
action.ruleNumber = 1001.0;
action.destIp = "192.168.1.0/24";
action.sourceIp = "192.168.2.0/24";
action.destPort = "22";
action.sourcePort = "33";
action.protocol = "tcp";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreatePolicyRouteRuleAction.Result res = action.call();CreatePolicyRouteRuleAction action = CreatePolicyRouteRuleAction()
action.ruleSetUuid = "ec2472bf205931318e02a2bb5356c0ee"
action.tableUuid = "b4c03beba98c3502ac53d784dd9bfe61"
action.ruleNumber = 1001.0
action.destIp = "192.168.1.0/24"
action.sourceIp = "192.168.2.0/24"
action.destPort = "22"
action.sourcePort = "33"
action.protocol = "tcp"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreatePolicyRouteRuleAction.Result res = action.call()DeletePolicyRouteRule
API Request
DELETE zstack/v1/policy-routes/rules/{uuid}?deleteMode={deleteMode}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/policy-routes/rules/b02689c3b5513b8db2bb5f45a8c7b169?deleteMode=Permissive| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 3.6.0 | |
| deleteMode | String | body | Optional. The delete mode. | 3.6.0 | |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DeletePolicyRouteRuleAction action = new DeletePolicyRouteRuleAction();
action.uuid = "b02689c3b5513b8db2bb5f45a8c7b169";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeletePolicyRouteRuleAction.Result res = action.call();DeletePolicyRouteRuleAction action = DeletePolicyRouteRuleAction()
action.uuid = "b02689c3b5513b8db2bb5f45a8c7b169"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeletePolicyRouteRuleAction.Result res = action.call()CreatePolicyRouteTable
API Request
POST zstack/v1/policy-routes/tablesAuthorization: OAuth the-session-uuid{
"params": {
"vRouterUuid": "efe77450940f3dfe9023f2589fdeda25",
"number": 1.0,
"description": "description"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"vRouterUuid":"efe77450940f3dfe9023f2589fdeda25","number":1.0,"description":"description"}}' http://localhost:8080/zstack/v1/policy-routes/tables| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| vRouterUuid | String | body (contained in the params structure) | The vRouter UUID. | 3.6.0 | |
| number | Integer | body (contained in the params structure) | The table number. | 3.6.0 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the resource. | 3.6.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The resource UUID. | 3.6.0 | |
| tagUuids | List | body (contained in the params structure) | Optional. The tag UUID list. | 3.6.0 | |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"inventory": {
"uuid": "8bd52616389d3ce7b5d74bc2424d3f8d",
"tableNumber": 1.0,
"description": "example-des",
"routes": [
{
"tableUuid": "2a7ba1261cef3cf19b587e493e479286",
"destinationCidr": "192.168.1.0/24",
"nextHopIp": "192.168.1.1",
"distance": 1.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. | 3.6.0 |
| inventory | PolicyRouteTableInventory | See inventory. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| tableNumber | int | The table number. | 3.6.0 |
| description | String | The detailed description of the resource. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| routes | List | See routes. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| tableUuid | String | The policy route table UUID. | 3.6.0 |
| destinationCidr | String | The destination CIDR address. | 3.6.0 |
| nextHopIp | String | The next hop IP address. | 3.6.0 |
| distance | int | The priority. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
SDK Sample
CreatePolicyRouteTableAction action = new CreatePolicyRouteTableAction();
action.vRouterUuid = "efe77450940f3dfe9023f2589fdeda25";
action.number = 1.0;
action.description = "description";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreatePolicyRouteTableAction.Result res = action.call();CreatePolicyRouteTableAction action = CreatePolicyRouteTableAction()
action.vRouterUuid = "efe77450940f3dfe9023f2589fdeda25"
action.number = 1.0
action.description = "description"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreatePolicyRouteTableAction.Result res = action.call()DeletePolicyRouteTable
API Request
DELETE zstack/v1/policy-routes/tables/{uuid}?deleteMode={deleteMode}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/policy-routes/tables/4c24bf6b15d3338ab1d66eac97eec58b?deleteMode=Permissive| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 3.6.0 | |
| deleteMode | String | body | Optional. The delete mode. | 3.6.0 | |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DeletePolicyRouteTableAction action = new DeletePolicyRouteTableAction();
action.uuid = "4c24bf6b15d3338ab1d66eac97eec58b";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeletePolicyRouteTableAction.Result res = action.call();DeletePolicyRouteTableAction action = DeletePolicyRouteTableAction()
action.uuid = "4c24bf6b15d3338ab1d66eac97eec58b"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeletePolicyRouteTableAction.Result res = action.call()QueryPolicyRouteTable
API Request
GET zstack/v1/policy-routes/tablesGET zstack/v1/policy-routes/tables/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/policy-routes/tablescurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/policy-routes/tables/e32b296e6633331284c5cbbd71cedfa4Queryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryPolicyRouteTable, and pressing the Tab key.
API Response
{
"inventories": [
{
"uuid": "6e39025e9eb432fda488f19e7104fdf0",
"tableNumber": 1.0,
"description": "example-des",
"routes": [
{
"tableUuid": "90f075232c383565ac3dbc09554c4152",
"destinationCidr": "192.168.1.0/24",
"nextHopIp": "192.168.1.1",
"distance": 1.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. | 3.6.0 |
| inventories | List | See inventories. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| tableNumber | int | The table number. | 3.6.0 |
| description | String | The detailed description of the resource. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| routes | List | See routes. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| tableUuid | String | The policy route table UUID. | 3.6.0 |
| destinationCidr | String | The destination CIDR. | 3.6.0 |
| nextHopIp | String | The next hop IP address. | 3.6.0 |
| distance | int | The priority. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
SDK Sample
QueryPolicyRouteTableAction action = new QueryPolicyRouteTableAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryPolicyRouteTableAction.Result res = action.call();QueryPolicyRouteTableAction action = QueryPolicyRouteTableAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryPolicyRouteTableAction.Result res = action.call()QueryPolicyRouteTableVRouterRef
API Request
GET zstack/v1/policy-routes/tables/vrouters/refsAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/policy-routes/tables/vrouters/refsQueryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryPolicyRouteTableVRouterRef, and pressing the Tab key.
API Response
{
"inventories": [
{
"id": 1.0,
"tableUuid": "cc3bb710f9d43cedb044213253363604",
"vRouterUuid": "f281299552813438acc3c5a400802a78"
}
]
}| 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.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
SDK Sample
QueryPolicyRouteTableVRouterRefAction action = new QueryPolicyRouteTableVRouterRefAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryPolicyRouteTableVRouterRefAction.Result res = action.call();QueryPolicyRouteTableVRouterRefAction action = QueryPolicyRouteTableVRouterRefAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryPolicyRouteTableVRouterRefAction.Result res = action.call()CreatePolicyRouteTableRouteEntry
API Request
POST zstack/v1/policy-routes/routesAuthorization: OAuth the-session-uuid{
"params": {
"tableUuid": "ef44a453884a3b93867d6ec0b7dd5716",
"destinationCidr": "192.168.1.0/24",
"nextHopIp": "192.168.1.1",
"distance": 1.0
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"tableUuid":"ef44a453884a3b93867d6ec0b7dd5716","destinationCidr":"192.168.1.0/24","nextHopIp":"192.168.1.1","distance":1.0}}' http://localhost:8080/zstack/v1/policy-routes/routes| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| tableUuid | String | body (contained in the params structure) | The policy route table UUID. | 3.6.0 | |
| destinationCidr | String | body (contained in the params structure) | The destination CIDR. | 3.6.0 | |
| nextHopIp | String | body (contained in the params structure) | The next hop IP address. | 3.6.0 | |
| distance | Integer | body (contained in the params structure) | The priority. | 3.6.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. | 3.6.0 | |
| tagUuids | List | body (contained in the params structure) | Optional. The tag UUID list. | 3.6.0 | |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"inventory": {
"tableUuid": "a6e9466373c333948f8d6ef573992d43",
"destinationCidr": "192.168.1.0/24",
"nextHopIp": "192.168.1.1",
"distance": 1.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. | 3.6.0 |
| inventory | PolicyRouteTableRouteEntryInventory | See inventory. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| tableUuid | String | The policy route table UUID. | 3.6.0 |
| destinationCidr | String | The destination CIDR. | 3.6.0 |
| nextHopIp | String | The next hop IP address. | 3.6.0 |
| distance | int | The priority. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
SDK Sample
CreatePolicyRouteTableRouteEntryAction action = new CreatePolicyRouteTableRouteEntryAction();
action.tableUuid = "ef44a453884a3b93867d6ec0b7dd5716";
action.destinationCidr = "192.168.1.0/24";
action.nextHopIp = "192.168.1.1";
action.distance = 1.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreatePolicyRouteTableRouteEntryAction.Result res = action.call();CreatePolicyRouteTableRouteEntryAction action = CreatePolicyRouteTableRouteEntryAction()
action.tableUuid = "ef44a453884a3b93867d6ec0b7dd5716"
action.destinationCidr = "192.168.1.0/24"
action.nextHopIp = "192.168.1.1"
action.distance = 1.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreatePolicyRouteTableRouteEntryAction.Result res = action.call()DeletePolicyRouteTableRouteEntry
API Request
DELETE zstack/v1/policy-routes/routes/{uuid}?deleteMode={deleteMode}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/policy-routes/routes/7e28a7059fb33a8bb2d7c61b7951303e?deleteMode=Permissive| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 3.6.0 | |
| deleteMode | String | body | Optional. The delete mode. | 3.6.0 | |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DeletePolicyRouteTableRouteEntryAction action = new DeletePolicyRouteTableRouteEntryAction();
action.uuid = "7e28a7059fb33a8bb2d7c61b7951303e";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeletePolicyRouteTableRouteEntryAction.Result res = action.call();DeletePolicyRouteTableRouteEntryAction action = DeletePolicyRouteTableRouteEntryAction()
action.uuid = "7e28a7059fb33a8bb2d7c61b7951303e"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeletePolicyRouteTableRouteEntryAction.Result res = action.call()QueryPolicyRouteTableRouteEntry
API Request
GET zstack/v1/policy-routes/routesGET zstack/v1/policy-routes/routes/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/policy-routes/routescurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/policy-routes/routes/775c98615c5936f3aab19b6271c9e5dcQueryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryPolicyRouteTableRouteEntry, and pressing the Tab key.
API Response
{
"inventories": [
{
"tableUuid": "49bf5678360b38058ab7096715e219f4",
"destinationCidr": "192.168.1.0/24",
"nextHopIp": "192.168.1.1",
"distance": 1.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. | 3.6.0 |
| inventories | List | See inventories. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| tableUuid | String | The policy route table UUID. | 3.6.0 |
| destinationCidr | String | The destination CIDR. | 3.6.0 |
| nextHopIp | String | The next hop IP address. | 3.6.0 |
| distance | int | The priority. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
SDK Sample
QueryPolicyRouteTableRouteEntryAction action = new QueryPolicyRouteTableRouteEntryAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryPolicyRouteTableRouteEntryAction.Result res = action.call();QueryPolicyRouteTableRouteEntryAction action = QueryPolicyRouteTableRouteEntryAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryPolicyRouteTableRouteEntryAction.Result res = action.call()QueryPolicyRouteRule
API Request
GET zstack/v1/policy-routes/rulesGET zstack/v1/policy-routes/rules/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/policy-routes/rulescurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/policy-routes/rules/cc3c19210de13878994ddcb5bee8a34cQueryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryPolicyRouteRule, and pressing the Tab key.
API Response
{
"inventories": [
{
"uuid": "538840755c1a36e0b79f1d04097b252e",
"ruleNumber": 1.0,
"ruleSetUuid": "7cb413c84b243290a7105e8c21f42b59",
"tableUuid": "d29940b692f33c0eaf96b0193029636c",
"destIp": "192.168.1.1",
"sourceIp": "80",
"destPort": "22",
"protocol": "tcp",
"state": "enable"
}
]
}| 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.6.0 |
| inventories | List | See inventories. | 3.6.0 |
| 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.6.0 |
| description | String | The brief description of the error. | 3.6.0 |
| details | String | The details about the error. | 3.6.0 |
| elaboration | String | The reserved field. Default value: null. | 3.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.6.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.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.6.0 |
| ruleNumber | int | The priority. | 3.6.0 |
| ruleSetUuid | String | The UUID of the policy route rule set. | 3.6.0 |
| tableUuid | String | The policy route table UUID. | 3.6.0 |
| destIp | String | The destination IP address. | 3.6.0 |
| sourceIp | String | The source IP address. | 3.6.0 |
| destPort | String | The destination port. | 3.6.0 |
| sourcePort | String | The source port. | 3.6.0 |
| createDate | Timestamp | The creation date. | 3.6.0 |
| lastOpDate | Timestamp | The last operation date. | 3.6.0 |
| protocol | PolicyRouteRuleProtocol | See protocol. | 3.6.0 |
| state | PolicyRouteRuleState | See state. | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| tcp | PolicyRouteRuleProtocol | 3.6.0 | |
| udp | PolicyRouteRuleProtocol | 3.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| enable | PolicyRouteRuleState | 3.6.0 | |
| disable | PolicyRouteRuleState | 3.6.0 |
SDK Sample
QueryPolicyRouteRuleAction action = new QueryPolicyRouteRuleAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryPolicyRouteRuleAction.Result res = action.call();QueryPolicyRouteRuleAction action = QueryPolicyRouteRuleAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryPolicyRouteRuleAction.Result res = action.call()AttachPolicyRouteRuleSetToL3
API Request
POST zstack/v1/policy-routes/rulesets/{ruleSetUuid}/l3networks/{l3Uuid}Authorization: OAuth the-session-uuid{
"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 -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' http://localhost:8080/zstack/v1/policy-routes/rulesets/1e6eb259093e3fa2a30c837ae69d259c/l3networks/8748b8be922938bbb430ed9cbe3e4e46| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| l3Uuid | String | url | The L3 network UUID. | 3.6.0 | |
| ruleSetUuid | String | url | The UUID of the policy rule set. | 3.6.0 | |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
AttachPolicyRouteRuleSetToL3Action action = new AttachPolicyRouteRuleSetToL3Action();
action.l3Uuid = "8748b8be922938bbb430ed9cbe3e4e46";
action.ruleSetUuid = "1e6eb259093e3fa2a30c837ae69d259c";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachPolicyRouteRuleSetToL3Action.Result res = action.call();AttachPolicyRouteRuleSetToL3Action action = AttachPolicyRouteRuleSetToL3Action()
action.l3Uuid = "8748b8be922938bbb430ed9cbe3e4e46"
action.ruleSetUuid = "1e6eb259093e3fa2a30c837ae69d259c"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachPolicyRouteRuleSetToL3Action.Result res = action.call()DetachPolicyRouteRuleSetFromL3
API Request
DELETE zstack/v1/policy-routes/rulesets/{ruleSetUuid}/l3networks/{l3Uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/policy-routes/rulesets/75641a6f70c03fcea051d7fb5e45a0e5/l3networks/9556f3da05743aa88a603e086875e22c| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| l3Uuid | String | url | The L3 network UUID. | 3.6.0 | |
| ruleSetUuid | String | url | The UUID of the policy route rule set. | 3.6.0 | |
| systemTags | List | body | Optional. The system tags. | 3.6.0 | |
| userTags | List | body | Optional. The user tags. | 3.6.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DetachPolicyRouteRuleSetFromL3Action action = new DetachPolicyRouteRuleSetFromL3Action();
action.l3Uuid = "9556f3da05743aa88a603e086875e22c";
action.ruleSetUuid = "75641a6f70c03fcea051d7fb5e45a0e5";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachPolicyRouteRuleSetFromL3Action.Result res = action.call();DetachPolicyRouteRuleSetFromL3Action action = DetachPolicyRouteRuleSetFromL3Action()
action.l3Uuid = "9556f3da05743aa88a603e086875e22c"
action.ruleSetUuid = "75641a6f70c03fcea051d7fb5e45a0e5"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachPolicyRouteRuleSetFromL3Action.Result res = action.call()GetPolicyRouteRuleSetFromVirtualRouter
API Request
GET zstack/v1/policy-routes/rulesets/virtualrouter/{vmInstanceUuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/policy-routes/rulesets/virtualrouter/d38e9c3321af3f01a5509fa7f43dc46a| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| vmInstanceUuid | String | url | The VM instance UUID. | 3.9.0 | |
| systemTags | List | query | Optional. The system tags. | 3.9.0 | |
| userTags | List | query | Optional. The user tags. | 3.9.0 |
API Response
{
"inventories": [
{
"uuid": "de191bb7f4763ce580fd7e2ed457cde8",
"name": "policy-rule-set",
"description": "policy rule set",
"type": "User",
"rules": [],
"l3Refs": []
}
]
}| 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 |
| inventories | List | See inventories. | 3.9.0 |
| 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 |
| 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 |
| type | String | 3.9.0 | |
| createDate | Timestamp | The creation date. | 3.9.0 |
| lastOpDate | Timestamp | The last operation date. | 3.9.0 |
| rules | List | See rules. | 3.9.0 |
| l3Refs | List | See l3Refs. | 3.9.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 3.9.0 |
| ruleNumber | int | 3.9.0 | |
| ruleSetUuid | String | 3.9.0 | |
| tableUuid | String | 3.9.0 | |
| destIp | String | 3.9.0 | |
| sourceIp | String | 3.9.0 | |
| destPort | String | 3.9.0 | |
| sourcePort | String | 3.9.0 | |
| createDate | Timestamp | The creation date. | 3.9.0 |
| lastOpDate | Timestamp | The last operation date. | 3.9.0 |
| protocol | PolicyRouteRuleProtocol | See protocol. | 3.9.0 |
| state | PolicyRouteRuleState | See state. | 3.9.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| tcp | PolicyRouteRuleProtocol | 3.9.0 | |
| udp | PolicyRouteRuleProtocol | 3.9.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| enable | PolicyRouteRuleState | 3.9.0 | |
| disable | PolicyRouteRuleState | 3.9.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | long | 3.9.0 | |
| l3NetworkUuid | String | The L3 network UUID. | 3.9.0 |
| ruleSetUuid | String | 3.9.0 | |
| createDate | Timestamp | The creation date. | 3.9.0 |
| lastOpDate | Timestamp | The last operation date. | 3.9.0 |
SDK Sample
GetPolicyRouteRuleSetFromVirtualRouterAction action = new GetPolicyRouteRuleSetFromVirtualRouterAction();
action.vmInstanceUuid = "d38e9c3321af3f01a5509fa7f43dc46a";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetPolicyRouteRuleSetFromVirtualRouterAction.Result res = action.call();GetPolicyRouteRuleSetFromVirtualRouterAction action = GetPolicyRouteRuleSetFromVirtualRouterAction()
action.vmInstanceUuid = "d38e9c3321af3f01a5509fa7f43dc46a"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetPolicyRouteRuleSetFromVirtualRouterAction.Result res = action.call()