sendConnectorEvent method
Relays third-party device events for a connector such as a new device or a device state change event.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
May throw ValidationException.
Parameter connectorId :
The id of the connector between the third-party cloud provider and IoT
managed integrations.
Parameter operation :
The Open Connectivity Foundation (OCF) operation requested to be performed
on the managed thing.
Parameter connectorDeviceId :
The third-party device id as defined by the connector. This device id must
not contain personal identifiable information (PII).
Parameter deviceDiscoveryId :
The id for the device discovery job.
Parameter devices :
The list of devices.
Parameter matterEndpoint :
The device endpoint.
Parameter message :
The device state change event payload.
This parameter will include the following three fields:
-
uri:schema auc://<PARTNER-DEVICE-ID>/ResourcePath(TheResourcepathcorresponds to an OCF resource.) -
op: For device state changes, this field must populate asn+d. -
cn: The content depends on the OCF resource referenced inResourcePath.
Parameter operationVersion :
The Open Connectivity Foundation (OCF) security specification version for
the operation being requested on the managed thing. For more information,
see OCF
Security Specification.
Parameter statusCode :
The status code of the Open Connectivity Foundation (OCF) operation being
performed on the managed thing.
Parameter traceId :
The trace request identifier. This is generated by IoT managed
integrations and can be used to trace this command and its related
operations in CloudWatch.
Parameter userId :
The id of the third-party cloud provider.
Implementation
Future<SendConnectorEventResponse> sendConnectorEvent({
required String connectorId,
required ConnectorEventOperation operation,
String? connectorDeviceId,
String? deviceDiscoveryId,
List<Device>? devices,
MatterEndpoint? matterEndpoint,
String? message,
String? operationVersion,
int? statusCode,
String? traceId,
String? userId,
}) async {
_s.validateNumRange(
'statusCode',
statusCode,
100,
550,
);
final $payload = <String, dynamic>{
'Operation': operation.value,
if (connectorDeviceId != null) 'ConnectorDeviceId': connectorDeviceId,
if (deviceDiscoveryId != null) 'DeviceDiscoveryId': deviceDiscoveryId,
if (devices != null) 'Devices': devices,
if (matterEndpoint != null) 'MatterEndpoint': matterEndpoint,
if (message != null) 'Message': message,
if (operationVersion != null) 'OperationVersion': operationVersion,
if (statusCode != null) 'StatusCode': statusCode,
if (traceId != null) 'TraceId': traceId,
if (userId != null) 'UserId': userId,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/connector-event/${Uri.encodeComponent(connectorId)}',
exceptionFnMap: _exceptionFns,
);
return SendConnectorEventResponse.fromJson(response);
}