terminateSession method

Future<TerminateSessionResponse> terminateSession({
  1. required String sessionId,
})

Permanently ends a session and closes the data connection between the Session Manager client and SSM Agent on the managed node. A terminated session can't be resumed.

May throw InternalServerError.

Parameter sessionId : The ID of the session to terminate.

Implementation

Future<TerminateSessionResponse> terminateSession({
  required String sessionId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.TerminateSession'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'SessionId': sessionId,
    },
  );

  return TerminateSessionResponse.fromJson(jsonResponse.body);
}