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 kitlog.Logger ReducedLoggingResponseCodes []int }
Options wraps the properties needed to set up the stat server
type Service ¶
type Service interface {
RequestStat(ctx context.Context, authHeaderValue, deviceID string) (*common.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 //Tr1d1umTransactor is the component that's responsible to make the HTTP //request to the XMiDT API and return only data we care about. HTTPTransactor common.Tr1d1umTransactor }
ServiceOptions defines the options needed to build a new stat service.
Click to show internal directories.
Click to hide internal directories.