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