server

package
v0.0.0-...-b9360c4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeDeviceLayoutRequest

func DecodeDeviceLayoutRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeDeviceLayoutRequest returns a decoder for requests sent to the information device layout endpoint.

func DecodeFirmwareStatisticsRequest

func DecodeFirmwareStatisticsRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeFirmwareStatisticsRequest returns a decoder for requests sent to the information firmware statistics endpoint.

func DeviceLayoutInformationPath

func DeviceLayoutInformationPath(deviceID string) string

DeviceLayoutInformationPath returns the URL path to the information service device layout HTTP endpoint.

func EncodeDeviceLayoutError

func EncodeDeviceLayoutError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error

EncodeDeviceLayoutError returns an encoder for errors returned by the device layout information endpoint.

func EncodeDeviceLayoutResponse

func EncodeDeviceLayoutResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeDeviceLayoutResponse returns an encoder for responses returned by the information device layout endpoint.

func EncodeFirmwareStatisticsError

func EncodeFirmwareStatisticsError(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder, formatter func(err error) goahttp.Statuser) func(context.Context, http.ResponseWriter, error) error

EncodeFirmwareStatisticsError returns an encoder for errors returned by the firmware statistics information endpoint.

func EncodeFirmwareStatisticsResponse

func EncodeFirmwareStatisticsResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeFirmwareStatisticsResponse returns an encoder for responses returned by the information firmware statistics endpoint.

func FirmwareStatisticsInformationPath

func FirmwareStatisticsInformationPath() string

FirmwareStatisticsInformationPath returns the URL path to the information service firmware statistics HTTP endpoint.

func Mount

func Mount(mux goahttp.Muxer, h *Server)

Mount configures the mux to serve the information endpoints.

func MountCORSHandler

func MountCORSHandler(mux goahttp.Muxer, h http.Handler)

MountCORSHandler configures the mux to serve the CORS endpoints for the service information.

func MountDeviceLayoutHandler

func MountDeviceLayoutHandler(mux goahttp.Muxer, h http.Handler)

MountDeviceLayoutHandler configures the mux to serve the "information" service "device layout" endpoint.

func MountFirmwareStatisticsHandler

func MountFirmwareStatisticsHandler(mux goahttp.Muxer, h http.Handler)

MountFirmwareStatisticsHandler configures the mux to serve the "information" service "firmware statistics" endpoint.

func NewCORSHandler

func NewCORSHandler() http.Handler

NewCORSHandler creates a HTTP handler which returns a simple 200 response.

func NewDeviceLayoutHandler

func NewDeviceLayoutHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewDeviceLayoutHandler creates a HTTP handler which loads the HTTP request and calls the "information" service "device layout" endpoint.

func NewDeviceLayoutPayload

func NewDeviceLayoutPayload(deviceID string, auth string) *information.DeviceLayoutPayload

NewDeviceLayoutPayload builds a information service device layout endpoint payload.

func NewFirmwareStatisticsHandler

func NewFirmwareStatisticsHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewFirmwareStatisticsHandler creates a HTTP handler which loads the HTTP request and calls the "information" service "firmware statistics" endpoint.

func NewFirmwareStatisticsPayload

func NewFirmwareStatisticsPayload(auth string) *information.FirmwareStatisticsPayload

NewFirmwareStatisticsPayload builds a information service firmware statistics endpoint payload.

Types

type DeviceLayoutBadRequestResponseBody

type DeviceLayoutBadRequestResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

DeviceLayoutBadRequestResponseBody is the type of the "information" service "device layout" endpoint HTTP response body for the "bad-request" error.

func NewDeviceLayoutBadRequestResponseBody

func NewDeviceLayoutBadRequestResponseBody(res *goa.ServiceError) *DeviceLayoutBadRequestResponseBody

NewDeviceLayoutBadRequestResponseBody builds the HTTP response body from the result of the "device layout" endpoint of the "information" service.

type DeviceLayoutForbiddenResponseBody

type DeviceLayoutForbiddenResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

DeviceLayoutForbiddenResponseBody is the type of the "information" service "device layout" endpoint HTTP response body for the "forbidden" error.

func NewDeviceLayoutForbiddenResponseBody

func NewDeviceLayoutForbiddenResponseBody(res *goa.ServiceError) *DeviceLayoutForbiddenResponseBody

NewDeviceLayoutForbiddenResponseBody builds the HTTP response body from the result of the "device layout" endpoint of the "information" service.

type DeviceLayoutNotFoundResponseBody

type DeviceLayoutNotFoundResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

DeviceLayoutNotFoundResponseBody is the type of the "information" service "device layout" endpoint HTTP response body for the "not-found" error.

func NewDeviceLayoutNotFoundResponseBody

