update_traffic_rule
update_traffic_rule
Section titled “update_traffic_rule”Patch fields on an existing traffic rule (read-modify-write).
Side effects:
- Modifies the named rule in place. The v2 PUT replaces the whole
object, so this reads the current rule first and merges
updatesonto it before writing — only the keys you supply change. - Takes effect immediately on matching traffic.
- Mutates controller state. Use dry_run=True to preview the change without applying.
Example
Section titled “Example”update_traffic_rule(rule_id="65f...", updates={"action": "ALLOW"})Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
rule_id | string | yes | — | The _id from list_traffic_rules. |
updates | object | yes | — | Partial traffic-rule record to merge. Common keys: action, matching_target, target_devices, enabled, plus target-specific fields. |
controller | string | no | ”default” | Name of the UniFi controller to target. Defaults to "default". |
dry_run | boolean | no | false | Preview the change without applying it. Returns the predicted change set. |