Skip to content

Commit 77774e7

Browse files
authored
Add SES operations to the SDK (#7)
1 parent 55f764c commit 77774e7

File tree

10 files changed

+220
-2139
lines changed

10 files changed

+220
-2139
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
push:
1111
branches:
1212
- main
13+
workflow_dispatch:
1314

1415
jobs:
1516

bin/generate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
version=$(cat VERSION)
44

55
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v7.9.0 generate \
6-
-i /local/openapi.yaml \
6+
-i https://raw.github.com/localstack/openapi/refs/heads/main/openapi/emulators/localstack-spec-latest.yml \
77
--skip-validate-spec \
88
-g python \
99
-o /local//packages/localstack-sdk-generated \

localstack-sdk-python/localstack/sdk/aws/client.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from localstack.clients import BaseClient
44
from localstack.sdk.api.aws_api import AwsApi
5-
from localstack.sdk.models import Message
5+
from localstack.sdk.models import Message, SesSentEmail
66

77

88
def _from_sqs_query_to_json(xml_dict: dict) -> list[Message]:
@@ -35,6 +35,10 @@ def __init__(self, **kwargs) -> None:
3535
super().__init__(**kwargs)
3636
self._client = AwsApi(self._api_client)
3737

38+
########
39+
# SQS
40+
########
41+
3842
def list_sqs_messages(self, account_id: str, region: str, queue_name: str) -> list[Message]:
3943
response = self._client.list_sqs_messages_with_http_info(
4044
account_id=account_id, region=region, queue_name=queue_name
@@ -45,6 +49,19 @@ def list_sqs_messages_from_queue_url(self, queue_url) -> list[Message]:
4549
response = self._client.list_all_sqs_messages_with_http_info(queue_url=queue_url)
4650
return _from_sqs_query_to_json(json.loads(response.raw_data))
4751

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+
4865

4966
def get_default(**args) -> AwsApi:
5067
"""Return a client with a default configuration"""

0 commit comments

Comments
 (0)