initializeCluster method

Future<InitializeClusterResponse> initializeCluster({
  1. required String clusterId,
  2. required String signedCert,
  3. required String trustAnchor,
})

Claims an AWS CloudHSM cluster by submitting the cluster certificate issued by your issuing certificate authority (CA) and the CA's root certificate. Before you can claim a cluster, you must sign the cluster's certificate signing request (CSR) with your issuing CA. To get the cluster's CSR, use DescribeClusters.

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

Parameter clusterId : The identifier (ID) of the cluster that you are claiming. To find the cluster ID, use DescribeClusters.

Parameter signedCert : The cluster certificate issued (signed) by your issuing certificate authority (CA). The certificate must be in PEM format and can contain a maximum of 5000 characters.

Parameter trustAnchor : The issuing certificate of the issuing certificate authority (CA) that issued (signed) the cluster certificate. You must use a self-signed certificate. The certificate used to sign the HSM CSR must be directly available, and thus must be the root certificate. The certificate must be in PEM format and can contain a maximum of 5000 characters.

Implementation

Future<InitializeClusterResponse> initializeCluster({
  required String clusterId,
  required String signedCert,
  required String trustAnchor,
}) async {
  ArgumentError.checkNotNull(clusterId, 'clusterId');
  ArgumentError.checkNotNull(signedCert, 'signedCert');
  _s.validateStringLength(
    'signedCert',
    signedCert,
    0,
    5000,
    isRequired: true,
  );
  ArgumentError.checkNotNull(trustAnchor, 'trustAnchor');
  _s.validateStringLength(
    'trustAnchor',
    trustAnchor,
    0,
    5000,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'BaldrApiService.InitializeCluster'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ClusterId': clusterId,
      'SignedCert': signedCert,
      'TrustAnchor': trustAnchor,
    },
  );

  return InitializeClusterResponse.fromJson(jsonResponse.body);
}