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.

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

Parameter auditCheckToActionsMapping : For an audit check, specifies which mitigation actions to apply. Those actions must be defined in your AWS account.

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 {
  ArgumentError.checkNotNull(
      auditCheckToActionsMapping, 'auditCheckToActionsMapping');
  ArgumentError.checkNotNull(target, 'target');
  ArgumentError.checkNotNull(taskId, 'taskId');
  _s.validateStringLength(
    'taskId',
    taskId,
    1,
    128,
    isRequired: true,
  );
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    1,
    64,
  );
  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);
}