Feature/add get site api to device object#573
Merged
azryve merged 3 commits intoJun 2, 2026
Merged
Conversation
Adds get_site(site_id) and list_sites(**filters) on NetboxV37Adapter, NetboxV41Adapter, and NetboxV42Adapter, with a thin facade on BaseNetboxStorage so downstream consumers can fetch a full Site (custom_fields, region, etc.) through the typed storage API rather than reaching into adapter.netbox.session. NetboxDevice.site stays an EntityWithSlug stub on all versions — enriching it would be breaking, and feels like a separate change. Callers that want the full record do `storage.get_site(device.site.id)`. Requires the matching annetbox release that ships the Site model and dcim_site* methods for v37, v41, and v42. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributors objected to list_sites forwarding arbitrary **filters straight to the netbox client, inconsistent with the device path which takes a structured, validated query. Introduce a SiteFilter TypedDict plus an ALLOWED_SITE_FILTERS allowlist and validate_site_filter(), mirroring the device Filter/ALLOWED_GLOB_GROUPS pattern. The storage facade validates the query once (raising ValueError on unknown fields rather than forwarding them) and the v37/v41/v42 adapters stay thin, splatting the dict into dcim_all_sites, just like list_devices. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…no arguments so it just lists all together
azryve
approved these changes
Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds get_site(site_id) and list_sites() on netbox adapter so downstream consumers can fetch a full Site (custom_fields, region, etc.) through the typed storage API.
Co-Authored-By: Claude Opus 4.8