Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigHandler ¶
func ConfigHandler(c *Options)
ConfigHandler sets up the server that powers the stat service That is, it configures the mux paths to access the service
Types ¶
type Options ¶
type Options struct {
S Service
//APIRouter is assumed to be a subrouter with the API prefix path (i.e. 'api/v2')
APIRouter *mux.Router
Authenticate *alice.Chain
Log *zap.Logger
ReducedLoggingResponseCodes []int
BearerFingerprint transaction.FingerprintConfig
}
Options wraps the properties needed to set up the stat server
type Service ¶
type Service interface {
RequestStat(ctx context.Context, authHeaderValue, deviceID string) (*transaction.XmidtResponse, error)
}
Service defines the behavior of the device statistics Tr1d1um Service.
func NewService ¶
func NewService(o *ServiceOptions) Service
NewService constructs a new stat service instance given some options.
type ServiceOptions ¶
type ServiceOptions struct {
//Base Endpoint URL for device stats from the XMiDT API.
//It's expected to have the "${device}" substring to perform device ID substitution.
XmidtStatURL string
//AuthAcquirer provides a mechanism to fetch auth tokens to complete the HTTP transaction
//with the remote server.
//(Optional)
AuthAcquirer acquire.Acquirer
//HTTPTransactor is the component that's responsible to make the HTTP
//request to the XMiDT API and return only data we care about.
HTTPTransactor transaction.T
}
ServiceOptions defines the options needed to build a new stat service.
Click to show internal directories.
Click to hide internal directories.