Skip to content

create_certificate_authority_audit_report async

create_certificate_authority_audit_report(
    certificate_authority_arn: Arn,
    s3_bucket_name: S3BucketName,
    audit_report_response_format: AuditReportResponseFormat,
    *,
    config_overrides: Optional[AsyncACMPCAClientConfig] = None,
) -> CreateCertificateAuthorityAuditReportResponse

Creates an audit report that lists every time that your CA private key is used to issue a certificate. The IssueCertificate and RevokeCertificate actions use the private key.

To save the audit report to your designated Amazon S3 bucket, you must create a bucket policy that grants Amazon Web Services Private CA permission to access and write to it. For an example policy, see Prepare an Amazon S3 bucket for audit reports.

Amazon Web Services Private CA assets that are stored in Amazon S3 can be protected with encryption. For more information, see Encrypting Your Audit Reports.

You can generate a maximum of one report every 30 minutes.

Parameters:

  • certificate_authority_arn (Arn) –

    The Amazon Resource Name (ARN) of the CA to be audited. This is of the form:

    arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012 .

  • s3_bucket_name (S3BucketName) –

    The name of the S3 bucket that will contain the audit report.

  • audit_report_response_format (AuditReportResponseFormat) –

    The format in which to create the report. This can be either JSON or CSV.

Raises:

Source code in docs_src/capo_acm_pca/_services/async_acmpca.py
async def create_certificate_authority_audit_report(
    self,
    certificate_authority_arn: "capo_acm_pca.types.arn.Arn",
    s3_bucket_name: "capo_acm_pca.types.s3_bucket_name.S3BucketName",
    audit_report_response_format: "capo_acm_pca.types.audit_report_response_format.AuditReportResponseFormat",
    *,
    config_overrides: Optional[AsyncACMPCAClientConfig] = None,
) -> "capo_acm_pca.types.create_certificate_authority_audit_report_response.CreateCertificateAuthorityAuditReportResponse":
    """<p>Creates an audit report that lists every time that your CA private key is used to issue a certificate. The <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_IssueCertificate.html">IssueCertificate</a> and <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_RevokeCertificate.html">RevokeCertificate</a> actions use the private key.</p> <p>To save the audit report to your designated Amazon S3 bucket, you must create a bucket policy that grants Amazon Web Services Private CA permission to access and write to it. For an example policy, see <a href="https://docs.aws.amazon.com/privateca/latest/userguide/PcaAuditReport.html#s3-access">Prepare an Amazon S3 bucket for audit reports</a>.</p> <p>Amazon Web Services Private CA assets that are stored in Amazon S3 can be protected with encryption. For more information, see <a href="https://docs.aws.amazon.com/privateca/latest/userguide/PcaAuditReport.html#audit-report-encryption">Encrypting Your Audit Reports</a>.</p> <note> <p>You can generate a maximum of one report every 30 minutes.</p> </note>

    Args:
        certificate_authority_arn: <p>The Amazon Resource Name (ARN) of the CA to be audited. This is of the form:</p> <p> <code>arn:aws:acm-pca:<i>region</i>:<i>account</i>:certificate-authority/<i>12345678-1234-1234-1234-123456789012</i> </code>.</p>
        s3_bucket_name: <p>The name of the S3 bucket that will contain the audit report.</p>
        audit_report_response_format: <p>The format in which to create the report. This can be either <b>JSON</b> or <b>CSV</b>.</p>

    Raises:
        capo_acm_pca.errors.invalid_args_exception.InvalidArgsException: <p>One or more of the specified arguments was not valid.</p>
        capo_acm_pca.errors.invalid_arn_exception.InvalidArnException: <p>The requested Amazon Resource Name (ARN) does not refer to an existing resource.</p>
        capo_acm_pca.errors.invalid_state_exception.InvalidStateException: <p>The state of the private CA does not allow this action to occur.</p>
        capo_acm_pca.errors.request_failed_exception.RequestFailedException: <p>The request has failed for an unspecified reason.</p>
        capo_acm_pca.errors.request_in_progress_exception.RequestInProgressException: <p>Your request is already in progress.</p>
        capo_acm_pca.errors.resource_not_found_exception.ResourceNotFoundException: <p>A resource such as a private CA, S3 bucket, certificate, audit report, or policy cannot be found.</p>
        capo_acm_pca.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_acm_pca.types.create_certificate_authority_audit_report_request.CreateCertificateAuthorityAuditReportRequest]",
    ) -> AsyncOperationResponse[
        "capo_acm_pca.types.create_certificate_authority_audit_report_response.CreateCertificateAuthorityAuditReportResponse"
    ]:
        import capo_acm_pca._operations.acm_private_ca.create_certificate_authority_audit_report

        (
            output,
            http_response,
        ) = await capo_acm_pca._operations.acm_private_ca.create_certificate_authority_audit_report.async_create_certificate_authority_audit_report(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateCertificateAuthorityAuditReport")
    )
    input_: capo_acm_pca.types.create_certificate_authority_audit_report_request.CreateCertificateAuthorityAuditReportRequest = {
        "certificate_authority_arn": certificate_authority_arn,
        "s3_bucket_name": s3_bucket_name,
        "audit_report_response_format": audit_report_response_format,
    }

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