Examples#
Index > CloudHSMV2 > Examples
Auto-generated documentation for CloudHSMV2 type annotations stubs module types-boto3-cloudhsmv2.
Client#
Implicit type annotations#
Can be used with types-boto3[cloudhsmv2]
package installed.
Write your CloudHSMV2
code as usual,
type checking and code completion should work out of the box.
# CloudHSMV2Client usage example
from boto3.session import Session
session = Session()
client = session.client("cloudhsmv2") # (1)
result = client.copy_backup_to_region() # (2)
- client: CloudHSMV2Client
- result: CopyBackupToRegionResponseTypeDef
# DescribeBackupsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("cloudhsmv2") # (1)
paginator = client.get_paginator("describe_backups") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: CloudHSMV2Client
- paginator: DescribeBackupsPaginator
- item: DescribeBackupsResponseTypeDef
Explicit type annotations#
With types-boto3-lite[cloudhsmv2]
or a standalone types_boto3_cloudhsmv2
package, you have to explicitly specify client: CloudHSMV2Client
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.
# CloudHSMV2Client usage example with type annotations
from boto3.session import Session
from types_boto3_cloudhsmv2.client import CloudHSMV2Client
from types_boto3_cloudhsmv2.type_defs import CopyBackupToRegionResponseTypeDef
from types_boto3_cloudhsmv2.type_defs import CopyBackupToRegionRequestRequestTypeDef
session = Session()
client: CloudHSMV2Client = session.client("cloudhsmv2")
kwargs: CopyBackupToRegionRequestRequestTypeDef = {...}
result: CopyBackupToRegionResponseTypeDef = client.copy_backup_to_region(**kwargs)
# DescribeBackupsPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_cloudhsmv2.client import CloudHSMV2Client
from types_boto3_cloudhsmv2.paginator import DescribeBackupsPaginator
from types_boto3_cloudhsmv2.type_defs import DescribeBackupsResponseTypeDef
session = Session()
client: CloudHSMV2Client = session.client("cloudhsmv2")
paginator: DescribeBackupsPaginator = client.get_paginator("describe_backups")
for item in paginator.paginate(...):
item: DescribeBackupsResponseTypeDef
print(item)