mypy-boto3-mgn

1.42.68 · active · verified Sat Apr 11

mypy-boto3-mgn provides type annotations for the AWS Migration Hub rehost service (MGN) within `boto3`. It enhances development with static type checking for clients, paginators, waiters, literals, and type definitions, compatible with tools like mypy, pyright, VSCode, and PyCharm. The package is automatically generated by `mypy-boto3-builder` and is frequently updated to align with `boto3` releases.

Warnings

Install

Imports

Quickstart

This example demonstrates how to initialize an MGN client with type annotations and make a sample API call (`list_waves`). It also shows how to type-hint the response using a generated TypeDef. The `TYPE_CHECKING` block ensures that `mypy-boto3-mgn` is only a development dependency.

import boto3
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from mypy_boto3_mgn import MgnClient
    from mypy_boto3_mgn.type_defs import ListWavesResponseTypeDef

# Instantiate the boto3 client with type hinting
client: MgnClient = boto3.client("mgn")

try:
    # Example API call with typed response
    response: ListWavesResponseTypeDef = client.list_waves(
        maxResults=10
    )
    print("Successfully listed waves:")
    for wave in response.get("items", []):
        print(f"  - Wave ID: {wave.get('waveID')}, Name: {wave.get('name')}")
except client.exceptions.ResourceNotFoundException:
    print("No waves found or region misconfigured.")
except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →