Documentation ¶
Index ¶
- Constants
- func NewHTTP(requestHandler *RequestHandler, authInterceptor kitNetHttp.Interceptor) *http.Server
- type Config
- type Device
- type DeviceSubscriptionLoader
- type DialCertManager
- type ErrFunc
- type Event
- type EventHandler
- type GoroutinePoolGoFunc
- type GoroutinePoolHandler
- type Handler
- type Iter
- type ListDevicesOfUserFunc
- type ListenCertManager
- type Representation
- type RequestHandler
- func (rh *RequestHandler) GetDevices(ctx context.Context, deviceIdsFilter []string, ...) ([]Device, error)
- func (rh *RequestHandler) GetResourceLinks(ctx context.Context, deviceIdsFilter []string, ...) (map[string]schema.ResourceLinks, error)
- func (rh *RequestHandler) GetUsersDevices(ctx context.Context, r *http.Request) ([]string, error)
- func (rh *RequestHandler) IsAuthorized(ctx context.Context, r *http.Request, deviceID string) 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 string, ...) (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) RetrieveResourcesValues(ctx context.Context, resourceIdsFilter []string, deviceIdsFilter []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 ResourceSubscriptionLoader
- type RetrieveDeviceAllResponse
- type RetrieveDeviceContentAllResponse
- type RetrieveDeviceWithLinksResponse
- type Server
- type Status
- type SubscriptionResponse
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.Server
NewHTTP returns HTTP server
Types ¶
type Config ¶
type Config struct { grpc.Config AuthServerAddr string `envconfig:"AUTH_SERVER_ADDRESS" default:"127.0.0.1:9100"` ResourceAggregateAddr string `envconfig:"RESOURCE_AGGREGATE_ADDRESS" default:"127.0.0.1:9100"` ResourceDirectoryAddr string `envconfig:"RESOURCE_DIRECTORY_ADDRESS" default:"127.0.0.1:9100"` FQDN string `envconfig:"FQDN" default:"cloud2cloud.pluggedin.cloud"` DevicesCheckInterval time.Duration `envconfig:"ALL_DEVICES_CHECK_INTERVAL" default:"3s"` TimeoutForRequests time.Duration `envconfig:"TIMEOUT_FOR_REQUESTS" default:"10s"` }
Config represent application configuration
type DeviceSubscriptionLoader ¶
type DeviceSubscriptionLoader struct {
// contains filtered or unexported fields
}
func (*DeviceSubscriptionLoader) Handle ¶
func (l *DeviceSubscriptionLoader) Handle(ctx context.Context, iter store.SubscriptionIter) error
type DialCertManager ¶
type ErrFunc ¶
type ErrFunc func(err error)
ErrFunc used by handler to report error from observation
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
type GoroutinePoolGoFunc ¶
type GoroutinePoolGoFunc func(func()) error
GoroutinePoolGoFunc processes actions via provided function
type GoroutinePoolHandler ¶
type GoroutinePoolHandler struct {
// contains filtered or unexported fields
}
GoroutinePoolHandler submit events to goroutine pool for process them.
func NewGoroutinePoolHandler ¶
func NewGoroutinePoolHandler( goroutinePoolGo GoroutinePoolGoFunc, eventsHandler Handler, errFunc ErrFunc) *GoroutinePoolHandler
NewGoroutinePoolHandler creates new event processor.
type ListDevicesOfUserFunc ¶
type ListenCertManager ¶
type Representation ¶
type RequestHandler ¶
type RequestHandler struct {
// contains filtered or unexported fields
}
RequestHandler for handling incoming request
func NewRequestHandler ¶
func NewRequestHandler( asClient pbAS.AuthorizationServiceClient, raClient pbRA.ResourceAggregateClient, rsClient pbRS.ResourceShadowClient, rdClient pbRD.ResourceDirectoryClient, ddClient pbDD.DeviceDirectoryClient, resourceProjection *projectionRA.Projection, store store.Store, updateNotificationContainer *raCqrs.UpdateNotificationContainer, timeoutForRequests time.Duration, ) *RequestHandler
NewRequestHandler factory for new RequestHandler
func (*RequestHandler) GetDevices ¶
func (rh *RequestHandler) GetDevices(ctx context.Context, deviceIdsFilter []string, authorizationContext pbCQRS.AuthorizationContext) ([]Device, error)
func (*RequestHandler) GetResourceLinks ¶
func (rh *RequestHandler) GetResourceLinks(ctx context.Context, deviceIdsFilter []string, authorizationContext pbCQRS.AuthorizationContext) (map[string]schema.ResourceLinks, error)
func (*RequestHandler) GetUsersDevices ¶
func (*RequestHandler) IsAuthorized ¶
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 string, 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) RetrieveResourcesValues ¶
func (rh *RequestHandler) RetrieveResourcesValues(ctx context.Context, resourceIdsFilter []string, deviceIdsFilter []string, authorizationContext pbCQRS.AuthorizationContext) (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 ResourceSubscriptionLoader ¶
type ResourceSubscriptionLoader struct {
// contains filtered or unexported fields
}
func (*ResourceSubscriptionLoader) Handle ¶
func (l *ResourceSubscriptionLoader) Handle(ctx context.Context, iter store.SubscriptionIter) 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( config Config, dialCertManager DialCertManager, listenCertManager ListenCertManager, authInterceptor kitNetHttp.Interceptor, resourceEventStore cqrsEventStore.EventStore, resourceSubscriber eventbus.Subscriber, subscriptionStore store.Store, goroutinePoolGo GoroutinePoolGoFunc, ) *Server
New create new Server with provided store and bus
type Status ¶
type Status string
const Status_OFFLINE Status = "offline"
const Status_ONLINE Status = "online"
type SubscriptionResponse ¶
type SubscriptionResponse struct {
SubscriptionID string `json:"subscriptionId"`
}
Source Files ¶
- auth.go
- cborEncoder.go
- config.go
- devicesSubscription.go
- eventHandler.go
- goroutinePoolHandler.go
- httpApi.go
- jsonEncoder.go
- resourceProjection.go
- retrieveAllDevicesSubscription.go
- retrieveDevice.go
- retrieveDeviceSubscription.go
- retrieveDevices.go
- retrieveResource.go
- retrieveResourceSubscription.go
- service.go
- subscribeToDevice.go
- subscribeToDevices.go
- subscribeToResouce.go
- unsubscribeFromDevice.go
- unsubscribeFromDevices.go
- unsubscribeFromResource.go
- updateResource.go
Click to show internal directories.
Click to hide internal directories.