Documentation
¶
Overview ¶
Package sync implements the core synchronization logic between Apple Business Manager and Snipe-IT.
Index ¶
- func SetLogFormatter(formatter logrus.Formatter)
- func SetLogLevel(level logrus.Level)
- func SetLogOutput(output io.Writer)
- type ABMCache
- type Engine
- func (e *Engine) CacheDir() string
- func (e *Engine) FetchAndSaveAppleCare(ctx context.Context, devices []abmclient.Device) error
- func (e *Engine) FetchAndSaveCache(ctx context.Context) error
- func (e *Engine) FetchAndSaveDevices(ctx context.Context) ([]abmclient.Device, error)
- func (e *Engine) LoadCache() error
- func (e *Engine) Run(ctx context.Context) (*Stats, error)
- func (e *Engine) RunSingle(ctx context.Context, serial string) (*Stats, error)
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetLogFormatter ¶ added in v1.6.0
SetLogFormatter sets the logger formatter.
func SetLogOutput ¶ added in v1.6.0
SetLogOutput sets the logger output.
Types ¶
type ABMCache ¶ added in v1.0.0
type ABMCache struct {
Devices []abmclient.Device
AppleCare map[string]*abmclient.CoverageResult // device ID -> coverage
}
ABMCache holds cached ABM device and AppleCare data loaded from the cache directory.
type Engine ¶
type Engine struct {
ShowProgress bool // show progress bars during download
// contains filtered or unexported fields
}
Engine performs the sync between ABM and Snipe-IT.
func NewDownloadEngine ¶ added in v1.0.0
NewDownloadEngine creates a lightweight engine for downloading ABM data without needing a Snipe-IT client.
func (*Engine) CacheDir ¶ added in v1.0.0
CacheDir returns the configured cache directory, defaulting to ".cache".
func (*Engine) FetchAndSaveAppleCare ¶ added in v1.3.3
FetchAndSaveAppleCare fetches AppleCare coverage for the given device list and writes applecare.json. If devices is nil, it loads devices from cache.
func (*Engine) FetchAndSaveCache ¶ added in v1.0.0
FetchAndSaveCache fetches all devices and AppleCare coverage from ABM and writes them to the cache directory as individual JSON files. Each section is saved immediately after fetching so that partial data is preserved if a later stage fails or is interrupted.
func (*Engine) FetchAndSaveDevices ¶ added in v1.3.3
FetchAndSaveDevices fetches devices from ABM, applies configured filters, writes devices.json, and returns the device list for further use.
func (*Engine) LoadCache ¶ added in v1.0.0
LoadCache reads ABM cache from individual JSON files in the cache directory.