createCluster method
Creates a new AWS CloudHSM cluster.
May throw CloudHsmAccessDeniedException. May throw CloudHsmInternalFailureException. May throw CloudHsmInvalidRequestException. May throw CloudHsmResourceNotFoundException. May throw CloudHsmServiceException. May throw CloudHsmTagException.
Parameter hsmType
:
The type of HSM to use in the cluster. Currently the only allowed value is
hsm1.medium
.
Parameter subnetIds
:
The identifiers (IDs) of the subnets where you are creating the cluster.
You must specify at least one subnet. If you specify multiple subnets,
they must meet the following criteria:
- All subnets must be in the same virtual private cloud (VPC).
- You can specify only one subnet per Availability Zone.
Parameter backupRetentionPolicy
:
A policy that defines how the service retains backups.
Parameter sourceBackupId
:
The identifier (ID) of the cluster backup to restore. Use this value to
restore the cluster from a backup instead of creating a new cluster. To
find the backup ID, use DescribeBackups.
Parameter tagList
:
Tags to apply to the CloudHSM cluster during creation.
Implementation
Future<CreateClusterResponse> createCluster({
required String hsmType,
required List<String> subnetIds,
BackupRetentionPolicy? backupRetentionPolicy,
String? sourceBackupId,
List<Tag>? tagList,
}) async {
ArgumentError.checkNotNull(hsmType, 'hsmType');
ArgumentError.checkNotNull(subnetIds, 'subnetIds');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'BaldrApiService.CreateCluster'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'HsmType': hsmType,
'SubnetIds': subnetIds,
if (backupRetentionPolicy != null)
'BackupRetentionPolicy': backupRetentionPolicy,
if (sourceBackupId != null) 'SourceBackupId': sourceBackupId,
if (tagList != null) 'TagList': tagList,
},
);
return CreateClusterResponse.fromJson(jsonResponse.body);
}