1111
1212
1313class CloudWatchLogsLogEvent (BaseModel ):
14- id : str # noqa AA03 VNE003
15- timestamp : datetime
16- message : Union [str , Type [BaseModel ]]
14+ id : str = Field (
15+ description = "Unique identifier for the log event within the batch." ,
16+ examples = ["eventId1" , "abc123def456" ],
17+ )
18+ timestamp : datetime = Field (
19+ description = "The time when the event occurred in milliseconds since Jan 1, 1970 00:00:00 UTC." ,
20+ examples = [1673779200000 ],
21+ )
22+ message : Union [str , Type [BaseModel ]] = Field (
23+ description = "The actual log message string or structured JSON payload emitted by the service or application." ,
24+ examples = ["This is a sample log message" , '{"statusCode":200,"path":"/hello"}' ],
25+ )
1726
1827
1928class CloudWatchLogsDecode (BaseModel ):
20- messageType : str
21- owner : str
22- logGroup : str
23- logStream : str
24- subscriptionFilters : List [str ]
25- logEvents : List [CloudWatchLogsLogEvent ]
26- policyLevel : Optional [str ] = None
29+ messageType : str = Field (
30+ description = "The type of CloudWatch Logs message." ,
31+ examples = ["DATA_MESSAGE" , "CONTROL_MESSAGE" ],
32+ )
33+ owner : str = Field (description = "The AWS account ID of the originating log data." , examples = ["123456789012" ])
34+ logGroup : str = Field (
35+ description = "The name of the log group that contains the log stream." ,
36+ examples = ["/aws/lambda/my-function" , "/aws/apigateway/my-api" ],
37+ )
38+ logStream : str = Field (
39+ description = "The name of the log stream that stores the log events." ,
40+ examples = ["2023/01/15/[$LATEST]abcdef1234567890" , "i-1234567890abcdef0" ],
41+ )
42+ subscriptionFilters : List [str ] = Field (
43+ description = "List of subscription filter names associated with the log group." ,
44+ examples = [["LambdaStream_cloudwatch" , "AlertFilter" ]],
45+ )
46+ logEvents : List [CloudWatchLogsLogEvent ] = Field (
47+ description = "Array of log events included in the message." ,
48+ examples = [[{"id" : "eventId1" , "timestamp" : 1673779200000 , "message" : "Sample log line" }]],
49+ )
50+ policyLevel : Optional [str ] = Field (
51+ default = None ,
52+ description = "Optional field specifying the policy level applied to the subscription filter, if present." ,
53+ examples = ["ACCOUNT" , "LOG_GROUP" ],
54+ )
2755
2856
2957class CloudWatchLogsData (BaseModel ):
30- decoded_data : CloudWatchLogsDecode = Field (..., alias = "data" )
58+ decoded_data : CloudWatchLogsDecode = Field (
59+ ...,
60+ alias = "data" ,
61+ description = "Decoded CloudWatch log data payload after base64 decoding and decompression." ,
62+ )
3163
3264 @field_validator ("decoded_data" , mode = "before" )
3365 def prepare_data (cls , value ):
@@ -42,4 +74,6 @@ def prepare_data(cls, value):
4274
4375
4476class CloudWatchLogsModel (BaseModel ):
45- awslogs : CloudWatchLogsData
77+ awslogs : CloudWatchLogsData = Field (
78+ description = "Top-level CloudWatch Logs model containing the AWS logs data section." ,
79+ )
0 commit comments