UpdatePortForwardingRule
API Request
URLs
PUT zstack/v1/port-forwarding/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"updatePortForwardingRule": {
"name": "pf2",
"description": "new rule"
},
"systemTags": [],
"userTags": []
}

Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updatePortForwardingRule":{"name":"pf2","description":"new rule"}}' \
http://localhost:8080/zstack/v1/port-forwarding/07eb042c2f5837a99f4018c3ee7e4137/actions
Request Parameters
Name | Type | Location | Description | Optional Value | Starting Version |
---|---|---|---|---|---|
uuid | String | url | The resource UUID. | 0.6 | |
name | String | body (contained in the updatePortForwardingRule structure) | Optional. The resource name. | 0.6 | |
description | String | body (contained in the updatePortForwardingRule structure) | Optional. The detailed description of the resource. | 0.6 | |
systemTags | List | body | Optional. The system tags. | 0.6 | |
userTags | List | body | Optional. The user tags. | 0.6 |
API Response
Sample
Response
{
"inventory": {
"uuid": "420edb331ec34871a416e570fa4faf8b",
"name": "TestAttachRule",
"description": "test atatch rule",
"vipIp": "192.168.0.187",
"guestIp": "10.0.0.244",
"vipUuid": "8282dbb28b70416790bd83d08d3718ba",
"vipPortStart": 33.0,
"vipPortEnd": 33.0,
"privatePortStart": 33.0,
"privatePortEnd": 33.0,
"vmNicUuid": "2e63ec7524074e9dad1255d5e02f0697",
"protocolType": "TCP",
"state": "Enabled",
"allowedCidr": "0.0.0.0/0",
"createDate": "Jun 7, 2017 9:20:38 PM",
"lastOpDate": "Jun 7, 2017 9:20:38 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 | PortForwardingRuleInventory | See inventory. | 0.6 |
#error
Name | Type | Description | Starting Version |
---|---|---|---|
code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
description | String | The brief description of the error. | 0.6 |
details | String | The details about the error. | 0.6 |
elaboration | String | The reserved field. Default value: null. | 0.6 |
opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
Name | Type | Description | Starting Version |
---|---|---|---|
uuid | String | The resource UUID. | 0.6 |
name | String | The resource name. | 0.6 |
description | String | The detailed description of the resource. | 0.6 |
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
UpdatePortForwardingRuleAction action = new UpdatePortForwardingRuleAction();
action.uuid = "b180491f86cd4de4befd11df26ebc4b1";
action.name = "pf2";
action.description = "new rule";
action.sessionId = "1130b06d95ed438386c8199cfae9e55b";
UpdatePortForwardingRuleAction.Result res = action.call();
Python
SDK
UpdatePortForwardingRuleAction action = UpdatePortForwardingRuleAction()
action.uuid = "fe896714482549eaac0cd07a6661664a"
action.name = "pf2"
action.description = "new rule"
action.sessionId = "0992d35c275a4def8bcbb013653b65f9"
UpdatePortForwardingRuleAction.Result res = action.call()