Documentation
¶
Index ¶
- type FactumClient
- func (factum *FactumClient) ApplyOpticalInventory(deviceID uint, inv optical.Inventory) (*optical.ApplyResult, error)
- func (factum *FactumClient) DeleteLibrenmsPendingDelete(deviceID int) error
- func (factum *FactumClient) GetDevice(name string) ([]*models.Device, error)
- func (factum *FactumClient) GetDeviceByName(name string) (*models.Device, error)
- func (factum *FactumClient) GetDeviceHelper(name string) ([]*models.Device, error)
- func (factum *FactumClient) GetDevices() ([]*models.Device, error)
- func (factum *FactumClient) GetDevicesWithInterfaces() ([]*models.Device, error)
- func (factum *FactumClient) GetJobs() ([]Job, error)
- func (factum *FactumClient) GetLibrenmsPendingDeletes() ([]*models.LibrenmsPendingDelete, error)
- func (factum *FactumClient) GetSyncTargets() ([]string, error)
- func (factum *FactumClient) TriggerSync(target string) (uint, error)
- func (factum *FactumClient) TriggerSyncAll() (uint, error)
- func (factum *FactumClient) UpsertLibrenmsPendingDelete(row *models.LibrenmsPendingDelete) (*models.LibrenmsPendingDelete, error)
- type FactumDeviceResponse
- type Job
- type JobTask
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FactumClient ¶
type FactumClient struct {
// contains filtered or unexported fields
}
func NewFactumClient ¶
func NewFactumClient(config *util.ConfigFactum) *FactumClient
func (*FactumClient) ApplyOpticalInventory ¶ added in v1.0.4
func (factum *FactumClient) ApplyOpticalInventory(deviceID uint, inv optical.Inventory) (*optical.ApplyResult, error)
ApplyOpticalInventory is PUT /api/optical/device/:id/inventory — persists a driver's optical dump onto OpticalKind / OpticalPort / OpticalXConnect.
func (*FactumClient) DeleteLibrenmsPendingDelete ¶
func (factum *FactumClient) DeleteLibrenmsPendingDelete(deviceID int) error
DeleteLibrenmsPendingDelete is DELETE /api/librenms/pending-deletes/:device_id.
func (*FactumClient) GetDevice ¶
func (factum *FactumClient) GetDevice(name string) ([]*models.Device, error)
func (*FactumClient) GetDeviceByName ¶
func (factum *FactumClient) GetDeviceByName(name string) (*models.Device, error)
GetDeviceByName returns the one device called name. web.ApiGetDeviceByName answers with an array, so an unknown name is an empty list and a 200, not an HTTP error - hence the explicit not-found here.
func (*FactumClient) GetDeviceHelper ¶
func (factum *FactumClient) GetDeviceHelper(name string) ([]*models.Device, error)
Fetch devices from Factum API devices
func (*FactumClient) GetDevices ¶
func (factum *FactumClient) GetDevices() ([]*models.Device, error)
func (*FactumClient) GetDevicesWithInterfaces ¶
func (factum *FactumClient) GetDevicesWithInterfaces() ([]*models.Device, error)
GetDevicesWithInterfaces is GET /api/device?include=interfaces. The default /api/device list is shallow (no nested interfaces/addresses) so the device-list UI stays cheap; DNS sync needs the nested addresses to emit per-interface A/AAAA records.
func (*FactumClient) GetJobs ¶
func (factum *FactumClient) GetJobs() ([]Job, error)
GetJobs returns the most recent jobs, newest first, each with its tasks embedded - GET /api/jobs (web.ApiJobs).
func (*FactumClient) GetLibrenmsPendingDeletes ¶
func (factum *FactumClient) GetLibrenmsPendingDeletes() ([]*models.LibrenmsPendingDelete, error)
GetLibrenmsPendingDeletes is GET /api/librenms/pending-deletes.
func (*FactumClient) GetSyncTargets ¶
func (factum *FactumClient) GetSyncTargets() ([]string, error)
GetSyncTargets returns the sync targets currently enabled in Settings, in worker.SyncTargets order - GET /api/sync/targets (web.ApiSyncTargets).
func (*FactumClient) TriggerSync ¶
func (factum *FactumClient) TriggerSync(target string) (uint, error)
TriggerSync dispatches target to a connected worker node and returns the created job's numeric ID - POST /api/sync/:target (web.ApiSyncTrigger).
func (*FactumClient) TriggerSyncAll ¶
func (factum *FactumClient) TriggerSyncAll() (uint, error)
TriggerSyncAll dispatches every enabled sync target as one job (one JobTask per target) and returns the created job's numeric ID - POST /api/sync/all (web.ApiSyncTriggerAll).
func (*FactumClient) UpsertLibrenmsPendingDelete ¶
func (factum *FactumClient) UpsertLibrenmsPendingDelete(row *models.LibrenmsPendingDelete) (*models.LibrenmsPendingDelete, error)
UpsertLibrenmsPendingDelete is PUT /api/librenms/pending-deletes/:device_id.
type FactumDeviceResponse ¶
type FactumDeviceResponse struct {
Data []*netboxtool.NBDevice `json:"data"`
}
type Job ¶
type Job struct {
ID uint `json:"id"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
Tasks []JobTask `json:"tasks"`
}
Job mirrors the fields of models.Job (plus its embedded JobTask children) this client needs - trimmed down rather than importing the model directly, since gorm's FactumModel embed and json:"-" fields have no meaning for an HTTP response DTO.