Skip to content

nautobot.apps.datasources

Utilities for an app to register datasource contents (for Git, etc.).

nautobot.apps.datasources.DatasourceContent

Parameters:

Name Type Description Default
name str

Human-readable name for this content type, such as "config contexts"

required
content_identifier str

Brief unique identifier of this content type; by convention a string such as "extras.configcontext"

required
icon str

Material Design Icons icon name, such as "mdi-code-json" or "mdi-script-text"

required
callback callable

Callback function to invoke whenever a given datasource is created, updated, or deleted. This callback should take three arguments (record, job_result, delete) where "record" is the GitRepository, etc. that is being refreshed, "job_result" is an extras.JobResult record for logging purposes, and "delete" is a boolean flag to distinguish between the "create/update" and "delete" cases.

required
weight int

Defines the order in which datasources will be loaded.

1000

__init__(name, content_identifier, icon, callback, weight=1000)

Ensure datasource properties.

nautobot.apps.datasources.get_repo_access_url(repository_record)

Returns the repo url with and without token when present Returns: (str): The url used to connect to the git repo, with credentials as applicable.