Getting Started
Installation
pip install capo-cloudhsm-v2
Usage
from capo_cloudhsm_v2 import AsyncCloudHSMV2Client
async def main():
async with AsyncCloudHSMV2Client() as cloud_hsmv2:
# Example: call the copy_backup_to_region operation
response = await cloud_hsmv2.copy_backup_to_region()
print(response["destination_backup"])
Pagination
Some operations in this SDK support pagination. If the operation supports pagination it will have an iter_ prefixed method that returns an async iterator.
from capo_cloudhsm_v2 import AsyncCloudHSMV2Client
async def main():
async with AsyncCloudHSMV2Client() as cloud_hsmv2:
# Example: paginate over describe_backups
async for item in cloud_hsmv2.iter_describe_backups():
print(item)
Error Handling
The SDK raises exceptions for errors returned by the API. Catch them to handle failures gracefully.
from capo_cloudhsm_v2 import AsyncCloudHSMV2Client
from capo_cloudhsm_v2.error import CloudHsmAccessDeniedException
async def main():
async with AsyncCloudHSMV2Client() as cloud_hsmv2:
try:
await cloud_hsmv2.copy_backup_to_region()
except CloudHsmAccessDeniedException as e:
print(f"Error: {e}")
print(e.data) # additional error data
Retrying
The SDK retries failed operations automatically. Retry behaviour follows the Smithy specification: errors are retried based on their is_retryable and is_throttling_error attributes. Throttling errors use a longer base delay. Network-level failures (connection errors and timeouts) are also retried. Non-retryable errors, such as client errors without the @retryable trait, are raised immediately without further attempts.
The number of attempts defaults to 3 and can be changed at the client level via retry_max_attempts, or per call via config_overrides.
from capo_cloudhsm_v2 import AsyncCloudHSMV2Client
async def main():
async with AsyncCloudHSMV2Client() as cloud_hsmv2:
# Default: 3 attempts for every operation
response = await cloud_hsmv2.copy_backup_to_region()
# Override per operation
response = await cloud_hsmv2.copy_backup_to_region(config_overrides={"retry_max_attempts": 5})
# Disable retries for this call
response = await cloud_hsmv2.copy_backup_to_region(config_overrides={"retry_max_attempts": 1})
Metadata
Release files for capo-cloudhsm-v2 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| capo_cloudhsm_v2-0.4.0.tar.gz | 86.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| capo_cloudhsm_v2-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 244.0 kB
Release files / capo_cloudhsm_v2-0.4.0.tar.gz
| Download URL | capo_cloudhsm_v2-0.4.0.tar.gz |
|---|---|
| Size | 86.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
36b4617ea3d74f428e0f05df50d9528b11e006cc37b22cab414d4b1434524fcf
|
|
BLAKE2b-256 checksum How to use checksums |
b5e63c6e5cd78d36b9edbd4ba18c023f2a89077e7e9f44792ea32fe3d62513cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / capo_cloudhsm_v2-0.4.0-py3-none-any.whl
| Download URL | capo_cloudhsm_v2-0.4.0-py3-none-any.whl |
|---|---|
| Size | 157.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
81ea8fdeef2dffcf0ef46e35e1a3ea297c85eab6985fd285f1724fb95e7b2084
|
|
BLAKE2b-256 checksum How to use checksums |
d6a76ffaf30a5e134d5432ebf31cb76aa1335a88040e56f5979a27edf43911e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|