mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
35 lines
786 B
Go
35 lines
786 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/go-kit/kit/endpoint"
|
|
"github.com/fleetdm/fleet/server/kolide"
|
|
)
|
|
|
|
type statusResponse struct {
|
|
Err error `json:"error,omitempty"`
|
|
}
|
|
|
|
func (m statusResponse) error() error { return m.Err }
|
|
|
|
func makeStatusLiveQueryEndpoint(svc kolide.Service) endpoint.Endpoint {
|
|
return func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
var resp statusResponse
|
|
if err := svc.StatusLiveQuery(ctx); err != nil {
|
|
resp.Err = err
|
|
}
|
|
return resp, nil
|
|
}
|
|
}
|
|
|
|
func makeStatusResultStoreEndpoint(svc kolide.Service) endpoint.Endpoint {
|
|
return func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
var resp statusResponse
|
|
if err := svc.StatusResultStore(ctx); err != nil {
|
|
resp.Err = err
|
|
}
|
|
return resp, nil
|
|
}
|
|
}
|