mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 20:22:53 -06:00
#16886: Updated documentation for event types
This commit is contained in:
parent
d1e16013f0
commit
6e59db7310
@ -18,17 +18,22 @@ The type(s) of object in NetBox that will trigger the rule.
|
|||||||
|
|
||||||
If not selected, the event rule will not be processed.
|
If not selected, the event rule will not be processed.
|
||||||
|
|
||||||
### Events
|
### Events Types
|
||||||
|
|
||||||
The events which will trigger the rule. At least one event type must be selected.
|
The event types which will trigger the rule. At least one event type must be selected.
|
||||||
|
|
||||||
| Name | Description |
|
| Name | Description |
|
||||||
|------------|--------------------------------------|
|
|----------------|---------------------------------------------|
|
||||||
| Creations | A new object has been created |
|
| Object created | A new object has been created |
|
||||||
| Updates | An existing object has been modified |
|
| Object updated | An existing object has been modified |
|
||||||
| Deletions | An object has been deleted |
|
| Object deleted | An object has been deleted |
|
||||||
| Job starts | A job for an object starts |
|
| Job started | A background job is initiated |
|
||||||
| Job ends | A job for an object terminates |
|
| Job completed | A background job completes successfully |
|
||||||
|
| Job failed | A background job fails |
|
||||||
|
| Job errored | A background job is aborted due to an error |
|
||||||
|
|
||||||
|
!!! tip "Custom Event Types"
|
||||||
|
The above list includes only built-in event types. NetBox plugins can also register their own custom event types.
|
||||||
|
|
||||||
### Conditions
|
### Conditions
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
# Events
|
# Event Types
|
||||||
|
|
||||||
Plugins can register their own custom event types for use with NetBox [event rules](../../models/extras/eventrule.md). This is accomplished by calling the `register()` method on an instance of the `Event` class. This can be done anywhere within the plugin. An example is provided below.
|
!!! info "This feature was introduced in NetBox v4.1."
|
||||||
|
|
||||||
|
Plugins can register their own custom event types for use with NetBox [event rules](../../models/extras/eventrule.md). This is accomplished by calling the `register()` method on an instance of the `EventType` class. This can be done anywhere within the plugin. An example is provided below.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
@ -9,8 +11,8 @@ from netbox.events import EventType, EVENT_TYPE_KIND_SUCCESS
|
|||||||
EventType(
|
EventType(
|
||||||
name='ticket_opened',
|
name='ticket_opened',
|
||||||
text=_('Ticket opened'),
|
text=_('Ticket opened'),
|
||||||
type=EVENT_TYPE_KIND_SUCCESS
|
kind=EVENT_TYPE_KIND_SUCCESS
|
||||||
).register()
|
).register()
|
||||||
```
|
```
|
||||||
|
|
||||||
::: netbox.events.Event
|
::: netbox.events.EventType
|
@ -143,7 +143,7 @@ nav:
|
|||||||
- Forms: 'plugins/development/forms.md'
|
- Forms: 'plugins/development/forms.md'
|
||||||
- Filters & Filter Sets: 'plugins/development/filtersets.md'
|
- Filters & Filter Sets: 'plugins/development/filtersets.md'
|
||||||
- Search: 'plugins/development/search.md'
|
- Search: 'plugins/development/search.md'
|
||||||
- Events: 'plugins/development/events.md'
|
- Event Types: 'plugins/development/event-types.md'
|
||||||
- Data Backends: 'plugins/development/data-backends.md'
|
- Data Backends: 'plugins/development/data-backends.md'
|
||||||
- REST API: 'plugins/development/rest-api.md'
|
- REST API: 'plugins/development/rest-api.md'
|
||||||
- GraphQL API: 'plugins/development/graphql-api.md'
|
- GraphQL API: 'plugins/development/graphql-api.md'
|
||||||
|
Loading…
Reference in New Issue
Block a user