importCertificate method

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

Uploads the specified certificate.

May throw ResourceAlreadyExistsFault. May throw InvalidCertificateFault. 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.

Parameter tags : The tags associated with the certificate.

Implementation

Future<ImportCertificateResponse> importCertificate({
  required String certificateIdentifier,
  String? certificatePem,
  Uint8List? certificateWallet,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(certificateIdentifier, 'certificateIdentifier');
  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 (tags != null) 'Tags': tags,
    },
  );

  return ImportCertificateResponse.fromJson(jsonResponse.body);
}