localstack-sdk-python 0.0.2__py3-none-any.whl → 0.0.3__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.
- localstack/sdk/aws/__init__.py +3 -0
- localstack/sdk/aws/client.py +68 -0
- localstack/sdk/state/__init__.py +3 -0
- localstack/sdk/state/client.py +11 -0
- {localstack_sdk_python-0.0.2.dist-info → localstack_sdk_python-0.0.3.dist-info}/METADATA +1 -1
- localstack_sdk_python-0.0.3.dist-info/RECORD +15 -0
- {localstack_sdk_python-0.0.2.dist-info → localstack_sdk_python-0.0.3.dist-info}/WHEEL +1 -1
- localstack_sdk_python-0.0.2.dist-info/RECORD +0 -11
- {localstack_sdk_python-0.0.2.dist-info → localstack_sdk_python-0.0.3.dist-info}/LICENSE.txt +0 -0
- {localstack_sdk_python-0.0.2.dist-info → localstack_sdk_python-0.0.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
from localstack.clients import BaseClient
|
|
4
|
+
from localstack.sdk.api.aws_api import AwsApi
|
|
5
|
+
from localstack.sdk.models import Message, SesSentEmail
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def _from_sqs_query_to_json(xml_dict: dict) -> list[Message]:
|
|
9
|
+
"""
|
|
10
|
+
todo: developer endpoint implements sqs-query protocol. Remove this workaround one we move them to json.
|
|
11
|
+
"""
|
|
12
|
+
raw_messages = (
|
|
13
|
+
xml_dict.get("ReceiveMessageResponse", {}).get("ReceiveMessageResult", {}) or {}
|
|
14
|
+
).get("Message", [])
|
|
15
|
+
if isinstance(raw_messages, dict):
|
|
16
|
+
raw_messages = [raw_messages]
|
|
17
|
+
messages = []
|
|
18
|
+
for msg in raw_messages:
|
|
19
|
+
_attributes = msg.get("Attribute", [])
|
|
20
|
+
attributes = {i["Name"]: i["Value"] for i in _attributes}
|
|
21
|
+
_m = {
|
|
22
|
+
"MessageId": msg.get("MessageId"),
|
|
23
|
+
"ReceiptHandle": msg.get("ReceiptHandle"),
|
|
24
|
+
"MD5OfBody": msg.get("MD5OfBody"),
|
|
25
|
+
"Body": msg.get("Body"),
|
|
26
|
+
"Attributes": attributes,
|
|
27
|
+
}
|
|
28
|
+
m = Message.from_dict(_m)
|
|
29
|
+
messages.append(m)
|
|
30
|
+
return messages
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class AWSClient(BaseClient):
|
|
34
|
+
def __init__(self, **kwargs) -> None:
|
|
35
|
+
super().__init__(**kwargs)
|
|
36
|
+
self._client = AwsApi(self._api_client)
|
|
37
|
+
|
|
38
|
+
########
|
|
39
|
+
# SQS
|
|
40
|
+
########
|
|
41
|
+
|
|
42
|
+
def list_sqs_messages(self, account_id: str, region: str, queue_name: str) -> list[Message]:
|
|
43
|
+
response = self._client.list_sqs_messages_with_http_info(
|
|
44
|
+
account_id=account_id, region=region, queue_name=queue_name
|
|
45
|
+
)
|
|
46
|
+
return _from_sqs_query_to_json(json.loads(response.raw_data))
|
|
47
|
+
|
|
48
|
+
def list_sqs_messages_from_queue_url(self, queue_url) -> list[Message]:
|
|
49
|
+
response = self._client.list_all_sqs_messages_with_http_info(queue_url=queue_url)
|
|
50
|
+
return _from_sqs_query_to_json(json.loads(response.raw_data))
|
|
51
|
+
|
|
52
|
+
########
|
|
53
|
+
# SES
|
|
54
|
+
########
|
|
55
|
+
|
|
56
|
+
def get_ses_messages(
|
|
57
|
+
self, id_filter: str | None = None, email_filter: str | None = None
|
|
58
|
+
) -> list[SesSentEmail]:
|
|
59
|
+
response = self._client.get_ses_messages(id=id_filter, email=email_filter)
|
|
60
|
+
return response.messages
|
|
61
|
+
|
|
62
|
+
def discard_ses_messages(self, id_filter: str | None = None) -> None:
|
|
63
|
+
return self._client.discard_ses_messages(id=id_filter)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def get_default(**args) -> AwsApi:
|
|
67
|
+
"""Return a client with a default configuration"""
|
|
68
|
+
return AwsApi(args)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from localstack.clients import BaseClient
|
|
2
|
+
from localstack.sdk.api import StateApi
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class StateClient(BaseClient):
|
|
6
|
+
def __init__(self, **args) -> None:
|
|
7
|
+
super().__init__(**args)
|
|
8
|
+
self._client = StateApi(self._api_client)
|
|
9
|
+
|
|
10
|
+
def reset_state(self) -> None:
|
|
11
|
+
self._client.localstack_state_reset_post_0()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
localstack/clients.py,sha256=UFBz23vDc48uGl1ton1-ejjQb-nnHnj0YEGVBelz57E,680
|
|
2
|
+
localstack/sdk/aws/__init__.py,sha256=Das2FPp0t5hl_gxEP8Nw6MigVxBU8HxePF5ZKq_YNkM,73
|
|
3
|
+
localstack/sdk/aws/client.py,sha256=TGemZuxjbojlq-kWEJNoVBGGg3a3Jshk2XF-PXd97RE,2333
|
|
4
|
+
localstack/sdk/chaos/__init__.py,sha256=czMV7U_iDgUPBObl6nmWQxl78cF-zVl1c8QPY5tnQg4,79
|
|
5
|
+
localstack/sdk/chaos/client.py,sha256=l5hJ8NNLNv2FaSp8lol8fOXZCcAL7DRDV2X_wFGYwxc,1506
|
|
6
|
+
localstack/sdk/chaos/managers.py,sha256=v9oKvotSmz3npEadYtrYBumCuISdxPeol_YGYYQQlGw,386
|
|
7
|
+
localstack/sdk/pods/__init__.py,sha256=49ilbKnbGpIRcv0w71nEp4RvDFtkxfrvrUVdrSLFltI,76
|
|
8
|
+
localstack/sdk/pods/client.py,sha256=YzHQBLbEaDb-veNS2NwDZrND12kFSAVoy5cm-hmS4-M,2909
|
|
9
|
+
localstack/sdk/state/__init__.py,sha256=gHCAz6H0FLwsg72361MbVpdL-YsuTH8GdaTmhKUgkL4,79
|
|
10
|
+
localstack/sdk/state/client.py,sha256=BISI3O-lM0hRIKJVGOPstlPcO6G9uFfYHp5vPOE6ztw,327
|
|
11
|
+
localstack_sdk_python-0.0.3.dist-info/LICENSE.txt,sha256=3PC-9Z69UsNARuQ980gNR_JsLx8uvMjdG6C7cc4LBYs,606
|
|
12
|
+
localstack_sdk_python-0.0.3.dist-info/METADATA,sha256=cZSAkz6TRLGu1R0_IdrtNI-SdXxkDxPfhUA9WXcFZMA,1740
|
|
13
|
+
localstack_sdk_python-0.0.3.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
|
14
|
+
localstack_sdk_python-0.0.3.dist-info/top_level.txt,sha256=3sqmK2lGac8nCy8nwsbS5SpIY_izmtWtgaTFKHYVHbI,11
|
|
15
|
+
localstack_sdk_python-0.0.3.dist-info/RECORD,,
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
localstack/clients.py,sha256=UFBz23vDc48uGl1ton1-ejjQb-nnHnj0YEGVBelz57E,680
|
|
2
|
-
localstack/sdk/chaos/__init__.py,sha256=czMV7U_iDgUPBObl6nmWQxl78cF-zVl1c8QPY5tnQg4,79
|
|
3
|
-
localstack/sdk/chaos/client.py,sha256=l5hJ8NNLNv2FaSp8lol8fOXZCcAL7DRDV2X_wFGYwxc,1506
|
|
4
|
-
localstack/sdk/chaos/managers.py,sha256=v9oKvotSmz3npEadYtrYBumCuISdxPeol_YGYYQQlGw,386
|
|
5
|
-
localstack/sdk/pods/__init__.py,sha256=49ilbKnbGpIRcv0w71nEp4RvDFtkxfrvrUVdrSLFltI,76
|
|
6
|
-
localstack/sdk/pods/client.py,sha256=YzHQBLbEaDb-veNS2NwDZrND12kFSAVoy5cm-hmS4-M,2909
|
|
7
|
-
localstack_sdk_python-0.0.2.dist-info/LICENSE.txt,sha256=3PC-9Z69UsNARuQ980gNR_JsLx8uvMjdG6C7cc4LBYs,606
|
|
8
|
-
localstack_sdk_python-0.0.2.dist-info/METADATA,sha256=3QTB1Pl1CrBrsbW42Ep2oDywzCAJ93C2khujATfCllg,1740
|
|
9
|
-
localstack_sdk_python-0.0.2.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
10
|
-
localstack_sdk_python-0.0.2.dist-info/top_level.txt,sha256=3sqmK2lGac8nCy8nwsbS5SpIY_izmtWtgaTFKHYVHbI,11
|
|
11
|
-
localstack_sdk_python-0.0.2.dist-info/RECORD,,
|
|
File without changes
|
{localstack_sdk_python-0.0.2.dist-info → localstack_sdk_python-0.0.3.dist-info}/top_level.txt
RENAMED
|
File without changes
|