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.
Parameters:
-
cluster_id
(ClusterId)
–
The identifier (ID) of the HSM's cluster. To find the cluster ID, use DescribeClusters.
-
availability_zone
(ExternalAz)
–
The Availability Zone where you are creating the HSM. To find the cluster's Availability Zones, use DescribeClusters.
-
ip_address
(Optional[IpAddress], default:
None
)
–
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.
Raises:
Source code in docs_src/capo_cloudhsm_v2/_services/cloud_hsmv2.py
| def create_hsm(
self,
cluster_id: "capo_cloudhsm_v2.types.cluster_id.ClusterId",
availability_zone: "capo_cloudhsm_v2.types.external_az.ExternalAz",
*,
config_overrides: Optional[CloudHSMV2ClientConfig] = None,
ip_address: Optional["capo_cloudhsm_v2.types.ip_address.IpAddress"] = None,
) -> "capo_cloudhsm_v2.types.create_hsm_response.CreateHsmResponse":
"""<p>Creates a new hardware security module (HSM) in the specified CloudHSM cluster.</p> <p> <b>Cross-account use:</b> No. You cannot perform this operation on an CloudHSM cluster in a different Amazon Web Service account.</p>
Args:
cluster_id: <p>The identifier (ID) of the HSM's cluster. To find the cluster ID, use <a>DescribeClusters</a>.</p>
availability_zone: <p>The Availability Zone where you are creating the HSM. To find the cluster's Availability Zones, use <a>DescribeClusters</a>.</p>
ip_address: <p>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.</p>
Raises:
capo_cloudhsm_v2.errors.cloud_hsm_access_denied_exception.CloudHsmAccessDeniedException: <p>The request was rejected because the requester does not have permission to perform the requested operation.</p>
capo_cloudhsm_v2.errors.cloud_hsm_internal_failure_exception.CloudHsmInternalFailureException: <p>The request was rejected because of an CloudHSM internal failure. The request can be retried.</p>
capo_cloudhsm_v2.errors.cloud_hsm_invalid_request_exception.CloudHsmInvalidRequestException: <p>The request was rejected because it is not a valid request.</p>
capo_cloudhsm_v2.errors.cloud_hsm_resource_not_found_exception.CloudHsmResourceNotFoundException: <p>The request was rejected because it refers to a resource that cannot be found.</p>
capo_cloudhsm_v2.errors.cloud_hsm_service_exception.CloudHsmServiceException: <p>The request was rejected because an error occurred.</p>
capo_cloudhsm_v2.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_cloudhsm_v2.types.create_hsm_request.CreateHsmRequest]",
) -> OperationResponse[
"capo_cloudhsm_v2.types.create_hsm_response.CreateHsmResponse"
]:
import capo_cloudhsm_v2._operations.baldr_api_service.create_hsm
output, http_response = (
capo_cloudhsm_v2._operations.baldr_api_service.create_hsm.create_hsm(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateHsm")
)
input_: capo_cloudhsm_v2.types.create_hsm_request.CreateHsmRequest = {
"cluster_id": cluster_id,
"availability_zone": availability_zone,
}
if ip_address is not None:
input_["ip_address"] = ip_address
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|