All Products
Search
Document Center

Web Application Firewall:DescribeDefenseRules

Last Updated:Sep 13, 2024

Queries protection rules by page.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
yundun-waf:DescribeDefenseRuleslist
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The ID of the Web Application Firewall (WAF) instance.

Note You can call the DescribeInstance operation to obtain the ID of the WAF instance.
waf_cdnsdf3****
RuleTypestringNo

The type of protection rule that you want to query. Valid values:

  • whitelist: whitelist rule.
  • defense: defense rule. This is the default value.
whitelist
QuerystringNo

The query conditions. Specify a string that contains multiple parameters in the JSON format.

Note The results vary based on the query conditions. For more information, see the "Query parameters" section in this topic.
{\\"name\\":\\"IP address blocking\_20220822\_10\\",\\"scene\\":\\"custom_acl\\",\\"templateId\\":5327}
PageNumberintegerNo

The number of the page to return. Default value: 1.

1
PageSizeintegerNo

The number of entries to return on each page. Default value: 10.

10
ResourceManagerResourceGroupIdstringNo

The ID of the resource group.

rg-acfm***q
RegionIdstringNo

The region where the WAF instance resides. Valid values:

  • cn-hangzhou: the Chinese mainland.
  • ap-southeast-1: outside the Chinese mainland.
cn-hangzhou

Query parameters

Parameter description

ParameterTypeRequiredExampleDescription
nameStringNotestThe name of the protection rule that you want to query. You can specify this parameter to query a protection rule by using exact matching.
nameIdStringNotest1The ID or name of the protection rule that you want to query. You can specify this parameter to query a protection rule by using fuzzy matching.
nameLikeStringNotest.aliyundoc.cThe name of the protection rule that you want to query. You can specify this parameter to query a protection rule by using fuzzy matching.
sceneStringNowaf_groupThe scenario in which the protection rules that you want to query are used. You can specify this parameter to query the protection rules that are used in a specific scenario by using exact matching. For information about the valid values of this parameter, see the description of the DefenseScene parameter in the CreateDefenseRule topic.
ruleIdLongNo33444The ID of the protection rule that you want to query. You can specify this parameter to query a protection rule by using exact matching.
ruleIdInArrayNo[3334455643,345555]The ID range of the protection rules that you want to query. You can specify this parameter to query multiple protection rules. Separate multiple protection rule IDs with commas (,).
templateIdLongNo24354The ID of the protection rule template to which the protection rules that you want to query belong. You can specify this parameter to query protection rules in a specific protection rule template.
orderByStringNonameThe method that you want to use to sort protection rules. Valid values:- name: sorts the protection rules by protection rule name.- gmtModified: sorts the protection rules by most recent modification time.- id: sorts the protection rules by protection rule ID.- templateId: sorts the protection rules by protection rule template ID.
descBooleanNotrueSpecifies whether to sort the protection rules in ascending or descending order. Valid values:- false: sorts the protected objects in ascending order.- true: sorts the protected objects in descending order.

Examples

{
    "name": "test",
    "nameId ": "test1,
    "nameLike": "test.aliyundoc.c",
    "nameIn": "test.aliyundoc.c",
    "InstaneId": "test1.aliyundoc.com,test2.aliyundoc.com",
    "templateId": 24354
}

Response parameters

ParameterTypeDescriptionExample
object

The data returned.

RequestIdstring

The ID of the request.

80736FA5-FA87-55F6-AA69-C5477C6FE6D0
TotalCountlong

The total number of returned entries.

2
Rulesarray<object>

An array of protection rules.

object

The protection rule.

Configstring

The details of the protection rule. The value is a string that contains multiple parameters in the JSON format. For more information, see the "Rule parameters" section in the CreateDefenseRule topic.

{\"policyId\":1012,\"action\":\"block\"}
DefenseOriginstring

The origin of the protection rule. Valid values:

  • custom: The protection rule is created by the user.
  • system: The protection rule is automatically generated by the system.
custom
DefenseScenestring

The scenario in which the protection rule is used. For more information, see the description of the DefenseScene parameter in the CreateDefenseRule topic.

waf_group
GmtModifiedlong

The most recent time when the protection rule was modified.

1665460629000
RuleIdlong

The ID of the protection rule.

42755
RuleNamestring

The name of the protection rule.

rules_41
Statusinteger

The status of the protection rule. Valid values:

  • 0: disabled.
  • 1: enabled.
1
TemplateIdlong

The ID of the protection rule template.

5673

Examples

Sample success responses

JSONformat

{
  "RequestId": "80736FA5-FA87-55F6-AA69-C5477C6FE6D0",
  "TotalCount": 2,
  "Rules": [
    {
      "Config": "{\\\"policyId\\\":1012,\\\"action\\\":\\\"block\\\"}",
      "DefenseOrigin": "custom",
      "DefenseScene": "waf_group",
      "GmtModified": 1665460629000,
      "RuleId": 42755,
      "RuleName": "rules_41",
      "Status": 1,
      "TemplateId": 5673
    }
  ]
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history