createHsm method

Future<CreateHsmResponse> createHsm({
  1. required String availabilityZone,
  2. required String clusterId,
  3. String? ipAddress,
})

Creates a new hardware security module (HSM) in the specified CloudHSM cluster.

Cross-account use: No. You cannot perform this operation on an CloudHSM cluster in a different Amazon Web Service account.

May throw CloudHsmAccessDeniedException. May throw CloudHsmInternalFailureException. May throw CloudHsmInvalidRequestException. May throw CloudHsmResourceNotFoundException. May throw CloudHsmServiceException.

Parameter availabilityZone : The Availability Zone where you are creating the HSM. To find the cluster's Availability Zones, use DescribeClusters.

Parameter clusterId : The identifier (ID) of the HSM's cluster. To find the cluster ID, use DescribeClusters.

Parameter ipAddress : The HSM's IP address. If you specify an IP address, use an available address from the subnet that maps to the Availability Zone where you are creating the HSM. If you don't specify an IP address, one is chosen for you from that subnet.

Implementation

Future<CreateHsmResponse> createHsm({
  required String availabilityZone,
  required String clusterId,
  String? ipAddress,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'BaldrApiService.CreateHsm'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AvailabilityZone': availabilityZone,
      'ClusterId': clusterId,
      if (ipAddress != null) 'IpAddress': ipAddress,
    },
  );

  return CreateHsmResponse.fromJson(jsonResponse.body);
}