my-aws-helpers 2.2.0__tar.gz → 2.3.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.

Potentially problematic release.


This version of my-aws-helpers might be problematic. Click here for more details.

Files changed (20) hide show
  1. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/PKG-INFO +1 -1
  2. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/my_aws_helpers/event.py +26 -2
  3. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/my_aws_helpers.egg-info/PKG-INFO +1 -1
  4. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/setup.py +1 -1
  5. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/README.md +0 -0
  6. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/my_aws_helpers/api.py +0 -0
  7. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/my_aws_helpers/auth.py +0 -0
  8. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/my_aws_helpers/cognito.py +0 -0
  9. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/my_aws_helpers/dynamo.py +0 -0
  10. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/my_aws_helpers/errors.py +0 -0
  11. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/my_aws_helpers/logging.py +0 -0
  12. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/my_aws_helpers/s3.py +0 -0
  13. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/my_aws_helpers/sfn.py +0 -0
  14. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/my_aws_helpers.egg-info/SOURCES.txt +0 -0
  15. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/my_aws_helpers.egg-info/dependency_links.txt +0 -0
  16. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/my_aws_helpers.egg-info/requires.txt +0 -0
  17. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/my_aws_helpers.egg-info/top_level.txt +0 -0
  18. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/my_aws_helpers.egg-info/zip-safe +0 -0
  19. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/setup.cfg +0 -0
  20. {my_aws_helpers-2.2.0 → my_aws_helpers-2.3.0}/tests/test_event.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: my_aws_helpers
3
- Version: 2.2.0
3
+ Version: 2.3.0
4
4
  Summary: AWS Helpers
5
5
  Home-page: https://github.com/JarrodMccarthy/aws_helpers.git
6
6
  Author: Jarrod McCarthy
@@ -1,10 +1,11 @@
1
1
  from __future__ import annotations
2
- from my_aws_helpers.dynamo import BaseTableObject, DynamoSerialiser
2
+ from typing import Optional
3
3
  from datetime import datetime
4
4
  from enum import Enum
5
5
  from uuid import uuid4
6
6
  from copy import copy
7
-
7
+ from boto3.dynamodb.conditions import Key
8
+ from my_aws_helpers.dynamo import BaseTableObject, DynamoSerialiser, BaseQueries, Dynamo
8
9
 
9
10
  class EventDynamoKeys:
10
11
  @staticmethod
@@ -71,3 +72,26 @@ class Event(BaseTableObject):
71
72
  obj['sk'] = self._get_sk()
72
73
  return DynamoSerialiser.object_serialiser(obj=obj)
73
74
 
75
+
76
+ class EventQueries(BaseQueries):
77
+ def __init__(self, table_name, client: Optional[Dynamo] = None):
78
+ super().__init__(table_name, client)
79
+
80
+ def put_event(self, event: Event) -> Event:
81
+ response = self.client.put_item(item = event._to_dynamo_representation())
82
+ if response["ResponseMetadata"]["HTTPStatusCode"] == 200:
83
+ return event
84
+ raise Exception(f"Failed to put object into dynamo table")
85
+
86
+ def get_event_by_id(self, id: str):
87
+ pk = EventDynamoKeys.get_event_pk(id=id)
88
+ sk = EventDynamoKeys.get_event_sk(id=id)
89
+ results = self.client.table.query(
90
+ KeyConditionExpression=Key("pk").eq(pk) & Key("sk").eq(sk)
91
+ )
92
+ if len(results["items"]) < 1:
93
+ return None
94
+ if len(results["Items"]) > 1:
95
+ raise Exception(f"Should only be 1 event with id {id}")
96
+ return Event._from_dynamo_representation(obj = results["Items"][0])
97
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: my-aws-helpers
3
- Version: 2.2.0
3
+ Version: 2.3.0
4
4
  Summary: AWS Helpers
5
5
  Home-page: https://github.com/JarrodMccarthy/aws_helpers.git
6
6
  Author: Jarrod McCarthy
@@ -3,7 +3,7 @@ from setuptools import find_namespace_packages, setup
3
3
 
4
4
  base_path = os.path.abspath(os.path.dirname(__file__))
5
5
 
6
- version = "2.2.0"
6
+ version = "2.3.0"
7
7
 
8
8
  setup(
9
9
  name="my_aws_helpers",
File without changes
File without changes