## Update priority of a firewall rule `client.Firewall.Rules.Edit(ctx, ruleID, body) (*SinglePage[FirewallRule], error)` **patch** `/zones/{zone_id}/firewall/rules/{rule_id}` Updates the priority of an existing firewall rule. ### Parameters - `ruleID string` The unique identifier of the firewall rule. - `body RuleEditParams` - `ZoneID param.Field[string]` Defines an identifier. ### Returns - `type FirewallRule struct{…}` - `ID string` The unique identifier of the firewall rule. - `Action Action` The action to apply to a matched request. The `log` action is only available on an Enterprise plan. - `const ActionBlock Action = "block"` - `const ActionChallenge Action = "challenge"` - `const ActionJSChallenge Action = "js_challenge"` - `const ActionManagedChallenge Action = "managed_challenge"` - `const ActionAllow Action = "allow"` - `const ActionLog Action = "log"` - `const ActionBypass Action = "bypass"` - `Description string` An informative summary of the firewall rule. - `Filter FirewallRuleFilter` - `type FirewallFilter struct{…}` - `ID string` The unique identifier of the filter. - `Description string` An informative summary of the filter. - `Expression string` The filter expression. For more information, refer to [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). - `Paused bool` When true, indicates that the filter is currently paused. - `Ref string` A short reference tag. Allows you to select related filters. - `type DeletedFilter struct{…}` - `ID string` The unique identifier of the filter. - `Deleted bool` When true, indicates that the firewall rule was deleted. - `Paused bool` When true, indicates that the firewall rule is currently paused. - `Priority float64` The priority of the rule. Optional value used to define the processing order. A lower number indicates a higher priority. If not provided, rules with a defined priority will be processed before rules without a priority. - `Products []Product` - `const ProductZoneLockdown Product = "zoneLockdown"` - `const ProductUABlock Product = "uaBlock"` - `const ProductBIC Product = "bic"` - `const ProductHot Product = "hot"` - `const ProductSecurityLevel Product = "securityLevel"` - `const ProductRateLimit Product = "rateLimit"` - `const ProductWAF Product = "waf"` - `Ref string` A short reference tag. Allows you to select related firewall rules. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/firewall" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.Firewall.Rules.Edit( context.TODO(), "372e67954025e0ba6aaa6d586b9e0b60", firewall.RuleEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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": "372e67954025e0ba6aaa6d586b9e0b60", "action": "block", "description": "Blocks traffic identified during investigation for MIR-31", "filter": { "id": "372e67954025e0ba6aaa6d586b9e0b61", "description": "Restrict access from these browsers on this address range.", "expression": "(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.addr ne 172.16.22.155", "paused": false, "ref": "FIL-100" }, "paused": false, "priority": 50, "products": [ "waf" ], "ref": "MIR-31" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ```