AttachPortForwardingRule
API Request
URLs
POST zstack/v1/port-forwarding/{ruleUuid}/vm-instances/nics/{vmNicUuid}
Headers
Authorization: OAuth the-session-uuid
Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST http://localhost:8080/zstack/v1/port-forwarding/4c74c079f5b836e1912d20914953d722/vm-instances/nics/05c384cc720e32e4b57e93daea1c5b91
Request Parameters
Name | Type | Location | Description | Optional Value | Starting Version |
---|---|---|---|---|---|
ruleUuid | String | url | The UUID of the port forwarding rule. | 0.6 | |
vmNicUuid | String | url | The VM NIC UUID. | 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": "8727976deceb42e898d9efc50863564a",
"name": "TestAttachRule",
"description": "test atatch rule",
"vipIp": "192.168.0.187",
"guestIp": "10.0.0.244",
"vipUuid": "2aa6a4055ce94c319894dfddc330376f",
"vipPortStart": 33.0,
"vipPortEnd": 33.0,
"privatePortStart": 33.0,
"privatePortEnd": 33.0,
"vmNicUuid": "39f90e4259784eee880e1cbef31c88da",
"protocolType": "TCP",
"state": "Enabled",
"allowedCidr": "0.0.0.0/0",
"createDate": "Jun 7, 2017 9:20:32 PM",
"lastOpDate": "Jun 7, 2017 9:20:32 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
AttachPortForwardingRuleAction action = new AttachPortForwardingRuleAction();
action.ruleUuid = "b34b406cf94f432eb0755a9201798d1f";
action.vmNicUuid = "be5e6e16b1f0428a833d3152699766ea";
action.sessionId = "14dc12a577f14f1b9622850e00f06884";
AttachPortForwardingRuleAction.Result res = action.call();
Python
SDK
AttachPortForwardingRuleAction action = AttachPortForwardingRuleAction()
action.ruleUuid = "3b83c27e561643778396b003a6294cea"
action.vmNicUuid = "4892663d34c642f8854306188276e890"
action.sessionId = "e1b52fc03d0f479c8da456abd4fd6e6b"
AttachPortForwardingRuleAction.Result res = action.call()