localstack-core 4.13.2.dev82__py3-none-any.whl → 4.13.2.dev83__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/services/sns/provider.py +54 -31
- localstack/version.py +2 -2
- {localstack_core-4.13.2.dev82.dist-info → localstack_core-4.13.2.dev83.dist-info}/METADATA +1 -1
- {localstack_core-4.13.2.dev82.dist-info → localstack_core-4.13.2.dev83.dist-info}/RECORD +9 -9
- {localstack_core-4.13.2.dev82.data → localstack_core-4.13.2.dev83.data}/scripts/localstack-supervisor +0 -0
- {localstack_core-4.13.2.dev82.dist-info → localstack_core-4.13.2.dev83.dist-info}/WHEEL +0 -0
- {localstack_core-4.13.2.dev82.dist-info → localstack_core-4.13.2.dev83.dist-info}/entry_points.txt +0 -0
- {localstack_core-4.13.2.dev82.dist-info → localstack_core-4.13.2.dev83.dist-info}/licenses/LICENSE.txt +0 -0
- {localstack_core-4.13.2.dev82.dist-info → localstack_core-4.13.2.dev83.dist-info}/top_level.txt +0 -0
|
@@ -175,6 +175,52 @@ class SnsProvider(SnsApi, ServiceLifecycleHook):
|
|
|
175
175
|
# see https://docs.aws.amazon.com/sns/latest/dg/sns-verify-signature-of-message.html
|
|
176
176
|
return Response(self._signature_cert_pem, 200)
|
|
177
177
|
|
|
178
|
+
# Tag Utils
|
|
179
|
+
|
|
180
|
+
def _check_matching_tags(
|
|
181
|
+
self, context: RequestContext, topic_arn: str, tags: TagList | None
|
|
182
|
+
) -> bool:
|
|
183
|
+
"""
|
|
184
|
+
Checks if a topic to be created doesn't already exist with different tags
|
|
185
|
+
:param context: The context of the original request
|
|
186
|
+
:param topic_arn: Arn of the topic
|
|
187
|
+
:param tags: Tags to be checked
|
|
188
|
+
:return: False if there is a mismatch in tags, True otherwise
|
|
189
|
+
"""
|
|
190
|
+
store = self.get_store(context.account_id, context.region)
|
|
191
|
+
existing_tags = self._list_resource_tags(context, resource_arn=topic_arn)
|
|
192
|
+
# if this is none there is nothing to check
|
|
193
|
+
if topic_arn in store.topics:
|
|
194
|
+
if tags is None:
|
|
195
|
+
tags = []
|
|
196
|
+
for tag in tags:
|
|
197
|
+
# this means topic already created with empty tags and when we try to create it
|
|
198
|
+
# again with other tag value then it should fail according to aws documentation.
|
|
199
|
+
if existing_tags is not None and tag not in existing_tags:
|
|
200
|
+
return False
|
|
201
|
+
return True
|
|
202
|
+
|
|
203
|
+
def _list_resource_tags(self, context: RequestContext, resource_arn: str) -> TagList:
|
|
204
|
+
store = self.get_store(context.account_id, context.region)
|
|
205
|
+
tags = store.TAGS.list_tags_for_resource(resource_arn).get("Tags")
|
|
206
|
+
return tags
|
|
207
|
+
|
|
208
|
+
def _tag_resource(
|
|
209
|
+
self, context: RequestContext, resource_arn: str, tags: list[dict[str, str]]
|
|
210
|
+
) -> None:
|
|
211
|
+
store = self.get_store(context.account_id, context.region)
|
|
212
|
+
store.TAGS.tag_resource(resource_arn, tags)
|
|
213
|
+
|
|
214
|
+
def _untag_resource(
|
|
215
|
+
self, context: RequestContext, resource_arn: str, tag_keys: list[str]
|
|
216
|
+
) -> None:
|
|
217
|
+
store = self.get_store(context.account_id, context.region)
|
|
218
|
+
store.TAGS.untag_resource(resource_arn, tag_keys)
|
|
219
|
+
|
|
220
|
+
def _remove_resource_tags(self, context: RequestContext, resource_arn: str) -> None:
|
|
221
|
+
store = self.get_store(context.account_id, context.region)
|
|
222
|
+
store.TAGS.tags.pop(resource_arn, None)
|
|
223
|
+
|
|
178
224
|
## Topic Operations
|
|
179
225
|
|
|
180
226
|
def create_topic(
|
|
@@ -213,7 +259,7 @@ class SnsProvider(SnsApi, ServiceLifecycleHook):
|
|
|
213
259
|
raise InvalidParameterException(
|
|
214
260
|
"Invalid parameter: Attributes Reason: Topic already exists with different attributes"
|
|
215
261
|
)
|
|
216
|
-
tag_resource_success = _check_matching_tags(topic_arn, tags
|
|
262
|
+
tag_resource_success = self._check_matching_tags(context, topic_arn, tags)
|
|
217
263
|
if not tag_resource_success:
|
|
218
264
|
raise InvalidParameterException(
|
|
219
265
|
"Invalid parameter: Tags Reason: Topic already exists with different tags"
|
|
@@ -229,7 +275,7 @@ class SnsProvider(SnsApi, ServiceLifecycleHook):
|
|
|
229
275
|
context=context,
|
|
230
276
|
)
|
|
231
277
|
if tags:
|
|
232
|
-
self.
|
|
278
|
+
self._tag_resource(context, resource_arn=topic_arn, tags=tags)
|
|
233
279
|
|
|
234
280
|
store.topics[topic_arn] = topic
|
|
235
281
|
|
|
@@ -251,8 +297,9 @@ class SnsProvider(SnsApi, ServiceLifecycleHook):
|
|
|
251
297
|
arn_data = parse_and_validate_topic_arn(topic_arn)
|
|
252
298
|
if context.region != arn_data["region"]:
|
|
253
299
|
raise InvalidParameterException("Invalid parameter: TopicArn")
|
|
254
|
-
store = self.get_store(context.account_id, context.region)
|
|
255
300
|
|
|
301
|
+
store = self.get_store(context.account_id, context.region)
|
|
302
|
+
self._remove_resource_tags(context, topic_arn)
|
|
256
303
|
store.topics.pop(topic_arn, None)
|
|
257
304
|
|
|
258
305
|
def list_topics(
|
|
@@ -1233,9 +1280,8 @@ class SnsProvider(SnsApi, ServiceLifecycleHook):
|
|
|
1233
1280
|
def list_tags_for_resource(
|
|
1234
1281
|
self, context: RequestContext, resource_arn: AmazonResourceName, **kwargs
|
|
1235
1282
|
) -> ListTagsForResourceResponse:
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
return ListTagsForResourceResponse(Tags=tags.get("Tags"))
|
|
1283
|
+
tags = self._list_resource_tags(context, resource_arn)
|
|
1284
|
+
return ListTagsForResourceResponse(Tags=tags)
|
|
1239
1285
|
|
|
1240
1286
|
def tag_resource(
|
|
1241
1287
|
self, context: RequestContext, resource_arn: AmazonResourceName, tags: TagList, **kwargs
|
|
@@ -1243,8 +1289,7 @@ class SnsProvider(SnsApi, ServiceLifecycleHook):
|
|
|
1243
1289
|
unique_tag_keys = {tag["Key"] for tag in tags}
|
|
1244
1290
|
if len(unique_tag_keys) < len(tags):
|
|
1245
1291
|
raise InvalidParameterException("Invalid parameter: Duplicated keys are not allowed.")
|
|
1246
|
-
|
|
1247
|
-
store.TAGS.tag_resource(resource_arn, tags)
|
|
1292
|
+
self._tag_resource(context, resource_arn, tags)
|
|
1248
1293
|
return TagResourceResponse()
|
|
1249
1294
|
|
|
1250
1295
|
def untag_resource(
|
|
@@ -1254,8 +1299,7 @@ class SnsProvider(SnsApi, ServiceLifecycleHook):
|
|
|
1254
1299
|
tag_keys: TagKeyList,
|
|
1255
1300
|
**kwargs,
|
|
1256
1301
|
) -> UntagResourceResponse:
|
|
1257
|
-
|
|
1258
|
-
store.TAGS.untag_resource(resource_arn, tag_keys)
|
|
1302
|
+
self._untag_resource(context, resource_arn, tag_keys)
|
|
1259
1303
|
return UntagResourceResponse()
|
|
1260
1304
|
|
|
1261
1305
|
@staticmethod
|
|
@@ -1503,27 +1547,6 @@ def _validate_phone_number(phone_number: str):
|
|
|
1503
1547
|
)
|
|
1504
1548
|
|
|
1505
1549
|
|
|
1506
|
-
def _check_matching_tags(topic_arn: str, tags: TagList | None, store: SnsStore) -> bool:
|
|
1507
|
-
"""
|
|
1508
|
-
Checks if a topic to be created doesn't already exist with different tags
|
|
1509
|
-
:param topic_arn: Arn of the topic
|
|
1510
|
-
:param tags: Tags to be checked
|
|
1511
|
-
:param store: Store object that holds the topics and tags
|
|
1512
|
-
:return: False if there is a mismatch in tags, True otherwise
|
|
1513
|
-
"""
|
|
1514
|
-
existing_tags = store.TAGS.list_tags_for_resource(topic_arn)["Tags"]
|
|
1515
|
-
# if this is none there is nothing to check
|
|
1516
|
-
if topic_arn in store.topics:
|
|
1517
|
-
if tags is None:
|
|
1518
|
-
tags = []
|
|
1519
|
-
for tag in tags:
|
|
1520
|
-
# this means topic already created with empty tags and when we try to create it
|
|
1521
|
-
# again with other tag value then it should fail according to aws documentation.
|
|
1522
|
-
if existing_tags is not None and tag not in existing_tags:
|
|
1523
|
-
return False
|
|
1524
|
-
return True
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
1550
|
def _get_total_publish_size(
|
|
1528
1551
|
message_body: str, message_attributes: MessageAttributeMap | None
|
|
1529
1552
|
) -> int:
|
localstack/version.py
CHANGED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '4.13.2.
|
|
32
|
-
__version_tuple__ = version_tuple = (4, 13, 2, '
|
|
31
|
+
__version__ = version = '4.13.2.dev83'
|
|
32
|
+
__version_tuple__ = version_tuple = (4, 13, 2, 'dev83')
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -4,7 +4,7 @@ localstack/deprecations.py,sha256=-3IYgCd6LEC3PjO7hbr3Dg-p0PIS6phjmv1qZnj1uo0,15
|
|
|
4
4
|
localstack/openapi.yaml,sha256=jFUzv-NKkJttxb8HRrmKiNYOmJD-zVfPxG3DDMrRwfg,30865
|
|
5
5
|
localstack/plugins.py,sha256=BIJC9dlo0WbP7lLKkCiGtd_2q5oeqiHZohvoRTcejXM,2457
|
|
6
6
|
localstack/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
localstack/version.py,sha256=
|
|
7
|
+
localstack/version.py,sha256=Wh2wST4lvbLiLrWClry4ZT7ZUfcNTir8-ggYRtr9T2A,721
|
|
8
8
|
localstack/aws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
localstack/aws/accounts.py,sha256=102zpGowOxo0S6UGMpfjw14QW7WCLVAGsnFK5xFMLoo,3043
|
|
10
10
|
localstack/aws/app.py,sha256=n9bJCfJRuMz_gLGAH430c3bIQXgUXeWO5NPfcdL2MV8,5145
|
|
@@ -747,7 +747,7 @@ localstack/services/sns/constants.py,sha256=RNRg-5AbI1jMyzLlGfEEAP74j8YiCbSTYxzn
|
|
|
747
747
|
localstack/services/sns/executor.py,sha256=VRaoalDYwo-K_1iDAMkeNZ6uXHo_WtGv4qPgNMxmAAk,4134
|
|
748
748
|
localstack/services/sns/filter.py,sha256=aHkd3oF2RTvuHiFZvVv1dD2qVpLUQkAeU2hJBQnW4xU,22990
|
|
749
749
|
localstack/services/sns/models.py,sha256=l-GO8jpFuyqUlr89EWA1Ef9tCasgSUAvOIitXiI3rg0,7094
|
|
750
|
-
localstack/services/sns/provider.py,sha256=
|
|
750
|
+
localstack/services/sns/provider.py,sha256=Hb_0cFHPC9DNgAcYrMjZxkjlU7G8qBqa0JG3UFn5Vus,77809
|
|
751
751
|
localstack/services/sns/publisher.py,sha256=zdvgxBxancNa9BbFe9T1DnWqEzCczp79RDZBDUq0nrk,60928
|
|
752
752
|
localstack/services/sns/utils.py,sha256=lKfELrr-ArvXRIaac7_kUwHVznPg3DEiX1tW6xchSTM,7242
|
|
753
753
|
localstack/services/sns/resource_providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -1311,10 +1311,10 @@ localstack/utils/server/tcp_proxy.py,sha256=y2NJAmvftTiAYsLU_8qe4W5LGqwUw21i90Pu
|
|
|
1311
1311
|
localstack/utils/xray/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1312
1312
|
localstack/utils/xray/trace_header.py,sha256=ahXk9eonq7LpeENwlqUEPj3jDOCiVRixhntQuxNor-Q,6209
|
|
1313
1313
|
localstack/utils/xray/traceid.py,sha256=GKO-R2sMMjlrH2UaLPXlQlZ6flbE7ZKb6IZMtMu_M5U,1110
|
|
1314
|
-
localstack_core-4.13.2.
|
|
1315
|
-
localstack_core-4.13.2.
|
|
1316
|
-
localstack_core-4.13.2.
|
|
1317
|
-
localstack_core-4.13.2.
|
|
1318
|
-
localstack_core-4.13.2.
|
|
1319
|
-
localstack_core-4.13.2.
|
|
1320
|
-
localstack_core-4.13.2.
|
|
1314
|
+
localstack_core-4.13.2.dev83.data/scripts/localstack-supervisor,sha256=nm1Il2d6ASyOB6Vo4CRHd90w7TK9FdRl9VPp0NN6hUk,6378
|
|
1315
|
+
localstack_core-4.13.2.dev83.dist-info/licenses/LICENSE.txt,sha256=3PC-9Z69UsNARuQ980gNR_JsLx8uvMjdG6C7cc4LBYs,606
|
|
1316
|
+
localstack_core-4.13.2.dev83.dist-info/METADATA,sha256=5qhV1XKYZWzrA2zthNhKDs1If3brCNUujI7rL73HV6Y,5867
|
|
1317
|
+
localstack_core-4.13.2.dev83.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
|
|
1318
|
+
localstack_core-4.13.2.dev83.dist-info/entry_points.txt,sha256=59aAnn8KVHWAHkMg2dOgmgYtRZ-xTX9T4UiIchWgK6k,20975
|
|
1319
|
+
localstack_core-4.13.2.dev83.dist-info/top_level.txt,sha256=3sqmK2lGac8nCy8nwsbS5SpIY_izmtWtgaTFKHYVHbI,11
|
|
1320
|
+
localstack_core-4.13.2.dev83.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{localstack_core-4.13.2.dev82.dist-info → localstack_core-4.13.2.dev83.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
{localstack_core-4.13.2.dev82.dist-info → localstack_core-4.13.2.dev83.dist-info}/top_level.txt
RENAMED
|
File without changes
|