aws-lambda-powertools 3.6.1a9__py3-none-any.whl → 3.7.1a0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  """Exposes version constant to avoid circular dependencies."""
2
2
 
3
- VERSION = "3.6.1a9"
3
+ VERSION = "3.7.1a0"
@@ -0,0 +1,418 @@
1
+ from __future__ import annotations
2
+
3
+ from datetime import datetime
4
+ from typing import Any, Literal
5
+
6
+ from aws_lambda_powertools.utilities.data_classes.common import DictWrapper
7
+
8
+ EVENT_CRUD_OPERATION = Literal["CREATED", "UPDATED", "DELETED"]
9
+ EVENT_ADD_REMOVE_OPERATION = Literal["ADDED", "REMOVED"]
10
+
11
+
12
+ class IoTCoreRegistryEventsBase(DictWrapper):
13
+ @property
14
+ def event_id(self) -> str:
15
+ """
16
+ The unique identifier for the event.
17
+ """
18
+ return self["eventId"]
19
+
20
+ @property
21
+ def timestamp(self) -> datetime:
22
+ """
23
+ The timestamp of the event.
24
+
25
+ The timestamp is in Unix format (seconds or milliseconds).
26
+ If it's 10 digits long, it represents seconds;
27
+ if it's 13 digits, it's in milliseconds and is converted to seconds.
28
+ """
29
+ ts = self["timestamp"]
30
+ return datetime.fromtimestamp(ts / 1000 if ts > 10**10 else ts)
31
+
32
+
33
+ class IoTCoreThingEvent(IoTCoreRegistryEventsBase):
34
+ """
35
+ Thing Created/Updated/Deleted
36
+ The registry publishes event messages when things are created, updated, or deleted.
37
+ """
38
+
39
+ @property
40
+ def event_type(self) -> Literal["THING_EVENT"]:
41
+ """
42
+ The event type, which will always be "THING_EVENT".
43
+ """
44
+ return self["eventType"]
45
+
46
+ @property
47
+ def operation(self) -> str:
48
+ """
49
+ The operation type for the event (e.g., CREATED, UPDATED, DELETED).
50
+ """
51
+ return self["operation"]
52
+
53
+ @property
54
+ def thing_id(self) -> str:
55
+ """
56
+ The unique identifier for the thing.
57
+ """
58
+ return self["thingId"]
59
+
60
+ @property
61
+ def account_id(self) -> str:
62
+ """
63
+ The account ID associated with the event.
64
+ """
65
+ return self["accountId"]
66
+
67
+ @property
68
+ def thing_name(self) -> str:
69
+ """
70
+ The name of the thing.
71
+ """
72
+ return self["thingName"]
73
+
74
+ @property
75
+ def version_number(self) -> int:
76
+ """
77
+ The version number of the thing.
78
+ """
79
+ return self["versionNumber"]
80
+
81
+ @property
82
+ def thing_type_name(self) -> str | None:
83
+ """
84
+ The thing type name if available, or None if not specified.
85
+ """
86
+ return self.get("thingTypeName")
87
+
88
+ @property
89
+ def attributes(self) -> dict[str, Any]:
90
+ """
91
+ The dictionary of attributes associated with the thing.
92
+ """
93
+ return self["attributes"]
94
+
95
+
96
+ class IoTCoreThingTypeEvent(IoTCoreRegistryEventsBase):
97
+ """
98
+ Thing Type Created/Updated/Deprecated/Undeprecated/Deleted
99
+ The registry publishes event messages when thing types are created, updated, deprecated, undeprecated, or deleted.
100
+ """
101
+
102
+ @property
103
+ def event_type(self) -> str:
104
+ """
105
+ The event type, corresponding to a thing type event.
106
+ """
107
+ return self["eventType"]
108
+
109
+ @property
110
+ def operation(self) -> EVENT_CRUD_OPERATION:
111
+ """
112
+ The operation performed on the thing type (e.g., CREATED, UPDATED, DELETED).
113
+ """
114
+ return self["operation"]
115
+
116
+ @property
117
+ def account_id(self) -> str:
118
+ """
119
+ The account ID associated with the event.
120
+ """
121
+ return self["accountId"]
122
+
123
+ @property
124
+ def thing_type_id(self) -> str:
125
+ """
126
+ The unique identifier for the thing type.
127
+ """
128
+ return self["thingTypeId"]
129
+
130
+ @property
131
+ def thing_type_name(self) -> str:
132
+ """
133
+ The name of the thing type.
134
+ """
135
+ return self["thingTypeName"]
136
+
137
+ @property
138
+ def is_deprecated(self) -> bool:
139
+ """
140
+ Whether the thing type is marked as deprecated.
141
+ """
142
+ return self["isDeprecated"]
143
+
144
+ @property
145
+ def deprecation_date(self) -> datetime | None:
146
+ """
147
+ The deprecation date of the thing type, or None if not available.
148
+ """
149
+ return datetime.fromisoformat(self["deprecationDate"]) if self.get("deprecationDate") else None
150
+
151
+ @property
152
+ def searchable_attributes(self) -> list[str]:
153
+ """
154
+ The list of attributes that are searchable for the thing type.
155
+ """
156
+ return self["searchableAttributes"]
157
+
158
+ @property
159
+ def propagating_attributes(self) -> list[dict[str, str]]:
160
+ """
161
+ The list of attributes to propagate for the thing type.
162
+ """
163
+ return self["propagatingAttributes"]
164
+
165
+ @property
166
+ def description(self) -> str:
167
+ """
168
+ The description of the thing type.
169
+ """
170
+ return self["description"]
171
+
172
+
173
+ class IoTCoreThingTypeAssociationEvent(IoTCoreRegistryEventsBase):
174
+ """
175
+ The registry publishes event messages when a thing type is associated or disassociated with a thing.
176
+ """
177
+
178
+ @property
179
+ def event_type(self) -> str:
180
+ """
181
+ The event type, related to the thing type association event.
182
+ """
183
+ return self["eventType"]
184
+
185
+ @property
186
+ def operation(self) -> Literal["THING_TYPE_ASSOCIATION_EVENT"]:
187
+ """
188
+ The operation type, which is always "THING_TYPE_ASSOCIATION_EVENT".
189
+ """
190
+ return self["operation"]
191
+
192
+ @property
193
+ def thing_id(self) -> str:
194
+ """
195
+ The unique identifier for the associated thing.
196
+ """
197
+ return self["thingId"]
198
+
199
+ @property
200
+ def thing_name(self) -> str:
201
+ """
202
+ The name of the associated thing.
203
+ """
204
+ return self["thingName"]
205
+
206
+ @property
207
+ def thing_type_name(self) -> str:
208
+ """
209
+ The name of the associated thing type.
210
+ """
211
+ return self["thingTypeName"]
212
+
213
+
214
+ class IoTCoreThingGroupEvent(IoTCoreRegistryEventsBase):
215
+ """
216
+ The registry publishes event messages when a thing group is created, updated, or deleted.
217
+ """
218
+
219
+ @property
220
+ def event_type(self) -> str:
221
+ """
222
+ The event type, corresponding to the thing group event.
223
+ """
224
+ return self["eventType"]
225
+
226
+ @property
227
+ def operation(self) -> EVENT_CRUD_OPERATION:
228
+ """
229
+ The operation type (e.g., CREATED, UPDATED, DELETED) performed on the thing group.
230
+ """
231
+ return self["operation"]
232
+
233
+ @property
234
+ def account_id(self) -> str:
235
+ """
236
+ The account ID associated with the event.
237
+ """
238
+ return self["accountId"]
239
+
240
+ @property
241
+ def thing_group_id(self) -> str:
242
+ """
243
+ The unique identifier for the thing group.
244
+ """
245
+ return self["thingGroupId"]
246
+
247
+ @property
248
+ def thing_group_name(self) -> str:
249
+ """
250
+ The name of the thing group.
251
+ """
252
+ return self["thingGroupName"]
253
+
254
+ @property
255
+ def version_number(self) -> int:
256
+ """
257
+ The version number of the thing group.
258
+ """
259
+ return self["versionNumber"]
260
+
261
+ @property
262
+ def parent_group_name(self) -> str | None:
263
+ """
264
+ The name of the parent group, or None if not applicable.
265
+ """
266
+ return self.get("parentGroupName")
267
+
268
+ @property
269
+ def parent_group_id(self) -> str | None:
270
+ """
271
+ The ID of the parent group, or None if not applicable.
272
+ """
273
+ return self.get("parentGroupId")
274
+
275
+ @property
276
+ def description(self) -> str:
277
+ """
278
+ The description of the thing group.
279
+ """
280
+ return self["description"]
281
+
282
+ @property
283
+ def root_to_parent_thing_groups(self) -> list[dict[str, str]]:
284
+ """
285
+ The list of root-to-parent thing group mappings.
286
+ """
287
+ return self["rootToParentThingGroups"]
288
+
289
+ @property
290
+ def attributes(self) -> dict[str, Any]:
291
+ """
292
+ The attributes associated with the thing group.
293
+ """
294
+ return self["attributes"]
295
+
296
+ @property
297
+ def dynamic_group_mapping_id(self) -> str | None:
298
+ """
299
+ The dynamic group mapping ID if available, or None if not specified.
300
+ """
301
+ return self.get("dynamicGroupMappingId")
302
+
303
+
304
+ class IoTCoreAddOrRemoveFromThingGroupEvent(IoTCoreRegistryEventsBase):
305
+ """
306
+ The registry publishes event messages when a thing is added to or removed from a thing group.
307
+ """
308
+
309
+ @property
310
+ def event_type(self) -> str:
311
+ """
312
+ The event type, corresponding to the add/remove from thing group event.
313
+ """
314
+ return self["eventType"]
315
+
316
+ @property
317
+ def operation(self) -> EVENT_ADD_REMOVE_OPERATION:
318
+ """
319
+ The operation (ADDED or REMOVED) performed on the thing in the group.
320
+ """
321
+ return self["operation"]
322
+
323
+ @property
324
+ def account_id(self) -> str:
325
+ """
326
+ The account ID associated with the event.
327
+ """
328
+ return self["accountId"]
329
+
330
+ @property
331
+ def group_arn(self) -> str:
332
+ """
333
+ The ARN of the group the thing was added to or removed from.
334
+ """
335
+ return self["groupArn"]
336
+
337
+ @property
338
+ def group_id(self) -> str:
339
+ """
340
+ The unique identifier of the group.
341
+ """
342
+ return self["groupId"]
343
+
344
+ @property
345
+ def thing_arn(self) -> str:
346
+ """
347
+ The ARN of the thing being added or removed.
348
+ """
349
+ return self["thingArn"]
350
+
351
+ @property
352
+ def thing_id(self) -> str:
353
+ """
354
+ The unique identifier for the thing being added or removed.
355
+ """
356
+ return self["thingId"]
357
+
358
+ @property
359
+ def membership_id(self) -> str:
360
+ """
361
+ The unique membership ID for the thing within the group.
362
+ """
363
+ return self["membershipId"]
364
+
365
+
366
+ class IoTCoreAddOrDeleteFromThingGroupEvent(IoTCoreRegistryEventsBase):
367
+ """
368
+ The registry publishes event messages when a child group is added to or deleted from a parent group.
369
+ """
370
+
371
+ @property
372
+ def event_type(self) -> str:
373
+ """
374
+ The event type, corresponding to the add/delete from thing group event.
375
+ """
376
+ return self["eventType"]
377
+
378
+ @property
379
+ def operation(self) -> EVENT_ADD_REMOVE_OPERATION:
380
+ """
381
+ The operation (ADDED or REMOVED) performed on the child group.
382
+ """
383
+ return self["operation"]
384
+
385
+ @property
386
+ def account_id(self) -> str:
387
+ """
388
+ The account ID associated with the event.
389
+ """
390
+ return self["accountId"]
391
+
392
+ @property
393
+ def thing_group_id(self) -> str:
394
+ """
395
+ The unique identifier of the thing group.
396
+ """
397
+ return self["thingGroupId"]
398
+
399
+ @property
400
+ def thing_group_name(self) -> str:
401
+ """
402
+ The name of the thing group.
403
+ """
404
+ return self["thingGroupName"]
405
+
406
+ @property
407
+ def child_group_id(self) -> str:
408
+ """
409
+ The unique identifier of the child group being added or removed.
410
+ """
411
+ return self["childGroupId"]
412
+
413
+ @property
414
+ def child_group_name(self) -> str:
415
+ """
416
+ The name of the child group being added or removed.
417
+ """
418
+ return self["childGroupName"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: aws_lambda_powertools
3
- Version: 3.6.1a9
3
+ Version: 3.7.1a0
4
4
  Summary: Powertools for AWS Lambda (Python) is a developer toolkit to implement Serverless best practices and increase developer velocity.
5
5
  License: MIT
6
6
  Keywords: aws_lambda_powertools,aws,tracing,logging,lambda,powertools,feature_flags,idempotency,middleware
@@ -83,7 +83,7 @@ aws_lambda_powertools/shared/json_encoder.py,sha256=JQeWNu-4M7_xI_hqYExrxsb3OcEH
83
83
  aws_lambda_powertools/shared/lazy_import.py,sha256=TbXQm2bcwXdZrYdBaJJXIswyLlumM85RJ_A_0w-h-GU,2019
84
84
  aws_lambda_powertools/shared/types.py,sha256=APkI38HbiTpSF19NSNii8Ydx73vmVUVotgEQ9jHruEI,124
85
85
  aws_lambda_powertools/shared/user_agent.py,sha256=DrCMFQuT4a4iIrpcWpAIjY37EFqR9-QxlxDGD-Nn9Gg,7081
86
- aws_lambda_powertools/shared/version.py,sha256=WZ6eerS4hr2Ba7_-XkiL0HCPEGMaI_xEwKa609r6xLU,84
86
+ aws_lambda_powertools/shared/version.py,sha256=ILjLMM6Ed-2HVhr0dTOPKCJ15XN8wX1EuNrp4XLBMic,84
87
87
  aws_lambda_powertools/tracing/__init__.py,sha256=f4bMThOPBPWTPVcYqcAIErAJPerMsf3H_Z4gCXCsK9I,141
88
88
  aws_lambda_powertools/tracing/base.py,sha256=DbLD8OSK05KLdSV36oNA5wDSGv8KbcOD19qMUqoXh58,4513
89
89
  aws_lambda_powertools/tracing/extensions.py,sha256=APOfXOq-hRBKaK5WyfIyrd_6M1_9SWJZ3zxLA9jDZzU,492
@@ -118,6 +118,7 @@ aws_lambda_powertools/utilities/data_classes/connect_contact_flow_event.py,sha25
118
118
  aws_lambda_powertools/utilities/data_classes/dynamo_db_stream_event.py,sha256=BrgOyFREC9gjj_ULhKB3L_7EbQ6ptV-8Was1TulPeWE,6102
119
119
  aws_lambda_powertools/utilities/data_classes/event_bridge_event.py,sha256=TeTtx2jOKyZSVdSPFrtxZUgv0Yt6HW_H7J5NNxy_mHo,2434
120
120
  aws_lambda_powertools/utilities/data_classes/event_source.py,sha256=hANsq_sZjFtDzV0ju47iSYwKcsn5Byk6ww0F2jUpMKw,1179
121
+ aws_lambda_powertools/utilities/data_classes/iot_registry_event.py,sha256=wUa0Gr64maNGkd9qKNxtwFHawIJN-nj9X8uLFdINE7c,10842
121
122
  aws_lambda_powertools/utilities/data_classes/kafka_event.py,sha256=BwkrEfGvmv0LvVpMsQeIzuX08QeWl9dVFjrbgSYL8Bs,3764
122
123
  aws_lambda_powertools/utilities/data_classes/kinesis_firehose_event.py,sha256=ea7Eq6ccBMhRHZzAYWwukwUJtRVi80DRej8VnixPJNU,10722
123
124
  aws_lambda_powertools/utilities/data_classes/kinesis_stream_event.py,sha256=vGQRJeoqE2Poqpis9d4FaF-ekdJxZzFYsJJMrv7ThhE,3943
@@ -250,7 +251,7 @@ aws_lambda_powertools/utilities/validation/envelopes.py,sha256=YD5HOFx6IClQgii0n
250
251
  aws_lambda_powertools/utilities/validation/exceptions.py,sha256=PKy_19zQMBJGCMMFl-sMkcm-cc0v3zZBn_bhGE4wKNo,2084
251
252
  aws_lambda_powertools/utilities/validation/validator.py,sha256=x_1qpuKJBuWpgNU-zCD3Di-vXrZfyUu7oA5RmjZjr84,10034
252
253
  aws_lambda_powertools/warnings/__init__.py,sha256=vqDVeZz8wGtD8WGYNSkQE7AHwqtIrPGRxuoJR_BBnSs,1193
253
- aws_lambda_powertools-3.6.1a9.dist-info/LICENSE,sha256=vMHS2eBgmwPUIMPb7LQ4p7ib_FPVQXarVjAasflrTwo,951
254
- aws_lambda_powertools-3.6.1a9.dist-info/METADATA,sha256=BVIInOdbgjfb0wQv9NyspRw14pno95Rckb5MbVro3P8,11151
255
- aws_lambda_powertools-3.6.1a9.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
256
- aws_lambda_powertools-3.6.1a9.dist-info/RECORD,,
254
+ aws_lambda_powertools-3.7.1a0.dist-info/LICENSE,sha256=vMHS2eBgmwPUIMPb7LQ4p7ib_FPVQXarVjAasflrTwo,951
255
+ aws_lambda_powertools-3.7.1a0.dist-info/METADATA,sha256=kdq4S1vY3Ub_0kDX7wvB3vfu1utVHXe_hsL31uuHVo0,11151
256
+ aws_lambda_powertools-3.7.1a0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
257
+ aws_lambda_powertools-3.7.1a0.dist-info/RECORD,,