startDetectMitigationActionsTask method

Future<StartDetectMitigationActionsTaskResponse> startDetectMitigationActionsTask({
  1. required List<String> actions,
  2. required DetectMitigationActionsTaskTarget target,
  3. required String taskId,
  4. String? clientRequestToken,
  5. bool? includeOnlyActiveViolations,
  6. bool? includeSuppressedAlerts,
  7. ViolationEventOccurrenceRange? violationEventOccurrenceRange,
})

Starts a Device Defender ML Detect mitigation actions task.

Requires permission to access the StartDetectMitigationActionsTask action.

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

Parameter actions : The actions to be performed when a device has unexpected behavior.

Parameter target : Specifies the ML Detect findings to which the mitigation actions are applied.

Parameter taskId : The unique identifier of the task.

Parameter clientRequestToken : Each mitigation action task must have a unique client request token. If you try to create a new task with the same token as a task that already exists, an exception occurs. If you omit this value, Amazon Web Services SDKs will automatically generate a unique client request.

Parameter includeOnlyActiveViolations : Specifies to list only active violations.

Parameter includeSuppressedAlerts : Specifies to include suppressed alerts.

Parameter violationEventOccurrenceRange : Specifies the time period of which violation events occurred between.

Implementation

Future<StartDetectMitigationActionsTaskResponse>
    startDetectMitigationActionsTask({
  required List<String> actions,
  required DetectMitigationActionsTaskTarget target,
  required String taskId,
  String? clientRequestToken,
  bool? includeOnlyActiveViolations,
  bool? includeSuppressedAlerts,
  ViolationEventOccurrenceRange? violationEventOccurrenceRange,
}) async {
  final $payload = <String, dynamic>{
    'actions': actions,
    'target': target,
    'clientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
    if (includeOnlyActiveViolations != null)
      'includeOnlyActiveViolations': includeOnlyActiveViolations,
    if (includeSuppressedAlerts != null)
      'includeSuppressedAlerts': includeSuppressedAlerts,
    if (violationEventOccurrenceRange != null)
      'violationEventOccurrenceRange': violationEventOccurrenceRange,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/detect/mitigationactions/tasks/${Uri.encodeComponent(taskId)}',
    exceptionFnMap: _exceptionFns,
  );
  return StartDetectMitigationActionsTaskResponse.fromJson(response);
}