Examples#
Auto-generated documentation for CloudHSM type annotations stubs module types-aiobotocore-cloudhsm.
Client#
Implicit type annotations#
Can be used with types-aiobotocore[cloudhsm]
package installed.
Write your CloudHSM
code as usual,
type checking and code completion should work out of the box.
# CloudHSMClient usage example
from aiobotocore.session import get_session
session = get_session()
async with session.create_client("cloudhsm") as client: # (1)
result = await client.add_tags_to_resource() # (2)
- client: CloudHSMClient
- result: AddTagsToResourceResponseTypeDef
# ListHapgsPaginator usage example
from aiobotocore.session import get_session
session = get_session()
async with session.create_client("cloudhsm") as client: # (1)
paginator = client.get_paginator("list_hapgs") # (2)
async for item in paginator.paginate(...):
print(item) # (3)
- client: CloudHSMClient
- paginator: ListHapgsPaginator
- item: ListHapgsResponseTypeDef
Explicit type annotations#
With types-aiobotocore-lite[cloudhsm]
or a standalone types_aiobotocore_cloudhsm
package, you have to explicitly specify
client: CloudHSMClient
type annotation.
All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.
# CloudHSMClient usage example with type annotations
from aiobotocore.session import get_session
from types_aiobotocore_cloudhsm.client import CloudHSMClient
from types_aiobotocore_cloudhsm.type_defs import AddTagsToResourceResponseTypeDef
from types_aiobotocore_cloudhsm.type_defs import AddTagsToResourceRequestRequestTypeDef
session = get_session()
async with session.create_client("cloudhsm") as client:
client: CloudHSMClient
kwargs: AddTagsToResourceRequestRequestTypeDef = {...}
result: AddTagsToResourceResponseTypeDef = await client.add_tags_to_resource(**kwargs)
# ListHapgsPaginator usage example with type annotations
from aiobotocore.session import get_session
from types_aiobotocore_cloudhsm.client import CloudHSMClient
from types_aiobotocore_cloudhsm.paginator import ListHapgsPaginator
from types_aiobotocore_cloudhsm.type_defs import ListHapgsResponseTypeDef
session = get_session()
async with session.create_client("cloudhsm") as client:
client: CloudHSMClient
paginator: ListHapgsPaginator = client.get_paginator("list_hapgs")
async for item in paginator.paginate(...):
item: ListHapgsResponseTypeDef
print(item)