Documentation ¶
Index ¶
- func ContentTypeToMediaType(contentType string) (message.MediaType, error)
- func DecodeContentWithCodec(codec Codec, contentType string, data []byte, response interface{}) error
- type ApplicationCallback
- type Client
- func (c *Client) Close(ctx context.Context) error
- func (c *Client) CreateResource(ctx context.Context, deviceID string, href string, request interface{}, ...) error
- func (c *Client) DeleteResource(ctx context.Context, deviceID string, href string, response interface{}, ...) error
- func (c *Client) FactoryReset(ctx context.Context, deviceID string) error
- func (c *Client) GetDevice(ctx context.Context, deviceID string) (*DeviceDetails, error)
- func (c *Client) GetDevices(ctx context.Context, opts ...GetDevicesOption) (map[string]*DeviceDetails, error)
- func (c *Client) GetDevicesIterator(ctx context.Context, deviceIDs []string, resourceTypes ...string) *kitNetGrpc.Iterator
- func (c *Client) GetDevicesViaCallback(ctx context.Context, deviceIDs, resourceTypes []string, ...) error
- func (c *Client) GetResource(ctx context.Context, deviceID string, href string, response interface{}, ...) error
- func (c *Client) GetResourceLinksIterator(ctx context.Context, deviceIDs []string, resourceTypes ...string) *kitNetGrpc.Iterator
- func (c *Client) GetResourceLinksViaCallback(ctx context.Context, deviceIDs, resourceTypes []string, ...) error
- func (c *Client) GetResourcesByResourceIDs(ctx context.Context, resourceIDsCallbacks ...ResourceIDCallback) error
- func (c *Client) GetResourcesIterator(ctx context.Context, resourceIDs []string, deviceIDs []string, ...) *kitNetGrpc.Iterator
- func (c *Client) GrpcGatewayClient() pb.GrpcGatewayClient
- func (c *Client) NewDeviceSubscription(ctx context.Context, deviceID string, handle SubscriptionHandler) (*DeviceSubscription, error)
- func (c *Client) NewDevicesSubscription(ctx context.Context, handle SubscriptionHandler) (*DevicesSubscription, error)
- func (c *Client) NewResourceSubscription(ctx context.Context, resourceID *commands.ResourceId, ...) (*ResourceSubscription, error)
- func (c *Client) ObserveDeviceResources(ctx context.Context, deviceID string, ...) (string, error)
- func (c *Client) ObserveDevices(ctx context.Context, handler DevicesObservationHandler) (string, error)
- func (c *Client) ObserveResource(ctx context.Context, deviceID string, href string, ...) (observationID string, _ error)
- func (c *Client) Reboot(ctx context.Context, deviceID string) error
- func (c *Client) StopObservingDevices(ctx context.Context, observationID string) error
- func (c *Client) StopObservingResource(ctx context.Context, observationID string) error
- func (c *Client) SubscribeToEventsWithCurrentState(ctx context.Context, deduplicateExpiration time.Duration, ...) (pb.GrpcGateway_SubscribeToEventsClient, error)
- func (c *Client) UpdateResource(ctx context.Context, deviceID string, href string, request interface{}, ...) error
- type Codec
- type CodecOption
- type Config
- type CreateOption
- type DeleteOption
- type DeviceDetails
- type DeviceIDsOption
- type DeviceMetadataUpdatedHandler
- type DeviceRegisteredHandler
- type DeviceResourcesObservationHandler
- type DeviceSubscriber
- type DeviceSubscription
- type DeviceSubscriptionHandlers
- func (h *DeviceSubscriptionHandlers) HandleDeviceMetadataUpdatePending(ctx context.Context, val *events.DeviceMetadataUpdatePending, fromDB bool) error
- func (h *DeviceSubscriptionHandlers) HandleResourceCreatePending(ctx context.Context, val *events.ResourceCreatePending, fromDB bool) error
- func (h *DeviceSubscriptionHandlers) HandleResourceDeletePending(ctx context.Context, val *events.ResourceDeletePending, fromDB bool) error
- func (h *DeviceSubscriptionHandlers) HandleResourceRetrievePending(ctx context.Context, val *events.ResourceRetrievePending, fromDB bool) error
- func (h *DeviceSubscriptionHandlers) HandleResourceUpdatePending(ctx context.Context, val *events.ResourceUpdatePending, fromDB bool) error
- type DeviceSubscriptions
- type DeviceUnregisteredHandler
- type DevicesObservationEvent
- type DevicesObservationEvent_type
- type DevicesObservationHandler
- type DevicesSubscription
- type GeneralMessageCodec
- type GetDevicesOption
- type GetOption
- type GrpcGateway_SubscribeToEventsClient
- func (c *GrpcGateway_SubscribeToEventsClient) CloseSend() error
- func (c *GrpcGateway_SubscribeToEventsClient) Context() context.Context
- func (c *GrpcGateway_SubscribeToEventsClient) Header() (metadata.MD, error)
- func (c *GrpcGateway_SubscribeToEventsClient) Recv() (*pb.Event, error)
- func (c *GrpcGateway_SubscribeToEventsClient) RecvMsg(m interface{}) error
- func (c *GrpcGateway_SubscribeToEventsClient) Send(m *pb.SubscribeToEvents) error
- func (c *GrpcGateway_SubscribeToEventsClient) SendMsg(m interface{}) error
- func (c *GrpcGateway_SubscribeToEventsClient) Trailer() metadata.MD
- type ObserveOption
- type OnboardOption
- type Operations
- type ResourceContentChangedHandler
- type ResourceCreatePendingHandler
- type ResourceCreatedHandler
- type ResourceDeletePendingHandler
- type ResourceDeletedHandler
- type ResourceIDCallback
- type ResourceInterfaceOption
- type ResourcePublishedHandler
- type ResourceRetrievePendingHandler
- type ResourceRetrievedHandler
- type ResourceSubscription
- type ResourceTypesOption
- type ResourceUnpublishedHandler
- type ResourceUpdatePendingHandler
- type ResourceUpdatedHandler
- type RetryFunc
- type SendEventFunc
- type SkipShadowOption
- type Sub
- type Subcription
- type SubscriptionHandler
- type UpdateOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContentTypeToMediaType ¶
Types ¶
type ApplicationCallback ¶
type ApplicationCallback interface {
GetRootCertificateAuthorities() ([]*x509.Certificate, error)
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for interacting with the client.
func New ¶
func New(client pb.GrpcGatewayClient) *Client
NewClient constructs a new client client. For every call there is expected jwt token for grpc stored in context.
func NewFromConfig ¶
NewFromConfig constructs a new client client. For every call there is expected jwt token for grpc stored in context.
func (*Client) CreateResource ¶
func (c *Client) CreateResource( ctx context.Context, deviceID string, href string, request interface{}, response interface{}, opts ...CreateOption, ) error
CreateResource requests creation of a new resource on a collection resource on a device.
func (*Client) DeleteResource ¶
func (c *Client) DeleteResource( ctx context.Context, deviceID string, href string, response interface{}, opts ...DeleteOption, ) error
DeleteResource invokes DELETE command within the resource aggregate, which transparently forwards the request to the device.
func (*Client) FactoryReset ¶
FactoryReset makes factory reset on device. JWT token must be stored in context for grpc call.
func (*Client) GetDevices ¶
func (c *Client) GetDevices( ctx context.Context, opts ...GetDevicesOption, ) (map[string]*DeviceDetails, error)
GetDevices retrieves device details from the client.
func (*Client) GetDevicesIterator ¶
func (c *Client) GetDevicesIterator(ctx context.Context, deviceIDs []string, resourceTypes ...string) *kitNetGrpc.Iterator
GetDevicesIterator gets devices. JWT token must be stored in context for grpc call. Next queries the next resource value. Returns false when failed or having no more items. Check it.Err for errors. Usage:
for { var v MyStruct if !it.Next(ctx, &v) { break } } if it.Err != nil { }
func (*Client) GetDevicesViaCallback ¶
func (c *Client) GetDevicesViaCallback(ctx context.Context, deviceIDs, resourceTypes []string, callback func(*pb.Device)) error
GetDevicesViaCallback returns devices. JWT token must be stored in context for grpc call.
func (*Client) GetResource ¶
func (c *Client) GetResource( ctx context.Context, deviceID string, href string, response interface{}, opts ...GetOption, ) error
GetResourceWithCodec retrieves content of a resource from the client.
func (*Client) GetResourceLinksIterator ¶
func (c *Client) GetResourceLinksIterator(ctx context.Context, deviceIDs []string, resourceTypes ...string) *kitNetGrpc.Iterator
GetResourceLinksIterator gets devices. JWT token must be stored in context for grpc call. Next queries the next resource value. Returns false when failed or having no more items. Check it.Err for errors. Usage:
for { var v MyStruct if !it.Next(ctx, &v) { break } } if it.Err != nil { }
func (*Client) GetResourceLinksViaCallback ¶
func (c *Client) GetResourceLinksViaCallback(ctx context.Context, deviceIDs, resourceTypes []string, callback func(*events.ResourceLinksPublished)) error
GetResourceLinksViaCallback returns resource links of devices. JWT token must be stored in context for grpc call.
func (*Client) GetResourcesByResourceIDs ¶
func (c *Client) GetResourcesByResourceIDs( ctx context.Context, resourceIDsCallbacks ...ResourceIDCallback, ) error
GetResourcesByResourceIDs gets resources contents by resourceIDs. JWT token must be stored in context for grpc call.
func (*Client) GetResourcesIterator ¶
func (c *Client) GetResourcesIterator(ctx context.Context, resourceIDs []string, deviceIDs []string, resourceTypes ...string) *kitNetGrpc.Iterator
GetResourcesIterator gets resources contents from resource shadow (cache of backend). JWT token must be stored in context for grpc call. By resourceIDs you can specify resources by deviceID and Href which will be retrieved from the backend, nil means all resources. Or by deviceIDs or resourceTypes you can filter output when you get all resources. Eg:
get all resources it := client.GetResourcesIterator(ctx, nil, nil) get all oic.wk.d resources iter := client.GetResourcesIterator(ctx, nil, nil, "oic.wk.d") get oic.wk.d resources of 2 devices iter := client.GetResourcesIterator(ctx, nil, string["60f6869d-343a-4989-7462-81ef215d31af", "07ef9eb6-1ce9-4ce4-73a6-9ee0a1d534d2"], "oic.wk.d") get a certain resource /oic/p of the device"60f6869d-343a-4989-7462-81ef215d31af" iter := client.GetResourcesIterator(ctx, commands.NewResourceID("60f6869d-343a-4989-7462-81ef215d31af", /oic/p), nil)
Next queries the next resource value. Returns false when failed or having no more items. Check it.Err for errors. Usage:
for { var v MyStruct if !it.Next(ctx, &v) { break } } if it.Err != nil { }
func (*Client) GrpcGatewayClient ¶
func (c *Client) GrpcGatewayClient() pb.GrpcGatewayClient
func (*Client) NewDeviceSubscription ¶
func (c *Client) NewDeviceSubscription(ctx context.Context, deviceID string, handle SubscriptionHandler) (*DeviceSubscription, error)
NewDeviceSubscription creates new devices subscriptions to listen events: resource published, resource unpublished. JWT token must be stored in context for grpc call.
func (*Client) NewDevicesSubscription ¶
func (c *Client) NewDevicesSubscription(ctx context.Context, handle SubscriptionHandler) (*DevicesSubscription, error)
NewDevicesSubscription creates new devices subscriptions to listen events: device online, device offline, device registered, device unregistered. JWT token must be stored in context for grpc call.
func (*Client) NewResourceSubscription ¶
func (c *Client) NewResourceSubscription(ctx context.Context, resourceID *commands.ResourceId, handle SubscriptionHandler) (*ResourceSubscription, error)
NewResourceSubscription creates new resource content changed subscription. JWT token must be stored in context for grpc call.
func (*Client) ObserveDeviceResources ¶
func (*Client) ObserveDevices ¶
func (*Client) ObserveResource ¶
func (c *Client) ObserveResource( ctx context.Context, deviceID string, href string, handler core.ObservationHandler, opts ...ObserveOption, ) (observationID string, _ error)
func (*Client) Reboot ¶
Reboot makes reboot on device. JWT token must be stored in context for grpc call.
func (*Client) StopObservingDevices ¶
func (*Client) StopObservingResource ¶
func (*Client) SubscribeToEventsWithCurrentState ¶
func (c *Client) SubscribeToEventsWithCurrentState(ctx context.Context, deduplicateExpiration time.Duration, opts ...grpc.CallOption) (pb.GrpcGateway_SubscribeToEventsClient, error)
SubscribeToEventsWithCurrentState creates subscribe to events with included the current state. It can provide duplicity events when lots of events are in the batch. The deduplicate is driven by deduplicateExpiration argument. Subscription doesn't guarantee that all events will be sent to the client. The client is responsible for synchronizing events.
func (*Client) UpdateResource ¶
func (c *Client) UpdateResource( ctx context.Context, deviceID string, href string, request interface{}, response interface{}, opts ...UpdateOption, ) error
UpdateResource updates content in OCF-CBOR format.
type Codec ¶
type Codec = interface { ContentFormat() message.MediaType Encode(v interface{}) ([]byte, error) Decode(m *message.Message, v interface{}) error }
Codec encodes/decodes according to the CoAP content format/media type.
type CodecOption ¶
type CodecOption struct {
// contains filtered or unexported fields
}
func WithCodec ¶
func WithCodec(codec Codec) CodecOption
type CreateOption ¶
type CreateOption = interface {
// contains filtered or unexported methods
}
CreateOption option definition.
type DeleteOption ¶
type DeleteOption = interface {
// contains filtered or unexported methods
}
DeleteOption option definition.
type DeviceDetails ¶
type DeviceDetails struct { // ID of the device ID string // Device basic content(oic.wk.d) of /oic/d resource. Device *pb.Device // Resources list of the device resources. Resources []*commands.Resource }
DeviceDetails describes a device.
type DeviceIDsOption ¶
type DeviceIDsOption struct {
// contains filtered or unexported fields
}
func WithDeviceIDs ¶
func WithDeviceIDs(deviceIDs ...string) DeviceIDsOption
type DeviceMetadataUpdatedHandler ¶
type DeviceMetadataUpdatedHandler = interface {
HandleDeviceMetadataUpdated(ctx context.Context, val *events.DeviceMetadataUpdated) error
}
DeviceMetadataUpdatedHandler handler of events.
type DeviceRegisteredHandler ¶
type DeviceRegisteredHandler = interface {
HandleDeviceRegistered(ctx context.Context, val *pb.Event_DeviceRegistered) error
}
DeviceRegisteredHandler handler of events.
type DeviceSubscriber ¶
type DeviceSubscriber struct {
// contains filtered or unexported fields
}
func NewDeviceSubscriber ¶
func NewDeviceSubscriber(getContext func() (context.Context, context.CancelFunc), owner, deviceID string, factoryRetry func() RetryFunc, rdClient pbGRPC.GrpcGatewayClient, resourceSubscriber *subscriber.Subscriber, tracerProvider trace.TracerProvider) (*DeviceSubscriber, error)
func (*DeviceSubscriber) Close ¶
func (s *DeviceSubscriber) Close() (err error)
func (*DeviceSubscriber) SubscribeToPendingCommands ¶
func (s *DeviceSubscriber) SubscribeToPendingCommands(ctx context.Context, h *DeviceSubscriptionHandlers)
type DeviceSubscription ¶
type DeviceSubscription struct {
// contains filtered or unexported fields
}
DeviceSubscription subscription.
func NewDeviceSubscription ¶
func NewDeviceSubscription(ctx context.Context, deviceID string, closeErrorHandler SubscriptionHandler, handle interface{}, gwClient pb.GrpcGatewayClient) (*DeviceSubscription, error)
NewDeviceSubscription creates new devices subscriptions to listen events: resource published, resource unpublished. JWT token must be stored in context for grpc call.
func (*DeviceSubscription) Cancel ¶
func (s *DeviceSubscription) Cancel() (wait func(), err error)
Cancel cancels subscription.
func (*DeviceSubscription) ID ¶
func (s *DeviceSubscription) ID() string
ID returns subscription id.
type DeviceSubscriptionHandlers ¶
type DeviceSubscriptionHandlers struct {
// contains filtered or unexported fields
}
func NewDeviceSubscriptionHandlers ¶
func NewDeviceSubscriptionHandlers(operations Operations) *DeviceSubscriptionHandlers
func (*DeviceSubscriptionHandlers) HandleDeviceMetadataUpdatePending ¶
func (h *DeviceSubscriptionHandlers) HandleDeviceMetadataUpdatePending(ctx context.Context, val *events.DeviceMetadataUpdatePending, fromDB bool) error
func (*DeviceSubscriptionHandlers) HandleResourceCreatePending ¶
func (h *DeviceSubscriptionHandlers) HandleResourceCreatePending(ctx context.Context, val *events.ResourceCreatePending, fromDB bool) error
func (*DeviceSubscriptionHandlers) HandleResourceDeletePending ¶
func (h *DeviceSubscriptionHandlers) HandleResourceDeletePending(ctx context.Context, val *events.ResourceDeletePending, fromDB bool) error
func (*DeviceSubscriptionHandlers) HandleResourceRetrievePending ¶
func (h *DeviceSubscriptionHandlers) HandleResourceRetrievePending(ctx context.Context, val *events.ResourceRetrievePending, fromDB bool) error
func (*DeviceSubscriptionHandlers) HandleResourceUpdatePending ¶
func (h *DeviceSubscriptionHandlers) HandleResourceUpdatePending(ctx context.Context, val *events.ResourceUpdatePending, fromDB bool) error
type DeviceSubscriptions ¶
type DeviceSubscriptions struct {
// contains filtered or unexported fields
}
func NewDeviceSubscriptions ¶
func NewDeviceSubscriptions(ctx context.Context, gwClient pb.GrpcGatewayClient, errFunc func(err error)) (*DeviceSubscriptions, error)
func (*DeviceSubscriptions) Cancel ¶
func (s *DeviceSubscriptions) Cancel() (wait func(), err error)
Cancel cancels subscription.
func (*DeviceSubscriptions) Subscribe ¶
func (s *DeviceSubscriptions) Subscribe(ctx context.Context, deviceID string, closeErrorHandler SubscriptionHandler, handle interface{}) (*Subcription, error)
type DeviceUnregisteredHandler ¶
type DeviceUnregisteredHandler = interface {
HandleDeviceUnregistered(ctx context.Context, val *pb.Event_DeviceUnregistered) error
}
DeviceUnregisteredHandler handler of events.
type DevicesObservationEvent ¶
type DevicesObservationEvent struct { DeviceIDs []string Event DevicesObservationEvent_type }
type DevicesObservationEvent_type ¶
type DevicesObservationEvent_type uint8
const ( DevicesObservationEvent_ONLINE DevicesObservationEvent_type = 0 DevicesObservationEvent_OFFLINE DevicesObservationEvent_type = 1 DevicesObservationEvent_REGISTERED DevicesObservationEvent_type = 2 DevicesObservationEvent_UNREGISTERED DevicesObservationEvent_type = 3 )
type DevicesObservationHandler ¶
type DevicesObservationHandler = interface { Handle(ctx context.Context, event DevicesObservationEvent) error OnClose() Error(err error) }
type DevicesSubscription ¶
type DevicesSubscription struct {
// contains filtered or unexported fields
}
DevicesSubscription subscription.
func NewDevicesSubscription ¶
func NewDevicesSubscription(ctx context.Context, closeErrorHandler SubscriptionHandler, handle interface{}, gwClient pb.GrpcGatewayClient) (*DevicesSubscription, error)
NewDevicesSubscription creates new devices subscriptions to listen events: device online, device offline, device registered, device unregistered. JWT token must be stored in context for grpc call.
func (*DevicesSubscription) Cancel ¶
func (s *DevicesSubscription) Cancel() (wait func(), err error)
Cancel cancels subscription.
func (*DevicesSubscription) ID ¶
func (s *DevicesSubscription) ID() string
ID returns subscription id.
type GeneralMessageCodec ¶
type GeneralMessageCodec struct{}
GeneralMessageCodec encodes in application/vnd.ocf+cbor and decodes json/coap/text.
func (GeneralMessageCodec) ContentFormat ¶
func (GeneralMessageCodec) ContentFormat() message.MediaType
ContentFormat used for encoding.
func (GeneralMessageCodec) Decode ¶
func (GeneralMessageCodec) Decode(m *message.Message, v interface{}) error
Decode the CBOR payload of a COAP message.
func (GeneralMessageCodec) Encode ¶
func (GeneralMessageCodec) Encode(v interface{}) ([]byte, error)
Encode encodes v and returns bytes.
type GetDevicesOption ¶
type GetDevicesOption = interface {
// contains filtered or unexported methods
}
UpdateOption option definition.
type GetOption ¶
type GetOption = interface {
// contains filtered or unexported methods
}
GetOption option definition.
type GrpcGateway_SubscribeToEventsClient ¶
type GrpcGateway_SubscribeToEventsClient struct {
// contains filtered or unexported fields
}
func (*GrpcGateway_SubscribeToEventsClient) CloseSend ¶
func (c *GrpcGateway_SubscribeToEventsClient) CloseSend() error
CloseSend closes the send direction of the stream. It closes the stream when non-nil error is met. It is also not safe to call CloseSend concurrently with SendMsg.
func (*GrpcGateway_SubscribeToEventsClient) Context ¶
func (c *GrpcGateway_SubscribeToEventsClient) Context() context.Context
Context returns the context for this stream.
It should not be called until after Header or RecvMsg has returned. Once called, subsequent client-side retries are disabled.
func (*GrpcGateway_SubscribeToEventsClient) Header ¶
func (c *GrpcGateway_SubscribeToEventsClient) Header() (metadata.MD, error)
Header returns the header metadata received from the server if there is any. It blocks if the metadata is not ready to read.
func (*GrpcGateway_SubscribeToEventsClient) Recv ¶
func (c *GrpcGateway_SubscribeToEventsClient) Recv() (*pb.Event, error)
func (*GrpcGateway_SubscribeToEventsClient) RecvMsg ¶
func (c *GrpcGateway_SubscribeToEventsClient) RecvMsg(m interface{}) error
RecvMsg blocks until it receives a message into m or the stream is done. It returns io.EOF when the stream completes successfully. On any other error, the stream is aborted and the error contains the RPC status.
It is safe to have a goroutine calling SendMsg and another goroutine calling RecvMsg on the same stream at the same time, but it is not safe to call RecvMsg on the same stream in different goroutines.
When new devices appear, it retrieves all current state of filtered events. And for that, duplication of an event can occur.
func (*GrpcGateway_SubscribeToEventsClient) Send ¶
func (c *GrpcGateway_SubscribeToEventsClient) Send(m *pb.SubscribeToEvents) error
func (*GrpcGateway_SubscribeToEventsClient) SendMsg ¶
func (c *GrpcGateway_SubscribeToEventsClient) SendMsg(m interface{}) error
SendMsg is generally called by generated code. On error, SendMsg aborts the stream. If the error was generated by the client, the status is returned directly; otherwise, io.EOF is returned and the status of the stream may be discovered using RecvMsg.
SendMsg blocks until:
- There is sufficient flow control to schedule m with the transport, or
- The stream is done, or
- The stream breaks.
SendMsg does not wait until the message is received by the server. An untimely stream closure may result in lost messages. To ensure delivery, users should ensure the RPC completed successfully using RecvMsg.
It is safe to have a goroutine calling SendMsg and another goroutine calling RecvMsg on the same stream at the same time, but it is not safe to call SendMsg on the same stream in different goroutines. It is also not safe to call CloseSend concurrently with SendMsg.
func (*GrpcGateway_SubscribeToEventsClient) Trailer ¶
func (c *GrpcGateway_SubscribeToEventsClient) Trailer() metadata.MD
Trailer returns the trailer metadata from the server, if there is any. It must only be called after stream.CloseAndRecv has returned, or stream.Recv has returned a non-nil error (including io.EOF).
type ObserveOption ¶
type ObserveOption = interface {
// contains filtered or unexported methods
}
ObserveOption option definition.
type OnboardOption ¶
type OnboardOption = func() interface{}
type Operations ¶
type Operations interface { RetrieveResource(ctx context.Context, event *events.ResourceRetrievePending) error UpdateResource(ctx context.Context, event *events.ResourceUpdatePending) error DeleteResource(ctx context.Context, event *events.ResourceDeletePending) error CreateResource(ctx context.Context, event *events.ResourceCreatePending) error UpdateDeviceMetadata(ctx context.Context, event *events.DeviceMetadataUpdatePending) error // Fatal error occurred during reconnection to the server. Client shall call DeviceSubscriber.Close(). OnDeviceSubscriberReconnectError(err error) }
type ResourceContentChangedHandler ¶
type ResourceContentChangedHandler = interface {
HandleResourceContentChanged(ctx context.Context, val *events.ResourceChanged) error
}
ResourceContentChangedHandler handler of events.
type ResourceCreatePendingHandler ¶
type ResourceCreatePendingHandler = interface {
HandleResourceCreatePending(ctx context.Context, val *events.ResourceCreatePending) error
}
ResourceCreatePendingHandler handler of events
type ResourceCreatedHandler ¶
type ResourceCreatedHandler = interface {
HandleResourceCreated(ctx context.Context, val *events.ResourceCreated) error
}
ResourceCreatedHandler handler of events
type ResourceDeletePendingHandler ¶
type ResourceDeletePendingHandler = interface {
HandleResourceDeletePending(ctx context.Context, val *events.ResourceDeletePending) error
}
ResourceDeletePendingHandler handler of events
type ResourceDeletedHandler ¶
type ResourceDeletedHandler = interface {
HandleResourceDeleted(ctx context.Context, val *events.ResourceDeleted) error
}
ResourceDeletedHandler handler of events
type ResourceIDCallback ¶
type ResourceIDCallback struct { ResourceID *commands.ResourceId Callback func(*pb.Resource) }
func MakeResourceIDCallback ¶
func MakeResourceIDCallback(deviceID, href string, callback func(*pb.Resource)) ResourceIDCallback
type ResourceInterfaceOption ¶
type ResourceInterfaceOption struct {
// contains filtered or unexported fields
}
func WithInterface ¶
func WithInterface(resourceInterface string) ResourceInterfaceOption
WithInterface updates/gets resource with interface directly from a device.
type ResourcePublishedHandler ¶
type ResourcePublishedHandler = interface {
HandleResourcePublished(ctx context.Context, val *events.ResourceLinksPublished) error
}
ResourcePublishedHandler handler of events.
type ResourceRetrievePendingHandler ¶
type ResourceRetrievePendingHandler = interface {
HandleResourceRetrievePending(ctx context.Context, val *events.ResourceRetrievePending) error
}
ResourceRetrievePendingHandler handler of events
type ResourceRetrievedHandler ¶
type ResourceRetrievedHandler = interface {
HandleResourceRetrieved(ctx context.Context, val *events.ResourceRetrieved) error
}
ResourceRetrievedHandler handler of events
type ResourceSubscription ¶
type ResourceSubscription struct {
// contains filtered or unexported fields
}
ResourceSubscription subscription.
func NewResourceSubscription ¶
func NewResourceSubscription(ctx context.Context, resourceID *commands.ResourceId, closeErrorHandler SubscriptionHandler, handle interface{}, gwClient pb.GrpcGatewayClient) (*ResourceSubscription, error)
NewResourceSubscription creates new resource content changed subscription. JWT token must be stored in context for grpc call.
func ToResourceSubscription ¶
func ToResourceSubscription(v interface{}, ok bool) (*ResourceSubscription, bool)
func (*ResourceSubscription) Cancel ¶
func (s *ResourceSubscription) Cancel() (wait func(), err error)
Cancel cancels subscription.
func (*ResourceSubscription) ID ¶
func (s *ResourceSubscription) ID() string
ID returns subscription id.
type ResourceTypesOption ¶
type ResourceTypesOption struct {
// contains filtered or unexported fields
}
func WithResourceTypes ¶
func WithResourceTypes(resourceTypes ...string) ResourceTypesOption
type ResourceUnpublishedHandler ¶
type ResourceUnpublishedHandler = interface {
HandleResourceUnpublished(ctx context.Context, val *events.ResourceLinksUnpublished) error
}
ResourceUnpublishedHandler handler of events.
type ResourceUpdatePendingHandler ¶
type ResourceUpdatePendingHandler = interface {
HandleResourceUpdatePending(ctx context.Context, val *events.ResourceUpdatePending) error
}
ResourceUpdatePendingHandler handler of events
type ResourceUpdatedHandler ¶
type ResourceUpdatedHandler = interface {
HandleResourceUpdated(ctx context.Context, val *events.ResourceUpdated) error
}
ResourceUpdatedHandler handler of events
type SendEventFunc ¶
type SkipShadowOption ¶
type SkipShadowOption struct{}
func WithSkipShadow ¶
func WithSkipShadow() SkipShadowOption
WithSkipShadow gets resource directly from a device without using interface for client client.
type Sub ¶
type Sub struct {
// contains filtered or unexported fields
}
func NewSub ¶
func NewSub(ctx context.Context, grpcClient pb.GrpcGatewayClient, send SendEventFunc, correlationID string, expiration time.Duration, req *pb.SubscribeToEvents_CreateSubscription) *Sub
func (*Sub) DropDeduplicateEvents ¶
func (s *Sub) DropDeduplicateEvents()
func (*Sub) SetContext ¶
type Subcription ¶
type Subcription struct {
// contains filtered or unexported fields
}
func (*Subcription) ID ¶
func (s *Subcription) ID() string
type SubscriptionHandler ¶
type SubscriptionHandler = interface { OnClose() Error(err error) }
SubscriptionHandler handler of events.
type UpdateOption ¶
type UpdateOption = interface {
// contains filtered or unexported methods
}
UpdateOption option definition.
Source Files ¶
- client.go
- createResource.go
- decodeWithCodec.go
- deleteResource.go
- deviceSubscriber.go
- deviceSubscription.go
- deviceSubscriptions.go
- devicesSubscription.go
- generalMessageCodec.go
- getDevice.go
- getDevices.go
- getResource.go
- getResourceFromDevice.go
- maintenance.go
- observeDeviceResources.go
- observeDevices.go
- observeResource.go
- options.go
- resourceSubscription.go
- subscribeToEventsWithCurrentState.go
- subscription.go
- updateResource.go