sendManagedThingCommand method
Send the command to the device represented by the managed thing.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
May throw UnauthorizedException.
May throw ValidationException.
Parameter endpoints :
The device endpoint.
Parameter managedThingId :
The id of the device.
Parameter accountAssociationId :
The identifier of the account association to use when sending a command to
a managed thing.
Parameter connectorAssociationId :
The ID tracking the current discovery process for one connector
association.
Implementation
Future<SendManagedThingCommandResponse> sendManagedThingCommand({
required List<CommandEndpoint> endpoints,
required String managedThingId,
String? accountAssociationId,
String? connectorAssociationId,
}) async {
final $payload = <String, dynamic>{
'Endpoints': endpoints,
if (accountAssociationId != null)
'AccountAssociationId': accountAssociationId,
if (connectorAssociationId != null)
'ConnectorAssociationId': connectorAssociationId,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/managed-things-command/${Uri.encodeComponent(managedThingId)}',
exceptionFnMap: _exceptionFns,
);
return SendManagedThingCommandResponse.fromJson(response);
}