rotateTunnelAccessToken method

Future<RotateTunnelAccessTokenResponse> rotateTunnelAccessToken({
  1. required ClientMode clientMode,
  2. required String tunnelId,
  3. DestinationConfig? destinationConfig,
})

Revokes the current client access token (CAT) and returns new CAT for clients to use when reconnecting to secure tunneling to access the same tunnel.

Requires permission to access the RotateTunnelAccessToken action.

May throw ResourceNotFoundException.

Parameter clientMode : The mode of the client that will use the client token, which can be either the source or destination, or both source and destination.

Parameter tunnelId : The tunnel for which you want to rotate the access tokens.

Implementation

Future<RotateTunnelAccessTokenResponse> rotateTunnelAccessToken({
  required ClientMode clientMode,
  required String tunnelId,
  DestinationConfig? destinationConfig,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'IoTSecuredTunneling.RotateTunnelAccessToken'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'clientMode': clientMode.value,
      'tunnelId': tunnelId,
      if (destinationConfig != null) 'destinationConfig': destinationConfig,
    },
  );

  return RotateTunnelAccessTokenResponse.fromJson(jsonResponse.body);
}