my-aws-helpers 2.0.0__tar.gz → 2.1.0__tar.gz
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.
- {my_aws_helpers-2.0.0 → my_aws_helpers-2.1.0}/PKG-INFO +1 -1
- my_aws_helpers-2.1.0/my_aws_helpers/event.py +38 -0
- {my_aws_helpers-2.0.0 → my_aws_helpers-2.1.0}/my_aws_helpers.egg-info/PKG-INFO +1 -1
- {my_aws_helpers-2.0.0 → my_aws_helpers-2.1.0}/my_aws_helpers.egg-info/SOURCES.txt +3 -1
- {my_aws_helpers-2.0.0 → my_aws_helpers-2.1.0}/setup.py +1 -1
- my_aws_helpers-2.1.0/tests/test_event.py +12 -0
- {my_aws_helpers-2.0.0 → my_aws_helpers-2.1.0}/README.md +0 -0
- {my_aws_helpers-2.0.0 → my_aws_helpers-2.1.0}/my_aws_helpers/api.py +0 -0
- {my_aws_helpers-2.0.0 → my_aws_helpers-2.1.0}/my_aws_helpers/auth.py +0 -0
- {my_aws_helpers-2.0.0 → my_aws_helpers-2.1.0}/my_aws_helpers/cognito.py +0 -0
- {my_aws_helpers-2.0.0 → my_aws_helpers-2.1.0}/my_aws_helpers/dynamo.py +0 -0
- {my_aws_helpers-2.0.0 → my_aws_helpers-2.1.0}/my_aws_helpers/errors.py +0 -0
- {my_aws_helpers-2.0.0 → my_aws_helpers-2.1.0}/my_aws_helpers/logging.py +0 -0
- {my_aws_helpers-2.0.0 → my_aws_helpers-2.1.0}/my_aws_helpers/s3.py +0 -0
- {my_aws_helpers-2.0.0 → my_aws_helpers-2.1.0}/my_aws_helpers/sfn.py +0 -0
- {my_aws_helpers-2.0.0 → my_aws_helpers-2.1.0}/my_aws_helpers.egg-info/dependency_links.txt +0 -0
- {my_aws_helpers-2.0.0 → my_aws_helpers-2.1.0}/my_aws_helpers.egg-info/requires.txt +0 -0
- {my_aws_helpers-2.0.0 → my_aws_helpers-2.1.0}/my_aws_helpers.egg-info/top_level.txt +0 -0
- {my_aws_helpers-2.0.0 → my_aws_helpers-2.1.0}/my_aws_helpers.egg-info/zip-safe +0 -0
- {my_aws_helpers-2.0.0 → my_aws_helpers-2.1.0}/setup.cfg +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from enum import Enum
|
|
5
|
+
from uuid import uuid4
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class EventStatus(str, Enum):
|
|
9
|
+
in_progress = "in_progress"
|
|
10
|
+
success = "success"
|
|
11
|
+
fail = "fail"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass
|
|
15
|
+
class Event:
|
|
16
|
+
status: str
|
|
17
|
+
message: str
|
|
18
|
+
id: str
|
|
19
|
+
created_timestamp: datetime
|
|
20
|
+
|
|
21
|
+
def __init__(
|
|
22
|
+
self,
|
|
23
|
+
status: str,
|
|
24
|
+
message: str,
|
|
25
|
+
id: str = None,
|
|
26
|
+
created_timestamp: datetime = None,
|
|
27
|
+
):
|
|
28
|
+
self.status: str = self.set_status(status=status)
|
|
29
|
+
self.message: str = message
|
|
30
|
+
self.id: str = id if id else uuid4().hex
|
|
31
|
+
self.created_timestamp: datetime = created_timestamp if created_timestamp else datetime.now()
|
|
32
|
+
|
|
33
|
+
def set_status(self, status: str) -> str:
|
|
34
|
+
if status not in list(EventStatus):
|
|
35
|
+
raise Exception("Status must be a member of EventStatus")
|
|
36
|
+
return status
|
|
37
|
+
|
|
38
|
+
|
|
@@ -6,6 +6,7 @@ my_aws_helpers/auth.py
|
|
|
6
6
|
my_aws_helpers/cognito.py
|
|
7
7
|
my_aws_helpers/dynamo.py
|
|
8
8
|
my_aws_helpers/errors.py
|
|
9
|
+
my_aws_helpers/event.py
|
|
9
10
|
my_aws_helpers/logging.py
|
|
10
11
|
my_aws_helpers/s3.py
|
|
11
12
|
my_aws_helpers/sfn.py
|
|
@@ -14,4 +15,5 @@ my_aws_helpers.egg-info/SOURCES.txt
|
|
|
14
15
|
my_aws_helpers.egg-info/dependency_links.txt
|
|
15
16
|
my_aws_helpers.egg-info/requires.txt
|
|
16
17
|
my_aws_helpers.egg-info/top_level.txt
|
|
17
|
-
my_aws_helpers.egg-info/zip-safe
|
|
18
|
+
my_aws_helpers.egg-info/zip-safe
|
|
19
|
+
tests/test_event.py
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from my_aws_helpers.event import Event, EventStatus
|
|
2
|
+
import pytest
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def test_event():
|
|
6
|
+
event = Event(status=EventStatus.success.value, message="test event")
|
|
7
|
+
assert event != None
|
|
8
|
+
|
|
9
|
+
def test_event_wrong_status():
|
|
10
|
+
with pytest.raises(Exception):
|
|
11
|
+
Event(status="not success", message="test event")
|
|
12
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|