Type Annotations for Boto3 Bedrock Data Automation

1.42.82 · active · verified Sat Apr 11

This library provides type annotations for the `boto3` AWS SDK, specifically for the Bedrock Data Automation service. It enables static type checking tools like `mypy` to validate interactions with the service, improving code quality and catching potential errors at development time. It is generated by the `mypy-boto3-builder` project and is frequently updated to align with `boto3` and AWS API changes. The current version is 1.42.82.

Warnings

Install

Imports

Quickstart

This example demonstrates how to initialize a `boto3` client with `mypy-boto3-bedrock-data-automation` type hints and perform a simple API call (listing jobs). The `TYPE_CHECKING` block ensures type hints are only active during static analysis, avoiding runtime overhead. Replace `list_data_automation_jobs` with other service calls as needed.

import boto3
from mypy_boto3_bedrock_data_automation.client import BedrockDataAutomationClient
from mypy_boto3_bedrock_data_automation.type_defs import ListDataAutomationJobsRequestRequestTypeDef
from typing import TYPE_CHECKING
import os

# Ensure boto3 is configured, e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION_NAME env vars
# Or configure a session explicitly: boto3.Session(region_name="us-east-1")

if TYPE_CHECKING:
    client: BedrockDataAutomationClient = boto3.client("bedrock-data-automation")
else:
    client = boto3.client("bedrock-data-automation")

# Example: List data automation jobs
try:
    print("Listing Bedrock Data Automation jobs...")
    response = client.list_data_automation_jobs()
    jobs = response.get("dataAutomationJobs", [])
    
    if jobs:
        print(f"Found {len(jobs)} jobs:")
        for job in jobs:
            print(f"  Job ID: {job.get('jobId')}, Status: {job.get('status')}, Created: {job.get('creationTime')}")
    else:
        print("No Bedrock Data Automation jobs found.")

except client.exceptions.ServiceException as e:
    print(f"AWS Service Error: {e.response['Error']['Code']} - {e.response['Error']['Message']}")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

view raw JSON →