mypy-boto3-appmesh

1.42.3 · active · verified Sat Apr 11

mypy-boto3-appmesh provides type annotations for the boto3 AppMesh 1.42.3 service, generated using mypy-boto3-builder 8.12.0. This library enhances type checking and IDE autocompletion for AWS SDK usage in Python projects. It is part of the larger `mypy-boto3` ecosystem which aims to provide comprehensive type hints for all boto3 services and closely follows boto3's release cycle.

Warnings

Install

Imports

Quickstart

This example demonstrates how to initialize a typed AppMesh client and use it to list existing meshes. Type hints provide autocompletion and static analysis for client methods and their responses. The `TYPE_CHECKING` guard ensures `mypy-boto3-appmesh` is only a development dependency.

import os
from typing import TYPE_CHECKING
import boto3

if TYPE_CHECKING:
    from mypy_boto3_appmesh import AppMeshClient
    from mypy_boto3_appmesh.type_defs import ListMeshesResponseTypeDef

# Ensure AWS credentials are configured (e.g., via environment variables or ~/.aws/credentials)
# For example:
# os.environ['AWS_ACCESS_KEY_ID'] = os.environ.get('AWS_ACCESS_KEY_ID', 'YOUR_ACCESS_KEY')
# os.environ['AWS_SECRET_ACCESS_KEY'] = os.environ.get('AWS_SECRET_ACCESS_KEY', 'YOUR_SECRET_KEY')
# os.environ['AWS_REGION'] = os.environ.get('AWS_REGION', 'us-east-1')

def list_app_meshes() -> None:
    session = boto3.Session()
    client: AppMeshClient = session.client("appmesh")

    try:
        # Using explicit type annotation for the response for demonstration
        response: ListMeshesResponseTypeDef = client.list_meshes()
        print("App Mesh Meshes:")
        for mesh in response.get("meshes", []):
            print(f"  - {mesh.get('meshName')}")
    except Exception as e:
        print(f"Error listing App Meshes: {e}")

if __name__ == "__main__":
    list_app_meshes()

view raw JSON →