全部產品
Search
文件中心

Edge Security Acceleration:CreateUserWafRuleset - 建立使用者WAF規則集

更新時間:Mar 26, 2026

用於建立執行個體層級的Web Application Firewall規則集,支援多種類型的防護規則。

介面說明

請求說明

  • 本 API 允許使用者為指定執行個體建立新的 WAF(Web Application Firewall)規則集。

  • InstanceId 是必需參數,指定了要為其建立規則集的具體執行個體。

  • Phase 參數定義了規則集的應用階段,例如自訂規則、頻次控制等。

  • NameExpression 是必填項,分別代表規則集的名字和具體的匹配運算式。

  • 選擇性參數 Description 提供了對規則集功能或用途的文字描述。

  • Status 控制著規則集是否立即生效 (on) 或者處於關閉狀態 (off)。

  • 通過 Rules 參數可以進一步配置更詳細的規則列表,每個規則都包含名稱、位置、運算式及動作等屬性。

  • 成功響應將返回新建立規則集的唯一識別碼 Id 以及所有關聯規則的 ID 列表 RuleIds

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

esa:CreateUserWafRuleset

none

*全部資源

*

請求文法

POST / HTTP/1.1

請求參數

名稱

類型

必填

描述

樣本值

InstanceId

string

執行個體 ID。

esa-site-ads11w

Phase

string

WAF 規則運行階段。

  • http_whitelist:白名單規則

  • http_custom:自訂規則

  • http_managed:託管規則

  • http_anti_scan:掃描防護規則

  • http_ratelimit:頻次控制規則

  • ip_access_rule:IP 訪問規則

  • http_bot:進階模式 Bots

  • http_security_level_rule:安全規則

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. 指定的參數對應的值不能通過匹配校正。如果您確定需要使用該參數值,請與我們聯絡。

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情