Skip to content

Examples#

Index > AppMesh > Examples

Auto-generated documentation for AppMesh type annotations stubs module types-aiobotocore-appmesh.

Client#

Implicit type annotations#

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

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

# AppMeshClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("appmesh") as client:  # (1)
    result = await client.create_gateway_route()  # (2)
  1. client: AppMeshClient
  2. result: CreateGatewayRouteOutputTypeDef
# ListGatewayRoutesPaginator usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("appmesh") as client:  # (1)
    paginator = client.get_paginator("list_gateway_routes")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: AppMeshClient
  2. paginator: ListGatewayRoutesPaginator
  3. item: ListGatewayRoutesOutputTypeDef

Explicit type annotations#

With types-aiobotocore-lite[appmesh] or a standalone types_aiobotocore_appmesh package, you have to explicitly specify client: AppMeshClient 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.

# AppMeshClient usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_appmesh.client import AppMeshClient
from types_aiobotocore_appmesh.type_defs import CreateGatewayRouteOutputTypeDef
from types_aiobotocore_appmesh.type_defs import CreateGatewayRouteInputRequestTypeDef


session = get_session()

async with session.create_client("appmesh") as client:
    client: AppMeshClient
    kwargs: CreateGatewayRouteInputRequestTypeDef = {...}
    result: CreateGatewayRouteOutputTypeDef = await client.create_gateway_route(**kwargs)
# ListGatewayRoutesPaginator usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_appmesh.client import AppMeshClient
from types_aiobotocore_appmesh.paginator import ListGatewayRoutesPaginator
from types_aiobotocore_appmesh.type_defs import ListGatewayRoutesOutputTypeDef


session = get_session()

async with session.create_client("appmesh") as client:
    client: AppMeshClient
    paginator: ListGatewayRoutesPaginator = client.get_paginator("list_gateway_routes")
    async for item in paginator.paginate(...):
        item: ListGatewayRoutesOutputTypeDef
        print(item)