Skip to content
Start here

Replace Waiting Room Rules

client.WaitingRooms.Rules.Update(ctx, waitingRoomID, params) (*SinglePage[WaitingRoomRule], error)
PUT/zones/{zone_id}/waiting_rooms/{waiting_room_id}/rules

Only available for the Waiting Room Advanced subscription. Replaces all rules for a waiting room.

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)
Waiting Rooms Write
ParametersExpand Collapse
waitingRoomID string
params RuleUpdateParams
ZoneID param.Field[string]

Path param: Identifier.

maxLength32
Rules param.Field[[]RuleUpdateParamsRule]

Body param

Action RuleUpdateParamsRulesAction

The action to take when the expression matches.

Expression string

Criteria defining when there is a match for the current rule.

Description stringoptional

The description of the rule.

Enabled booloptional

When set to true, the rule is enabled.

ReturnsExpand Collapse
type WaitingRoomRule struct{…}
ID stringoptional

The ID of the rule.

Action WaitingRoomRuleActionoptional

The action to take when the expression matches.

Description stringoptional

The description of the rule.

Enabled booloptional

When set to true, the rule is enabled.

Expression stringoptional

Criteria defining when there is a match for the current rule.

LastUpdated Timeoptional
formatdate-time
Version stringoptional

The version of the rule.

Replace Waiting Room Rules

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/waiting_rooms"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  page, err := client.WaitingRooms.Rules.Update(
    context.TODO(),
    "699d98642c564d2e855e9661899b7252",
    waiting_rooms.RuleUpdateParams{
      ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
      Rules: []waiting_rooms.RuleUpdateParamsRule{waiting_rooms.RuleUpdateParamsRule{
        Action: cloudflare.F(waiting_rooms.RuleUpdateParamsRulesActionBypassWaitingRoom),
        Expression: cloudflare.F("ip.src in {10.20.30.40}"),
      }},
    },
  )
  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"
      }
    }
  ],
  "success": true,
  "result": [
    {
      "id": "25756b2dfe6e378a06b033b670413757",
      "action": "bypass_waiting_room",
      "description": "allow all traffic from 10.20.30.40",
      "enabled": true,
      "expression": "ip.src in {10.20.30.40}",
      "last_updated": "2014-01-01T05:20:00.12345Z",
      "version": "1"
    }
  ],
  "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"
      }
    }
  ],
  "success": true,
  "result": [
    {
      "id": "25756b2dfe6e378a06b033b670413757",
      "action": "bypass_waiting_room",
      "description": "allow all traffic from 10.20.30.40",
      "enabled": true,
      "expression": "ip.src in {10.20.30.40}",
      "last_updated": "2014-01-01T05:20:00.12345Z",
      "version": "1"
    }
  ],
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000
  }
}