getConnection method
Retrieves connection information for the specified MQTT client.
Requires permission to access the GetConnection action.
May throw ForbiddenException.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
Parameter clientId :
The unique identifier of the MQTT client to retrieve connection
information. The client ID can't start with a dollar sign ($).
MQTT client IDs must be URL encoded (percent-encoded) when they contain characters that are not valid in HTTP requests, such as spaces, forward slashes (/), and UTF-8 characters.
Parameter includeSocketInformation :
Specifies if socket information (sourcePort, targetPort, sourceIp,
targetIp) should be included in the GetConnection response. Set to
TRUE to include socket information. Set to FALSE
to omit socket information. By default, this is set to FALSE.
See the developer
guide for how to authorize this parameter.
Implementation
Future<GetConnectionResponse> getConnection({
required String clientId,
bool? includeSocketInformation,
}) async {
final $query = <String, List<String>>{
if (includeSocketInformation != null)
'includeSocketInformation': [includeSocketInformation.toString()],
};
final response = await _protocol.send(
payload: null,
method: 'GET',
requestUri: '/connections/${Uri.encodeComponent(clientId)}',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return GetConnectionResponse.fromJson(response);
}