调用AddACLRule接口添加访问控制规则。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | AddACLRule |
系统规定参数。取值:AddACLRule。 |
RegionId | String | 是 | cn-shanghai |
访问控制实例所属地域ID。 您可以通过调用DescribeRegions接口获取地域ID。 |
AclId | String | 是 | acl-xhwhyuo43l0n***** |
访问控制实例ID。 |
Description | String | 否 | desctest |
访问控制规则描述信息。 描述长度为1~512个字符。 |
Direction | String | 是 | in |
访问控制规则应用方向。取值:
|
SourceCidr | String | 是 | 192.168.20.0/24 |
源网段。 源网段格式为CIDR格式。例如:192.168.1.0/24。 |
DestCidr | String | 是 | 192.168.10.0/24 |
目的网段。 目的网段格式为CIDR格式。例如:192.168.10.0/24。 |
IpProtocol | String | 是 | tcp |
访问控制规则应用的协议。 访问控制功能支持的协议类型,请以控制台为准。协议格式不区分大小写。 |
SourcePortRange | String | 是 | 1/200 |
源端口范围。 取值范围:-1或1~65535。 源端口范围格式例如:1/200、80/80,其中-1/-1代表不限制端口。 |
DestPortRange | String | 是 | 1/200 |
目的端口范围。 取值范围:-1或1~65535。 目的端口范围格式例如:1/200、80/80,其中-1/-1代表不限制端口。 |
Policy | String | 是 | accept |
访问控制规则授权策略。取值:
|
Priority | Integer | 否 | 12 |
访问控制规则优先级。 数值越小,优先级越高。同优先级时,首先下发到智能接入网关设备的规则优先生效。 取值范围:1~100。默认值:1。 |
Type | String | 否 | LAN |
访问控制规则类型。取值:
|
Name | String | 否 | doctest |
访问控制规则名称。 长度为2~100个字符,以大小写字母或中文开头,可包含数字、半角句号(.)、下划线(_)和短划线(-)。 |
DpiSignatureIds.N | String | 否 | 1 |
应用ID。 系统支持一次最多输入100个应用ID。 |
DpiGroupIds.N | String | 否 | 20 |
应用组ID。 系统支持一次最多输入100个应用组ID。 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
Policy | String | drop |
访问控制规则授权策略。
|
Description | String | test |
访问控制规则描述信息。 |
RequestId | String | 880F84CB-9B54-4413-A8A3-8832C82D1BC4 |
请求ID。 |
SourcePortRange | String | 1/65535 |
源端口范围。 |
SourceCidr | String | 192.168.20.0/24 |
源网段。 源网段格式为CIDR格式。例如:192.168.1.0/24。 |
Priority | Integer | 1 |
访问控制规则优先级。 数值越小,优先级越高。同优先级时,首先下发到智能接入网关设备的规则优先生效。 |
AclId | String | acl-xhwhyuo43l0******* |
访问控制实例ID。 |
AcrId | String | acr-c1hkd054qywi****** |
访问控制规则ID。 |
DestPortRange | String | 1/65535 |
目的端口范围。 |
Direction | String | out |
访问控制规则应用方向。取值:
|
DpiGroupIds | Array of String | 20 |
当前访问控制规则匹配的应用组ID列表。 |
Name | String | doctest |
访问控制规则名称。 |
Type | String | LAN |
访问控制规则类型。
|
GmtCreate | Long | 1553766882689 |
创建访问控制规则时的时间戳。 时间戳格式为Long型,优先级相同时,时间戳小的访问控制规则优先生效。 |
DestCidr | String | 192.168.10.0/24 |
目的网段。 目的网段格式为CIDR格式。例如:192.168.10.0/24。 |
DpiSignatureIds | Array of String | 1 |
当前访问控制规则匹配的应用ID列表。 |
IpProtocol | String | TCP |
访问控制规则应用的协议。 |
示例
请求示例
http(s)://[Endpoint]/?Action=AddACLRule
&RegionId=cn-shanghai
&AclId=acl-xhwhyuo43l0n*****
&Description=desctest
&Direction=in
&SourceCidr=192.168.20.0/24
&DestCidr=192.168.10.0/24
&IpProtocol=tcp
&SourcePortRange=1/200
&DestPortRange=1/200
&Policy=accept
&Priority=12
&Type=LAN
&Name=doctest
&DpiSignatureIds=["1"]
&DpiGroupIds=["20"]
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<AddACLRuleResponse>
<Policy>drop</Policy>
<Description>test</Description>
<RequestId>880F84CB-9B54-4413-A8A3-8832C82D1BC4</RequestId>
<SourcePortRange>1/65535</SourcePortRange>
<SourceCidr>192.168.20.0/24</SourceCidr>
<Priority>1</Priority>
<AclId>acl-xhwhyuo43l0*******</AclId>
<AcrId>acr-c1hkd054qywi******</AcrId>
<DestPortRange>1/65535</DestPortRange>
<Direction>out</Direction>
<DpiGroupIds>20</DpiGroupIds>
<Name>doctest</Name>
<Type>LAN</Type>
<GmtCreate>1553766882689</GmtCreate>
<DestCidr>192.168.10.0/24</DestCidr>
<DpiSignatureIds>1</DpiSignatureIds>
<IpProtocol>TCP</IpProtocol>
</AddACLRuleResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"Policy" : "drop",
"Description" : "test",
"RequestId" : "880F84CB-9B54-4413-A8A3-8832C82D1BC4",
"SourcePortRange" : "1/65535",
"SourceCidr" : "192.168.20.0/24",
"Priority" : 1,
"AclId" : "acl-xhwhyuo43l0*******",
"AcrId" : "acr-c1hkd054qywi******",
"DestPortRange" : "1/65535",
"Direction" : "out",
"DpiGroupIds" : [ "20" ],
"Name" : "doctest",
"Type" : "LAN",
"GmtCreate" : 1553766882689,
"DestCidr" : "192.168.10.0/24",
"DpiSignatureIds" : [ "1" ],
"IpProtocol" : "TCP"
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | ACL.NoSupportWanType | An SAG 1000 device does not support a WAN ACL. | sag-1000类型盒子不支持公网ACL。 |
400 | ACL.InvalidType | The specified ACL type is invalid. | 非法的ACL类型。 |
403 | Forbidden | User not authorized to operate on the specified resource. | 用户没有操作此资源的权限。 |
403 | MissingParameter | The input parameter is missing, please check your input. | 输入参数缺失,请检查您的输入。 |
403 | InvalidDescription | Description not valid. | 详情描述超过长度限制。 |
403 | InvalidParameter | The specified parameter is invalid. | 非法参数。 |
403 | FeatureNotSupport | The current edition of the smart access gateway does not support this feature. | 智能接入网关当前版本不支持该功能特性。 |
403 | FeatureNotSupportForActiveSmartAG | The current edition of the active smart access gateway does not support this feature. | 主智能接入网关的当前版本不支持该功能特性。 |
403 | FeatureNotSupportForStandBySmartAG | The current edition of the standby smart access gateway does not support this feature. | 备智能接入网关的当前版本不支持该功能特性。 |
403 | NotSupportedProtocol | The specified protocol of the ACL rule is not supported. | 您输入的ACL规则的协议类型是不支持的。 |
403 | InvalidId.ACL | The specified ACL ID is invalid. | 无效的ACL组ID。 |
403 | InvalidPortRange | The specified port range is invalid. | 您输入的端口范围不合法。 |
403 | AcrPerAclAmountLimit | The maximum number of rules in an ACL is exceeded. You can open a ticket to increase the quota. | 您创建的ACL规则超出了单个ACL组下规则数量限额,您可以通过工单申请提升限额。 |
403 | InternalError | An internal server error occurred. | 内部服务错误。 |
访问错误中心查看更多错误码。