本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
托管集成通知
托管集成通知管理向客户发送的所有通知,便于在他们的设备上提供更新和见解的实时沟通。无论是通知客户设备事件、设备生命周期还是设备状态,托管集成通知在增强整体客户体验方面都起着至关重要的作用。通过提供可操作的信息,客户可以做出明智的决策并优化资源利用率。
设置托管集成通知
要设置托管集成通知,请按照以下步骤操作:
-
创建 Amazon Kinesis 数据流
要创建 Kinesis 数据流,请按照创建和管理 Kinesis 数据流中概述的步骤进行操作。
目前,仅支持 Amazon Kinesis 数据流作为客户管理的托管集成通知目的地。
-
创建 Amazon Kinesis 直播访问角色
创建 AWS Identity and Access Management 有权访问您刚刚创建的 Kinesis 直播的访问角色
有关更多信息,请参阅《AWS Identity and Access Management用户指南》中的 IAM 角色创建。
-
向用户授予调用
CreateDestination
API 的权限以下策略定义了用户调用 CreateDestinationAPI 的要求。如果未设置,则对
CreateDestination
API 的调用将失败。要获取托管集成的passrole权限,请参阅AWS Identity and Access Management用户指南中的授予用户将角色传递给 AWS 服务的权限。
{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":"iam:PassRole", "Resource":"arn:aws:iam::
accountID
:role/kinesis_stream_access_role", "Condition":{ "StringEquals":{ "iam:PassedToService":"iotmanagedintegrations.amazonaws.com" } } }, { "Effect":"Allow", "Action":"iotmanagedintegrations:CreateDestination", "Resource":"*" } ] } -
调用
CreateDestination
API创建 Amazon Kinesis 数据流和流访问角色后,调用 CreateDestinationAPI 创建您的客户管理的目标,托管集成通知将发送到该目的地。对于
deliveryDestinationArn
参数,请使用您的新 Amazon Kinesis 数据流中的。arn
{ "DeliveryDestinationArn": "Your Kinesis arn" "DeliveryDestinationType": "KINESIS" "Name": "DestinationName" "ClientToken": "Random string" "RoleArn": "arn:aws:iam::
accountID
:role/kinesis_stream_access_role" } -
调用
CreateNotificationConfiguration
API最后,您将创建通知配置,通过将通知路由到由您的 Amazon Kinesis 数据流表示的客户管理的目的地,通知您所选的事件类型。调用 CreateNotificationConfigurationAPI 来创建通知配置。在
destinationName
参数中,使用与最初使用CreateDestination
API 创建客户管理的目的地时创建的目标名称相同的目标名称。{ "EventType": "DEVICE_EVENT" "DestinationName" // This name has to be identical to the name in createDestination API "ClientToken": "Random string" }
使用托管集成监控的事件类型
以下是使用托管集成通知监控的事件类型:
-
DEVICE_COMMAND
-
SendManagedThingAPI 命令的状态。有效值为
succeeded
或failed
。{ "version":"0", "messageId":"6a7e8feb-b491-4cf7-a9f1-bf3703467718", "messageType":"DEVICE_EVENT", "source":"aws.iotmanagedintegrations", "customerAccountId":"123456789012", "timestamp":"2017-12-22T18:43:48Z", "region":"ca-central-1", "resources":[ "arn:aws:iotmanagedintegrations:ca-central-1:123456789012:managed-thing/6a7e8feb-b491-4cf7-a9f1-bf3703467718" ], "payload":{ "traceId":"1234567890abcdef0", "receivedAt":"2017-12-22T18:43:48Z", "executedAt":"2017-12-22T18:43:48Z", "result":"failed" } }
-
-
DEVICE_COMMAND_REQUEST
-
来自网络实时通信 (WebRTC) 的命令请求。
WebRTC标准允许两个对等方之间进行通信。这些对等体可以传输实时视频、音频和任意数据。托管集成支持WebRTC,以便在客户的移动应用程序和最终用户的设备之间实现这些类型的流式传输。有关 WebRTC 标准的更多信息,请参阅 WebRTC。
{ "version":"0", "messageId":"6a7e8feb-b491-4cf7-a9f1-bf3703467718", "messageType":"DEVICE_COMMAND_REQUEST", "source":"aws.iotmanagedintegrations", "customerAccountId":"123456789012", "timestamp":"2017-12-22T18:43:48Z", "region":"ca-central-1", "resources":[ "arn:aws:iotmanagedintegrations:ca-central-1:123456789012:managed-thing/6a7e8feb-b491-4cf7-a9f1-bf3703467718" ], "payload":{ "endpoints":[{ "endpointId":"1", "capabilities":[{ "id":"aws.DoorLock", "name":"Door Lock", "version":"1.0" }] }] } }
-
-
DEVICE_DISCOVERY_STATUS
-
设备的发现状态。
{ "version":"0", "messageId":"6a7e8feb-b491-4cf7-a9f1-bf3703467718", "messageType":"DEVICE_DISCOVERY_STATUS", "source":"aws.iotmanagedintegrations", "customerAccountId":"123456789012", "timestamp":"2017-12-22T18:43:48Z", "region":"ca-central-1", "resources":[ "arn:aws:iotmanagedintegrations:ca-central-1:123456789012:managed-thing/6a7e8feb-b491-4cf7-a9f1-bf3703467718" ], "payload":{ "deviceCount": 1, "deviceDiscoveryId": "123", "status": "SUCCEEDED" } }
-
-
DEVICE_EVENT
-
设备事件发生的通知。
{ "version":"1.0", "messageId":"2ed545027bd347a2b855d28f94559940", "messageType":"DEVICE_EVENT", "source":"aws.iotmanagedintegrations", "customerAccountId":"123456789012", "timestamp":"1731630247280", "resources":[ "/quit/1b15b39992f9460ba82c6c04595d1f4f" ], "payload":{ "endpoints":[{ "endpointId":"1", "capabilities":[{ "id":"aws.DoorLock", "name":"Door Lock", "version":"1.0", "properties":[{ "name":"ActuatorEnabled", "value":"true" }] }] }] } }
-
-
DEVICE_LIFE_CYCLE
-
设备生命周期的状态。
{ "version": "1.0.0", "messageId": "8d1e311a473f44f89d821531a0907b05", "messageType": "DEVICE_LIFE_CYCLE", "source": "aws.iotmanagedintegrations", "customerAccountId": "123456789012", "timestamp": "2024-11-14T19:55:57.568284645Z", "region": "ca-central-1", "resources": [ "arn:aws:iotmanagedintegrations:ca-central-1:123456789012:managed-thing/d5c280b423a042f3933eed09cf408657" ], "payload": { "deviceDetails": { "id": "d5c280b423a042f3933eed09cf408657", "arn": "arn:aws:iotmanagedintegrations:ca-central-1:123456789012:managed-thing/d5c280b423a042f3933eed09cf408657", "createdAt": "2024-11-14T19:55:57.515841147Z", "updatedAt": "2024-11-14T19:55:57.515841559Z" }, "status": "UNCLAIMED" } }
-
-
DEVICE_OTA
-
设备的 OTA 通知。
-
-
DEVICE_STATE
-
设备状态更新时的通知。
{ "messageType": "DEVICE_STATE", "source": "aws.iotmanagedintegrations", "customerAccountId": "123456789012", "timestamp": "1731623291671", "resources": [ "arn:aws:iotmanagedintegrations:ca-central-1:123456789012:managed-thing/61889008880012345678" ], "payload": { "addedStates": { "endpoints": [{ "endpointId": "nonEndpointId", "capabilities": [{ "id": "aws.OnOff", "name": "On/Off", "version": "1.0", "properties": [{ "name": "OnOff", "value": { "propertyValue": "\"onoff\"", "lastChangedAt": "2024-06-11T01:38:09.000414Z" } } ]} ]} ]} } }
-