CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-aws-lambda-powertools

Comprehensive developer toolkit implementing serverless best practices for AWS Lambda functions in Python

89

1.21x
Overview
Eval results
Files

task.mdevals/scenario-7/

Multi-Source Event Processor

A Lambda function that processes events from multiple AWS services and extracts relevant data in a type-safe manner.

Capabilities

Process SQS Events

  • Extracts message body, receipt handle, and message attributes from SQS events @test
  • Handles batch of 3 SQS messages and returns list of extracted data @test

Process S3 Events

  • Extracts bucket name, object key, and event name from S3 events @test
  • Decodes URL-encoded object keys correctly @test

Process DynamoDB Stream Events

  • Extracts new and old images from DynamoDB stream records @test
  • Converts DynamoDB types to Python native types @test

Process API Gateway Events

  • Extracts HTTP method, path, query parameters, and headers from API Gateway REST events @test
  • Performs case-insensitive header lookup @test

Implementation

@generates

API

def process_sqs_event(event: dict) -> list[dict]:
    """
    Process SQS event and extract message details.

    Args:
        event: Raw SQS event dictionary

    Returns:
        List of dictionaries containing:
        - body: Message body as string
        - receipt_handle: Receipt handle for the message
        - attributes: Message attributes dictionary
    """
    pass

def process_s3_event(event: dict) -> list[dict]:
    """
    Process S3 event and extract object details.

    Args:
        event: Raw S3 event dictionary

    Returns:
        List of dictionaries containing:
        - bucket: Bucket name
        - key: Object key (URL-decoded)
        - event_name: Event name (e.g., 'ObjectCreated:Put')
    """
    pass

def process_dynamodb_event(event: dict) -> list[dict]:
    """
    Process DynamoDB stream event and extract record details.

    Args:
        event: Raw DynamoDB stream event dictionary

    Returns:
        List of dictionaries containing:
        - event_name: Event name (INSERT, MODIFY, REMOVE)
        - new_image: New image as native Python dict (None for REMOVE)
        - old_image: Old image as native Python dict (None for INSERT)
    """
    pass

def process_apigateway_event(event: dict) -> dict:
    """
    Process API Gateway REST event and extract request details.

    Args:
        event: Raw API Gateway REST event dictionary

    Returns:
        Dictionary containing:
        - method: HTTP method
        - path: Request path
        - query_params: Query string parameters as dict
        - user_agent: User-Agent header value (case-insensitive lookup)
    """
    pass

Dependencies { .dependencies }

aws-lambda-powertools { .dependency }

Provides type-safe event source data classes for AWS Lambda events.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/pypi-aws-lambda-powertools

tile.json