Skip to content

start_audit_mitigation_actions_task async

start_audit_mitigation_actions_task(
    task_id: MitigationActionsTaskId,
    target: AuditMitigationActionsTaskTarget,
    audit_check_to_actions_mapping: AuditCheckToActionsMapping,
    client_request_token: ClientRequestToken,
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
) -> StartAuditMitigationActionsTaskResponse

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

Requires permission to access the StartAuditMitigationActionsTask action.

Parameters:

  • task_id (MitigationActionsTaskId) –

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

  • target (AuditMitigationActionsTaskTarget) –

    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.

  • audit_check_to_actions_mapping (AuditCheckToActionsMapping) –

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

  • client_request_token (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.

Raises:

Source code in docs_src/capo_iot/_services/async_io_t.py
async def start_audit_mitigation_actions_task(
    self,
    task_id: "capo_iot.types.mitigation_actions_task_id.MitigationActionsTaskId",
    target: "capo_iot.types.audit_mitigation_actions_task_target.AuditMitigationActionsTaskTarget",
    audit_check_to_actions_mapping: "capo_iot.types.audit_check_to_actions_mapping.AuditCheckToActionsMapping",
    client_request_token: "capo_iot.types.client_request_token.ClientRequestToken",
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
) -> "capo_iot.types.start_audit_mitigation_actions_task_response.StartAuditMitigationActionsTaskResponse":
    """<p>Starts a task that applies a set of mitigation actions to the specified target.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">StartAuditMitigationActionsTask</a> action.</p>

    Args:
        task_id: <p>A unique identifier for the task. You can use this identifier to check the status of the task or to cancel it.</p>
        target: <p>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.</p>
        audit_check_to_actions_mapping: <p>For an audit check, specifies which mitigation actions to apply. Those actions must be defined in your Amazon Web Services accounts.</p>
        client_request_token: <p>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.</p>

    Raises:
        capo_iot.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
        capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot.errors.limit_exceeded_exception.LimitExceededException: <p>A limit has been exceeded.</p>
        capo_iot.errors.task_already_exists_exception.TaskAlreadyExistsException: <p> This exception occurs if you attempt to start a task with the same task-id as an existing task but with a different clientRequestToken. </p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iot.types.start_audit_mitigation_actions_task_request.StartAuditMitigationActionsTaskRequest]",
    ) -> AsyncOperationResponse[
        "capo_iot.types.start_audit_mitigation_actions_task_response.StartAuditMitigationActionsTaskResponse"
    ]:
        import capo_iot._operations.aws_iot_service.start_audit_mitigation_actions_task

        (
            output,
            http_response,
        ) = await capo_iot._operations.aws_iot_service.start_audit_mitigation_actions_task.async_start_audit_mitigation_actions_task(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartAuditMitigationActionsTask")
    )
    input_: capo_iot.types.start_audit_mitigation_actions_task_request.StartAuditMitigationActionsTaskRequest = {
        "task_id": task_id,
        "target": target,
        "audit_check_to_actions_mapping": audit_check_to_actions_mapping,
        "client_request_token": client_request_token,
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output