createLunaClient method

Future<CreateLunaClientResponse> createLunaClient({
  1. required String certificate,
  2. String? label,
})

This is documentation for AWS CloudHSM Classic. For more information, see AWS CloudHSM Classic FAQs, the AWS CloudHSM Classic User Guide, and the AWS CloudHSM Classic API Reference.

For information about the current version of AWS CloudHSM, see AWS CloudHSM, the AWS CloudHSM User Guide, and the AWS CloudHSM API Reference.

Creates an HSM client.

May throw CloudHsmServiceException. May throw CloudHsmInternalException. May throw InvalidRequestException.

Parameter certificate : The contents of a Base64-Encoded X.509 v3 certificate to be installed on the HSMs used by this client.

Parameter label : The label for the client.

Implementation

Future<CreateLunaClientResponse> createLunaClient({
  required String certificate,
  String? label,
}) async {
  ArgumentError.checkNotNull(certificate, 'certificate');
  _s.validateStringLength(
    'certificate',
    certificate,
    600,
    2400,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CloudHsmFrontendService.CreateLunaClient'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Certificate': certificate,
      if (label != null) 'Label': label,
    },
  );

  return CreateLunaClientResponse.fromJson(jsonResponse.body);
}