func NewDeviceLayoutNotFoundResponseBody(res *goa.ServiceError) *DeviceLayoutNotFoundResponseBody

NewDeviceLayoutNotFoundResponseBody builds the HTTP response body from the result of the "device layout" endpoint of the "information" service.

type DeviceLayoutResponseBody

type DeviceLayoutResponseBody struct {
	Configurations []*StationConfigurationResponseBody     `form:"configurations" json:"configurations" xml:"configurations"`
	Sensors        map[string][]*StationSensorResponseBody `form:"sensors" json:"sensors" xml:"sensors"`
}

DeviceLayoutResponseBody is the type of the "information" service "device layout" endpoint HTTP response body.

func NewDeviceLayoutResponseBody

func NewDeviceLayoutResponseBody(res *informationviews.DeviceLayoutResponseView) *DeviceLayoutResponseBody

NewDeviceLayoutResponseBody builds the HTTP response body from the result of the "device layout" endpoint of the "information" service.

type DeviceLayoutUnauthorizedResponseBody

type DeviceLayoutUnauthorizedResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

DeviceLayoutUnauthorizedResponseBody is the type of the "information" service "device layout" endpoint HTTP response body for the "unauthorized" error.

func NewDeviceLayoutUnauthorizedResponseBody

func NewDeviceLayoutUnauthorizedResponseBody(res *goa.ServiceError) *DeviceLayoutUnauthorizedResponseBody

NewDeviceLayoutUnauthorizedResponseBody builds the HTTP response body from the result of the "device layout" endpoint of the "information" service.

type ErrorNamer

type ErrorNamer interface {
	ErrorName() string
}

ErrorNamer is an interface implemented by generated error structs that exposes the name of the error as defined in the design.

type FirmwareStatisticsBadRequestResponseBody

type FirmwareStatisticsBadRequestResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

FirmwareStatisticsBadRequestResponseBody is the type of the "information" service "firmware statistics" endpoint HTTP response body for the "bad-request" error.

func NewFirmwareStatisticsBadRequestResponseBody

func NewFirmwareStatisticsBadRequestResponseBody(res *goa.ServiceError) *FirmwareStatisticsBadRequestResponseBody

NewFirmwareStatisticsBadRequestResponseBody builds the HTTP response body from the result of the "firmware statistics" endpoint of the "information" service.

type FirmwareStatisticsForbiddenResponseBody

type FirmwareStatisticsForbiddenResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

FirmwareStatisticsForbiddenResponseBody is the type of the "information" service "firmware statistics" endpoint HTTP response body for the "forbidden" error.

func NewFirmwareStatisticsForbiddenResponseBody

func NewFirmwareStatisticsForbiddenResponseBody(res *goa.ServiceError) *FirmwareStatisticsForbiddenResponseBody

NewFirmwareStatisticsForbiddenResponseBody builds the HTTP response body from the result of the "firmware statistics" endpoint of the "information" service.

type FirmwareStatisticsNotFoundResponseBody

type FirmwareStatisticsNotFoundResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

FirmwareStatisticsNotFoundResponseBody is the type of the "information" service "firmware statistics" endpoint HTTP response body for the "not-found" error.

func NewFirmwareStatisticsNotFoundResponseBody

func NewFirmwareStatisticsNotFoundResponseBody(res *goa.ServiceError) *FirmwareStatisticsNotFoundResponseBody

NewFirmwareStatisticsNotFoundResponseBody builds the HTTP response body from the result of the "firmware statistics" endpoint of the "information" service.

type FirmwareStatisticsUnauthorizedResponseBody

type FirmwareStatisticsUnauthorizedResponseBody struct {
	// Name is the name of this class of errors.
	Name string `form:"name" json:"name" xml:"name"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID string `form:"id" json:"id" xml:"id"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message string `form:"message" json:"message" xml:"message"`
	// Is the error temporary?
	Temporary bool `form:"temporary" json:"temporary" xml:"temporary"`
	// Is the error a timeout?
	Timeout bool `form:"timeout" json:"timeout" xml:"timeout"`
	// Is the error a server-side fault?
	Fault bool `form:"fault" json:"fault" xml:"fault"`
}

FirmwareStatisticsUnauthorizedResponseBody is the type of the "information" service "firmware statistics" endpoint HTTP response body for the "unauthorized" error.

func NewFirmwareStatisticsUnauthorizedResponseBody

func NewFirmwareStatisticsUnauthorizedResponseBody(res *goa.ServiceError) *FirmwareStatisticsUnauthorizedResponseBody

NewFirmwareStatisticsUnauthorizedResponseBody builds the HTTP response body from the result of the "firmware statistics" endpoint of the "information" service.

type MountPoint

