Documentation ¶
Index ¶
- Constants
- func NewHTTP(requestHandler *RequestHandler, authInterceptor kitNetHttp.Interceptor) http.Handler
- type APIsConfig
- type ClientsConfig
- type Config
- type Device
- type EventBusConfig
- type GrpcGatewayConfig
- type HTTPConfig
- type HTTPSubscriptionConfig
- type ListDevicesOfUserFunc
- type Representation
- type RequestHandler
- func (rh *RequestHandler) GetDevices(ctx context.Context, deviceIdFilter []string) ([]Device, error)
- func (rh *RequestHandler) GetResourceLinks(ctx context.Context, deviceIdFilter []string) (map[string]schema.ResourceLinks, error)
- func (rh *RequestHandler) RetrieveDevice(w http.ResponseWriter, r *http.Request)
- func (rh *RequestHandler) RetrieveDeviceSubscription(w http.ResponseWriter, r *http.Request)
- func (rh *RequestHandler) RetrieveDeviceWithContentQuery(ctx context.Context, w http.ResponseWriter, routeVars map[string]string, ...) (int, error)
- func (rh *RequestHandler) RetrieveDeviceWithLinks(ctx context.Context, w http.ResponseWriter, deviceID string, ...) (int, error)
- func (rh *RequestHandler) RetrieveDeviceWithRepresentations(ctx context.Context, w http.ResponseWriter, deviceID string, ...) (int, error)
- func (rh *RequestHandler) RetrieveDevices(w http.ResponseWriter, r *http.Request)
- func (rh *RequestHandler) RetrieveDevicesAll(ctx context.Context, w http.ResponseWriter, encoder responseWriterEncoderFunc) (int, error)
- func (rh *RequestHandler) RetrieveDevicesBase(ctx context.Context, w http.ResponseWriter, encoder responseWriterEncoderFunc) (int, error)
- func (rh *RequestHandler) RetrieveDevicesSubscription(w http.ResponseWriter, r *http.Request)
- func (rh *RequestHandler) RetrieveDevicesWithContentQuery(ctx context.Context, w http.ResponseWriter, routeVars map[string]string, ...) (statusCode int, err error)
- func (rh *RequestHandler) RetrieveResource(w http.ResponseWriter, r *http.Request)
- func (rh *RequestHandler) RetrieveResourceBase(ctx context.Context, w http.ResponseWriter, resourceID *commands.ResourceId, ...) (int, error)
- func (rh *RequestHandler) RetrieveResourceSubscription(w http.ResponseWriter, r *http.Request)
- func (rh *RequestHandler) RetrieveResourceWithContentQuery(ctx context.Context, w http.ResponseWriter, routeVars map[string]string, ...) (int, error)
- func (rh *RequestHandler) RetrieveResources(ctx context.Context, resourceIdFilter []string, deviceIdFilter []string) (map[string][]Representation, error)
- func (rh *RequestHandler) SubscribeToDevice(w http.ResponseWriter, r *http.Request)
- func (rh *RequestHandler) SubscribeToDevices(w http.ResponseWriter, r *http.Request)
- func (rh *RequestHandler) SubscribeToResource(w http.ResponseWriter, r *http.Request)
- func (rh *RequestHandler) UnsubscribeFromDevice(w http.ResponseWriter, r *http.Request)
- func (rh *RequestHandler) UnsubscribeFromDevices(w http.ResponseWriter, r *http.Request)
- func (rh *RequestHandler) UnsubscribeFromResource(w http.ResponseWriter, r *http.Request)
- func (rh *RequestHandler) UpdateResource(w http.ResponseWriter, r *http.Request)
- type ResourceAggregateConfig
- type RetrieveDeviceAllResponse
- type RetrieveDeviceContentAllResponse
- type RetrieveDeviceWithLinksResponse
- type Server
- type Status
- type StorageConfig
- type Subscription
- type SubscriptionConfig
- type SubscriptionData
- func (s *SubscriptionData) Connect(ctx context.Context, emitEvent emitEventFunc, ...) error
- func (s *SubscriptionData) Data() store.Subscription
- func (s *SubscriptionData) IncrementSequenceNumber(ctx context.Context) (uint64, error)
- func (s *SubscriptionData) SetInitialized(ctx context.Context) error
- func (s *SubscriptionData) Store(sub Subscription)
- func (s *SubscriptionData) Subscription() Subscription
- type SubscriptionManager
- func (s *SubscriptionManager) Connect(ID string) error
- func (s *SubscriptionManager) DumpNotConnectedSubscriptionDatas() map[string]*SubscriptionData
- func (s *SubscriptionManager) Load(ID string) (store.Subscription, bool)
- func (s *SubscriptionManager) LoadSubscriptions() error
- func (s *SubscriptionManager) PullOut(ctx context.Context, ID, href string) (store.Subscription, error)
- func (s *SubscriptionManager) Run()
- func (s *SubscriptionManager) Store(ctx context.Context, sub store.Subscription) error
Constants ¶
View Source
const ContentQuery = "content"
View Source
const ContentQueryAllValue = "all"
View Source
const ContentQueryBaseValue = "base"
View Source
const ContentQueryDefault = ContentQueryBaseValue
Variables ¶
This section is empty.
Functions ¶
func NewHTTP ¶
func NewHTTP(requestHandler *RequestHandler, authInterceptor kitNetHttp.Interceptor) http.Handler
NewHTTP returns HTTP handler
Types ¶
type APIsConfig ¶
type APIsConfig struct {
HTTP HTTPConfig `yaml:"http" json:"http"`
}
func (*APIsConfig) Validate ¶
func (c *APIsConfig) Validate() error
type ClientsConfig ¶
type ClientsConfig struct { Eventbus EventBusConfig `yaml:"eventBus" json:"eventBus"` GrpcGateway GrpcGatewayConfig `yaml:"grpcGateway" json:"grpcGateway"` ResourceAggregate ResourceAggregateConfig `yaml:"resourceAggregate" json:"resourceAggregate"` Storage StorageConfig `yaml:"storage" json:"storage"` Subscription SubscriptionConfig `yaml:"subscription" json:"subscription"` OpenTelemetryCollector http.OpenTelemetryCollectorConfig `yaml:"openTelemetryCollector" json:"openTelemetryCollector"` }
func (*ClientsConfig) Validate ¶
func (c *ClientsConfig) Validate() error
type Config ¶
type Config struct { Log log.Config `yaml:"log" json:"log"` APIs APIsConfig `yaml:"apis" json:"apis"` Clients ClientsConfig `yaml:"clients" json:"clients"` TaskQueue queue.Config `yaml:"taskQueue" json:"taskQueue"` }
Config represents application configuration
type EventBusConfig ¶
type EventBusConfig struct {
NATS natsClient.Config `yaml:"nats" json:"nats"`
}
func (*EventBusConfig) Validate ¶
func (c *EventBusConfig) Validate() error
type GrpcGatewayConfig ¶
type GrpcGatewayConfig struct {
Connection grpcClient.Config `yaml:"grpc" json:"grpc"`
}
func (*GrpcGatewayConfig) Validate ¶
func (c *GrpcGatewayConfig) Validate() error
type HTTPConfig ¶
type HTTPConfig struct { Connection listener.Config `yaml:",inline" json:",inline"` Authorization validator.Config `yaml:"authorization" json:"authorization"` }
func (*HTTPConfig) Validate ¶
func (c *HTTPConfig) Validate() error
type HTTPSubscriptionConfig ¶
type HTTPSubscriptionConfig struct { ReconnectInterval time.Duration `yaml:"reconnectInterval" json:"reconnectInterval"` EmitEventTimeout time.Duration `yaml:"emitEventTimeout" json:"emitEventTimeout"` TLS cmClient.Config `yaml:"tls" json:"tls"` }
func (*HTTPSubscriptionConfig) Validate ¶
func (c *HTTPSubscriptionConfig) Validate() error
type ListDevicesOfUserFunc ¶
type Representation ¶
type RequestHandler ¶
type RequestHandler struct {
// contains filtered or unexported fields
}
RequestHandler for handling incoming request
func NewRequestHandler ¶
func NewRequestHandler( gwClient pbGRPC.GrpcGatewayClient, raClient *raClient.Client, subMgr *SubscriptionManager, emitEvent emitEventFunc, ) *RequestHandler
NewRequestHandler factory for new RequestHandler
func (*RequestHandler) GetDevices ¶
func (*RequestHandler) GetResourceLinks ¶
func (rh *RequestHandler) GetResourceLinks(ctx context.Context, deviceIdFilter []string) (map[string]schema.ResourceLinks, error)
func (*RequestHandler) RetrieveDevice ¶
func (rh *RequestHandler) RetrieveDevice(w http.ResponseWriter, r *http.Request)
func (*RequestHandler) RetrieveDeviceSubscription ¶
func (rh *RequestHandler) RetrieveDeviceSubscription(w http.ResponseWriter, r *http.Request)
func (*RequestHandler) RetrieveDeviceWithContentQuery ¶
func (rh *RequestHandler) RetrieveDeviceWithContentQuery(ctx context.Context, w http.ResponseWriter, routeVars map[string]string, contentQuery string, encoder responseWriterEncoderFunc) (int, error)
func (*RequestHandler) RetrieveDeviceWithLinks ¶
func (rh *RequestHandler) RetrieveDeviceWithLinks(ctx context.Context, w http.ResponseWriter, deviceID string, encoder responseWriterEncoderFunc) (int, error)
func (*RequestHandler) RetrieveDeviceWithRepresentations ¶
func (rh *RequestHandler) RetrieveDeviceWithRepresentations(ctx context.Context, w http.ResponseWriter, deviceID string, encoder responseWriterEncoderFunc) (int, error)
func (*RequestHandler) RetrieveDevices ¶
func (rh *RequestHandler) RetrieveDevices(w http.ResponseWriter, r *http.Request)
func (*RequestHandler) RetrieveDevicesAll ¶
func (rh *RequestHandler) RetrieveDevicesAll(ctx context.Context, w http.ResponseWriter, encoder responseWriterEncoderFunc) (int, error)
func (*RequestHandler) RetrieveDevicesBase ¶
func (rh *RequestHandler) RetrieveDevicesBase(ctx context.Context, w http.ResponseWriter, encoder responseWriterEncoderFunc) (int, error)
func (*RequestHandler) RetrieveDevicesSubscription ¶
func (rh *RequestHandler) RetrieveDevicesSubscription(w http.ResponseWriter, r *http.Request)
func (*RequestHandler) RetrieveDevicesWithContentQuery ¶
func (rh *RequestHandler) RetrieveDevicesWithContentQuery(ctx context.Context, w http.ResponseWriter, routeVars map[string]string, contentQuery string, encoder responseWriterEncoderFunc) (statusCode int, err error)
func (*RequestHandler) RetrieveResource ¶
func (rh *RequestHandler) RetrieveResource(w http.ResponseWriter, r *http.Request)
func (*RequestHandler) RetrieveResourceBase ¶
func (rh *RequestHandler) RetrieveResourceBase(ctx context.Context, w http.ResponseWriter, resourceID *commands.ResourceId, encoder responseWriterEncoderFunc) (int, error)
func (*RequestHandler) RetrieveResourceSubscription ¶
func (rh *RequestHandler) RetrieveResourceSubscription(w http.ResponseWriter, r *http.Request)
func (*RequestHandler) RetrieveResourceWithContentQuery ¶
func (rh *RequestHandler) RetrieveResourceWithContentQuery(ctx context.Context, w http.ResponseWriter, routeVars map[string]string, contentQuery string, encoder responseWriterEncoderFunc) (int, error)
func (*RequestHandler) RetrieveResources ¶
func (rh *RequestHandler) RetrieveResources(ctx context.Context, resourceIdFilter []string, deviceIdFilter []string) (map[string][]Representation, error)
func (*RequestHandler) SubscribeToDevice ¶
func (rh *RequestHandler) SubscribeToDevice(w http.ResponseWriter, r *http.Request)
func (*RequestHandler) SubscribeToDevices ¶
func (rh *RequestHandler) SubscribeToDevices(w http.ResponseWriter, r *http.Request)
func (*RequestHandler) SubscribeToResource ¶
func (rh *RequestHandler) SubscribeToResource(w http.ResponseWriter, r *http.Request)
func (*RequestHandler) UnsubscribeFromDevice ¶
func (rh *RequestHandler) UnsubscribeFromDevice(w http.ResponseWriter, r *http.Request)
func (*RequestHandler) UnsubscribeFromDevices ¶
func (rh *RequestHandler) UnsubscribeFromDevices(w http.ResponseWriter, r *http.Request)
func (*RequestHandler) UnsubscribeFromResource ¶
func (rh *RequestHandler) UnsubscribeFromResource(w http.ResponseWriter, r *http.Request)
func (*RequestHandler) UpdateResource ¶
func (rh *RequestHandler) UpdateResource(w http.ResponseWriter, r *http.Request)
type ResourceAggregateConfig ¶
type ResourceAggregateConfig struct {
Connection grpcClient.Config `yaml:"grpc" json:"grpc"`
}
func (*ResourceAggregateConfig) Validate ¶
func (c *ResourceAggregateConfig) Validate() error
type RetrieveDeviceAllResponse ¶
type RetrieveDeviceAllResponse struct { Device Links []Representation `json:"links"` }
type RetrieveDeviceContentAllResponse ¶
type RetrieveDeviceContentAllResponse struct { Device Links []Representation `json:"links"` }
type RetrieveDeviceWithLinksResponse ¶
type RetrieveDeviceWithLinksResponse struct { Device Links []schema.ResourceLink `json:"links"` }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server handle HTTP request
func New ¶
func New(ctx context.Context, config Config, fileWatcher *fsnotify.Watcher, logger log.Logger) (*Server, error)
New parses configuration and creates new Server with provided store and bus
type Status ¶
type Status string
const Status_OFFLINE Status = "offline"
const Status_ONLINE Status = "online"
type StorageConfig ¶
func (*StorageConfig) Validate ¶
func (c *StorageConfig) Validate() error
type Subscription ¶
type Subscription interface {
Cancel() (func(), error)
}
type SubscriptionConfig ¶
type SubscriptionConfig struct {
HTTP HTTPSubscriptionConfig `yaml:"http" json:"http"`
}
func (*SubscriptionConfig) Validate ¶
func (c *SubscriptionConfig) Validate() error
type SubscriptionData ¶
type SubscriptionData struct {
// contains filtered or unexported fields
}
func (*SubscriptionData) Connect ¶
func (s *SubscriptionData) Connect(ctx context.Context, emitEvent emitEventFunc, deleteSub func(ctx context.Context, subID, href string) (store.Subscription, error)) error
func (*SubscriptionData) Data ¶
func (s *SubscriptionData) Data() store.Subscription
func (*SubscriptionData) IncrementSequenceNumber ¶
func (s *SubscriptionData) IncrementSequenceNumber(ctx context.Context) (uint64, error)
func (*SubscriptionData) SetInitialized ¶
func (s *SubscriptionData) SetInitialized(ctx context.Context) error
func (*SubscriptionData) Store ¶
func (s *SubscriptionData) Store(sub Subscription)
func (*SubscriptionData) Subscription ¶
func (s *SubscriptionData) Subscription() Subscription
type SubscriptionManager ¶
type SubscriptionManager struct {
// contains filtered or unexported fields
}
func NewSubscriptionManager ¶
func NewSubscriptionManager(ctx context.Context, store store.Store, gwClient pb.GrpcGatewayClient, reconnectInterval time.Duration, emitEvent emitEventFunc) *SubscriptionManager
func (*SubscriptionManager) Connect ¶
func (s *SubscriptionManager) Connect(ID string) error
func (*SubscriptionManager) DumpNotConnectedSubscriptionDatas ¶
func (s *SubscriptionManager) DumpNotConnectedSubscriptionDatas() map[string]*SubscriptionData
func (*SubscriptionManager) Load ¶
func (s *SubscriptionManager) Load(ID string) (store.Subscription, bool)
func (*SubscriptionManager) LoadSubscriptions ¶
func (s *SubscriptionManager) LoadSubscriptions() error
func (*SubscriptionManager) PullOut ¶
func (s *SubscriptionManager) PullOut(ctx context.Context, ID, href string) (store.Subscription, error)
func (*SubscriptionManager) Run ¶
func (s *SubscriptionManager) Run()
func (*SubscriptionManager) Store ¶
func (s *SubscriptionManager) Store(ctx context.Context, sub store.Subscription) error
Source Files ¶
- cborEncoder.go
- config.go
- deviceSubscriptions.go
- devicesSubscriptions.go
- emitEvent.go
- httpApi.go
- jsonEncoder.go
- resourceSubscriptions.go
- retrieveAllDevicesSubscription.go
- retrieveDevice.go
- retrieveDeviceSubscription.go
- retrieveDevices.go
- retrieveResource.go
- retrieveResourceSubscription.go
- service.go
- subscribeToDevice.go
- subscribeToDevices.go
- subscribeToResource.go
- subscriptionManager.go
- subscriptions.go
- unsubscribeFromDevice.go
- unsubscribeFromDevices.go
- unsubscribeFromResource.go
- updateResource.go
Click to show internal directories.
Click to hide internal directories.