Add core modules (SSH args parser, cache, resolver, NetBox client) with tests
Release / release (push) Failing after 51s

This commit is contained in:
Sebastian Unterschütz
2026-05-23 12:38:41 +02:00
commit 8ef4bbec16
24 changed files with 2524 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
package netbox
// HostEntry is a unified model for both devices and virtual machines from NetBox.
type HostEntry struct {
ID int
Name string
Kind string // "device" | "vm"
PrimaryIP4 string // e.g. "10.0.1.5" (prefix length stripped)
PrimaryIP6 string
Tags []string
}
// netboxIP represents an IP address as returned by the NetBox API.
type netboxIP struct {
Address string `json:"address"` // CIDR notation, e.g. "10.0.1.5/24"
}
// netboxDevice matches the relevant fields of the NetBox /dcim/devices/ response.
type netboxDevice struct {
ID int `json:"id"`
Name string `json:"name"`
Tags []struct {
Name string `json:"name"`
} `json:"tags"`
PrimaryIP4 *netboxIP `json:"primary_ip4"`
PrimaryIP6 *netboxIP `json:"primary_ip6"`
}
// netboxVM matches the relevant fields of the NetBox /virtualization/virtual-machines/ response.
type netboxVM struct {
ID int `json:"id"`
Name string `json:"name"`
Tags []struct {
Name string `json:"name"`
} `json:"tags"`
PrimaryIP4 *netboxIP `json:"primary_ip4"`
PrimaryIP6 *netboxIP `json:"primary_ip6"`
}
type netboxListResponse[T any] struct {
Count int `json:"count"`
Results []T `json:"results"`
}
type netboxIPListResponse struct {
Count int `json:"count"`
Results []struct {
Address string `json:"address"`
Interface *struct {
Name string `json:"name"`
} `json:"assigned_object"`
} `json:"results"`
}