All Products
Search
Document Center

ENS:GetDeviceInternetPort

Last Updated:Jul 26, 2024

Queries the network address translation (NAT) rule details of a device such as a server or container by its ID.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ens:GetDeviceInternetPortget
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The ID of the instance. You can specify the ID of the server or container. You can specify only one ID.

i-5s6xbnx9srb3vm6tp9hg9o64e
NatTypestringYes

The type of the NAT gateway. The value must be of the enumerated data type. Valid values:

  • SNAT
  • DNAT
DNAT
RuleIdstringNo

The ID of the rule. If you leave this parameter empty, all rules are queried.

snat-5ref5fc1l1xgqnpjzrtw1hw5a

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response

RequestIdstring

The ID of the request.

36311833-83FC-57C3-A7DD-768F61F65555
InstanceIdstring

The ID of the instance. The value is the ID of the server or container.

i-5sadvk2xnylvra9kyejcnevi6
NetworkInfoarray<object>

The network mapping information about the instance.

object
InternalIpstring

The internal IP address.

10.0.0.49
InternalPortstring

The internal port number.

2020/2025
ExternalIpstring

The public IP address.

39.105.62.120
ExternalPortstring

The external port number.

20
ISPstring

The Internet service provider (ISP).

cmcc
Statusstring

The status of the external port.

Running

Examples

Sample success responses

JSONformat

{
  "RequestId": "36311833-83FC-57C3-A7DD-768F61F65555",
  "InstanceId": "i-5sadvk2xnylvra9kyejcnevi6",
  "NetworkInfo": [
    {
      "InternalIp": "10.0.0.49",
      "InternalPort": "2020/2025",
      "ExternalIp": "39.105.62.120",
      "ExternalPort": "20",
      "ISP": "cmcc",
      "Status": "Running"
    }
  ]
}

Error codes

HTTP status codeError codeError message
400NoPermissionPermission denied.
400InvalidParameter.%sThe specified field %s invalid. Please check it again.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history