cancelCommand method

Future<void> cancelCommand({
  1. required String commandId,
  2. List<String>? instanceIds,
})

Attempts to cancel the command specified by the Command ID. There is no guarantee that the command will be terminated and the underlying process stopped.

May throw DuplicateInstanceId. May throw InternalServerError. May throw InvalidCommandId. May throw InvalidInstanceId.

Parameter commandId : The ID of the command you want to cancel.

Parameter instanceIds : (Optional) A list of managed node IDs on which you want to cancel the command. If not provided, the command is canceled on every node on which it was requested.

Implementation

Future<void> cancelCommand({
  required String commandId,
  List<String>? instanceIds,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.CancelCommand'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'CommandId': commandId,
      if (instanceIds != null) 'InstanceIds': instanceIds,
    },
  );
}