QueryPortForwardingRule
API Request
URLs
GET zstack/v1/port-forwarding
GET zstack/v1/port-forwarding/{uuid}Headers
Authorization: OAuth the-session-uuidCurl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 959a6d98336c4575a31212834d8ccc4d" \
-X GET http://localhost:8080/zstack/v1/port-forwarding?q=name=pf1&q=state=Enabledcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 0389ba8bf3c44bf8a9c5ee89d066fbdc" \
-X GET http://localhost:8080/zstack/v1/port-forwarding/3d9c9dbbea944e039d55e706aacb6899Queryable Fields
You can check all queryable fields and resource names that can be queried across
tables by using zstack-cli, entering
QueryPortForwardingRule, and pressing the Tab key.
API Response
Sample
Response
{
"inventories": [
{
"uuid": "c5cf6d7df3164418b3fe5c7569eb1dea",
"name": "TestAttachRule",
"description": "test atatch rule",
"vipIp": "192.168.0.187",
"guestIp": "10.0.0.244",
"vipUuid": "b5166a0c9adb4aaf8088022b5336209a",
"vipPortStart": 33.0,
"vipPortEnd": 33.0,
"privatePortStart": 33.0,
"privatePortEnd": 33.0,
"vmNicUuid": "8aa417eb4537475b815b289240e0c0c2",
"protocolType": "TCP",
"state": "Enabled",
"allowedCidr": "0.0.0.0/0",
"createDate": "Jun 7, 2017 9:21:17 PM",
"lastOpDate": "Jun 7, 2017 9:21:17 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 |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| vipIp | String | The IP address of the VIP. | 0.6 |
| guestIp | String | The IP address of the VM NIC. | 0.6 |
| vipUuid | String | The VIP UUID. | 0.6 |
| vipPortStart | Integer | The start port of the VIP. | 0.6 |
| vipPortEnd | Integer | The end port of the VIP. | 0.6 |
| privatePortStart | Integer | The start port of the guest IP address. | 0.6 |
| privatePortEnd | Integer | The end port of the guest IP address. | 0.6 |
| vmNicUuid | String | The VM NIC UUID. | 0.6 |
| protocolType | String | The protocol type of the network traffic. | 0.6 |
| state | String | The state of the rule. | 0.6 |
| allowedCidr | String | The source CIDR. The port forwarding rule is only applied to the traffics of the source CIDR. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
Java
SDK
QueryPortForwardingRuleAction action = new QueryPortForwardingRuleAction();
action.conditions = asList("name=pf1","state=Enabled");
action.sessionId = "4311e616ca8b4bb19d0792be1e08f3b8";
QueryPortForwardingRuleAction.Result res = action.call();Python
SDK
QueryPortForwardingRuleAction action = QueryPortForwardingRuleAction()
action.conditions = ["name=pf1","state=Enabled"]
action.sessionId = "b9745425f62d43289db77d9bfd117b35"
QueryPortForwardingRuleAction.Result res = action.call()