Type Annotations for boto3 Route53RecoveryCluster

1.42.3 · active · verified Sat Apr 11

This library provides comprehensive type annotations for the `boto3` AWS SDK's Route53RecoveryCluster service (version 1.42.3), generated by `mypy-boto3-builder` 8.12.0. It enhances development with static type checking, autocompletion, and early error detection for `boto3` calls related to Route53RecoveryCluster. The project is actively maintained, with new versions frequently released, often in sync with `boto3` updates and `mypy-boto3-builder` enhancements.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a type-hinted `Route53RecoveryClusterClient` and call a basic operation like `list_clusters`. The `TYPE_CHECKING` block ensures that `mypy` can use the specific client type for robust static analysis, while allowing the code to run without `mypy-boto3` dependencies in production. Remember to replace placeholder credentials with actual AWS configuration or environment variables.

import boto3
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from mypy_boto3_route53_recovery_cluster.client import Route53RecoveryClusterClient
    from mypy_boto3_route53_recovery_cluster.type_defs import ListClustersResponseTypeDef


def get_recovery_cluster_info() -> ListClustersResponseTypeDef:
    # It's recommended to explicitly type the client for best autocompletion and type checking.
    client: Route53RecoveryClusterClient = boto3.client(
        "route53-recovery-cluster",
        region_name="us-east-1", # Replace with your region
        aws_access_key_id="AKIATEST", # Use os.environ.get('AWS_ACCESS_KEY_ID', '') in real code
        aws_secret_access_key="SECRETLONGKEY", # Use os.environ.get('AWS_SECRET_ACCESS_KEY', '')
        aws_session_token="SESSIONTOKEN" # Use os.environ.get('AWS_SESSION_TOKEN', '') if applicable
    )

    response = client.list_clusters()
    print(f"Clusters: {response.get('Clusters')}")
    return response

if __name__ == "__main__":
    # This part would typically run in a properly configured AWS environment
    # For this example, we'll just print a placeholder as credentials are not live
    print("--- Mocking AWS client call for quickstart ---")
    if TYPE_CHECKING:
        result = get_recovery_cluster_info()
        print(f"Mocked Cluster List (Type-checked): {result.get('Clusters')}")
    else:
        print("Run mypy to check types. Actual execution requires AWS credentials.")

view raw JSON →