ChangePortForwardingRuleState
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.
{
"changePortForwardingRuleState": {
"stateEvent": "disable"
},
"systemTags": [],
"userTags": []
}

Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changePortForwardingRuleState":{"stateEvent":"disable"}}' \
http://localhost:8080/zstack/v1/port-forwarding/d391cd5c4b57369daa48190ec0e193f6/actions
Request Parameters
Name | Type | Location | Description | Optional Value | Starting Version |
---|---|---|---|---|---|
uuid | String | url | The resource UUID. | 0.6 | |
stateEvent | String | body (contained in the changePortForwardingRuleState structure) | The state of the port forwarding rule. |
|
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": "59d724e1f8e8417693fbc14d124ce801",
"name": "TestAttachRule",
"description": "test atatch rule",
"vipIp": "192.168.0.187",
"guestIp": "10.0.0.244",
"vipUuid": "f9c5cbc8662d43408dc704003d4f70ad",
"vipPortStart": 33.0,
"vipPortEnd": 33.0,
"privatePortStart": 33.0,
"privatePortEnd": 33.0,
"vmNicUuid": "1b41288698ac45149f352ab6c8de2531",
"protocolType": "TCP",
"state": "Enabled",
"allowedCidr": "0.0.0.0/0",
"createDate": "Jun 7, 2017 9:20:26 PM",
"lastOpDate": "Jun 7, 2017 9:20:26 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
ChangePortForwardingRuleStateAction action = new ChangePortForwardingRuleStateAction();
action.uuid = "4a721a0136d94428951072e3314b5187";
action.stateEvent = "disable";
action.sessionId = "ce7e78520ff34fbd8dcc181fba226ee0";
ChangePortForwardingRuleStateAction.Result res = action.call();
Python
SDK
ChangePortForwardingRuleStateAction action = ChangePortForwardingRuleStateAction()
action.uuid = "a694cfa2057e4bd087a076e6f970f8cf"
action.stateEvent = "disable"
action.sessionId = "abbfa65e2f3040038dc85a68ffa37c8b"
ChangePortForwardingRuleStateAction.Result res = action.call()