- Add internal/netbox/types.go with Device and CustomFields domain types - Add internal/netbox/client.go with NewClient, Ping, ListDevices, GetDevice - Add client_test.go with validation unit tests and skippable integration tests - go-netbox v4.3.0 dependency added
26 lines
853 B
Go
26 lines
853 B
Go
package netbox
|
|
|
|
import "time"
|
|
|
|
// Device represents a HWLab inventory item backed by a NetBox device record.
|
|
type Device struct {
|
|
ID int
|
|
Name string
|
|
AssetTag string // HW-XXXXX identifier
|
|
CustomFields CustomFields
|
|
Created time.Time
|
|
LastUpdated time.Time
|
|
}
|
|
|
|
// CustomFields holds all HWLab-defined NetBox custom field values for a device.
|
|
// NetBox returns these as map[string]interface{} — we provide typed access.
|
|
type CustomFields struct {
|
|
HWID string // hw_id
|
|
CatalogStatus string // catalog_status
|
|
ProductURL string // product_url
|
|
FirmwareVersion string // firmware_version
|
|
TestDate string // test_date (ISO 8601 date string)
|
|
TestData string // test_data (JSON string)
|
|
AINotes string // ai_notes
|
|
PhotoURLs []string // photo_urls (multi-value)
|
|
}
|