forked from micromdm/micromdm
/
syncnow.go
40 lines (31 loc) · 860 Bytes
/
syncnow.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package depsync
import (
"context"
"net/http"
"github.com/go-kit/kit/endpoint"
)
func (s *DEPSyncService) SyncNow(_ context.Context) error {
s.syncer.SyncNow()
return nil
}
type syncNowResponse struct{}
type syncNowRequest struct{}
func MakeSyncNowEndpoint(s Service) endpoint.Endpoint {
return func(ctx context.Context, _ interface{}) (interface{}, error) {
s.SyncNow(ctx)
return syncNowResponse{}, nil
}
}
func decodeEmptyRequest(ctx context.Context, r *http.Request) (interface{}, error) {
return nil, nil
}
func encodeEmptyResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {
return nil
}
func decodeEmptyResponse(ctx context.Context, r *http.Response) (interface{}, error) {
return nil, nil
}
func (e Endpoints) SyncNow(ctx context.Context) error {
_, err := e.SyncNowEndpoint(ctx, nil)
return err
}