- CableRecord type added to types.go (ID, HWID, Label, TestData, CatalogStatus) - CreateCable(ctx, label, assetTag, testDataJSON) uses DcimCablesCreate - Sets test_data and catalog_status custom fields; hw_id if assetTag non-empty - Rejects empty label with sentinel error message - Unit tests use httptest.NewUnstartedServer (201 success, 422 error, empty label)
35 lines
1.1 KiB
Go
35 lines
1.1 KiB
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
|
|
}
|
|
|
|
// CableRecord represents a HWLab cable item backed by a NetBox cable record.
|
|
type CableRecord struct {
|
|
ID int
|
|
HWID string
|
|
Label string
|
|
TestData string // raw JSON blob from test run
|
|
CatalogStatus string
|
|
}
|
|
|
|
// 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)
|
|
}
|