Skip to content

Examples#

Index > AppMesh > Examples

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

Client#

Implicit type annotations#

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

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

# 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
# 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 types-boto3-lite[appmesh] or a standalone types_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.

# AppMeshClient usage example with type annotations

from boto3.session import Session

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


session = Session()

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

kwargs: CreateGatewayRouteInputRequestTypeDef = {...}
result: CreateGatewayRouteOutputTypeDef = client.create_gateway_route(**kwargs)
# ListGatewayRoutesPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_appmesh.client import AppMeshClient
from types_boto3_appmesh.paginator import ListGatewayRoutesPaginator
from types_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)