Skip to content

Examples#

Index > AppMesh > Examples

Auto-generated documentation for AppMesh type annotations stubs module mypy-boto3-appmesh.

Client#

Implicit type annotations#

Can be used with boto3-stubs[appmesh] package installed.

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

Client method usage example#

# AppMeshClient usage example

from boto3.session import Session


session = Session()

client = session.client("appmesh")  # (1)
result = client.create_gateway_route()  # (2)
  1. client: AppMeshClient
  2. result: CreateGatewayRouteOutputTypeDef

Paginator usage example#

# ListGatewayRoutesPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("appmesh")  # (1)

paginator = client.get_paginator("list_gateway_routes")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: AppMeshClient
  2. paginator: ListGatewayRoutesPaginator
  3. item: ListGatewayRoutesOutputTypeDef

Explicit type annotations#

With boto3-stubs-lite[appmesh] or a standalone mypy_boto3_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.

Client method usage example#

# AppMeshClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_appmesh.client import AppMeshClient
from mypy_boto3_appmesh.type_defs import CreateGatewayRouteOutputTypeDef
from mypy_boto3_appmesh.type_defs import CreateGatewayRouteInputTypeDef


session = Session()

client: AppMeshClient = session.client("appmesh")

kwargs: CreateGatewayRouteInputTypeDef = {...}
result: CreateGatewayRouteOutputTypeDef = client.create_gateway_route(**kwargs)

Paginator usage example#

# ListGatewayRoutesPaginator usage example with type annotations

from boto3.session import Session

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


session = Session()
client: AppMeshClient = session.client("appmesh")

paginator: ListGatewayRoutesPaginator = client.get_paginator("list_gateway_routes")
for item in paginator.paginate(...):
    item: ListGatewayRoutesOutputTypeDef
    print(item)