调用AddACLRule添加访问控制规则。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 否 | AddACLRule |
要执行的操作。 取值:AddACLRule。 |
AclId | String | 是 | acl-xhwhyuo43l0n***** |
访问控制ID。 |
DestCidr | String | 是 | 0.0.0.0/0 |
目的地址,CIDR 格式和 IPv4 格式的IP地址范围。 默认值:0.0.0.0/0。 |
DestPortRange | String | 是 | 1/200 |
目的端口范围,格式为80/80。 |
Direction | String | 是 | in |
规则方向。 取值:in|out。 |
IpProtocol | String | 是 | tcp |
协议,不区分大小写。 |
Policy | String | 是 | accept |
访问权限,取值:
|
RegionId | String | 是 | cn-hangzhou |
地域ID。 |
SourceCidr | String | 是 | 0.0.0.0/0 |
源地址,CIDR 格式和IPv4格式的IP地址范围。 默认值:0.0.0.0/0。 |
SourcePortRange | String | 是 | 1/200 |
源端口范围,格式为80/80。 |
Description | String | 否 | test |
规则描述信息,长度为1~512个字符。 |
Priority | Integer | 否 | 12 |
优先级,取值范围:1~100。 默认值:1。 |
Type | String | 否 | LAN |
访问控制规则类型:
|
Name | String | 否 | doctest |
访问控制规则名称。 长度为2-100个字符,以大小字母或中文开头,可包含数字、"."、"_"、"-"。 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
RequestId | String | 880F84CB-9B54-4413-A8A3-8832C82D1BC4 |
请求ID。 |
AcrId | String | acr-c1hkd054qywi****** |
访问控制规则ID。 |
AclId | String | acl-xhwhyuo43l0******* |
访问控制ID。 |
Description | String | 3 |
规则描述信息,长度为1~512个字符。 |
Direction | String | out |
规则方向。 取值:in|out。 |
SourceCidr | String | 192.168.3.0/24 |
源地址,CIDR 格式和IPv4格式的IP地址范围。 默认值:0.0.0.0/0 |
DestCidr | String | 10.0.0.1/32 |
目的地址,CIDR格式和IPv4格式的IP地址范围。 默认值:0.0.0.0/0。 |
IpProtocol | String | TCP |
协议,不区分大小写。 |
SourcePortRange | String | 1/65535 |
源端口范围,80/80。 |
DestPortRange | String | 1/65535 |
目的端口范围,格式为80/80。 |
Policy | String | drop |
访问权限,取值:
|
Priority | Integer | 1 |
优先级,取值范围:1~100。 默认值:1。 |
GmtCreate | Long | 1553766882689 |
规则创建时间Long型时间戳,优先级相同时,小时间戳先生效。 |
Type | String | LAN |
访问控制规则类型:
|
Name | String | doctest |
访问控制规则名称。 长度为2-100个字符,以大小字母或中文开头,可包含数字、"."、"_"、"-"。 |
示例
请求示例
http(s)://[Endpoint]/?Action=AddACLRule
&AclId=acl-xhwhyuo43l0n*****
&DestCidr=0.0.0.0/0
&DestPortRange=1/200
&Direction=in
&IpProtocol=tcp
&Policy=accept
&RegionId=cn-hangzhou
&SourceCidr=0.0.0.0/0
&SourcePortRange=1/200
&<公共请求参数>
正常返回示例
XML
格式
<AddACLRule>
<AcrId>acr-c1hkd054qywiw2****</AcrId>
<Type>LAN</Type>
<GmtCreate>1553766882689</GmtCreate>
<Direction>out</Direction>
<Priority>1</Priority>
<Name>doctest</Name>
<IpProtocol>TCP</IpProtocol>
<SourceCidr>192.168.3.0/24</SourceCidr>
<SourcePortRange>1/65535</SourcePortRange>
<AclId>acl-xhwhyuo43l0n2b****</AclId>
<Policy>drop</Policy>
<RequestId>880F84CB-9B54-4413-A8A3-8832C82D1BC4</RequestId>
<DestPortRange>1/65535</DestPortRange>
<DestCidr>10.0.0.1/32</DestCidr>
</AddACLRule>
JSON
格式
{
"AcrId": "acr-c1hkd054qywiw2****",
"Type": "LAN",
"GmtCreate": 1553766882689,
"Direction": "out",
"Priority": 1,
"Name": "doctest",
"IpProtocol": "TCP",
"SourceCidr": "192.168.3.0/24",
"SourcePortRange": "1/65535",
"AclId": "acl-xhwhyuo43l0n2b****",
"Policy": "drop",
"RequestId": "880F84CB-9B54-4413-A8A3-8832C82D1BC4",
"DestPortRange": "1/65535",
"DestCidr": "10.0.0.1/32"
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
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. | 内部服务错误 |
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类型。 |
访问错误中心查看更多错误码。