Skip to content
Start here

List WAF rule groups

Deprecated
client.Firewall.WAF.Packages.Groups.List(ctx, packageID, params) (*V4PagePaginationArray[Group], error)
GET/zones/{zone_id}/firewall/waf/packages/{package_id}/groups

Fetches the WAF rule groups in a WAF package.

Note: Applies only to the previous version of WAF managed rules.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Firewall Services WriteFirewall Services Read
ParametersExpand Collapse
packageID string

Defines the unique identifier of a WAF package.

maxLength32
params WAFPackageGroupListParams
ZoneID param.Field[string]

Path param: Defines an identifier of a schema.

maxLength32
Direction param.Field[WAFPackageGroupListParamsDirection]Optional

Query param: Defines the direction used to sort returned rule groups.

const WAFPackageGroupListParamsDirectionAsc WAFPackageGroupListParamsDirection = "asc"
const WAFPackageGroupListParamsDirectionDesc WAFPackageGroupListParamsDirection = "desc"
Match param.Field[WAFPackageGroupListParamsMatch]Optional

Query param: Defines the condition for search requirements. When set to all, all the search requirements must match. When set to any, only one of the search requirements has to match.

const WAFPackageGroupListParamsMatchAny WAFPackageGroupListParamsMatch = "any"
const WAFPackageGroupListParamsMatchAll WAFPackageGroupListParamsMatch = "all"
Mode param.Field[WAFPackageGroupListParamsMode]Optional

Query param: Defines the state of the rules contained in the rule group. When on, the rules in the group are configurable/usable.

const WAFPackageGroupListParamsModeOn WAFPackageGroupListParamsMode = "on"
const WAFPackageGroupListParamsModeOff WAFPackageGroupListParamsMode = "off"
Name param.Field[string]Optional

Query param: Defines the name of the rule group.

Order param.Field[WAFPackageGroupListParamsOrder]Optional

Query param: Defines the field used to sort returned rule groups.

const WAFPackageGroupListParamsOrderMode WAFPackageGroupListParamsOrder = "mode"
const WAFPackageGroupListParamsOrderRulesCount WAFPackageGroupListParamsOrder = "rules_count"
Page param.Field[float64]Optional

Query param: Defines the page number of paginated results.

minimum1
PerPage param.Field[float64]Optional

Query param: Defines the number of rule groups per page.

maximum100
minimum5
RulesCount param.Field[float64]Optional

Query param: Defines the number of rules in the current rule group.

ReturnsExpand Collapse
type Group struct{…}
ID string

Defines the unique identifier of the rule group.

maxLength32
Description string

Defines an informative summary of what the rule group does.

Mode GroupMode

Defines the state of the rules contained in the rule group. When on, the rules in the group are configurable/usable.

One of the following:
const GroupModeOn GroupMode = "on"
const GroupModeOff GroupMode = "off"
Name string

Defines the name of the rule group.

RulesCount float64

Defines the number of rules in the current rule group.

AllowedModes []GroupAllowedModeOptional

Defines the available states for the rule group.

One of the following:
const GroupAllowedModeOn GroupAllowedMode = "on"
const GroupAllowedModeOff GroupAllowedMode = "off"
ModifiedRulesCount float64Optional

Defines the number of rules within the group that have been modified from their default configuration.

PackageID stringOptional

Defines the unique identifier of a WAF package.

maxLength32

List WAF rule groups

package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/cloudflare-go"
  "github.com/stainless-sdks/cloudflare-go/firewall"
  "github.com/stainless-sdks/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  page, err := client.Firewall.WAF.Packages.Groups.List(
    context.TODO(),
    "a25a9a7e9c00afc1fb2e0245519d725b",
    firewall.WAFPackageGroupListParams{
      ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": [
    {
      "id": "de677e5818985db1285d0e80225f06e5",
      "description": "Group designed to protect against IP addresses that are a threat and typically used to launch DDoS attacks",
      "mode": "on",
      "name": "Project Honey Pot",
      "rules_count": 10,
      "allowed_modes": [
        "on",
        "off"
      ],
      "modified_rules_count": 2,
      "package_id": "a25a9a7e9c00afc1fb2e0245519d725b"
    }
  ],
  "success": true,
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": [
    {
      "id": "de677e5818985db1285d0e80225f06e5",
      "description": "Group designed to protect against IP addresses that are a threat and typically used to launch DDoS attacks",
      "mode": "on",
      "name": "Project Honey Pot",
      "rules_count": 10,
      "allowed_modes": [
        "on",
        "off"
      ],
      "modified_rules_count": 2,
      "package_id": "a25a9a7e9c00afc1fb2e0245519d725b"
    }
  ],
  "success": true,
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000
  }
}