startExecutionPreview method

Future<StartExecutionPreviewResponse> startExecutionPreview({
  1. required String documentName,
  2. String? documentVersion,
  3. ExecutionInputs? executionInputs,
})

Initiates the process of creating a preview showing the effects that running a specified Automation runbook would have on the targeted resources.

May throw InternalServerError. May throw ValidationException.

Parameter documentName : The name of the Automation runbook to run. The result of the execution preview indicates what the impact would be of running this runbook.

Parameter documentVersion : The version of the Automation runbook to run. The default value is $DEFAULT.

Parameter executionInputs : Information about the inputs that can be specified for the preview operation.

Implementation

Future<StartExecutionPreviewResponse> startExecutionPreview({
  required String documentName,
  String? documentVersion,
  ExecutionInputs? executionInputs,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.StartExecutionPreview'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DocumentName': documentName,
      if (documentVersion != null) 'DocumentVersion': documentVersion,
      if (executionInputs != null) 'ExecutionInputs': executionInputs,
    },
  );

  return StartExecutionPreviewResponse.fromJson(jsonResponse.body);
}