Skip to content

Examples#

Index > MigrationHub > Examples

Auto-generated documentation for MigrationHub type annotations stubs module types-aiobotocore-mgh.

Client#

Implicit type annotations#

Can be used with types-aiobotocore[mgh] package installed.

Write your MigrationHub code as usual, type checking and code completion should work out of the box.

# MigrationHubClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("mgh") as client:  # (1)
    result = await client.describe_application_state()  # (2)
  1. client: MigrationHubClient
  2. result: DescribeApplicationStateResultTypeDef
# ListApplicationStatesPaginator usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("mgh") as client:  # (1)
    paginator = client.get_paginator("list_application_states")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: MigrationHubClient
  2. paginator: ListApplicationStatesPaginator
  3. item: ListApplicationStatesResultTypeDef

Explicit type annotations#

With types-aiobotocore-lite[mgh] or a standalone types_aiobotocore_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 aiobotocore.session import get_session

from types_aiobotocore_mgh.client import MigrationHubClient
from types_aiobotocore_mgh.type_defs import DescribeApplicationStateResultTypeDef
from types_aiobotocore_mgh.type_defs import DescribeApplicationStateRequestRequestTypeDef


session = get_session()

async with session.create_client("mgh") as client:
    client: MigrationHubClient
    kwargs: DescribeApplicationStateRequestRequestTypeDef = {...}
    result: DescribeApplicationStateResultTypeDef = await client.describe_application_state(**kwargs)
# ListApplicationStatesPaginator usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_mgh.client import MigrationHubClient
from types_aiobotocore_mgh.paginator import ListApplicationStatesPaginator
from types_aiobotocore_mgh.type_defs import ListApplicationStatesResultTypeDef


session = get_session()

async with session.create_client("mgh") as client:
    client: MigrationHubClient
    paginator: ListApplicationStatesPaginator = client.get_paginator("list_application_states")
    async for item in paginator.paginate(...):
        item: ListApplicationStatesResultTypeDef
        print(item)