Queries the rules of a security group.
Debugging
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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ecs:DescribeSecurityGroupAttribute | get |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
SecurityGroupId | string | Yes | The ID of the security group. | sg-bp1gxw6bznjjvhu3**** |
RegionId | string | Yes | The region ID of the security group. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
NicType | string | No | The network interface controller (NIC) type of the security group rule.
| intranet |
Direction | string | No | The direction in which the security group rule is applied. Valid values:
Default value: all. | all |
NextToken | string | No | The pagination token that is used in the next request to retrieve a new page of results. You do not need to specify this parameter for the first request. You must specify the token that is obtained from the previous query as the value of NextToken. | AAAAAdDWBF2**** |
MaxResults | integer | No | The maximum number of entries per page.
Default value: 500. | 500 |
Response parameters
Examples
Sample success responses
JSON
format
{
"VpcId": "vpc-bp1opxu1zkhn00gzv****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
"InnerAccessPolicy": "Accept",
"Description": "This is description.",
"SecurityGroupId": "sg-bp1gxw6bznjjvhu3****",
"SecurityGroupName": "SecurityGroupName Sample",
"RegionId": "cn-hangzhou",
"Permissions": {
"Permission": [
{
"SecurityGroupRuleId": "sgr-bp12kewq32dfwrdi****",
"Direction": "ingress",
"SourceGroupId": "sg-bp12kc4rqohaf2js****",
"DestGroupOwnerAccount": "1234567890",
"DestPrefixListId": "pl-x1j1k5ykzqlixabc****",
"DestPrefixListName": "DestPrefixListName Sample",
"SourceCidrIp": "0.0.0.0/0",
"Ipv6DestCidrIp": "2001:db8:1233:1a00::***",
"CreateTime": "2018-12-12T07:28:38Z",
"Ipv6SourceCidrIp": "2001:db8:1234:1a00::***",
"DestGroupId": "sg-bp1czdx84jd88i7v****",
"DestCidrIp": "0.0.0.0/0",
"IpProtocol": "TCP",
"Priority": "1",
"DestGroupName": "testDestGroupName",
"NicType": "intranet",
"Policy": "Accept",
"Description": "Description Sample 01",
"PortRange": "80/80",
"SourcePrefixListName": "SourcePrefixListName Sample",
"SourcePrefixListId": "pl-x1j1k5ykzqlixdcy****",
"SourceGroupOwnerAccount": "1234567890",
"SourceGroupName": "testSourceGroupName1",
"SourcePortRange": "80/80"
}
]
},
"NextToken": "AAAAAdDWBF2****"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidNicType.ValueNotSupported | The specified NicType does not exist. | The specified NicType parameter does not exist. |
400 | InvalidParamter | Invalid Parameter. | The specified parameter is invalid. |
400 | InvalidSecurityGroupId.Malformed | The specified parameter "SecurityGroupId" is not valid. | - |
400 | MissingParameter.RegionId | The parameter "RegionId" should not be null. | - |
404 | InvalidRegionId.NotFound | The specified RegionId does not exist. | The specified region ID does not exist. |
404 | InvalidSecurityGroupId.NotFound | The specified SecurityGroupId does not exist. | The specified security group does not exist in this account. Check whether the security group ID is correct. |
500 | InternalError | The request processing has failed due to some unknown error. | An internal error has occurred. Try again later. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-05-21 | The Error code has changed. The request parameters of the API has changed. The response structure of the API has changed | View Change Details |