Documentation
¶
Index ¶
- Variables
- func AppendGetAlexaEn(data *DataToDevice, alexaEnabled bool)
- func AppendGetGVAEn(data *DataToDevice, gvaEnabled bool)
- func AppendGetSTEn(data *DataToDevice, stEnabled bool)
- func AppendGetSchedDetails(ctx context.Context, data *DataToDevice, scheduleData map[string]interface{}, ...)
- func AppendGetSchedVer(data *DataToDevice, version *int64)
- func AppendGetServerConfig(data *DataToDevice, outputs map[string]interface{})
- func AppendGetTimeSync(data *DataToDevice)
- func AppendGetTriggerDetails(ctx context.Context, data *DataToDevice, triggerData map[string]interface{}, ...)
- func AppendGetTriggerVer(data *DataToDevice, version *int64)
- func CleanupNodeFromGroupAsync(ctx *rmngctx.RmngContext, nodeIDs []string, oldGroupID string)
- func CreateAdminGroupIfNotExists(ctx context.Context, groupNames []string, parentGroupName string) error
- func DeviceParamsFromShadow(shadow ReportedOrDesiredShadow, deviceName string) map[string]interface{}
- func EmitGroupMembershipChangeAsync(ctx *rmngctx.RmngContext, nodeID, groupID string, subGroupIDs []string, ...)
- func GetGroupIDFromShadowName(shadowName string) (string, []string, error)
- func GetNodeIdFromCert(cert *x509.Certificate) string
- func GetShadowNameForNodeGroups(groups group_node_db.NodesGroups) string
- func HandleGetAlexaEn(ctx context.Context, n *Node, responseData *DataToDevice) error
- func HandleGetAlexaEnWithNodeDetails(ctx context.Context, n *Node, responseData *DataToDevice, ...) error
- func HandleGetGVAEnWithNodeDetails(ctx context.Context, n *Node, responseData *DataToDevice, ...) error
- func HandleGetSTEnWithNodeDetails(ctx context.Context, n *Node, responseData *DataToDevice, ...) error
- func HandleGetSchedDetails(ctx context.Context, n *Node, responseData *DataToDevice) error
- func HandleGetSchedDetailsWithNodeDetails(ctx context.Context, n *Node, responseData *DataToDevice, ...) error
- func HandleGetSchedVer(ctx context.Context, n *Node, responseData *DataToDevice) error
- func HandleGetSchedVerWithNodeDetails(ctx context.Context, n *Node, responseData *DataToDevice, ...) error
- func HandleGetServerConfig(ctx context.Context, n *Node, responseData *DataToDevice) error
- func HandleGetTriggerDetails(ctx context.Context, n *Node, responseData *DataToDevice) error
- func HandleGetTriggerDetailsWithNodeDetails(ctx context.Context, n *Node, responseData *DataToDevice, ...) error
- func HandleGetTriggerVer(ctx context.Context, n *Node, responseData *DataToDevice) error
- func HandleGetTriggerVerWithNodeDetails(ctx context.Context, n *Node, responseData *DataToDevice, ...) error
- func RegisterNodeInRmng(rmngCtx *rmngctx.RmngContext, cert string, caCert string, ...) (string, error)
- func SessionMatches(current nodes_online_db.NodesOnlineEntry, event PresenceEvent) bool
- func ShadowNodeAddToGroup(ctx *rmngctx.RmngContext, nodeID, groupID string, capabilities []string) error
- func ShadowNodeAddToGroupAuthorized(ctx *rmngctx.RmngContext, nodeID, groupID string, capabilities []string) (group_node_db.NodesGroups, error)
- func ShadowNodeRemoveFromGroup(ctx *rmngctx.RmngContext, nodeID, groupID string) error
- func ShadowNodeRemoveFromGroupAuthorized(ctx *rmngctx.RmngContext, nodeID, groupID string) error
- func ShadowNodeRemoveFromGroupAuthorizedBulk(ctx *rmngctx.RmngContext, nodeIDs []string, groupID string, ...)
- func ShadowNodeUpdateSubGroup(ctx *rmngctx.RmngContext, nodeID, groupID, subGroupID string, ...) error
- func ShadowOnline(shadow ReportedOrDesiredShadow) bool
- func UpdateNodeInRmng(rmngCtx *rmngctx.RmngContext, nodeID string, newCertPEM string, ...) error
- func ValidateCAAndGetNodeId(nodeCert string, caCert string) (string, error)
- type Data
- type DataToDevice
- type DisconnectInfo
- type IoTNodeShadow
- type Metadata
- type Node
- func (n *Node) AddTags(rmngCtx *rmngctx.RmngContext, tags []string, tagsType TagType) error
- func (n *Node) AddToAdminGroups(rmngCtx *rmngctx.RmngContext, groupNames []string) error
- func (n *Node) ClearUserTags(rmngCtx *rmngctx.RmngContext) error
- func (n *Node) CopyShadow(rmngCtx *rmngctx.RmngContext, oldShadowName, newShadowName string) error
- func (n *Node) DeleteShadow(rmngCtx *rmngctx.RmngContext, oldGroups group_node_db.NodesGroups) error
- func (n *Node) GetAlexaEnStatus(ctx context.Context) (*bool, error)
- func (n *Node) GetGVAEnStatus(ctx context.Context) (*bool, error)
- func (n *Node) GetID() string
- func (n *Node) GetNodesGroups(rmngCtx *rmngctx.RmngContext) (group_node_db.NodesGroups, error)
- func (n *Node) GetParams(ctx *rmngctx.RmngContext, deviceName string) (map[string]interface{}, error)
- func (n *Node) GetPermissions() *rbac.EntityPermissions
- func (n *Node) GetSTEnStatus(ctx context.Context) (*bool, error)
- func (n *Node) HandleGetGroupInfo(ctx context.Context, response *DataToDevice) error
- func (n *Node) HandleSetNodeConfig(ctx context.Context, nodeConfig map[string]interface{}, response *DataToDevice) error
- func (n *Node) LoadCertificates(ctx context.Context) error
- func (n *Node) MoveShadow(rmngCtx *rmngctx.RmngContext, oldGroup, newGroup group_node_db.NodesGroups) error
- func (n *Node) MoveShadowFrom(rmngCtx *rmngctx.RmngContext, oldGroup group_node_db.NodesGroups) error
- func (n *Node) NotifyCleanupGroupAddSync(rmngCtx *rmngctx.RmngContext, oldGroups group_node_db.NodesGroups, ...) error
- func (n *Node) NotifyCleaupNodeFromGroupSync(rmngCtx *rmngctx.RmngContext, oldGroups group_node_db.NodesGroups) error
- func (n *Node) NotifySubGroupUpdate(rmngCtx *rmngctx.RmngContext, oldGroups group_node_db.NodesGroups, ...) error
- func (n *Node) PublishToDevice(rmngCtx *rmngctx.RmngContext, topic string, data map[string]interface{}) error
- func (n *Node) PublishToDeviceDesired(rmngCtx *rmngctx.RmngContext, data map[string]interface{}) error
- func (n *Node) PublishToDeviceFromCloud(rmngCtx *rmngctx.RmngContext, data map[string]interface{}) error
- func (n *Node) ReadFromDesiredShadow(rmngCtx *rmngctx.RmngContext) (ReportedOrDesiredShadow, error)
- func (n *Node) ReadFromIndexedReportedShadow(rmngCtx *rmngctx.RmngContext) (ReportedOrDesiredShadow, error)
- func (n *Node) ReadFromReportedShadow(rmngCtx *rmngctx.RmngContext) (ReportedOrDesiredShadow, error)
- func (n *Node) ReadFromShadow(rmngCtx *rmngctx.RmngContext, target string) (ReportedOrDesiredShadow, error)
- func (n *Node) SendAlexaEnabled(ctx context.Context) error
- func (n *Node) SendGVAEnabled(ctx context.Context) error
- func (n *Node) SendGetGroupInfo(ctx context.Context) error
- func (n *Node) SendSTEnabled(ctx context.Context) error
- func (n *Node) SendScheduleDetails(ctx context.Context) error
- func (n *Node) SendTriggerDetails(ctx context.Context) error
- func (n *Node) UpdateAlexaEnabled(ctx context.Context, enabled bool) error
- func (n *Node) UpdateGVAEnabled(ctx context.Context, enabled bool) error
- func (n *Node) UpdateSTEnabled(ctx context.Context, enabled bool) error
- func (n *Node) UpdateTagsMap(rmngCtx *rmngctx.RmngContext, tags map[string]interface{}, tagsType TagType) error
- func (n *Node) VerifySignature(challengeHash []byte, signature []byte) error
- func (n *Node) WriteToDesiredShadow(rmngCtx *rmngctx.RmngContext, data ReportedOrDesiredShadow) error
- func (n *Node) WriteToIndexedReportedShadow(rmngCtx *rmngctx.RmngContext, data ReportedOrDesiredShadow) error
- func (n *Node) WriteToReportedShadow(rmngCtx *rmngctx.RmngContext, data ReportedOrDesiredShadow) error
- func (n *Node) WriteToShadow(rmngCtx *rmngctx.RmngContext, target string, data ReportedOrDesiredShadow) error
- type NodeDataResetEvent
- type PresenceEvent
- type PublishInputEvent
- type ReportedOrDesiredShadow
- type ShadowState
- type TagType
- type TagsObj
Constants ¶
This section is empty.
Variables ¶
var ErrNodeAlreadyRegistered = errors.New("node already registered")
ErrNodeAlreadyRegistered is returned by RegisterNodeInRmng when the node is already registered. Handlers map it to HTTP 409; use UpdateNodeInRmng to modify an existing node.
var ErrNodeNotFound = errors.New("node not found")
ErrNodeNotFound is returned by UpdateNodeInRmng when the target node has no row in node_details. Callers (the bulk update container) record this as a failure with a clean reason rather than treating it as a transport error.
Functions ¶
func AppendGetAlexaEn ¶
func AppendGetAlexaEn(data *DataToDevice, alexaEnabled bool)
AppendGetAlexaEn appends Alexa enabled status to the response
func AppendGetGVAEn ¶
func AppendGetGVAEn(data *DataToDevice, gvaEnabled bool)
AppendGetGVAEn appends GVA enabled status to the response
func AppendGetSTEn ¶
func AppendGetSTEn(data *DataToDevice, stEnabled bool)
AppendGetSTEn appends SmartThings enabled status to the response
func AppendGetSchedDetails ¶
func AppendGetSchedDetails(ctx context.Context, data *DataToDevice, scheduleData map[string]interface{}, version *int64)
AppendGetSchedDetails appends schedule details to the response
func AppendGetSchedVer ¶
func AppendGetSchedVer(data *DataToDevice, version *int64)
AppendGetSchedVer appends schedule version to the response
func AppendGetServerConfig ¶
func AppendGetServerConfig(data *DataToDevice, outputs map[string]interface{})
func AppendGetTimeSync ¶
func AppendGetTimeSync(data *DataToDevice)
AppendGetTimeSync appends the current server time (epoch ms) to the response. Lets devices set their wall clock over the existing MQTT connection instead of waiting for SNTP to converge; accuracy is bounded by delivery latency.
func AppendGetTriggerDetails ¶
func AppendGetTriggerDetails(ctx context.Context, data *DataToDevice, triggerData map[string]interface{}, version *int64)
AppendGetTriggerDetails appends trigger details to the response
func AppendGetTriggerVer ¶
func AppendGetTriggerVer(data *DataToDevice, version *int64)
AppendGetTriggerVer appends trigger version to the response
func CleanupNodeFromGroupAsync ¶
func CleanupNodeFromGroupAsync(ctx *rmngctx.RmngContext, nodeIDs []string, oldGroupID string)
CleanupNodeFromGroupAsync invokes the node_data_reset Lambda for the given nodes' prior group. No-op when the input is empty or there is no prior group (fresh association).
func CreateAdminGroupIfNotExists ¶
func CreateAdminGroupIfNotExists(ctx context.Context, groupNames []string, parentGroupName string) error
CreateAdminGroupIfNotExists creates admin groups if they don't already exist. If parentGroupName is provided, validates hierarchy and creates parent/child as needed. If parentGroupName is empty, groups are created flat (no parent validation).
func DeviceParamsFromShadow ¶
func DeviceParamsFromShadow(shadow ReportedOrDesiredShadow, deviceName string) map[string]interface{}
DeviceParamsFromShadow extracts a single device's params map from a shadow's Params, returning an empty map when absent or malformed so callers can report whatever state they have rather than failing outright.
func EmitGroupMembershipChangeAsync ¶
func EmitGroupMembershipChangeAsync(ctx *rmngctx.RmngContext, nodeID, groupID string, subGroupIDs []string, action string)
EmitGroupMembershipChangeAsync fires a group_membership_change event to the notifications Lambda so voice-assistant channels (Alexa, GVA) can re-discover (added) or drop (removed) the node. Best-effort: any failure is logged, never returned — the caller's primary association has already succeeded. No-op when the identifiers are missing or NOTIFICATIONS_FUNCTION_NAME is not configured.
func GetNodeIdFromCert ¶
func GetNodeIdFromCert(cert *x509.Certificate) string
func GetShadowNameForNodeGroups ¶
func GetShadowNameForNodeGroups(groups group_node_db.NodesGroups) string
GetShadowNameForNodeGroups generates a shadow name based on the node's group and subgroups The format is "params-{groupID}-{subgroup1}-{subgroup2}-..." where subgroups are sorted alphabetically
func HandleGetAlexaEn ¶
func HandleGetAlexaEn(ctx context.Context, n *Node, responseData *DataToDevice) error
HandleGetAlexaEn handles the getAlexaEn event from the device
func HandleGetAlexaEnWithNodeDetails ¶
func HandleGetAlexaEnWithNodeDetails(ctx context.Context, n *Node, responseData *DataToDevice, nodeDetails *node_details_db.NodeDetails) error
HandleGetAlexaEn handles the getAlexaEn event with pre-fetched NodeDetails
func HandleGetGVAEnWithNodeDetails ¶
func HandleGetGVAEnWithNodeDetails(ctx context.Context, n *Node, responseData *DataToDevice, nodeDetails *node_details_db.NodeDetails) error
HandleGetGVAEnWithNodeDetails handles the getGVAEn event with pre-fetched NodeDetails
func HandleGetSTEnWithNodeDetails ¶
func HandleGetSTEnWithNodeDetails(ctx context.Context, n *Node, responseData *DataToDevice, nodeDetails *node_details_db.NodeDetails) error
HandleGetSTEnWithNodeDetails handles the getSTEn event with pre-fetched NodeDetails
func HandleGetSchedDetails ¶
func HandleGetSchedDetails(ctx context.Context, n *Node, responseData *DataToDevice) error
HandleGetSchedDetails handles the getSchedDetails event from the device
func HandleGetSchedDetailsWithNodeDetails ¶
func HandleGetSchedDetailsWithNodeDetails(ctx context.Context, n *Node, responseData *DataToDevice, nodeDetails *node_details_db.NodeDetails) error
HandleGetSchedDetails handles the getSchedDetails event with pre-fetched NodeDetails
func HandleGetSchedVer ¶
func HandleGetSchedVer(ctx context.Context, n *Node, responseData *DataToDevice) error
HandleGetSchedVer handles the getSchedVer event from the device
func HandleGetSchedVerWithNodeDetails ¶
func HandleGetSchedVerWithNodeDetails(ctx context.Context, n *Node, responseData *DataToDevice, nodeDetails *node_details_db.NodeDetails) error
HandleGetSchedVer handles the getSchedVer event with pre-fetched NodeDetails
func HandleGetServerConfig ¶
func HandleGetServerConfig(ctx context.Context, n *Node, responseData *DataToDevice) error
func HandleGetTriggerDetails ¶
func HandleGetTriggerDetails(ctx context.Context, n *Node, responseData *DataToDevice) error
HandleGetTriggerDetails handles the getTriggerDetails event from the device
func HandleGetTriggerDetailsWithNodeDetails ¶
func HandleGetTriggerDetailsWithNodeDetails(ctx context.Context, n *Node, responseData *DataToDevice, nodeDetails *node_details_db.NodeDetails) error
HandleGetTriggerDetailsWithNodeDetails handles the getTriggerDetails event with pre-fetched NodeDetails
func HandleGetTriggerVer ¶
func HandleGetTriggerVer(ctx context.Context, n *Node, responseData *DataToDevice) error
HandleGetTriggerVer handles the getTriggerVer event from the device
func HandleGetTriggerVerWithNodeDetails ¶
func HandleGetTriggerVerWithNodeDetails(ctx context.Context, n *Node, responseData *DataToDevice, nodeDetails *node_details_db.NodeDetails) error
HandleGetTriggerVerWithNodeDetails handles the getTriggerVer event with pre-fetched NodeDetails
func RegisterNodeInRmng ¶
func SessionMatches ¶
func SessionMatches(current nodes_online_db.NodesOnlineEntry, event PresenceEvent) bool
SessionMatches reports whether the stored session entry matches the incoming event. Both fields are checked because MQTT persistent sessions keep the same SessionID across reconnects — only VersionNumber increments.
func ShadowNodeAddToGroup ¶
func ShadowNodeAddToGroup(ctx *rmngctx.RmngContext, nodeID, groupID string, capabilities []string) error
ShadowNodeAddToGroup is the user-flow add. Verifies the caller owns the target group, runs the system-flow add, then fires the node-left-group lifecycle hook if this is a real group change (a downstream handler, if deployed, reacts to it).
func ShadowNodeAddToGroupAuthorized ¶
func ShadowNodeAddToGroupAuthorized(ctx *rmngctx.RmngContext, nodeID, groupID string, capabilities []string) (group_node_db.NodesGroups, error)
ShadowNodeAddToGroupAuthorized runs the full add-to-group side effects: disassoc from any old group, sync notify (group_id Thing attribute, shadow migration, iparams clear, getGroupInfo notify), async per-user data reset, and the Alexa/GVA membership notification. Returns the prior group/subgroups.
func ShadowNodeRemoveFromGroup ¶
func ShadowNodeRemoveFromGroup(ctx *rmngctx.RmngContext, nodeID, groupID string) error
ShadowNodeRemoveFromGroup is the user-flow remove. Verifies the caller owns the source group, runs the system-flow remove, then fires the node-left-group lifecycle hook.
func ShadowNodeRemoveFromGroupAuthorized ¶
func ShadowNodeRemoveFromGroupAuthorized(ctx *rmngctx.RmngContext, nodeID, groupID string) error
ShadowNodeRemoveFromGroupAuthorized runs disassoc + sync notify + async per-user data reset for a single node.
func ShadowNodeRemoveFromGroupAuthorizedBulk ¶
func ShadowNodeRemoveFromGroupAuthorizedBulk( ctx *rmngctx.RmngContext, nodeIDs []string, groupID string, perNode func(nodeID string) error, )
ShadowNodeRemoveFromGroupAuthorizedBulk removes N nodes from the same group in parallel with bounded fan-out. For each node it runs the authorized disassoc + sync notify, then the optional perNode callback for caller-specific extras (e.g. downstream Thing/DDB teardown). After the fan-out completes, issues a single batched node_data_reset for successfully-removed nodes.
An empty groupID is permitted — the per-node disassoc + reset phases are skipped, but the parallel fan-out and perNode callback still run. Supports cleanup flows where the upstream group association is already gone (e.g. a downstream cascade after a parent node has left its group).
Best-effort per node: any error from the disassoc OR the perNode callback is logged and the rest of the fan-out continues. A node whose disassoc failed is omitted from the batched reset.
func ShadowNodeUpdateSubGroup ¶
func ShadowNodeUpdateSubGroup(ctx *rmngctx.RmngContext, nodeID, groupID, subGroupID string, operationType group_node_db.SubGroupOperationType) error
ShadowNodeUpdateSubGroup updates a node's subgroup membership and runs the shadow-side notify. Subgroup changes don't reorganize child nodes, so no lifecycle hook is fired.
func ShadowOnline ¶
func ShadowOnline(shadow ReportedOrDesiredShadow) bool
ShadowOnline reports whether the node is reachable per its reported shadow. A nil Online field (never reported — the node has never completed a connect handshake) defaults to offline; online is reported only once firmware has explicitly published `online=true` on connect.
func UpdateNodeInRmng ¶
func UpdateNodeInRmng(rmngCtx *rmngctx.RmngContext, nodeID string, newCertPEM string, adminGroupNames []string, tags []string, capabilities []string) error
UpdateNodeInRmng applies metadata updates (admin groups, tags) and optionally a cert update to an existing registered node.
newCertPEM == "" means the cert binding is left untouched. When non-empty, the new cert is registered (idempotent — recovers ARN if already registered), attached to the Thing, given the default policy, and any previously-attached certs are detached and deactivated. This is the "operator correction" use case: a wrong PEM was registered and needs to be replaced with the right one. Note: cloud-side only — nothing here pushes the new cert to the device, which is what distinguishes this from key rotation.
Existence is checked against node_details (the project's source of truth for "is this node ours?"); a missing row is reported as ErrNodeNotFound so the caller can record it cleanly.
All operations are idempotent: re-running this for the same nodeID with the same inputs is a no-op — making update-jobs safe to retry by the same failed-nodes-export workflow as registration.
Types ¶
type DataToDevice ¶
DataToDevice is the data to be sent to the device's topic from the cloud
func NewDataToDevice ¶
func NewDataToDevice(node *Node) *DataToDevice
type DisconnectInfo ¶
type IoTNodeShadow ¶
type IoTNodeShadow struct {
State *ShadowState `json:"state,omitempty"`
Metadata *Metadata `json:"metadata,omitempty"`
Version *int `json:"version,omitempty"`
Timestamp *int `json:"timestamp,omitempty"`
}
type Node ¶
type Node struct {
ThingName string
Permissions rbac.EntityPermissions
Certificates []*iot_types.CertificateDescription
GroupID string
SubGroupIDs []string
// contains filtered or unexported fields
}
func (*Node) AddToAdminGroups ¶
func (n *Node) AddToAdminGroups(rmngCtx *rmngctx.RmngContext, groupNames []string) error
AddToAdminGroups adds the node to a thing group
func (*Node) ClearUserTags ¶
func (n *Node) ClearUserTags(rmngCtx *rmngctx.RmngContext) error
ClearUserTags clears user tags from the iparams shadow.
func (*Node) CopyShadow ¶
func (n *Node) CopyShadow(rmngCtx *rmngctx.RmngContext, oldShadowName, newShadowName string) error
func (*Node) DeleteShadow ¶
func (n *Node) DeleteShadow(rmngCtx *rmngctx.RmngContext, oldGroups group_node_db.NodesGroups) error
DeleteShadow deletes the shadow associated with the old group configuration
func (*Node) GetAlexaEnStatus ¶
GetAlexaEnStatus gets the Alexa enabled status for the node
func (*Node) GetGVAEnStatus ¶
GetGVAEnStatus gets the GVA enabled status for the node
func (*Node) GetNodesGroups ¶
func (n *Node) GetNodesGroups(rmngCtx *rmngctx.RmngContext) (group_node_db.NodesGroups, error)
func (*Node) GetParams ¶
func (n *Node) GetParams(ctx *rmngctx.RmngContext, deviceName string) (map[string]interface{}, error)
GetParams retrieves device-specific parameters from the node's shadow data Returns the device parameters as a map, or an empty map if the device is not found
func (*Node) GetPermissions ¶
func (n *Node) GetPermissions() *rbac.EntityPermissions
func (*Node) GetSTEnStatus ¶
GetSTEnStatus gets the SmartThings enabled status for the node
func (*Node) HandleGetGroupInfo ¶
func (n *Node) HandleGetGroupInfo(ctx context.Context, response *DataToDevice) error
HandleGetGroupInfo gets the group info for the node and adds it to the response
func (*Node) HandleSetNodeConfig ¶
func (*Node) MoveShadow ¶
func (n *Node) MoveShadow(rmngCtx *rmngctx.RmngContext, oldGroup, newGroup group_node_db.NodesGroups) error
MoveShadow moves the contents from old shadow name to new shadow name and deletes the old shadow This separate API is maintained for simplification in testing purposes
func (*Node) MoveShadowFrom ¶
func (n *Node) MoveShadowFrom(rmngCtx *rmngctx.RmngContext, oldGroup group_node_db.NodesGroups) error
MoveShadow moves the contents from old shadow name to new shadow name and deletes the old shadow
func (*Node) NotifyCleanupGroupAddSync ¶
func (n *Node) NotifyCleanupGroupAddSync(rmngCtx *rmngctx.RmngContext, oldGroups group_node_db.NodesGroups, groupID string) error
func (*Node) NotifyCleaupNodeFromGroupSync ¶
func (n *Node) NotifyCleaupNodeFromGroupSync(rmngCtx *rmngctx.RmngContext, oldGroups group_node_db.NodesGroups) error
func (*Node) NotifySubGroupUpdate ¶
func (n *Node) NotifySubGroupUpdate(rmngCtx *rmngctx.RmngContext, oldGroups group_node_db.NodesGroups, subGroupID string, operationType group_node_db.SubGroupOperationType) error
func (*Node) PublishToDevice ¶
func (n *Node) PublishToDevice(rmngCtx *rmngctx.RmngContext, topic string, data map[string]interface{}) error
PublishToDevice publishes the data to the device's topic
func (*Node) PublishToDeviceDesired ¶
func (n *Node) PublishToDeviceDesired(rmngCtx *rmngctx.RmngContext, data map[string]interface{}) error
func (*Node) PublishToDeviceFromCloud ¶
func (n *Node) PublishToDeviceFromCloud(rmngCtx *rmngctx.RmngContext, data map[string]interface{}) error
PublishToDeviceFromCloud publishes the data to the device's topic from the cloud
func (*Node) ReadFromDesiredShadow ¶
func (n *Node) ReadFromDesiredShadow(rmngCtx *rmngctx.RmngContext) (ReportedOrDesiredShadow, error)
func (*Node) ReadFromIndexedReportedShadow ¶
func (n *Node) ReadFromIndexedReportedShadow(rmngCtx *rmngctx.RmngContext) (ReportedOrDesiredShadow, error)
ReadFromIndexedReportedShadow reads the 'reported' section of the indexed shadow (iparams)
func (*Node) ReadFromReportedShadow ¶
func (n *Node) ReadFromReportedShadow(rmngCtx *rmngctx.RmngContext) (ReportedOrDesiredShadow, error)
ReadFromReportedShadow reads the data from the 'reported' shadow of the node
func (*Node) ReadFromShadow ¶
func (n *Node) ReadFromShadow(rmngCtx *rmngctx.RmngContext, target string) (ReportedOrDesiredShadow, error)
func (*Node) SendAlexaEnabled ¶
SendAlexaEnabled sends a notification to the device about its Alexa enabled status
func (*Node) SendGVAEnabled ¶
SendGVAEnabled sends a notification to the device about its GVA enabled status
func (*Node) SendGetGroupInfo ¶
SendGetGroupInfo generates the group info for the node and sends it to the device
func (*Node) SendSTEnabled ¶
SendSTEnabled sends a notification to the device about its SmartThings enabled status
func (*Node) SendScheduleDetails ¶
SendScheduleDetails sends the schedule details to the device
func (*Node) SendTriggerDetails ¶
SendTriggerDetails sends the trigger details to the device
func (*Node) UpdateAlexaEnabled ¶
UpdateAlexaEnabled updates the Alexa enabled status for the node
func (*Node) UpdateGVAEnabled ¶
UpdateGVAEnabled updates the GVA enabled status for the node
func (*Node) UpdateSTEnabled ¶
UpdateSTEnabled updates the SmartThings enabled status for the node
func (*Node) UpdateTagsMap ¶
func (n *Node) UpdateTagsMap(rmngCtx *rmngctx.RmngContext, tags map[string]interface{}, tagsType TagType) error
UpdateTagsMap writes tags from a map to the indexed shadow. Values can be strings or nil (to delete).
func (*Node) VerifySignature ¶
func (*Node) WriteToDesiredShadow ¶
func (n *Node) WriteToDesiredShadow(rmngCtx *rmngctx.RmngContext, data ReportedOrDesiredShadow) error
We never actually write to the desired shadow. This API is just for completeness. Please use PublishToDeviceDesired() instead
func (*Node) WriteToIndexedReportedShadow ¶
func (n *Node) WriteToIndexedReportedShadow(rmngCtx *rmngctx.RmngContext, data ReportedOrDesiredShadow) error
WriteToIndexedReportedShadow writes the data to the 'reported' indexed shadow of the node
func (*Node) WriteToReportedShadow ¶
func (n *Node) WriteToReportedShadow(rmngCtx *rmngctx.RmngContext, data ReportedOrDesiredShadow) error
func (*Node) WriteToShadow ¶
func (n *Node) WriteToShadow(rmngCtx *rmngctx.RmngContext, target string, data ReportedOrDesiredShadow) error
type NodeDataResetEvent ¶
type NodeDataResetEvent struct {
NodeIDs []string `json:"node_ids"`
OldGroupID string `json:"old_group_id"`
// GroupDelete marks the group-wide wipe fired by group
GroupDelete bool `json:"group_delete"`
}
NodeDataResetEvent is the payload for the async per-user data reset Lambda (triggers, schedules, timeseries, automations).
type PresenceEvent ¶
type PresenceEvent struct {
ClientID string `json:"clientId"`
ThingName string `json:"thingName,omitempty"`
EventType string `json:"eventType"`
Timestamp int64 `json:"timestamp"`
SessionID string `json:"sessionIdentifier"`
PrincipalID string `json:"principalIdentifier"`
IPAddress string `json:"ipAddress"`
VersionNumber int `json:"versionNumber"`
ClientInitiatedDisconnect bool `json:"clientInitiatedDisconnect,omitempty"`
DisconnectReason string `json:"disconnectReason,omitempty"`
}
External contract — json tags must remain camelCase to match the AWS IoT Lifecycle Events payload.
type PublishInputEvent ¶
type PublishInputEvent struct {
ThingName string `json:"thing_name"`
Data map[string]interface{} `json:"data"`
}
PublishInputEvent is the wire shape produced by IoT topic rules with the projection `SELECT topic(3) as thing_name, * as data FROM ...`. Produced by the core `node_to_cloud_rule` → publish_input_event_handler (filter `rainmaker/nodes/+/to_cloud`), and reusable by any optional rule that keeps the same SELECT projection so this struct can decode its input too.
type ReportedOrDesiredShadow ¶
type ReportedOrDesiredShadow struct {
Data *Data `json:"data,omitempty"`
Online *bool `json:"online,omitempty"`
DisconnectInfo *DisconnectInfo `json:"disconnect_info,omitempty"`
Params map[string]interface{} `json:"params,omitempty"`
}
func BuildDisconnectShadow ¶
func BuildDisconnectShadow(event PresenceEvent) ReportedOrDesiredShadow
BuildDisconnectShadow constructs the reported shadow payload for a node that has gone offline, including disconnect metadata when present.
func ComputeJSONDeltaMap ¶
func ComputeJSONDeltaMap(old, new ReportedOrDesiredShadow) (ReportedOrDesiredShadow, error)
Can be improved
type ShadowState ¶
type ShadowState struct {
Reported *ReportedOrDesiredShadow `json:"reported,omitempty"`
Desired *ReportedOrDesiredShadow `json:"desired,omitempty"`
}
Directories
¶
| Path | Synopsis |
|---|---|
|
Package nodelifecycle hosts generic node-lifecycle hooks (node-left-group, node-offline).
|
Package nodelifecycle hosts generic node-lifecycle hooks (node-left-group, node-offline). |