createCertificateAuthorityAuditReport method

Future<CreateCertificateAuthorityAuditReportResponse> createCertificateAuthorityAuditReport({
  1. required AuditReportResponseFormat auditReportResponseFormat,
  2. required String certificateAuthorityArn,
  3. required String s3BucketName,
})

Creates an audit report that lists every time that your CA private key is used. The report is saved in the Amazon S3 bucket that you specify on input. The IssueCertificate and RevokeCertificate actions use the private key. ACM Private CAA assets that are stored in Amazon S3 can be protected with encryption. For more information, see Encrypting Your Audit Reports.

May throw RequestInProgressException. May throw RequestFailedException. May throw ResourceNotFoundException. May throw InvalidArnException. May throw InvalidArgsException. May throw InvalidStateException.

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

Parameter certificateAuthorityArn : 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 .

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

Implementation

Future<CreateCertificateAuthorityAuditReportResponse>
    createCertificateAuthorityAuditReport({
  required AuditReportResponseFormat auditReportResponseFormat,
  required String certificateAuthorityArn,
  required String s3BucketName,
}) async {
  ArgumentError.checkNotNull(
      auditReportResponseFormat, 'auditReportResponseFormat');
  ArgumentError.checkNotNull(
      certificateAuthorityArn, 'certificateAuthorityArn');
  _s.validateStringLength(
    'certificateAuthorityArn',
    certificateAuthorityArn,
    5,
    200,
    isRequired: true,
  );
  ArgumentError.checkNotNull(s3BucketName, 's3BucketName');
  _s.validateStringLength(
    's3BucketName',
    s3BucketName,
    3,
    63,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'ACMPrivateCA.CreateCertificateAuthorityAuditReport'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AuditReportResponseFormat': auditReportResponseFormat.toValue(),
      'CertificateAuthorityArn': certificateAuthorityArn,
      'S3BucketName': s3BucketName,
    },
  );

  return CreateCertificateAuthorityAuditReportResponse.fromJson(
      jsonResponse.body);
}