sendAutomationSignal method

Future<void> sendAutomationSignal({
  1. required String automationExecutionId,
  2. required SignalType signalType,
  3. Map<String, List<String>>? payload,
})

Sends a signal to an Automation execution to change the current behavior or status of the execution.

May throw AutomationExecutionNotFoundException. May throw AutomationStepNotFoundException. May throw InvalidAutomationSignalException. May throw InternalServerError.

Parameter automationExecutionId : The unique identifier for an existing Automation execution that you want to send the signal to.

Parameter signalType : The type of signal to send to an Automation execution.

Parameter payload : The data sent with the signal. The data schema depends on the type of signal used in the request.

For Approve and Reject signal types, the payload is an optional comment that you can send with the signal type. For example:

Comment="Looks good"

For StartStep and Resume signal types, you must send the name of the Automation step to start or resume as the payload. For example:

StepName="step1"

For the StopStep signal type, you must send the step execution ID as the payload. For example:

StepExecutionId="97fff367-fc5a-4299-aed8-0123456789ab"

Implementation

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