type MountPoint struct {
	// Method is the name of the service method served by the mounted HTTP handler.
	Method string
	// Verb is the HTTP method used to match requests to the mounted handler.
	Verb string
	// Pattern is the HTTP request path pattern used to match requests to the
	// mounted handler.
	Pattern string
}

MountPoint holds information about the mounted endpoints.

type SensorRangeResponseBody

type SensorRangeResponseBody struct {
	Minimum float32 `form:"minimum" json:"minimum" xml:"minimum"`
	Maximum float32 `form:"maximum" json:"maximum" xml:"maximum"`
}

SensorRangeResponseBody is used to define fields on response body types.

type SensorReadingResponseBody

type SensorReadingResponseBody struct {
	Last float32 `form:"last" json:"last" xml:"last"`
	Time int64   `form:"time" json:"time" xml:"time"`
}

SensorReadingResponseBody is used to define fields on response body types.

type Server

type Server struct {
	Mounts             []*MountPoint
	DeviceLayout       http.Handler
	FirmwareStatistics http.Handler
	CORS               http.Handler
}

Server lists the information service endpoint HTTP handlers.

func New

func New(
	e *information.Endpoints,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) *Server

New instantiates HTTP handlers for all the information service endpoints using the provided encoder and decoder. The handlers are mounted on the given mux using the HTTP verb and path defined in the design. errhandler is called whenever a response fails to be encoded. formatter is used to format errors returned by the service methods prior to encoding. Both errhandler and formatter are optional and can be nil.

func (*Server) Service

func (s *Server) Service() string

Service returns the name of the service served.

func (*Server) Use

func (s *Server) Use(m func(http.Handler) http.Handler)

Use wraps the server handlers with the given middleware.

type StationConfigurationResponseBody

type StationConfigurationResponseBody struct {
	ID           int64                        `form:"id" json:"id" xml:"id"`
	Time         int64                        `form:"time" json:"time" xml:"time"`
	ProvisionID  int64                        `form:"provisionId" json:"provisionId" xml:"provisionId"`
	MetaRecordID *int64                       `form:"metaRecordId,omitempty" json:"metaRecordId,omitempty" xml:"metaRecordId,omitempty"`
	SourceID     *int32                       `form:"sourceId,omitempty" json:"sourceId,omitempty" xml:"sourceId,omitempty"`
	Modules      []*StationModuleResponseBody `form:"modules" json:"modules" xml:"modules"`
}

StationConfigurationResponseBody is used to define fields on response body types.

type StationModuleResponseBody

type StationModuleResponseBody struct {
	ID               int64                        `form:"id" json:"id" xml:"id"`
	HardwareID       *string                      `form:"hardwareId,omitempty" json:"hardwareId,omitempty" xml:"hardwareId,omitempty"`
	HardwareIDBase64 *string                      `form:"hardwareIdBase64,omitempty" json:"hardwareIdBase64,omitempty" xml:"hardwareIdBase64,omitempty"`
	MetaRecordID     *int64                       `form:"metaRecordId,omitempty" json:"metaRecordId,omitempty" xml:"metaRecordId,omitempty"`
	Name             string                       `form:"name" json:"name" xml:"name"`
	Label            *string                      `form:"label,omitempty" json:"label,omitempty" xml:"label,omitempty"`
	Position         int32                        `form:"position" json:"position" xml:"position"`
	Flags            int32                        `form:"flags" json:"flags" xml:"flags"`
	Internal         bool                         `form:"internal" json:"internal" xml:"internal"`
	FullKey          string                       `form:"fullKey" json:"fullKey" xml:"fullKey"`
	Sensors          []*StationSensorResponseBody `form:"sensors" json:"sensors" xml:"sensors"`
	Meta             map[string]interface{}       `form:"meta,omitempty" json:"meta,omitempty" xml:"meta,omitempty"`
}

StationModuleResponseBody is used to define fields on response body types.

type StationSensorResponseBody

type StationSensorResponseBody struct {
	Name          string                     `form:"name" json:"name" xml:"name"`
	UnitOfMeasure string                     `form:"unitOfMeasure" json:"unitOfMeasure" xml:"unitOfMeasure"`
	Reading       *SensorReadingResponseBody `form:"reading,omitempty" json:"reading,omitempty" xml:"reading,omitempty"`
	Key           string                     `form:"key" json:"key" xml:"key"`
	FullKey       string                     `form:"fullKey" json:"fullKey" xml:"fullKey"`
	Ranges        []*SensorRangeResponseBody `form:"ranges" json:"ranges" xml:"ranges"`
	Meta          map[string]interface{}     `form:"meta,omitempty" json:"meta,omitempty" xml:"meta,omitempty"`
}

StationSensorResponseBody is used to define fields on response body types.

Jump to

Keyboard shortcuts

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