startAuditMitigationActionsTask method

Future<StartAuditMitigationActionsTaskResponse> startAuditMitigationActionsTask({
  1. required Map<String, List<String>> auditCheckToActionsMapping,
  2. required AuditMitigationActionsTaskTarget target,
  3. required String taskId,
  4. String? clientRequestToken,
})

Starts a task that applies a set of mitigation actions to the specified target.

Requires permission to access the StartAuditMitigationActionsTask action.

May throw InternalFailureException. May throw InvalidRequestException. May throw LimitExceededException. May throw TaskAlreadyExistsException. May throw ThrottlingException.

Parameter auditCheckToActionsMapping : For an audit check, specifies which mitigation actions to apply. Those actions must be defined in your Amazon Web Services accounts.

Parameter target : Specifies the audit findings to which the mitigation actions are applied. You can apply them to a type of audit check, to all findings from an audit, or to a specific set of findings.

Parameter taskId : A unique identifier for the task. You can use this identifier to check the status of the task or to cancel it.

Parameter clientRequestToken : Each audit mitigation task must have a unique client request token. If you try to start a new task with the same token as a task that already exists, an exception occurs. If you omit this value, a unique client request token is generated automatically.

Implementation

Future<StartAuditMitigationActionsTaskResponse>
    startAuditMitigationActionsTask({
  required Map<String, List<String>> auditCheckToActionsMapping,
  required AuditMitigationActionsTaskTarget target,
  required String taskId,
  String? clientRequestToken,
}) async {
  final $payload = <String, dynamic>{
    'auditCheckToActionsMapping': auditCheckToActionsMapping,
    'target': target,
    'clientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/audit/mitigationactions/tasks/${Uri.encodeComponent(taskId)}',
    exceptionFnMap: _exceptionFns,
  );
  return StartAuditMitigationActionsTaskResponse.fromJson(response);
}