Skip to content

Feature request: Add Pydantic Models For boto3 #6705

Open
@CoreOxide

Description

@CoreOxide

Use case

Allow using boto3 payloads \ responses as Python classes - more specifically - Pydantic classes.
This would eliminate the guesswork in filling field values, or constantly having to model response payloads.

Solution/User Experience

Lets take a look at a practical example:

import boto3

from aws_resource_validator.pydantic_models.dynamodb.dynamodb_classes import ListTablesOutput

dynamodb = boto3.client('dynamodb')

def list_dynamo_tables() -> List[str]:
    tables: ListTablesOutput = ListTablesOutput(**dynamodb.list_tables())
    return tables.TableNames


if __name__ == "__main__":
    tables: List[str] = list_dynamo_tables()
    print("DynamoDB Tables:", tables)

As you can see, the tables variable acts as a Python class, and you can access it's properties with .. All of it's fields already have types.

This is opposed to accessing the fields as dict keys, and receiving a value of unknown type.
As Powertools is all about ease of use and user experience, so I feel like it would be a great new home for AWS Resource Validator.

Alternative solutions

Instructing user to consume the library independently.

Acknowledgment

Metadata

Metadata

Labels

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions