Skip to main content
Resource Center/Network Service/Network Service Operations/Port Forwarding Operations
POSTPort Forwarding OperationsSince 0.6SynchronousAuth Required

AttachPortForwardingRule

AttachPortForwardingRule

Execution Availability

Try It Out

Submit a mock request using the current auth context and example-driven inputs.

Path Parameters

Request Inputs

Path Parameters

  • ruleUuidStringRequired

    The UUID of the port forwarding rule.

  • vmNicUuidStringRequired

    The VM NIC UUID.

Body Fields

  • systemTagsList

    Optional. The system tags.

  • userTagsList

    Optional. The user tags.

Responses

200 OK

On success, this API returns the following response structure.

  • successbooleanRequired

    操作是否成功。

  • errorErrorCodeRequired

    The error code. If not null, the operation fails, or vice versa. For more information, see error.

    • codeStringRequired

      The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001.

    • descriptionStringRequired

      The brief description of the error.

    • detailsStringRequired

      The details about the error.

    • elaborationStringRequired

      The reserved field. Default value: null.

    • opaqueLinkedHashMapRequired

      The reserved field. Default value: null.

    • causeErrorCodeRequired

      The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null.

  • inventoryPortForwardingRuleInventoryRequired

    See inventory.

    • uuidStringRequired

      The resource UUID.

    • nameStringRequired

      The resource name.

    • descriptionStringRequired

      The detailed description of the resource.

    • vipIpStringRequired

      The IP address of the VIP.

    • guestIpStringRequired

      The IP address of the VM NIC.

    • vipUuidStringRequired

      The VIP UUID.

    • vipPortStartIntegerRequired

      The start port of the VIP.

    • vipPortEndIntegerRequired

      The end port of the VIP.

    • privatePortStartIntegerRequired

      The start port of the guest IP address.

    • privatePortEndIntegerRequired

      The end port of the guest IP address.

    • vmNicUuidStringRequired

      The VM NIC UUID.

    • protocolTypeStringRequired

      The protocol type of the network traffic.

    • stateStringRequired

      The state of the rule.

    • allowedCidrStringRequired

      The source CIDR. The port forwarding rule is only applied to the traffics of the source CIDR.

    • createDateTimestampRequired

      The creation date.

    • lastOpDateTimestampRequired

      The last operation date.

Endpoint

POST/zstack/v1/port-forwarding/{ruleUuid}/vm-instances/nics/{vmNicUuid}

/zstack/v1/port-forwarding/{ruleUuid}/vm-instances/nics/{vmNicUuid}

Operation ID

AttachPortForwardingRule

Permalink

Request Example

curl -X POST 'http://{host}/zstack/v1/port-forwarding/{ruleUuid}/vm-instances/nics/{vmNicUuid}' -H 'Authorization: OAuth {sessionUuid}' -H 'Content-Type: application/json;charset=UTF-8' -d '{"systemTags":["<systemTags>"],"userTags":["<userTags>"]}'

Response Example

200
{ "inventory": { "uuid": "8727976deceb42e898d9efc50863564a", "name": "TestAttachRule", "description": "test atatch rule", "vipIp": "192.168.0.187", "guestIp": "10.0.0.244", "vipUuid": "2aa6a4055ce94c319894dfddc330376f", "vipPortStart": 33, "vipPortEnd": 33, "privatePortStart": 33, "privatePortEnd": 33, "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" } }

Change History

This API has no change history records yet.

View all change history