|
1 | 1 | from typing import Dict, Type, Union
|
2 | 2 |
|
3 |
| -from pydantic import BaseModel |
| 3 | +from pydantic import BaseModel, Field |
4 | 4 |
|
5 | 5 |
|
6 | 6 | class AlbRequestContextData(BaseModel):
|
7 |
| - targetGroupArn: str |
| 7 | + targetGroupArn: str = Field( |
| 8 | + description="The ARN of the target group that the request was routed to.", |
| 9 | + examples=[ |
| 10 | + "arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", |
| 11 | + "arn:aws:elasticloadbalancing:eu-west-1:123456789012:targetgroup/api-targets/1234567890123456", |
| 12 | + ], |
| 13 | + ) |
8 | 14 |
|
9 | 15 |
|
10 | 16 | class AlbRequestContext(BaseModel):
|
11 |
| - elb: AlbRequestContextData |
| 17 | + elb: AlbRequestContextData = Field( |
| 18 | + description="Information about the Elastic Load Balancer that processed the request.", |
| 19 | + ) |
12 | 20 |
|
13 | 21 |
|
14 | 22 | class AlbModel(BaseModel):
|
15 |
| - httpMethod: str |
16 |
| - path: str |
17 |
| - body: Union[str, Type[BaseModel]] |
18 |
| - isBase64Encoded: bool |
19 |
| - headers: Dict[str, str] |
20 |
| - queryStringParameters: Dict[str, str] |
21 |
| - requestContext: AlbRequestContext |
| 23 | + httpMethod: str = Field( |
| 24 | + description="The HTTP method used for the request.", |
| 25 | + examples=["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT"], |
| 26 | + ) |
| 27 | + path: str = Field( |
| 28 | + description="The path portion of the request URL.", |
| 29 | + examples=["/", "/api/users", "/health", "/api/v1/products/123"], |
| 30 | + ) |
| 31 | + body: Union[str, Type[BaseModel]] = Field( |
| 32 | + description="The request body. Can be a string or a parsed model if content-type allows parsing.", |
| 33 | + ) |
| 34 | + isBase64Encoded: bool = Field(description="Indicates whether the body is base64-encoded.", examples=[False, True]) |
| 35 | + headers: Dict[str, str] = Field( |
| 36 | + description="The request headers as key-value pairs.", |
| 37 | + examples=[ |
| 38 | + {"host": "example.com", "user-agent": "Mozilla/5.0"}, |
| 39 | + {"content-type": "application/json", "authorization": "Bearer token123"}, |
| 40 | + ], |
| 41 | + ) |
| 42 | + queryStringParameters: Dict[str, str] = Field( |
| 43 | + description="The query string parameters as key-value pairs.", |
| 44 | + examples=[{"page": "1", "limit": "10"}, {"filter": "active", "sort": "name"}], |
| 45 | + ) |
| 46 | + requestContext: AlbRequestContext = Field( |
| 47 | + description="Contains information about the request context, including the load balancer details.", |
| 48 | + ) |
0 commit comments