createHsm method
Creates a new hardware security module (HSM) in the specified AWS CloudHSM cluster.
May throw CloudHsmInternalFailureException. May throw CloudHsmServiceException. May throw CloudHsmInvalidRequestException. May throw CloudHsmResourceNotFoundException. May throw CloudHsmAccessDeniedException.
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 {
ArgumentError.checkNotNull(availabilityZone, 'availabilityZone');
ArgumentError.checkNotNull(clusterId, 'clusterId');
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);
}