mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
26 lines
636 B
Go
26 lines
636 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/go-kit/kit/endpoint"
|
|
"github.com/kolide/fleet/server/kolide"
|
|
)
|
|
|
|
type certificateResponse struct {
|
|
CertificateChain []byte `json:"certificate_chain"`
|
|
Err error `json:"error,omitempty"`
|
|
}
|
|
|
|
func (r certificateResponse) error() error { return r.Err }
|
|
|
|
func makeCertificateEndpoint(svc kolide.Service) endpoint.Endpoint {
|
|
return func(ctx context.Context, request interface{}) (interface{}, error) {
|
|
chain, err := svc.CertificateChain(ctx)
|
|
if err != nil {
|
|
return certificateResponse{Err: err}, nil
|
|
}
|
|
return certificateResponse{CertificateChain: chain}, nil
|
|
}
|
|
}
|