importCertificate method

Future<ImportCertificateResponse> importCertificate({
  1. required String certificateIdentifier,
  2. String? certificatePem,
  3. Uint8List? certificateWallet,
  4. String? kmsKeyId,
  5. List<Tag>? tags,
})

Uploads the specified certificate.

May throw InvalidCertificateFault. May throw KMSKeyNotAccessibleFault. May throw ResourceAlreadyExistsFault. May throw ResourceQuotaExceededFault.

Parameter certificateIdentifier : A customer-assigned name for the certificate. Identifiers must begin with a letter and must contain only ASCII letters, digits, and hyphens. They can't end with a hyphen or contain two consecutive hyphens.

Parameter certificatePem : The contents of a .pem file, which contains an X.509 certificate.

Parameter certificateWallet : The location of an imported Oracle Wallet certificate for use with SSL. Provide the name of a .sso file using the fileb:// prefix. You can't provide the certificate inline.

Example: filebase64("${path.root}/rds-ca-2019-root.sso")

Parameter kmsKeyId : An KMS key identifier that is used to encrypt the certificate.

If you don't specify a value for the KmsKeyId parameter, then DMS uses your default encryption key.

KMS creates the default encryption key for your Amazon Web Services account. Your Amazon Web Services account has a different default encryption key for each Amazon Web Services Region.

Parameter tags : The tags associated with the certificate.

Implementation

Future<ImportCertificateResponse> importCertificate({
  required String certificateIdentifier,
  String? certificatePem,
  Uint8List? certificateWallet,
  String? kmsKeyId,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonDMSv20160101.ImportCertificate'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'CertificateIdentifier': certificateIdentifier,
      if (certificatePem != null) 'CertificatePem': certificatePem,
      if (certificateWallet != null)
        'CertificateWallet': base64Encode(certificateWallet),
      if (kmsKeyId != null) 'KmsKeyId': kmsKeyId,
      if (tags != null) 'Tags': tags,
    },
  );

  return ImportCertificateResponse.fromJson(jsonResponse.body);
}