Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into cognito_custom_message
- Loading branch information
Showing
7 changed files
with
261 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from .sns import SNSPublish as SNSPublish | ||
from .sns import SNSPublishBatch as SNSPublishBatch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
#!/usr/bin/env python | ||
|
||
import sys | ||
|
||
if sys.version_info >= (3, 8): | ||
from typing import Any, Dict, List, Literal, Optional, TypedDict, Union | ||
else: | ||
from typing import Any, Dict, List, Optional, Union | ||
|
||
from typing_extensions import Literal, TypedDict | ||
|
||
|
||
class MessageAttributesString(TypedDict): | ||
""" | ||
MessageAttributesString | ||
Attributes: | ||
---------- | ||
DataType: str | ||
StringValue: str | ||
BinaryValue: Any | ||
""" | ||
|
||
DataType: str | ||
StringValue: Optional[str] | ||
BinaryValue: Optional[Any] | ||
|
||
|
||
class MessageAttributes(TypedDict): | ||
""" | ||
MessageAttributes | ||
Attributes: | ||
---------- | ||
string: py:class:`MessageAttributesString` | ||
""" | ||
|
||
string: MessageAttributesString | ||
|
||
|
||
class PublishBatchRequestEntry(TypedDict, total=False): | ||
""" | ||
PublishBatchRequestEntry | ||
https://docs.aws.amazon.com/sns/latest/api/API_PublishBatchRequestEntry.html | ||
Attributes: | ||
---------- | ||
Id: str | ||
Message: str | ||
MessageAttributes: Optional[:py:class:`MessageAttributes`] | ||
MessageDeduplicationId: Optional[str] | ||
MessageGroupId: Optional[str] | ||
MessageStructure: Optional[str] | ||
Subject: Optional[str] | ||
""" | ||
|
||
Id: str | ||
Message: str | ||
MessageAttributes: Optional[MessageAttributes] | ||
MessageDeduplicationId: Optional[str] | ||
MessageGroupId: Optional[str] | ||
MessageStructure: Optional[str] | ||
Subject: Optional[str] | ||
|
||
|
||
class SNSPublish(TypedDict, total=False): | ||
""" | ||
SNSPublish | ||
https://docs.aws.amazon.com/sns/latest/api/API_Publish.html | ||
Attributes: | ||
---------- | ||
Message: Union[str, Dict[str, str]] | ||
MessageAttributes: Optional[:py:class:`MessageAttributes`] | ||
MessageDeduplicationId: Optional[str] | ||
MessageGroupId: Optional[str] | ||
MessageStructure: Optional[Literal["json"]] | ||
PhoneNumber: Optional[str] | ||
Subject: Optional[str] | ||
TargetArn: Optional[str] | ||
TopicArn: Optional[str] | ||
""" | ||
|
||
Message: Union[str, Dict[str, str]] | ||
MessageAttributes: Optional[MessageAttributes] | ||
MessageDeduplicationId: Optional[str] | ||
MessageGroupId: Optional[str] | ||
MessageStructure: Optional[Literal["json"]] | ||
PhoneNumber: Optional[str] | ||
Subject: Optional[str] | ||
TargetArn: Optional[str] | ||
TopicArn: Optional[str] | ||
|
||
|
||
class SNSPublishBatch(TypedDict, total=False): | ||
""" | ||
SNSPublishBatch | ||
https://docs.aws.amazon.com/sns/latest/api/API_PublishBatch.html | ||
Attributes: | ||
---------- | ||
TopicArn: str | ||
PublishBatchRequestEntries: List[:py:class:`PublishBatchRequestEntry`] | ||
""" | ||
|
||
TopicArn: str | ||
PublishBatchRequestEntries: List[PublishBatchRequestEntry] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from aws_lambda_typing.requests import SNSPublish, SNSPublishBatch | ||
|
||
|
||
def test_sns_publish() -> None: | ||
request: SNSPublish = { | ||
"Message": "Hello World", | ||
"MessageAttributes": { | ||
"string": { | ||
"DataType": "string", | ||
"StringValue": "string", | ||
"BinaryValue": b"bytes", | ||
} | ||
}, | ||
"MessageDeduplicationId": "string", | ||
"MessageGroupId": "string", | ||
"MessageStructure": "json", | ||
"PhoneNumber": "string", | ||
"Subject": "string", | ||
"TargetArn": "string", | ||
"TopicArn": "string", | ||
} | ||
|
||
|
||
def test_sns_publish_batch() -> None: | ||
request: SNSPublishBatch = { | ||
"TopicArn": "string", | ||
"PublishBatchRequestEntries": [ | ||
{ | ||
"Id": "string", | ||
"Message": "Hello World", | ||
"MessageAttributes": { | ||
"string": { | ||
"DataType": "string", | ||
"StringValue": "string", | ||
"BinaryValue": b"bytes", | ||
} | ||
}, | ||
"MessageDeduplicationId": "string", | ||
"MessageGroupId": "string", | ||
"MessageStructure": "json", | ||
"Subject": "string", | ||
} | ||
], | ||
} |