用于创建实例级别的Web应用防火墙规则集,支持多种类型的防护规则。
接口说明
请求说明
本 API 允许用户为指定实例创建新的 WAF(Web Application Firewall)规则集。
InstanceId是必需参数,指定了要为其创建规则集的具体实例。Phase参数定义了规则集的应用阶段,例如自定义规则、频次控制等。Name和Expression是必填项,分别代表规则集的名字和具体的匹配表达式。可选参数
Description提供了对规则集功能或用途的文字描述。Status控制着规则集是否立即生效 (on) 或者处于关闭状态 (off)。通过
Rules参数可以进一步配置更详细的规则列表,每个规则都包含名称、位置、表达式及动作等属性。成功响应将返回新创建规则集的唯一标识符
Id以及所有关联规则的 ID 列表RuleIds。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
请求语法
POST / HTTP/1.1
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| InstanceId |
string |
是 |
实例 ID。 |
esa-site-ads11w |
| Phase |
string |
是 |
WAF 运行阶段。 |
http_custom |
| Name |
string |
是 |
WAF 规则集名称。 |
example |
| Description |
string |
否 |
WAF 规则集描述。 |
this is a test ruleset. |
| Status |
string |
是 |
WAF 规则集状态。 |
on |
| Expression |
string |
是 |
WAF 规则集表达式。 |
ip.src == 1.1.1.1 |
| Shared | WafBatchRuleShared |
否 |
WAF 批量规则共享配置。 |
|
| Rules |
array |
否 |
WAF 规则集下的规则配置列表。 |
|
| WafRuleConfig |
否 |
WAF 规则集下的规则配置。 |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
Schema of Response |
||
| RequestId |
string |
请求 ID。 |
15C66C7B-671A-4297-9187-2C4477247A74 |
| Id |
integer |
WAF 规则集的 ID。 |
665d3af3621bccf3fe29e1a4 |
| RuleIds |
array |
WAF 规则集下的规则 ID 列表。 |
|
|
integer |
WAF 规则集下的规则 ID。 |
87570 |
示例
正常返回示例
JSON格式
{
"RequestId": "15C66C7B-671A-4297-9187-2C4477247A74",
"Id": 0,
"RuleIds": [
87570
]
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | InvalidParameter | The specified parameter is invalid. | 输入参数规范校验失败。 |
| 400 | InstanceNotExist | The instance does not exist. Check whether the specified instance ID is correct or whether the instance belongs to your account. | 实例不存在,请检查提供的实例ID是否正确或该实例是否属于您的账户。 |
| 400 | InternalException | Failed to call the service. Try again later or contact technical support. | 调用服务失败,请稍后重试或联系客服咨询详情。 |
| 403 | Rule.Config.Noncompliance | The specified rule configuration does not meet the compliance requirements.Check and adjust your configurations. | 指定的规则配置未满足既定的合规性标准。请检查规则设置,查找任何不符合或违反预期标准的差异,并进行必要的调整,以确保所有规则均得到正确验证。 |
| 403 | Rule.Config.Malformed | The format of the rule configuration is invalid.Check the configuration for syntax errors or structural inconsistencies and correct them to meet the requirements. | 指定的规则配置格式错误或未按要求格式编写。请检查规则配置中是否存在语法错误或结构不一致,并予以纠正,以符合预期的配置架构。 |
| 403 | %s.NotSupport | The specified resource type %s is not supported. | 不支持指定的资源类型。如需使用该类型资源,请与我们联系。 |
| 403 | %s.OverQuota | The quantity of %s exceeds the quota. | 该资源的数量超出了配额所规定的范围,如需申请更多的额度,请与我们联系。 |
| 403 | %s.WrongValueMatched | The value of specified parameter %s can not pass the matching check. | 指定的参数对应的值不能通过匹配校验。如果您确定需要使用该参数值,请与我们联系。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。