endpoint

package
v0.0.0-...-41a29be Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTokenVerificationFailure signifies that an auth token was missing or invalid
	ErrTokenVerificationFailure = errors.New("API token was missing or invalid")
)

Functions

func VerifyAPIKey

func VerifyAPIKey(apiTokens []string) kitendpoint.Middleware

VerifyAPIKey checks the API key in a request

Types

type HealthCheckResponse

type HealthCheckResponse struct {
	Status string `json:"status"`
}

HealthCheckResponse has fields with healthcheck status

type HealthCheckServicer

type HealthCheckServicer interface {
	Run(context.Context, interface{}) (interface{}, error)
}

HealthCheckServicer provides functions for performing component healthcheck

func NewHealthCheck

func NewHealthCheck(c *config.Configuration) HealthCheckServicer

NewHealthCheck creates a new healthcheck

type Measurement

type Measurement struct {
	Name  string  `json:"name"`
	Value float64 `json:"value"`
	Unit  string  `json:"unit"`
}

Measurement contains the measurement details

func (*Measurement) FieldMap

func (s *Measurement) FieldMap(req *http.Request) binding.FieldMap

FieldMap binds fields to their JSON labels

type MeasurementMessage

type MeasurementMessage struct {
	Timestamp int32    `json:"timestamp"`
	RelayID   string   `json:"relay_id"`
	Status    string   `json:"status"`
	Sensors   []Sensor `json:"sensors"`
	APIToken  string
}

MeasurementMessage represents a message to be enqueued for later processing

func (*MeasurementMessage) FieldMap

func (m *MeasurementMessage) FieldMap(req *http.Request) binding.FieldMap

FieldMap binds fields to their JSON labels

func (*MeasurementMessage) GetToken

func (m *MeasurementMessage) GetToken() string

GetToken returns the API token associated with the request

type ProtectedOperationRequest

type ProtectedOperationRequest interface {
	GetToken() string
}

ProtectedOperationRequest is used to indicate a request type uses auth tokens

type ReadingResponse

type ReadingResponse struct {
	Status string `json:"status"`
}

ReadingResponse has fields with operation status

type Sensor

type Sensor struct {
	ID             string          `json:"id"`
	SensorReadings []SensorReading `json:"readings"`
}

Sensor represents a sensor with a collection of readings to be saved

func (*Sensor) FieldMap

func (s *Sensor) FieldMap(req *http.Request) binding.FieldMap

FieldMap binds fields to their JSON labels

type SensorReading

type SensorReading struct {
	Timestamp    int32         `json:"timestamp"`
	Measurements []Measurement `json:"measurements"`
}

SensorReading represents a reading from a point in time with one or more measurements

func (*SensorReading) FieldMap

func (s *SensorReading) FieldMap() binding.FieldMap

FieldMap binds fields to their JSON labels

type SensorReadingQueueMessage

type SensorReadingQueueMessage struct {
	RelayID            string        `json:"relay_id"`
	SensorID           string        `json:"sensor_id"`
	ReadingTimestamp   int32         `json:"reading_timestamp"`
	ReportingTimestamp int32         `json:"reporting_timestamp"`
	Measurements       []Measurement `json:"measurements"`
}

SensorReadingQueueMessage holds one or more measurements to be written

type SensorReadingsServicer

type SensorReadingsServicer interface {
	HandleMeasurementMessage(context.Context, interface{}) (interface{}, error)
}

SensorReadingsServicer provides functions for dealing with new sensor readings

func NewSensorReadingServicer

func NewSensorReadingServicer(c *config.Configuration) SensorReadingsServicer

NewSensorReadingServicer creates a new healthcheck

Jump to

Keyboard shortcuts

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