文档

DescribeSecurityGroupAttribute - 查询一个安全组的安全组规则

更新时间:

调用DescribeSecurityGroupAttribute查询一个安全组的安全组规则。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。
  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:
    • 对于必选的资源类型,用背景高亮的方式表示。
    • 对于不支持资源级授权的操作,用全部资源表示。
  • 条件关键字:是指云产品自身定义的条件关键字。
  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作访问级别资源类型条件关键字关联操作
ecs:DescribeSecurityGroupAttributeRead
  • SecurityGroup
    acs:ecs:{#regionId}:{#accountId}:securitygroup/{#securitygroupId}
  • ecs:tag

请求参数

名称类型必填描述示例值
SecurityGroupIdstring

安全组 ID。

sg-bp1gxw6bznjjvhu3****
RegionIdstring

安全组所属地域 ID。您可以调用 DescribeRegions 查看最新的阿里云地域列表。

cn-hangzhou
NicTypestring

安全组规则的网卡类型。

  • 经典网络类型安全组的取值范围:
    • internet(默认):公网
    • intranet:内网
    说明 单次调用只能查询一种网卡类型的安全组规则,查询全部类型请分两次调用。
  • 专有网络类型安全组的取值只能为:intranet(默认),即内网。
    说明 如果传入 internet 或空值,则会默认转化为 intranet。
intranet
Directionstring

安全组规则授权方向。取值范围:

  • egress:安全组出方向
  • ingress:安全组入方向
  • all:不区分方向

默认值:all

all

返回参数

名称类型描述示例值
object
VpcIdstring

VPC ID。如果返回 VPC ID,表示该安全组网络类型为 VPC。否则,表示是经典网络类型安全组。

vpc-bp1opxu1zkhn00gzv****
RequestIdstring

请求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
InnerAccessPolicystring

安全组内网络连通策略。可能值:

  • Accept:内网互通
  • Drop:内网隔离
Accept
Descriptionstring

安全组描述信息。

This is description.
SecurityGroupIdstring

目标安全组 ID。

sg-bp1gxw6bznjjvhu3****
SecurityGroupNamestring

目标安全组名称。

SecurityGroupName Sample
RegionIdstring

地域 ID。

cn-hangzhou
Permissionsobject []

安全组权限规则集合。

SecurityGroupRuleIdstring

安全组规则 ID。

sgr-bp12kewq32dfwrdi****
Directionstring

授权方向。

ingress
SourceGroupIdstring

源端安全组,用于入方向授权。

sg-bp12kc4rqohaf2js****
DestGroupOwnerAccountstring

目的端安全组所属阿里云账户 ID。

1234567890
DestPrefixListIdstring

目的端前缀列表 ID,用于出方向授权。

pl-x1j1k5ykzqlixabc****
DestPrefixListNamestring

目的端前缀列表的名称。

DestPrefixListName Sample
SourceCidrIpstring

源端 IP 地址段,用于入方向授权。

0.0.0.0/0
Ipv6DestCidrIpstring

目的端 IPv6 地址段。

2001:db8:1233:1a00::***
CreateTimestring

创建时间,UTC 时间。

2018-12-12T07:28:38Z
Ipv6SourceCidrIpstring

源端 IPv6 地址段。

2001:db8:1234:1a00::***
DestGroupIdstring

目的端安全组,用于出方向授权。

sg-bp1czdx84jd88i7v****
DestCidrIpstring

目的端 IP 地址段,用于出方向授权。

0.0.0.0/0
IpProtocolstring

IP 协议。

TCP
Prioritystring

规则优先级。

1
DestGroupNamestring

目的端安全组名称。

testDestGroupName
NicTypestring

网络类型。

intranet
Policystring

授权策略。

Accept
Descriptionstring

安全组描述信息。

Description Sample 01
PortRangestring

端口范围。

80/80
SourcePrefixListNamestring

源端前缀列表的名称。

SourcePrefixListName Sample
SourcePrefixListIdstring

源端前缀列表 ID,用于入方向授权。

pl-x1j1k5ykzqlixdcy****
SourceGroupOwnerAccountstring

源端安全组所属阿里云账户 ID。

1234567890
SourceGroupNamestring

源端安全组名称。

testSourceGroupName1
SourcePortRangestring

源端端口范围。

80/80

示例

正常返回示例

JSON格式

{
  "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"
      }
    ]
  }
}

错误码

HTTP status code错误码错误信息描述
400InvalidNicType.ValueNotSupportedThe specified NicType does not exist.指定的网络类型不存在,请您检查网络类型是否正确。
400InvalidParamterInvalid Parameter.输入的参数无效。
400InvalidSecurityGroupId.MalformedThe specified parameter "SecurityGroupId" is not valid.-
400MissingParameter.RegionIdThe parameter "RegionId" should not be null.-
404InvalidRegionId.NotFoundThe specified RegionId does not exist.指定的地域 ID 不存在。
404InvalidSecurityGroupId.NotFoundThe specified SecurityGroupId does not exist.指定的安全组在该用户账号下不存在,请您检查安全组 ID 是否正确。
500InternalErrorThe request processing has failed due to some unknown error.内部错误,请重试。

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
暂无变更历史
  • 本页导读 (1)
文档反馈