mypy-boto3-migration-hub-refactor-spaces Type Stubs

1.42.3 · active · verified Sat Apr 11

This package provides type annotations for the `boto3` AWS Migration Hub Refactor Spaces service (version 1.42.3), generated by the `mypy-boto3-builder`. It enables static type checking with tools like `mypy` and enhances autocompletion and error detection in IDEs for `boto3` users. The library is actively maintained, with updates typically mirroring `boto3` releases and the `mypy-boto3-builder`'s development cadence.

Warnings

Install

Imports

Quickstart

Demonstrates how to obtain a type-annotated `boto3` client for Migration Hub Refactor Spaces and perform a basic API call with type-checked inputs and outputs. Ensure `boto3` is installed alongside this stub package.

import boto3
from mypy_boto3_migration_hub_refactor_spaces.client import MigrationHubRefactorSpacesClient
from mypy_boto3_migration_hub_refactor_spaces.type_defs import ListEnvironmentsOutputTypeDef
from mypy_boto3_migration_hub_refactor_spaces.literals import EnvironmentStatusType

def get_typed_client() -> MigrationHubRefactorSpacesClient:
    """Returns a type-annotated Migration Hub Refactor Spaces client."""
    # boto3 is the actual runtime library, mypy-boto3-migration-hub-refactor-spaces provides type hints
    client: MigrationHubRefactorSpacesClient = boto3.client("migration-hub-refactor-spaces")
    return client

if __name__ == "__main__":
    refactor_client = get_typed_client()
    
    try:
        # Example: List environments with type-checked response
        environments: ListEnvironmentsOutputTypeDef = refactor_client.list_environments(
            # Add optional filters for type-checking
            MaxResults=100
        )
        print(f"Found {len(environments.get('EnvironmentSummaryList', []))} environments.")

        # Example of using a literal for a parameter
        # This is a placeholder as list_environments doesn't have a status filter directly
        # if environments.get('EnvironmentSummaryList'):
        #     first_env = environments['EnvironmentSummaryList'][0]
        #     if first_env.get('Status') == EnvironmentStatusType.ACTIVE:
        #         print(f"First environment '{first_env.get('Name')}' is active.")

    except refactor_client.exceptions.ResourceNotFoundException:
        print("No Refactor Spaces environments found.")
    except Exception as e:
        print(f"An unexpected error occurred: {e}")

view raw JSON →