mypy-boto3-migrationhuborchestrator Type Annotations

1.42.3 · active · verified Sat Apr 11

mypy-boto3-migrationhuborchestrator provides type annotations for the `boto3` AWS Migration Hub Orchestrator service, enhancing static analysis and IDE autocompletion for Python projects. It is generated by the `mypy-boto3-builder` and is currently at version 1.42.3, with releases closely tracking `boto3` updates to ensure compatibility and comprehensive type coverage.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use the `mypy-boto3-migrationhuborchestrator` stubs with a `boto3` client to get type-checking for the `list_templates` operation. It includes the recommended `TYPE_CHECKING` guard for imports and handles potential `AccessDeniedException`.

import boto3
from typing import TYPE_CHECKING

# Best practice: guard type imports with if TYPE_CHECKING
if TYPE_CHECKING:
    from mypy_boto3_migrationhuborchestrator import MigrationHubOrchestratorClient
    from mypy_boto3_migrationhuborchestrator.type_defs import TemplateSummaryTypeDef

# Initialize a boto3 client for Migration Hub Orchestrator
client: MigrationHubOrchestratorClient = boto3.client('migrationhuborchestrator')

# Use a method and check its return type
try:
    response = client.list_templates(maxResults=5)
    templates: list[TemplateSummaryTypeDef] = response['Templates']
    for template in templates:
        print(f"Template ID: {template['Id']}, Name: {template['Name']}")
except client.exceptions.AccessDeniedException:
    print("Access denied. Please check your AWS credentials and permissions.")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

# To run mypy:
# 1. pip install mypy boto3 mypy-boto3-migrationhuborchestrator
# 2. mypy your_script_name.py

view raw JSON →