stopAutomationExecution method

Future<void> stopAutomationExecution({
  1. required String automationExecutionId,
  2. StopType? type,
})

Stop an Automation that is currently running.

May throw AutomationExecutionNotFoundException. May throw InvalidAutomationStatusUpdateException. May throw InternalServerError.

Parameter automationExecutionId : The execution ID of the Automation to stop.

Parameter type : The stop request type. Valid types include the following: Cancel and Complete. The default type is Cancel.

Implementation

Future<void> stopAutomationExecution({
  required String automationExecutionId,
  StopType? type,
}) async {
  ArgumentError.checkNotNull(automationExecutionId, 'automationExecutionId');
  _s.validateStringLength(
    'automationExecutionId',
    automationExecutionId,
    36,
    36,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.StopAutomationExecution'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AutomationExecutionId': automationExecutionId,
      if (type != null) 'Type': type.toValue(),
    },
  );
}