Skip to content

delete_assessment_report async

delete_assessment_report(
    assessment_id: UUID,
    assessment_report_id: UUID,
    *,
    config_overrides: Optional[AsyncAuditManagerClientConfig] = None,
) -> DeleteAssessmentReportResponse

Deletes an assessment report in Audit Manager.

When you run the DeleteAssessmentReport operation, Audit Manager attempts to delete the following data:

  1. The specified assessment report that’s stored in your S3 bucket

  2. The associated metadata that’s stored in Audit Manager

If Audit Manager can’t access the assessment report in your S3 bucket, the report isn’t deleted. In this event, the DeleteAssessmentReport operation doesn’t fail. Instead, it proceeds to delete the associated metadata only. You must then delete the assessment report from the S3 bucket yourself.

This scenario happens when Audit Manager receives a 403 (Forbidden) or 404 (Not Found) error from Amazon S3. To avoid this, make sure that your S3 bucket is available, and that you configured the correct permissions for Audit Manager to delete resources in your S3 bucket. For an example permissions policy that you can use, see Assessment report destination permissions in the Audit Manager User Guide. For information about the issues that could cause a 403 (Forbidden) or 404 (Not Found) error from Amazon S3, see List of Error Codes in the Amazon Simple Storage Service API Reference.

Parameters:

  • assessment_id (UUID) –

    The unique identifier for the assessment.

  • assessment_report_id (UUID) –

    The unique identifier for the assessment report.

Raises:

  • AccessDeniedException –

    Your account isn't registered with Audit Manager. Check the delegated administrator setup on the Audit Manager settings page, and try again.

  • InternalServerException –

    An internal service error occurred during the processing of your request. Try again later.

  • ResourceNotFoundException –

    The resource that's specified in the request can't be found.

  • ValidationException –

    The request has invalid or missing parameters.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_auditmanager/_services/async_audit_manager.py
async def delete_assessment_report(
    self,
    assessment_id: "capo_auditmanager.types.uuid.UUID",
    assessment_report_id: "capo_auditmanager.types.uuid.UUID",
    *,
    config_overrides: Optional[AsyncAuditManagerClientConfig] = None,
) -> "capo_auditmanager.types.delete_assessment_report_response.DeleteAssessmentReportResponse":
    """<p>Deletes an assessment report in Audit Manager. </p> <p>When you run the <code>DeleteAssessmentReport</code> operation, Audit Manager attempts to delete the following data:</p> <ol> <li> <p>The specified assessment report that’s stored in your S3 bucket</p> </li> <li> <p>The associated metadata that’s stored in Audit Manager</p> </li> </ol> <p>If Audit Manager can’t access the assessment report in your S3 bucket, the report isn’t deleted. In this event, the <code>DeleteAssessmentReport</code> operation doesn’t fail. Instead, it proceeds to delete the associated metadata only. You must then delete the assessment report from the S3 bucket yourself. </p> <p>This scenario happens when Audit Manager receives a <code>403 (Forbidden)</code> or <code>404 (Not Found)</code> error from Amazon S3. To avoid this, make sure that your S3 bucket is available, and that you configured the correct permissions for Audit Manager to delete resources in your S3 bucket. For an example permissions policy that you can use, see <a href="https://docs.aws.amazon.com/audit-manager/latest/userguide/security_iam_id-based-policy-examples.html#full-administrator-access-assessment-report-destination">Assessment report destination permissions</a> in the <i>Audit Manager User Guide</i>. For information about the issues that could cause a <code>403 (Forbidden)</code> or <code>404 (Not Found</code>) error from Amazon S3, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList">List of Error Codes</a> in the <i>Amazon Simple Storage Service API Reference</i>. </p>

    Args:
        assessment_id: <p> The unique identifier for the assessment. </p>
        assessment_report_id: <p> The unique identifier for the assessment report. </p>

    Raises:
        capo_auditmanager.errors.access_denied_exception.AccessDeniedException: <p> Your account isn't registered with Audit Manager. Check the delegated administrator setup on the Audit Manager settings page, and try again. </p>
        capo_auditmanager.errors.internal_server_exception.InternalServerException: <p> An internal service error occurred during the processing of your request. Try again later. </p>
        capo_auditmanager.errors.resource_not_found_exception.ResourceNotFoundException: <p> The resource that's specified in the request can't be found. </p>
        capo_auditmanager.errors.validation_exception.ValidationException: <p> The request has invalid or missing parameters. </p>
        capo_auditmanager.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_auditmanager.types.delete_assessment_report_request.DeleteAssessmentReportRequest]",
    ) -> AsyncOperationResponse[
        "capo_auditmanager.types.delete_assessment_report_response.DeleteAssessmentReportResponse"
    ]:
        import capo_auditmanager._operations.bedrock_assessment_manager_lambda.delete_assessment_report

        (
            output,
            http_response,
        ) = await capo_auditmanager._operations.bedrock_assessment_manager_lambda.delete_assessment_report.async_delete_assessment_report(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteAssessmentReport")
    )
    input_: capo_auditmanager.types.delete_assessment_report_request.DeleteAssessmentReportRequest = {
        "assessment_id": assessment_id,
        "assessment_report_id": assessment_report_id,
    }

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