api

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSendMessage    = errors.New("error sending message")
	ErrDeviceAuth     = errors.New("error authenticating device")
	ErrCACertLoading  = errors.New("unable to read CA certificate")
	ErrTLSConfLoading = errors.New("unable to read client TLS configuration")
	ErrBrokerURLEmpty = errors.New("invalid empty broker URL")
	ErrClientIDEmpty  = errors.New("invalid empty client ID")
	ErrTopicEmpty     = errors.New("invalid empty topic")
)

Functions

func MakeHTTPHandler

func MakeHTTPHandler(s Service, logger log.Logger, otTracer stdopentracing.Tracer) http.Handler

func MakeHealthEndpoint

func MakeHealthEndpoint(s Service) endpoint.Endpoint

func MakePostConnect

func MakePostConnect(s Service) endpoint.Endpoint

func MakePostDisconnect

func MakePostDisconnect(s Service) endpoint.Endpoint

func MakePostSendMessage

func MakePostSendMessage(s Service) endpoint.Endpoint

Types

type Endpoints

type Endpoints struct {
	HealthEndpoint  endpoint.Endpoint
	PostSendMessage endpoint.Endpoint
	PostConnect     endpoint.Endpoint
	PostDisconnect  endpoint.Endpoint
}

func MakeServerEndpoints

func MakeServerEndpoints(s Service, otTracer stdopentracing.Tracer) Endpoints

type Middleware

type Middleware func(Service) Service

func LoggingMidleware

func LoggingMidleware(logger log.Logger) Middleware

func NewInstrumentingMiddleware

func NewInstrumentingMiddleware(counter metrics.Counter, latency metrics.Histogram) Middleware

type Service

type Service interface {
	Health(ctx context.Context) bool
	PostSendMessage(ctx context.Context, message string, topic string) error
	PostConnect(ctx context.Context, authKey string, authCRT string, brokerURL string, clientID string) error
	PostDisconnect(ctx context.Context)
}

func NewDeviceService

func NewDeviceService(CAPath string, client client.Client) Service

Jump to

Keyboard shortcuts

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