|
1 |
| -# Amazon SNS Extended Client Library for Python |
| 1 | +## My Project |
2 | 2 |
|
3 |
| -### Implements the functionality of [amazon-sns-java-extended-client-lib](https://github.com/awslabs/amazon-sns-java-extended-client-lib) in Python |
| 3 | +TODO: Fill this README out! |
4 | 4 |
|
5 |
| -## Getting Started |
| 5 | +Be sure to: |
6 | 6 |
|
7 |
| -* **Sign up for AWS** -- Before you begin, you need an AWS account. For more information about creating an AWS account, see [create and activate aws account](https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/). |
8 |
| -* **Minimum requirements** -- Python 3.x (or later) and pip |
9 |
| -* **Download** -- Download the latest preview release or pick it up from pip: |
10 |
| -``` |
11 |
| -under construction |
12 |
| -``` |
13 |
| - |
14 |
| - |
15 |
| -## Overview |
16 |
| -sns-extended-client allows for publishing large messages through SNS via S3. This is the same mechanism that the Amazon library |
17 |
| -[amazon-sns-java-extended-client-lib](https://github.com/awslabs/amazon-sns-java-extended-client-lib) provides. |
18 |
| - |
19 |
| -To do this, this library automatically extends the normal boto3 SNS client and Topic resource classes upon import using the [botoinator](https://github.com/QuiNovas/botoinator) library. This allows for further extension or decoration if desired. |
20 |
| - |
21 |
| -## Additional attributes available on `boto3` SNS `client`, `Topic` and `PlatformEndpoint` objects. |
22 |
| -* large_payload_support -- the S3 bucket name that will store large messages. |
23 |
| -* message_size_threshold -- the threshold for storing the message in the large messages bucket. Cannot be less than `0` or greater than `262144`. Defaults to `262144`. |
24 |
| -* always_through_s3 -- if `True`, then all messages will be serialized to S3. Defaults to `False` |
25 |
| -* s3 -- the boto3 S3 `resource` object to use to store objects to S3. Use this if you want to control the S3 resource (for example, custom S3 config or credentials). Defaults to `boto3.resource("s3")` on first use if not previously set. |
26 |
| - |
27 |
| -## Usage |
28 |
| - |
29 |
| -#### Note: |
30 |
| -> The s3 bucket must already exist prior to usage, and be accessible by whatever credentials you have available |
31 |
| -
|
32 |
| -### Enabling support for large payloads (>256Kb) |
33 |
| - |
34 |
| -```python |
35 |
| -import boto3 |
36 |
| -import sns_extended_client |
37 |
| - |
38 |
| -# Low level client |
39 |
| -sn = boto3.client('sns') |
40 |
| -sns.large_payload_support = 'bucket-name' |
41 |
| - |
42 |
| -# boto resource |
43 |
| -resource = boto3.resource('sns') |
44 |
| -topic = resource.Topic('topic-arn') |
45 |
| - |
46 |
| -# Or |
47 |
| -topic = resource.create_queue(TopicName='topic-name') |
48 |
| - |
49 |
| -topic.large_payload_support = 'my-bucket-name' |
50 |
| -``` |
51 |
| - |
52 |
| -### Enabling support for large payloads (>64K) |
53 |
| -```python |
54 |
| -import boto3 |
55 |
| -import sns_extended_client |
56 |
| - |
57 |
| -# Low level client |
58 |
| -sns = boto3.client('sns') |
59 |
| -sns.large_payload_support = 'BUCKET-NAME' |
60 |
| -sns.message_size_threshold = 65536 |
61 |
| - |
62 |
| -# boto resource |
63 |
| -resource = boto3.resource('sns') |
64 |
| -topic = resource.Topic('topic-arn') |
65 |
| - |
66 |
| -# Or |
67 |
| -topic = resource.create_queue('topic-name') |
68 |
| - |
69 |
| -topic.large_payload_support = 'bucket-name' |
70 |
| -topic.message_size_threshold = 65536 |
71 |
| -``` |
72 |
| -### Enabling support for large payloads for all messages |
73 |
| -```python |
74 |
| -import boto3 |
75 |
| -import sns_extended_client |
76 |
| - |
77 |
| -# Low level client |
78 |
| -sns = boto3.client('sns') |
79 |
| -sns.large_payload_support = 'my-bucket-name' |
80 |
| -sns.always_through_s3 = True |
81 |
| - |
82 |
| -# boto resource |
83 |
| -resource = boto3.resource('sns') |
84 |
| -topic = resource.Topic('topic-arn') |
85 |
| - |
86 |
| -# Or |
87 |
| -topic = resource.create_queue(QueueName='topic-name') |
88 |
| - |
89 |
| -topic.large_payload_support = 'my-bucket-name' |
90 |
| -topic.always_through_s3 = True |
91 |
| -``` |
92 |
| -### Setting a custom S3 resource |
93 |
| -```python |
94 |
| -import boto3 |
95 |
| -from botocore.config import Config |
96 |
| -import sns_extended_client |
97 |
| - |
98 |
| -# Low level client |
99 |
| -sns = boto3.client('sns') |
100 |
| -sns.large_payload_support = 'my-bucket-name' |
101 |
| -sns.s3 = boto3.resource( |
102 |
| - 's3', |
103 |
| - config=Config( |
104 |
| - signature_version='s3v4', |
105 |
| - s3={ |
106 |
| - "use_accelerate_endpoint": True |
107 |
| - } |
108 |
| - ) |
109 |
| -) |
110 |
| - |
111 |
| -# boto resource |
112 |
| -resource = boto3.resource('sns') |
113 |
| -topic = resource.Topic('topic-arn') |
114 |
| - |
115 |
| -# Or |
116 |
| -topic = resource.create_queue(QueueName='topic-name') |
117 |
| - |
118 |
| -topic.large_payload_support = 'my-bucket-name' |
119 |
| -topic.s3 = boto3.resource( |
120 |
| - 's3', |
121 |
| - config=Config( |
122 |
| - signature_version='s3v4', |
123 |
| - s3={ |
124 |
| - "use_accelerate_endpoint": True |
125 |
| - } |
126 |
| - ) |
127 |
| -) |
128 |
| -``` |
| 7 | +* Change the title in this README |
| 8 | +* Edit your repository description on GitHub |
129 | 9 |
|
130 | 10 | ## Security
|
131 | 11 |
|
|
0 commit comments