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 instance. A terminated session cannot be resumed.

May throw DoesNotExistException. May throw InternalServerError.

Parameter sessionId : The ID of the session to terminate.

Implementation

Future<TerminateSessionResponse> terminateSession({
  required String sessionId,
}) async {
  ArgumentError.checkNotNull(sessionId, 'sessionId');
  _s.validateStringLength(
    'sessionId',
    sessionId,
    1,
    96,
    isRequired: true,
  );
  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);
}