Data Backends
Data sources can be defined to reference data which exists on systems of record outside NetBox, such as a git repository or Amazon S3 bucket. Plugins can register their own backend classes to introduce support for additional resource types. This is done by subclassing NetBox's DataBackend class.
from netbox.data_backends import DataBackend
class MyDataBackend(DataBackend):
name = 'mybackend'
label = 'My Backend'
...
To register one or more data backends with NetBox, define a list named backends at the end of this file:
backends = [MyDataBackend]
The path to the list of data backends can be modified by setting data_backends in the PluginConfig instance.
DataBackend
A data backend represents a specific system of record for data, such as a git repository or Amazon S3 bucket.
Attributes:
| Name | Type | Description |
|---|---|---|
| name | Any | The identifier under which this backend will be registered in NetBox |
| label | Any | The human-friendly name for this backend |
| is_local | Any | A boolean indicating whether this backend accesses local data |
| parameters | Any | A dictionary mapping configuration form field names to their classes |
| sensitive_parameters | Any | An iterable of field names for which the values should not be displayed to the user |
init_config()
A hook to initialize the instance's configuration.
The data returned by this method is assigned to the instance's config attribute upon initialization, which can be referenced by the fetch() method.
fetch()
A context manager which performs the following: 1. Handles all setup and synchronization 2. Yields the local path at which data has been replicated 3. Performs any necessary cleanup.