-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
NetBox version
v2.11.1
Feature type
New functionality
Proposed functionality
Extend the Webhook model to support the attachment of arbitrary conditions that control whether a webhook fires. These attributes could be specified in a manner similar to how object permission constraints are defined.
For example, suppose we create a webhook for the IPAddress model, but we only want it to fire if the IP address is within 10.0.0.0/8. We could specify something like the following on the webhook:
{"address__net_contained": "10.0.0.0/8"}
(The net_contained lookup is used to specify a containing prefix.)
Use case
Eliminates many of the simpler use cases that currently require a middleware by handling basic conditional logic. The intent here is not to solve complex problems, but rather to expedite simplistic use cases where we only want to fire a webhook if an object meets certain conditions.
Database changes
Add a new JSON field (conditions?) to the Webhook model
External dependencies
No response