Open
Description
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
- This feature request meets Powertools for AWS Lambda (Python) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Java, TypeScript, and .NET
Metadata
Metadata
Assignees
Type
Projects
Status
Triage