api

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2020 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventsAPI

type EventsAPI struct {
	// contains filtered or unexported fields
}

EventsAPI handles requests to the /events path

func NewEventsAPI

func NewEventsAPI(tokenProcessor token.Processor, eventOutput output.Output) (EventsAPI, error)

NewEventsAPI provisions an events API with its required resources

func (EventsAPI) Handle

func (eventsAPI EventsAPI) Handle(responseWriter http.ResponseWriter, request *http.Request)

Handle does nothing right now

type InstallAPI

type InstallAPI struct {
	// contains filtered or unexported fields
}

InstallAPI handles requests to the /install path for sensor installation

func NewInstallAPI

func NewInstallAPI(tokenProcessor token.Processor, eventOutput output.Output, verifiers []auth.Verifier) (InstallAPI, error)

NewInstallAPI provisions a sensor API with its required resources

func (InstallAPI) Handle

func (installAPI InstallAPI) Handle(responseWriter http.ResponseWriter, request *http.Request)

Handle validates and processes install requests

type InstallRequest

type InstallRequest struct {
	Key   auth.Key `json:"key"`
	Label string   `json:"label"`
}

InstallRequest is what the sensor sends in the HTTP body to request installation

type InstallResponse

type InstallResponse struct {
	Token     string    `json:"token"`
	Sensor    uuid.UUID `json:"sensor"`
	ExpiresAt int64     `json:"expiresAt"`
	IssuedAt  int64     `json:"issuedAt"`
}

InstallResponse forms the response body that the sensor will receive on a successful install request

type SensorAPI

type SensorAPI struct {
	InstallHandler InstallAPI
	EventsHandler  EventsAPI
}

SensorAPI is the root HTTP Handler for the sensor API

func (SensorAPI) ServeHTTP

func (sensorAPI SensorAPI) ServeHTTP(responseWriter http.ResponseWriter, request *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL