Skip to content

update_firewall_rule

Patch fields on an existing firewall rule.

Side effects:

  • Modifies the named rule in place. Only fields supplied in updates change; everything else is preserved.
  • Takes effect immediately on the next packet hitting the affected datapath.
  • Mutates controller state. Use dry_run=True to preview the change without applying.
update_firewall_rule(rule_id="65f...", updates={"enabled": False})
ParameterTypeRequiredDefaultDescription
rule_idstringyesThe _id from list_firewall_rules.
updatesobjectyesPartial firewall-rule record. Common keys: enabled, action, protocol, rule_index, src_address, dst_address, src_networkconf_id, dst_networkconf_id, src_port, dst_port, name.
controllerstringno”default”Name of the UniFi controller to target. Defaults to "default".
dry_runbooleannofalsePreview the change without applying it. Returns the predicted change set.