mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
32 lines
783 B
Go
32 lines
783 B
Go
package service
|
|
|
|
import (
|
|
"github.com/kolide/kolide/server/kolide"
|
|
"golang.org/x/net/context"
|
|
)
|
|
|
|
func (svc service) ListHosts(ctx context.Context, opt kolide.ListOptions) ([]*kolide.Host, error) {
|
|
return svc.ds.ListHosts(opt)
|
|
}
|
|
|
|
func (svc service) GetHost(ctx context.Context, id uint) (*kolide.Host, error) {
|
|
return svc.ds.Host(id)
|
|
}
|
|
|
|
func (svc service) GetHostSummary(ctx context.Context) (*kolide.HostSummary, error) {
|
|
online, offline, mia, new, err := svc.ds.GenerateHostStatusStatistics(svc.clock.Now())
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &kolide.HostSummary{
|
|
OnlineCount: online,
|
|
OfflineCount: offline,
|
|
MIACount: mia,
|
|
NewCount: new,
|
|
}, nil
|
|
}
|
|
|
|
func (svc service) DeleteHost(ctx context.Context, id uint) error {
|
|
return svc.ds.DeleteHost(id)
|
|
}
|