Type Annotations for boto3 SecurityLake

1.42.3 · active · verified Sat Apr 11

mypy-boto3-securitylake provides static type annotations for the AWS SDK for Python (boto3) specifically for the SecurityLake service. It enhances development experience by enabling IDE autocompletion and static type checking with tools like MyPy, addressing the dynamic nature of boto3's client generation. This package is generated by the `mypy-boto3-builder` and is currently at version 1.42.3, typically released in sync with `boto3` updates.

Warnings

Install

Imports

Quickstart

Demonstrates how to import and use the `SecurityLakeClient` for type-hinted interaction with AWS SecurityLake, including fetching data lakes and their details. Explicit type annotations are shown for clarity and improved IDE experience.

import boto3
from mypy_boto3_securitylake.client import SecurityLakeClient
from mypy_boto3_securitylake.type_defs import ListDataLakesResponseTypeDef
import os

def get_securitylake_data_lakes() -> ListDataLakesResponseTypeDef:
    # It's recommended to explicitly type the client for best IDE support
    client: SecurityLakeClient = boto3.client(
        "securitylake", 
        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', '')
    )
    response = client.list_data_lakes()
    return response

if __name__ == "__main__":
    data_lakes = get_securitylake_data_lakes()
    print(f"Found {len(data_lakes.get('DataLakes', []))} data lakes:")
    for dl in data_lakes.get('DataLakes', []):
        print(f"- Region: {dl['Region']}, ARN: {dl['DataLakeArn']}")

view raw JSON →