mypy-boto3-support-app Type Stubs

1.42.3 · active · verified Sat Apr 11

mypy-boto3-support-app provides comprehensive type annotations for the AWS boto3 SupportApp service, enabling static type checking with tools like mypy and enhancing IDE auto-completion. It is part of the larger `mypy-boto3` project, with its current version 1.42.3 being generated by `mypy-boto3-builder 8.12.0`. The library follows a rapid release cadence, aligning with `boto3` updates and `mypy-boto3-builder` enhancements.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a typed `SupportAppClient` and make an API call using type-hinted request parameters. The `if TYPE_CHECKING:` guard ensures that type imports are only active during static analysis, preventing runtime dependencies.

import boto3
from typing import TYPE_CHECKING
import os

if TYPE_CHECKING:
    from mypy_boto3_support_app.client import SupportAppClient
    from mypy_boto3_support_app.type_defs import CreateCaseRequestRequestTypeDef


def create_support_case(
    subject: str, 
    communication_body: str, 
    service_code: str,
    category_code: str
) -> dict:
    client: SupportAppClient = boto3.client(
        "support-app",
        region_name=os.environ.get('AWS_REGION', 'us-east-1'),
        aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', ''),
        aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', '')
    )

    # Example: Defining a request payload with type hints
    # Note: Replace with actual required parameters for CreateCase API
    request_payload: CreateCaseRequestRequestTypeDef = {
        'subject': subject,
        'communicationBody': communication_body,
        'serviceCode': service_code,
        'categoryCode': category_code,
        'severityCode': 'low',
        'language': 'en'
    }

    try:
        response = client.create_case(**request_payload)
        print(f"Successfully created case: {response.get('caseId')}")
        return response
    except Exception as e:
        print(f"Error creating case: {e}")
        raise

# Example usage (ensure AWS credentials and region are set in environment variables)
# if __name__ == "__main__":
#     # These values are placeholders and would need to be valid for your AWS account
#     # For actual usage, retrieve service and category codes from AWS Support documentation
#     sample_subject = "My application is experiencing an issue."
#     sample_body = "Detailed description of the problem and steps to reproduce."
#     sample_service_code = "amazon-ec2" # Example, replace with actual support service code
#     sample_category_code = "instance-connect" # Example, replace with actual support category code
#     
#     # Uncomment to run the example
#     # create_support_case(sample_subject, sample_body, sample_service_code, sample_category_code)

view raw JSON →