registerCertificate method

Future<RegisterCertificateResult> registerCertificate({
  1. required String certificateData,
  2. required String directoryId,
  3. ClientCertAuthSettings? clientCertAuthSettings,
  4. CertificateType? type,
})

Registers a certificate for a secure LDAP or client certificate authentication.

May throw CertificateAlreadyExistsException. May throw CertificateLimitExceededException. May throw ClientException. May throw DirectoryDoesNotExistException. May throw DirectoryUnavailableException. May throw InvalidCertificateException. May throw InvalidParameterException. May throw ServiceException. May throw UnsupportedOperationException.

Parameter certificateData : The certificate PEM string that needs to be registered.

Parameter directoryId : The identifier of the directory.

Parameter clientCertAuthSettings : A ClientCertAuthSettings object that contains client certificate authentication settings.

Parameter type : The function that the registered certificate performs. Valid values include ClientLDAPS or ClientCertAuth. The default value is ClientLDAPS.

Implementation

Future<RegisterCertificateResult> registerCertificate({
  required String certificateData,
  required String directoryId,
  ClientCertAuthSettings? clientCertAuthSettings,
  CertificateType? type,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'DirectoryService_20150416.RegisterCertificate'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'CertificateData': certificateData,
      'DirectoryId': directoryId,
      if (clientCertAuthSettings != null)
        'ClientCertAuthSettings': clientCertAuthSettings,
      if (type != null) 'Type': type.value,
    },
  );

  return RegisterCertificateResult.fromJson(jsonResponse.body);
}