Skip to content

Feature/add get site api to device object#573

Merged
azryve merged 3 commits into
annetutil:mainfrom
crazyformat:feature/add_get_site_api_to_device_object
Jun 2, 2026
Merged

Feature/add get site api to device object#573
azryve merged 3 commits into
annetutil:mainfrom
crazyformat:feature/add_get_site_api_to_device_object

Conversation

@crazyformat
Copy link
Copy Markdown

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

Dmitrii Kulikovskii and others added 3 commits June 1, 2026 21:13
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 azryve merged commit d0eb576 into annetutil:main Jun 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants